/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "StateMod_QueryTool_JFrame.setupGUI"; addWindowListener(this); GridBagLayout gb = new GridBagLayout(); JPanel main_JPanel = new JPanel(); main_JPanel.setLayout(gb); JGUIUtil.addComponent(main_JPanel, new JLabel("Component:"), 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); __component_JComboBox = new SimpleJComboBox(false); __component_JComboBox.add("Diversion Stations"); JGUIUtil.addComponent(main_JPanel, __component_JComboBox, 1, 0, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); try { __input_filter_diversion_JPanel = new StateMod_Diversion_InputFilter_JPanel(__dataset); JGUIUtil.addComponent(main_JPanel, __input_filter_diversion_JPanel, 0, 1, 4, 4, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); } catch (Exception) { Message.printWarning(1, routine, "Unable to initialize input filter for diversion stations."); } getContentPane().add(main_JPanel); // add bottom buttons FlowLayout fl = new FlowLayout(FlowLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(fl); __query_JButton = new SimpleJButton(__Query_String, this); __query_JButton.setToolTipText("Query the data set using specified criteria."); __display_JButton = new SimpleJButton(__Display_String, this); __display_JButton.setToolTipText("Display the results of the query."); __display_JButton.setEnabled(false); // Enable after query. __cancel_JButton = new SimpleJButton(__Cancel_String, this); __cancel_JButton.setToolTipText("Cancel query and close window."); buttonPanel.add(__query_JButton); buttonPanel.add(__display_JButton); buttonPanel.add(__cancel_JButton); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); JGUIUtil.addComponent(bottomJPanel, buttonPanel, 0, 0, 8, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); __message_JTextField = new JTextField(); __message_JTextField.setText("Select filter criteria and then press Query"); __message_JTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __message_JTextField, 0, 1, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __status_JTextField = new JTextField(5); __status_JTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __status_JTextField, 7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_CONTROL, this); } pack(); setSize(550, 190); // Allows replacement res option to display JGUIUtil.center(this); setResizable(true); setVisible(true); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { __xdgSimpleJComboBox = new SimpleJComboBox(); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> diversionsVector = (java.util.List<StateMod_Diversion>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS).getData(); IList <StateMod_Diversion> diversionsVector = (IList <StateMod_Diversion>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS).getData(); IList <string> list_names = StateMod_Util.createIdentifierListFromStateModData(diversionsVector, true, null); int size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Diversion"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlow> instreamFlowsVector = (java.util.List<StateMod_InstreamFlow>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS).getData(); IList <StateMod_InstreamFlow> instreamFlowsVector = (IList <StateMod_InstreamFlow>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(instreamFlowsVector, true, null); size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Instream Flow"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamGage> gageVector = (java.util.List<StateMod_StreamGage>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS).getData(); IList <StateMod_StreamGage> gageVector = (IList <StateMod_StreamGage>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(gageVector, true, null); size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Stream Gage"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate> estimateVector = (java.util.List<StateMod_StreamEstimate>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS).getData(); IList <StateMod_StreamEstimate> estimateVector = (IList <StateMod_StreamEstimate>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(estimateVector, true, null); size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Stream Estimate"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Reservoir> reservoirsVector = (java.util.List<StateMod_Reservoir>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS).getData(); IList <StateMod_Reservoir> reservoirsVector = (IList <StateMod_Reservoir>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(reservoirsVector, true, null); size = list_names.Count; __xrgSimpleJComboBox = new SimpleJComboBox(); for (int i = 0; i < size; i++) { __xrgSimpleJComboBox.add(list_names[i] + " - Reservoir"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Well> wellsVector = (java.util.List<StateMod_Well>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS).getData(); IList <StateMod_Well> wellsVector = (IList <StateMod_Well>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(wellsVector, true, null); size = list_names.Count; __xwgSimpleJComboBox = new SimpleJComboBox(); for (int i = 0; i < size; i++) { __xwgSimpleJComboBox.add(list_names[i] + " - Well"); } // Define the button groups and add radio buttons to the group in the // order of the GUI... __general_ButtonGroup = new ButtonGroup(); __general_ButtonGroup.add(__xstJRadioButton = new JRadioButton("-xst", false)); __general_ButtonGroup.add(__xwbJRadioButton = new JRadioButton("-xwb", true)); __general_ButtonGroup.add(__xwrJRadioButton = new JRadioButton("-xwr", false)); __general_ButtonGroup.add(__xcuJRadioButton = new JRadioButton("-xcu", false)); __compare_ButtonGroup = new ButtonGroup(); __compare_ButtonGroup.add(__xdcJRadioButton = new JRadioButton("-xdc", true)); __compare_ButtonGroup.add(__xrcJRadioButton = new JRadioButton("-xrc", false)); __compare_ButtonGroup.add(__xwcJRadioButton = new JRadioButton("-xwc", false)); __compare_ButtonGroup.add(__xscJRadioButton = new JRadioButton("-xsc", false)); __graph_ButtonGroup = new ButtonGroup(); __graph_ButtonGroup.add(__xdgJRadioButton = new JRadioButton("-xdg", true)); __graph_ButtonGroup.add(__xrgJRadioButton = new JRadioButton("-xrg", false)); __graph_ButtonGroup.add(__xwgJRadioButton = new JRadioButton("-xwg", false)); __daily_ButtonGroup = new ButtonGroup(); __daily_ButtonGroup.add(__xdyJRadioButton = new JRadioButton("-xdy", true)); __daily_ButtonGroup.add(__xryJRadioButton = new JRadioButton("-xry", false)); __daily_ButtonGroup.add(__xwyJRadioButton = new JRadioButton("-xwy", false)); __other_ButtonGroup = new ButtonGroup(); __other_ButtonGroup.add(__xnmJRadioButton = new JRadioButton("-xnm", true)); __other_ButtonGroup.add(__xrxJRadioButton = new JRadioButton("-xrx", false)); __other_ButtonGroup.add(__xspJRadioButton = new JRadioButton("-xsp", false)); __other_ButtonGroup.add(__xbnJRadioButton = new JRadioButton("-xbn", false)); // Set the selected item in the graph output, based on whether data // exists... bool something_selected = false; // To help select a radio button if (__xdgSimpleJComboBox.getItemCount() == 0) { __xdgSimpleJComboBox.setEnabled(false); } else { __xdgSimpleJComboBox.select(0); __xdgJRadioButton.setSelected(true); something_selected = true; } if (__xrgSimpleJComboBox.getItemCount() == 0) { __xrgSimpleJComboBox.setEnabled(false); } else { __xrgSimpleJComboBox.select(0); if (!something_selected) { __xrgJRadioButton.setSelected(true); something_selected = true; } } if (__xwgSimpleJComboBox.getItemCount() == 0) { __xwgSimpleJComboBox.setEnabled(false); } else { __xwgSimpleJComboBox.select(0); if (!something_selected) { __xwgJRadioButton.setSelected(true); } } __runStateModJButton = new JButton(__BUTTON_RUN_REPORT); __cancelJButton = new JButton(__BUTTON_CANCEL); // REVISIT - enable when full help system is redesigned //__helpJButton = new JButton(__BUTTON_HELP); GridBagLayout gb = new GridBagLayout(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(gb); int col1 = 0; int col2 = 1; int col3 = 2; int y; int bound = 2; // buffer around components. __main_JTabbedPane = new JTabbedPane(); __general_JPanel = new JPanel(); __general_JPanel.setLayout(gb); __compare_JPanel = new JPanel(); __compare_JPanel.setLayout(gb); __graph_JPanel = new JPanel(); __graph_JPanel.setLayout(gb); __daily_JPanel = new JPanel(); __daily_JPanel.setLayout(gb); __other_JPanel = new JPanel(); __other_JPanel.setLayout(gb); ///////////////////////////////////////////////////////////// // general panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__general_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xstJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel1 = new JLabel("Direct and Instream Flow Data (*.xdd)"); __xstJLabel1.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel1, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel2 = new JLabel("Reservoir Data - Total and by Account " + "(*.xre)"); __xstJLabel2.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel2, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel3 = new JLabel("Operation Right Summary (*.xop)"); __xstJLabel3.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel3, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel4 = new JLabel("Instream Flow Reach Summary (*.xir)"); __xstJLabel4.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel4, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel5 = new JLabel("Well Summary (*.xwe)"); __xstJLabel5.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel5, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xwbJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwbJLabel = new JLabel("Water balance (*.xwb) and " + "Ground Water Balance (*.xgw)"); __xwbJLabel.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xwbJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xwrJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwrJLabel = new JLabel("Water rights list, sorted by basin " + "rank (*.xwr)"); __xwrJLabel.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xwrJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xcuJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel1 = new JLabel("Simulated Diversions and " + "Consumptive Use (*.xcu)"); __xcuJLabel1.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel1, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel2 = new JLabel("Water supply summary (*.xsu)"); __xcuJLabel2.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel2, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel3 = new JLabel("Shortage Summary (*.xsh)"); __xcuJLabel3.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel3, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel4 = new JLabel("CU by Water District (*.xwd)"); __xcuJLabel4.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel4, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // compare panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__compare_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xdcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xdcJLabel = new JLabel("Diversion comparison (*.xdc)"); __xdcJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xdcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xrcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xrcJLabel = new JLabel("Reservoir comparison (*.xrc)"); __xrcJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xrcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xwcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwcJLabel = new JLabel("Well comparison (*.xwc)"); __xwcJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xwcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xscJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xscJLabel = new JLabel("Stream flow gage comparison (*.xsc)"); __xscJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xscJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // graph panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__graph_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xdgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xdgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); __xdgSimpleJComboBox.addMouseListener(this); __xdgJLabel = new JLabel("Direct diversion, instream flow and " + "gage graph (*.xdg)"); __xdgJLabel.addMouseListener(this); JGUIUtil.addComponent(__graph_JPanel, __xdgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xrgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xrgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); __xrgSimpleJComboBox.addMouseListener(this); __xrgJLabel = new JLabel("Reservoir graph (*.xrg)"); __xrgJLabel.addMouseListener(this); JGUIUtil.addComponent(__graph_JPanel, __xrgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xwgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xwgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); __xwgSimpleJComboBox.addMouseListener(this); __xwgJLabel = new JLabel("Well graph (*.xwg)"); __xwgJLabel.addMouseListener(this); JGUIUtil.addComponent(__graph_JPanel, __xwgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // daily panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__daily_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__daily_JPanel, __xdyJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xdyJLabel = new JLabel("Daily Direct Diversion and Instream Flow Data" + " (*.xdy)"); __xdyJLabel.addMouseListener(this); JGUIUtil.addComponent(__daily_JPanel, __xdyJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__daily_JPanel, __xryJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xryJLabel = new JLabel("Daily Reservoir Data (*.xry)"); __xryJLabel.addMouseListener(this); JGUIUtil.addComponent(__daily_JPanel, __xryJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__daily_JPanel, __xwyJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwyJLabel = new JLabel("Daily Well Data (*.xwy)"); __xwyJLabel.addMouseListener(this); JGUIUtil.addComponent(__daily_JPanel, __xwyJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // other panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__other_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xnmJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xnmJLabel1 = new JLabel("Detailed Node Accounting, monthly (*.xnm) and "); __xnmJLabel1.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xnmJLabel1, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xnmJLabel2 = new JLabel("Summary Node Accounting, average (*.xna)"); __xnmJLabel2.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xnmJLabel2, col3, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xrxJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xrxJLabel = new JLabel("River data summary (*.xrx)"); __xrxJLabel.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xrxJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xspJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xspJLabel = new JLabel("Selected parameter printout," + " uses output control file (*.xsp)"); __xspJLabel.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xspJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xbnJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xbnJLabel = new JLabel("ASCII listing of Binary Direct and " + "Instream Data (*.xbn)"); __xbnJLabel.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xbnJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __main_JTabbedPane.add("General", __general_JPanel); __main_JTabbedPane.add("Compare", __compare_JPanel); __main_JTabbedPane.add("Graph", __graph_JPanel); __main_JTabbedPane.add("Daily", __daily_JPanel); __main_JTabbedPane.add("Other", __other_JPanel); getContentPane().add("Center", __main_JTabbedPane); // add buttons JPanel p1 = new JPanel(); p1.add(__runStateModJButton); p1.add(__cancelJButton); // REVISIT - add when full help system is redesigned. //p1.add(__helpJButton); //__helpJButton.setEnabled(false); //__helpJButton.addActionListener(this); __runStateModJButton.addActionListener(this); __cancelJButton.addActionListener(this); getContentPane().add("South", p1); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RUN_REPORT, this); } pack(); JGUIUtil.center(this); setVisible(true); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "StateMod_Response_JFrame.setupGUI"; addWindowListener(this); PropList p = new PropList("StateMod_Response_JFrame.JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { // Operate on a copy of the table model... __tableModel = new StateMod_Response_TableModel(__dataset_copy); StateMod_Response_CellRenderer crr = new StateMod_Response_CellRenderer(__tableModel); jsw = new JScrollWorksheet(crr, __tableModel, p); __worksheet = jsw.getJWorksheet(); __tableModel.setWorksheet(__worksheet); widths = crr.getColumnWidths(); } catch (Exception e) { Message.printWarning(1, routine, "Error building worksheet."); Message.printWarning(2, routine, e); jsw = new JScrollWorksheet(0, 0, p); __worksheet = jsw.getJWorksheet(); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.addMouseListener(this); __worksheet.addKeyListener(this); __worksheet.setHourglassJFrame(this); /* TODO SAM 2007-03-01 Evaluate logic * boolean renameAllowed = false; * if (__tableModel != null) { * renameAllowed = true; * } */ JPanel top_panel = new JPanel(); top_panel.setLayout(new GridBagLayout()); int y = 0; JGUIUtil.addComponent(top_panel, new JLabel("To rename a data set component, select a row and " + "either type a new file name or use the Browse button."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(top_panel, new JLabel("If ARE DATA MODIFIED? is YES, data for the " + "component have been modified by the GUI but the file has not been written."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(top_panel, new JLabel("Consequently, StateMod will not recognize the " + "changes until the data are saved with File...Save."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(top_panel, new JLabel("If a filename is changed, the file with the original filename will remain " + "even after the new file is saved."), 0, y++, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(top_panel, new JLabel("Data set base name (from *.rsp): "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(top_panel, new JLabel(__dataset.getBaseName()), 1, y++, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(top_panel, new JLabel("Data set directory: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(top_panel, new JLabel(__dataset.getDataSetDirectory()), 1, y++, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); getContentPane().add("North", top_panel); getContentPane().add("Center", jsw); JPanel button_panel = new JPanel(); __browse_JButton = new SimpleJButton(__BUTTON_BROWSE, this); __browse_JButton.setEnabled(false); __browse_JButton.setToolTipText("Select an existing file."); button_panel.add(__browse_JButton); __apply_JButton = new SimpleJButton(__BUTTON_APPLY, this); //__apply_JButton.setEnabled(false); __apply_JButton.setToolTipText("Set the file names. File...Save is still required to save files."); button_panel.add(__apply_JButton); __cancel_JButton = new SimpleJButton(__BUTTON_CANCEL, this); __cancel_JButton.setToolTipText("Cancel file name changes."); button_panel.add(__cancel_JButton); __close_JButton = new SimpleJButton(__BUTTON_CLOSE, this); __close_JButton.setToolTipText("Apply file name changes and close " + "window. File...Save is still required to save files."); //__close_JButton.setEnabled (false); button_panel.add(__close_JButton); //__help_JButton = new SimpleJButton(__BUTTON_HELP, this); //__help_JButton.setEnabled(false); //button_panel.add(__help_JButton); JPanel bottom_panel = new JPanel(); bottom_panel.setLayout(new BorderLayout()); getContentPane().add("South", bottom_panel); bottom_panel.add("South", button_panel); pack(); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RESPONSE, this); } setSize(700, 500); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }
/// <summary> /// Sets up the GUI. </summary> /// <param name="index"> the index of the network node to preselect. </param> private void setupGUI(int index) { string routine = "StateMod_RiverNetworkNode_JFrame.setupGUI"; addWindowListener(this); JPanel p1 = new JPanel(); // entire top half __searchID = new JTextField(10); __searchName = new JTextField(10); __findNext = new JButton(__BUTTON_FIND_NEXT); __searchCriteriaGroup = new ButtonGroup(); __searchIDJRadioButton = new JRadioButton("ID", true); __searchIDJRadioButton.addActionListener(this); __searchCriteriaGroup.add(__searchIDJRadioButton); __searchNameJRadioButton = new JRadioButton("Name", false); __searchNameJRadioButton.addActionListener(this); __searchCriteriaGroup.add(__searchNameJRadioButton); __idJTextField = new JTextField(12); __idJTextField.setEditable(false); __nameJTextField = new JTextField(24); __nameJTextField.setEditable(false); __nodeJTextField = new JTextField(12); __commentJTextField = new JTextField(24); __showOnMap_JButton = new SimpleJButton(__BUTTON_SHOW_ON_MAP, this); __showOnMap_JButton.setToolTipText("Annotate map with location (button is disabled if layer does not have matching ID)"); __showOnNetwork_JButton = new SimpleJButton(__BUTTON_SHOW_ON_NETWORK, this); __showOnNetwork_JButton.setToolTipText("Annotate network with location"); __applyJButton = new JButton(__BUTTON_APPLY); __cancelJButton = new JButton(__BUTTON_CANCEL); __helpJButton = new JButton(__BUTTON_HELP); __closeJButton = new JButton(__BUTTON_CLOSE); GridBagLayout gb = new GridBagLayout(); p1.setLayout(gb); int y = 0; PropList p = new PropList("StateMod_RiverNetworkNode_JFrame.JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { StateMod_RiverNetworkNode_TableModel tmr = new StateMod_RiverNetworkNode_TableModel(__riverNetworkNodesVector); StateMod_RiverNetworkNode_CellRenderer crr = new StateMod_RiverNetworkNode_CellRenderer(tmr); jsw = new JScrollWorksheet(crr, tmr, p); __worksheet = jsw.getJWorksheet(); widths = crr.getColumnWidths(); } catch (Exception e) { Message.printWarning(2, routine, e); jsw = new JScrollWorksheet(0, 0, p); __worksheet = jsw.getJWorksheet(); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.setHourglassJFrame(this); __worksheet.addMouseListener(this); __worksheet.addKeyListener(this); JGUIUtil.addComponent(p1, jsw, 0, y, 4, 9, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("ID:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __idJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("Name:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __nameJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("Downstream Node:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __nodeJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("Comment:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __commentJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); // // add search areas // y = 10; JPanel searchPanel = new JPanel(); searchPanel.setLayout(gb); searchPanel.setBorder(BorderFactory.createTitledBorder("Search list for: ")); JGUIUtil.addComponent(p1, searchPanel, 0, y, 1, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(searchPanel, __searchIDJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(searchPanel, __searchID, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST); __searchID.addActionListener(this); JGUIUtil.addComponent(searchPanel, __searchNameJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __searchName.setEditable(false); JGUIUtil.addComponent(searchPanel, __searchName, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST); __searchName.addActionListener(this); JGUIUtil.addComponent(searchPanel, __findNext, 0, ++y, 4, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __findNext.addActionListener(this); // // add close and help buttons // JPanel pfinal = new JPanel(); FlowLayout fl = new FlowLayout(FlowLayout.RIGHT); pfinal.setLayout(fl); __helpJButton.setEnabled(false); pfinal.add(__showOnMap_JButton); pfinal.add(__showOnNetwork_JButton); if (__editable) { pfinal.add(__applyJButton); pfinal.add(__cancelJButton); } pfinal.add(__closeJButton); // pfinal.add(__helpJButton); __applyJButton.addActionListener(this); __cancelJButton.addActionListener(this); __helpJButton.addActionListener(this); __closeJButton.addActionListener(this); getContentPane().add("Center", p1); getContentPane().add("South", pfinal); initializeDisables(); selectTableIndex(index); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK, this); } pack(); setSize(690, 400); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } __worksheet.addSortListener(this); }
/// <summary> /// Sets up the GUI. </summary> /// <param name="index"> Data item to display. </param> private void setupGUI(int index) { string routine = "StateMod_DelayTable_JFrame"; addWindowListener(this); // AWT portion JPanel p1 = new JPanel(); // selection list and grid JPanel p2 = new JPanel(); // search widgets JPanel pmain = new JPanel(); // everything but close and help buttons __searchID = new JTextField(10); __findNextDelay = new JButton("Find Next"); PropList p = new PropList("StateMod_DelayTable_JFrame.JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); bool percent = true; if (__dataset.getInterv() == -100 || __dataset.getInterv() < -1) { percent = false; } int[] widthsR = null; JScrollWorksheet jswR = null; try { StateMod_DelayTable_TableModel tmd = new StateMod_DelayTable_TableModel(new List<double?>(), __monthly_data, __editable, percent); tmd.setSubDelays(new List<double?>()); StateMod_DelayTable_CellRenderer crd = new StateMod_DelayTable_CellRenderer(tmd); jswR = new JScrollWorksheet(crd, tmd, p); __worksheetR = jswR.getJWorksheet(); // remove the ID column __worksheetR.removeColumn(0); widthsR = crd.getColumnWidths(); } catch (Exception e) { Message.printWarning(1, routine, "Error building worksheet."); Message.printWarning(2, routine, e); jswR = new JScrollWorksheet(0, 0, p); __worksheetR = jswR.getJWorksheet(); } __worksheetR.setPreferredScrollableViewportSize(null); // Assume all have the same units so pass in the first one... __worksheetR.setHourglassJFrame(this); __worksheetR.addMouseListener(this); __worksheetR.addKeyListener(this); __graphDelayJButton = new JButton("Graph"); if (__delaysVector.Count == 0) { __graphDelayJButton.setEnabled(false); } __helpJButton = new JButton(__BUTTON_HELP); __helpJButton.setEnabled(false); __closeJButton = new JButton(__BUTTON_CLOSE); __addReturn = new JButton(__BUTTON_ADD_RETURN); __deleteReturn = new JButton(__BUTTON_DELETE_RETURN); __deleteReturn.setEnabled(false); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton applyJButton = new JButton(__BUTTON_APPLY); GridBagLayout gb = new GridBagLayout(); p1.setLayout(gb); p2.setLayout(gb); pmain.setLayout(gb); int y; int[] widthsL = null; JScrollWorksheet jswL = null; try { StateMod_DelayTable_TableModel tmd = new StateMod_DelayTable_TableModel(__delaysVector, __monthly_data, __editable, percent); StateMod_DelayTable_CellRenderer crd = new StateMod_DelayTable_CellRenderer(tmd); jswL = new JScrollWorksheet(crd, tmd, p); __worksheetL = jswL.getJWorksheet(); // remove all the columns but the ID column. __worksheetL.removeColumn(1); __worksheetL.removeColumn(2); widthsL = crd.getColumnWidths(); } catch (Exception e) { Message.printWarning(1, routine, "Error building worksheet."); Message.printWarning(2, routine, e); jswL = new JScrollWorksheet(0, 0, p); __worksheetL = jswL.getJWorksheet(); } __worksheetL.setPreferredScrollableViewportSize(null); __worksheetR.setPreferredScrollableViewportSize(null); __worksheetL.setHourglassJFrame(this); __worksheetL.addMouseListener(this); __worksheetL.addKeyListener(this); JGUIUtil.addComponent(pmain, jswL, 0, 0, 2, 12, .2, 1, 10, 10, 1, 10, GridBagConstraints.BOTH, GridBagConstraints.WEST); JGUIUtil.addComponent(pmain, jswR, 5, 1, 18, 24, 1, 1, 10, 10, 10, 10, GridBagConstraints.BOTH, GridBagConstraints.WEST); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 1, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); // close and help buttons JPanel pfinal = new JPanel(); FlowLayout fl = new FlowLayout(FlowLayout.RIGHT); pfinal.setLayout(fl); if (__editable) { pfinal.add(__addReturn); pfinal.add(__deleteReturn); } pfinal.add(applyJButton); pfinal.add(cancelJButton); pfinal.add(__closeJButton); pfinal.add(__graphDelayJButton); // pfinal.add(__helpJButton); JGUIUtil.addComponent(bottomJPanel, pfinal, 0, 0, 8, 1, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); __helpJButton.addActionListener(this); __closeJButton.addActionListener(this); __graphDelayJButton.addActionListener(this); __addReturn.addActionListener(this); __deleteReturn.addActionListener(this); cancelJButton.addActionListener(this); applyJButton.addActionListener(this); // add search areas y = 0; JPanel searchPanel = new JPanel(); searchPanel.setLayout(gb); searchPanel.setBorder(BorderFactory.createTitledBorder("Search above list for: ")); JGUIUtil.addComponent(searchPanel, new JLabel("ID"), 0, y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(searchPanel, __searchID, 1, y, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST); __searchID.addActionListener(this); y++; JGUIUtil.addComponent(searchPanel, __findNextDelay, 0, y, 4, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.CENTER); __findNextDelay.addActionListener(this); JGUIUtil.addComponent(pmain, searchPanel, 0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, 5, 10, 20, 10, GridBagConstraints.NONE, GridBagConstraints.SOUTHWEST); getContentPane().add("Center", pmain); getContentPane().add("South", bottomJPanel); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(__window_type, this); } pack(); setSize(530, 400); JGUIUtil.center(this); setVisible(true); if (widthsR != null) { __worksheetR.setColumnWidths(widthsR); } if (widthsL != null) { __worksheetL.setColumnWidths(widthsL); } selectLeftTableIndex(index, false, true); }