public static void main(string[] args) { AudioTool.prefs = Preferences.userRoot().node("/edu/cmu/sphinx/tools/audio/AudioTool"); AudioTool.filename = AudioTool.prefs.get("filename", "untitled.raw"); AudioTool.file = new File(AudioTool.filename); if (args.Length == 1 && String.instancehelper_equals(args[0], "-dumpMixers")) { AudioTool.dumpMixers(); java.lang.System.exit(0); } try { if (args.Length > 0) { AudioTool.filename = args[0]; } URL url; if (args.Length == 2) { url = new File(args[1]).toURI().toURL(); } else { url = ClassLiteral <AudioTool> .Value.getResource("spectrogram.config.xml"); } ConfigurationManager configurationManager = new ConfigurationManager(url); AudioTool.recorder = (Microphone)configurationManager.lookup("microphone"); AudioTool.recorder.initialize(); AudioTool.audio = new AudioData(); FrontEnd frontEnd = (FrontEnd)configurationManager.lookup("frontEnd"); StreamDataSource dataSource = (StreamDataSource)configurationManager.lookup("streamDataSource"); FrontEnd frontEnd2 = (FrontEnd)configurationManager.lookup("cepstrumFrontEnd"); StreamDataSource dataSource2 = (StreamDataSource)configurationManager.lookup("cstreamDataSource"); PropertySheet propertySheet = configurationManager.getPropertySheet("windower"); float @float = propertySheet.getFloat("windowShiftInMs"); JFrame jframe = new JFrame("AudioTool"); AudioTool.fileChooser = new JFileChooser(); AudioTool.createMenuBar(jframe); float num = @float * AudioTool.audio.getAudioFormat().getSampleRate() / 1000f; AudioTool.audioPanel = new AudioPanel(AudioTool.audio, 1f / num, 0.004f); AudioTool.spectrogramPanel = new SpectrogramPanel(frontEnd, dataSource, AudioTool.audio); AudioTool.cepstrumPanel = new CepstrumPanel(frontEnd2, dataSource2, AudioTool.audio); JPanel jpanel = new JPanel(); jpanel.setLayout(new BoxLayout(jpanel, 3)); jpanel.add(AudioTool.audioPanel); AudioTool.audioPanel.setAlignmentX(0f); jpanel.add(AudioTool.spectrogramPanel); AudioTool.spectrogramPanel.setAlignmentX(0f); jpanel.add(AudioTool.cepstrumPanel); AudioTool.cepstrumPanel.setAlignmentX(0f); JScrollPane jscrollPane = new JScrollPane(jpanel); JPanel jpanel2 = new JPanel(new BorderLayout()); jpanel2.add(AudioTool.createButtonPanel(), "North"); jpanel2.add(jscrollPane); AudioTool.player = new AudioPlayer(AudioTool.audio); AudioTool.player.start(); AudioTool.getAudioFromFile(AudioTool.filename); jframe.setDefaultCloseOperation(3); jframe.setContentPane(jpanel2); jframe.pack(); jframe.setSize(640, 400); jframe.setVisible(true); } catch (System.Exception ex) { Throwable.instancehelper_printStackTrace(ex); } }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "StateMod_Save_JDialog.setupGUI"; addWindowListener(this); PropList p = new PropList("StateMod_Save_JDialog.JWorksheet"); /* * p.add("JWorksheet.CellFont=Courier"); * p.add("JWorksheet.CellStyle=Plain"); * p.add("JWorksheet.CellSize=11"); * p.add("JWorksheet.HeaderFont=Arial"); * p.add("JWorksheet.HeaderStyle=Plain"); * p.add("JWorksheet.HeaderSize=11"); * p.add("JWorksheet.HeaderBackground=LightGray"); * p.add("JWorksheet.RowColumnPresent=false"); */ p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.SelectionMode=MultipleDiscontinuousRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { __tableModel = new StateMod_Save_TableModel(__dataset); StateMod_Save_CellRenderer crr = new StateMod_Save_CellRenderer(__tableModel); jsw = new JScrollWorksheet(crr, __tableModel, p); __worksheet = jsw.getJWorksheet(); widths = crr.getColumnWidths(); // Select all the rows initially... __worksheet.selectAllRows(); } 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.setHourglassJFrame(__parent); __helpButton = new SimpleJButton(__BUTTON_HELP, this); __helpButton.setEnabled(false); __saveButton = new SimpleJButton(__BUTTON_SAVE, this); __saveButton.setToolTipText("Save data to file(s)."); __cancelButton = new SimpleJButton(__BUTTON_CANCEL, this); __cancelButton.setToolTipText("Cancel without saving data to file(s)."); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); JGUIUtil.addComponent(panel, new JLabel("Data from the following files have been modified."), 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("Select files to be saved and press the \"Save Selected Files\" button."), 0, 1, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("To change the filenames, use the Data...Control...Response menu"), 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("Data set base name (from *.rsp): "), 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(panel, new JLabel(__dataset.getBaseName()), 1, 3, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("Data set directory: "), 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(panel, new JLabel(__dataset.getDataSetDirectory()), 1, 4, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); __updateCheckbox = new JCheckBox((string)null, true); JGUIUtil.addComponent(panel, __updateCheckbox, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(panel, new JLabel("Carry forward old file comments?"), 1, 6, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); getContentPane().add("North", panel); getContentPane().add("Center", jsw); JPanel button_panel = new JPanel(); button_panel.add(__saveButton); button_panel.add(__cancelButton); // button_panel.add(__helpButton); JPanel bottom_panel = new JPanel(); bottom_panel.setLayout(new BorderLayout()); getContentPane().add("South", bottom_panel); bottom_panel.add("South", button_panel); pack(); setSize(700, 500); JGUIUtil.center(this); if (widths != null) { __worksheet.setColumnWidths(widths, __parent.getGraphics()); } setVisible(true); }
private void initPreselectionPanel() { //UPGRADE_ISSUE: Class 'java.awt.GridBagLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagLayout"' //UPGRADE_ISSUE: Constructor 'java.awt.GridBagLayout.GridBagLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagLayout"' GridBagLayout gridbag = new GridBagLayout(); //UPGRADE_ISSUE: Class 'java.awt.GridBagConstraints' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Constructor 'java.awt.GridBagConstraints.GridBagConstraints' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' GridBagConstraints c = new GridBagConstraints(); JPanel preselectionPanel = new JPanel(gridbag); preselectionPanel.setBorder(BorderFactory.createTitledBorder("Module and Template Selection")); //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.fill' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.BOTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.fill = GridBagConstraints.BOTH; moduleList = new JList(moduleListModel); moduleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); moduleList.SelectionModel.addListSelectionListener(this); Collection modules = engine.WorkingMemory.Modules; Iterator itr = modules.iterator(); while (itr.hasNext()) { Module mod = (Module) itr.next(); moduleListModel.addElement(mod.ModuleName); } JPanel modulePanel = new JPanel(); modulePanel.setLayout(new BoxLayout(modulePanel, BoxLayout.Y_AXIS)); modulePanel.add(new JLabel("Select a Module:")); modulePanel.add(new JScrollPane(moduleList)); //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.weightx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.weightx = 0.5; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridy' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridx = c.gridy = 0; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.weighty' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.weighty = 1.0; // c.gridwidth = GridBagConstraints.RELATIVE; gridbag.setConstraints(modulePanel, c); preselectionPanel.add(modulePanel); templateList = new JList(templateListModel); templateList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); templateList.SelectionModel.addListSelectionListener(this); initTemplateList(); JPanel templatePanel = new JPanel(); templatePanel.setLayout(new BoxLayout(templatePanel, BoxLayout.Y_AXIS)); templatePanel.add(new JLabel("Select a Template:")); templatePanel.add(new JScrollPane(templateList)); // c.gridwidth = GridBagConstraints.REMAINDER; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridx = 1; gridbag.setConstraints(templatePanel, c); preselectionPanel.add(templatePanel); JPanel dumpAreaPanel = new JPanel(); dumpAreaPanel.setLayout(new BoxLayout(dumpAreaPanel, BoxLayout.Y_AXIS)); dumpAreaPanel.add(new JLabel("Template Definition:")); dumpAreaPanel.add(new JScrollPane(dumpAreaTemplate)); //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.weightx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.weightx = 0.0; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridwidth' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridwidth = 2; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridy' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridy = 1; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridx = 0; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.fill' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.BOTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.fill = GridBagConstraints.BOTH; gridbag.setConstraints(dumpAreaPanel, c); preselectionPanel.add(dumpAreaPanel); contentPanel.add(preselectionPanel, "preselection"); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "setupGUI"; addWindowListener(this); __addRowButton = new SimpleJButton(__BUTTON_ADD_ROW, this); __deleteRowButton = new SimpleJButton(__BUTTON_DELETE_ROW, this); __saveTemplateButton = new SimpleJButton(__BUTTON_SAVE_FILE, this); __clearWorksheetButton = new SimpleJButton(__BUTTON_CLEAR_LIST, this); __loadTemplateButton = new SimpleJButton(__BUTTON_LOAD_FILE, this); __helpButton = new SimpleJButton(__BUTTON_HELP, this); __helpButton.setEnabled(false); __closeButton = new SimpleJButton(__BUTTON_CLOSE, this); __useAllJCheckBox = new JCheckBox(__CHECKBOX_USE_ALL, false); __useAllJCheckBox.addActionListener(this); // Make a main panel to be the resizable body of the frame... JPanel main_JPanel = new JPanel(); GridBagLayout gb = new GridBagLayout(); main_JPanel.setLayout(gb); GridLayout gl = new GridLayout(2, 2, 2, 2); JPanel top_panel = new JPanel(); top_panel.setLayout(gl); JPanel radio_panel = new JPanel(); radio_panel.setLayout(gb); GridLayout gl2 = new GridLayout(1, 0, 2, 0); JPanel bottom_JPanel = new JPanel(); bottom_JPanel.setLayout(gl2); FlowLayout fl = new FlowLayout(FlowLayout.CENTER); JPanel final_button_JPanel = new JPanel(); final_button_JPanel.setLayout(fl); JPanel grid_JPanel = new JPanel(); grid_JPanel.setLayout(gb); // add add a row, delete selected rows, clear spreadsheet, // select template, save template buttons top_panel.add(__addRowButton); top_panel.add(__deleteRowButton); top_panel.add(__clearWorksheetButton); top_panel.add(__loadTemplateButton); int y = 0; JGUIUtil.addComponent(main_JPanel, top_panel, 0, y, 10, 3, 0, 0, 10, 10, 10, 10, GridBagConstraints.NONE, GridBagConstraints.NORTH); y += 3; JGUIUtil.addComponent(main_JPanel, __useAllJCheckBox, 0, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); PropList p = new PropList("StateMod_OutputControl_JFrame.JWorksheet"); p.add("JWorksheet.ShowRowHeader=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.ShowPopupMenu=true"); int[] widths = null; JScrollWorksheet jsw = null; try { __tableModel = new StateMod_OutputControl_TableModel(this, new List <object>(), (System.Collections.IList)__riverNetworkComp.getData()); StateMod_OutputControl_CellRenderer cro = new StateMod_OutputControl_CellRenderer(__tableModel); jsw = new JScrollWorksheet(cro, __tableModel, p); __worksheet = jsw.getJWorksheet(); System.Collections.IList v = StateMod_Util.arrayToList(StateMod_GraphNode.node_types); v.Add("Other"); __worksheet.setColumnJComboBoxValues(0, v); __worksheet.setCellSpecificJComboBoxColumn(1, false); System.Collections.IList offOn = new List <object>(); offOn.Add("Off"); offOn.Add("On"); __worksheet.setColumnJComboBoxValues(2, offOn); __tableModel.setWorksheet(__worksheet); widths = cro.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.setHourglassJFrame(this); JGUIUtil.addComponent(grid_JPanel, jsw, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); JGUIUtil.addComponent(main_JPanel, grid_JPanel, 0, ++y, 10, 12, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); y += 11; // To account for grid height // Add bottom buttons - these are alphabetical so be // careful if you add more ... final_button_JPanel.add(__closeButton); // REVISIT SAM 2006-03-04 // Help is not currently enabled //final_button_JPanel.add(__helpButton); final_button_JPanel.add(__saveTemplateButton); // Add the final buttons on the bottom to the bottom panel... bottom_JPanel.add(final_button_JPanel); // Add the button panel to the frame... JGUIUtil.addComponent(main_JPanel, bottom_JPanel, 0, ++y, 10, 1, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.SOUTH); // Add the main panel as the resizable content... getContentPane().add("Center", main_JPanel); // Add JTextFields for messages... JPanel message_JPanel = new JPanel(); message_JPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); __statusJTextField = new JTextField(" "); __statusJTextField.setEditable(false); JGUIUtil.addComponent(message_JPanel, __messageJTextField, 0, 0, 9, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(message_JPanel, __statusJTextField, 9, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH); getContentPane().add("South", message_JPanel); pack(); setSize(670, 500); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }
/// <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); }
public FactEditor(Rete engine) : base(engine) { InitBlock(); //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' setLayout(new BorderLayout()); setTitle("Assert new Fact"); //UPGRADE_ISSUE: Constructor 'java.awt.CardLayout.CardLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtCardLayout"' contentPanel = new JPanel(new CardLayout()); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' add(contentPanel, BorderLayout.CENTER); cancelButton = new JButton("Cancel", IconLoader.getImageIcon("cancel")); cancelButton.addActionListener(this); assertButton = new JButton("Assert Fact", IconLoader.getImageIcon("database_add")); assertButton.addActionListener(this); assertButton.setVisible(false); backButton = new JButton("Back", IconLoader.getImageIcon("resultset_previous")); backButton.addActionListener(this); backButton.setVisible(false); nextButton = new JButton("Next", IconLoader.getImageIcon("resultset_next")); nextButton.setHorizontalTextPosition(SwingConstants.LEFT); nextButton.addActionListener(this); JPanel buttonPanel = new JPanel(); //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"' //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"' buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 1)); buttonPanel.add(cancelButton); buttonPanel.add(backButton); buttonPanel.add(nextButton); buttonPanel.add(assertButton); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000"' add(buttonPanel, BorderLayout.PAGE_END); dumpAreaTemplate.setEditable(false); //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"' //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"' dumpAreaTemplate.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle) System.Drawing.FontStyle.Regular)); dumpAreaTemplate.setRows(5); dumpAreaFact.setEditable(false); //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"' //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"' dumpAreaFact.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle) System.Drawing.FontStyle.Regular)); dumpAreaFact.setRows(5); }
/// <summary> /// Initialize the interface. </summary> /// <param name="title"> Title to be displayed. </param> /// <param name="is_visible"> Indicates whether the display should be made visible at /// creation. </param> private void initialize(string title, bool is_visible) { GridBagLayout gbl = new GridBagLayout(); Insets insetsTLBR = new Insets(2, 2, 2, 2); // space around text // area // Add a panel to hold the main components... JPanel display_JPanel = new JPanel(); display_JPanel.setLayout(gbl); getContentPane().add(display_JPanel); JTabbedPane dataset_JTabbedPane = new JTabbedPane(); //dataset_JTabbedPane.addChangeListener ( this ); JGUIUtil.addComponent(display_JPanel, dataset_JTabbedPane, 0, 0, 10, 1, 0, 0, insetsTLBR, GridBagConstraints.BOTH, GridBagConstraints.CENTER); int y = 0; // Used for vertical positioning. // // Data Set Components... // // 1 row per component, each column width of 1 // JPanel components_JPanel = new JPanel(); components_JPanel.setLayout(gbl); dataset_JTabbedPane.addTab("Components", null, components_JPanel, "Components"); // Add the headers... int x = 0; JGUIUtil.addComponent(components_JPanel, new JLabel("Component"), x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(components_JPanel, new JLabel("Created How"), ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(components_JPanel, new JLabel("Input File"), ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(components_JPanel, new JLabel("Count"), ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(components_JPanel, new JLabel("Incomplete"), ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(components_JPanel, new JLabel("Data File"), ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); // Now add the contents for each component... IList <DataSetComponent> components_Vector = __dataset.getComponents(); int size = components_Vector.Count; DataSetComponent component; y = 0; // Incremented below. True row 0 is used for headers above. IList <DataSetComponent> data = null; int data_size = 0; for (int i = 0; i < size; i++) { x = 0; component = components_Vector[i]; JTextField component_JTextField = new JTextField(component.getComponentName(), 20); component_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, component_JTextField, x, ++y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); if (component.isGroup()) { // Get each of the sub-component's information... if (component.getData() == null) { continue; } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<RTi.Util.IO.DataSetComponent> data0 = (java.util.List<RTi.Util.IO.DataSetComponent>)component.getData(); IList <DataSetComponent> data0 = (IList <DataSetComponent>)component.getData(); data = data0; data_size = 0; if (data != null) { data_size = data.Count; } for (int j = 0; j < data_size; j++) { x = 0; component = (DataSetComponent)data[j]; component_JTextField = new JTextField(" " + component.getComponentName(), 20); component_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, component_JTextField, x, ++y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); // REVISIT - need to track create method JTextField from_JTextField = new JTextField("?", 10); //from.getName(), 10 ); from_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, from_JTextField, ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); // REVISIT - need to indicate list or commands // file JTextField inputfile_JTextField = new JTextField("?", 10); //from.getName(), 10 ); inputfile_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, inputfile_JTextField, ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); int count = 0; try { count = ((System.Collections.IList)component.getData()).Count; } catch (Exception) { // REVISIT // Probably because not a Vector (GIS // and control) - need a more graceful // way to handle. count = -1; } JTextField object_JTextField = null; if (count >= 0) { object_JTextField = new JTextField("" + count, 5); } else { object_JTextField = new JTextField("-", 5); } object_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, object_JTextField, ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); // REVISIT - need to indicate how many are // incomplete JTextField incomplete_JTextField = new JTextField("?", 5); //from.getName(), 10 ); incomplete_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, incomplete_JTextField, ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); JTextField datafile_JTextField = new JTextField(component.getDataFileName(), 15); datafile_JTextField.setEditable(false); JGUIUtil.addComponent(components_JPanel, datafile_JTextField, ++x, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.WEST); } } } // // Data Set Properties... // // 1 grid for labels, 6 for text fields (resizable). // y = 0; JPanel properties_JPanel = new JPanel(); properties_JPanel.setLayout(gbl); JGUIUtil.addComponent(properties_JPanel, new JLabel("Data Set Type:"), 0, y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.EAST); JTextField dataset_type_JTextField = new JTextField(__dataset.getDataSetName(), 20); dataset_type_JTextField.setEditable(false); JGUIUtil.addComponent(properties_JPanel, dataset_type_JTextField, 1, y, 2, 1, 0.0, 1.0, insetsTLBR, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(properties_JPanel, new JLabel("Data Set Base Name:"), 0, ++y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.EAST); JTextField dataset_basename_JTextField = new JTextField(__dataset.getBaseName(), 20); dataset_basename_JTextField.setEditable(false); JGUIUtil.addComponent(properties_JPanel, dataset_basename_JTextField, 1, y, 2, 1, 0.0, 1.0, insetsTLBR, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(properties_JPanel, new JLabel("Data Set Directory:"), 0, ++y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.EAST); JTextField dataset_dir_JTextField = new JTextField(__dataset.getDataSetDirectory(), 40); dataset_dir_JTextField.setEditable(false); JGUIUtil.addComponent(properties_JPanel, dataset_dir_JTextField, 1, y, 6, 1, 0.0, 1.0, insetsTLBR, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(properties_JPanel, new JLabel("Data Set File:"), 0, ++y, 1, 1, 0.0, 0.0, insetsTLBR, GridBagConstraints.NONE, GridBagConstraints.EAST); JTextField dataset_file_JTextField = new JTextField(__dataset.getDataSetFileName(), 20); dataset_file_JTextField.setEditable(false); JGUIUtil.addComponent(properties_JPanel, dataset_file_JTextField, 1, y, 2, 1, 0.0, 1.0, insetsTLBR, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); dataset_JTabbedPane.addTab("Properties", null, properties_JPanel, "Properties"); // Show the interface... if ((string.ReferenceEquals(title, null)) || (title.Length == 0)) { setTitle("Data Set Manager"); } else { setTitle(title); } pack(); JGUIUtil.center(this); setResizable(true); setVisible(is_visible); }
/// <summary> /// Sets up the GUI. /// </summary> public virtual void setupGUI() { string routine = "setupGUI"; addWindowListener(this); __addReturnFlow = new JButton(__BUTTON_ADD_RETURN_FLOW); __deleteReturnFlow = new JButton(__BUTTON_DEL_RETURN_FLOW); __helpJButton = new JButton(__BUTTON_HELP); __helpJButton.setEnabled(false); __closeJButton = new JButton(__BUTTON_CLOSE); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton applyJButton = new JButton(__BUTTON_APPLY); GridBagLayout gb = new GridBagLayout(); JPanel bigPanel = new JPanel(); bigPanel.setLayout(gb); JPanel p1 = new JPanel(); p1.setLayout(new FlowLayout(FlowLayout.RIGHT)); GridLayout gl = new GridLayout(2, 2, 1, 1); JPanel info_panel = new JPanel(); info_panel.setLayout(gl); JPanel main_panel = new JPanel(); main_panel.setLayout(new BorderLayout()); info_panel.add(new JLabel("Diversion:")); info_panel.add(new JLabel(__currentDiv.getID())); info_panel.add(new JLabel("Diversion name:")); info_panel.add(new JLabel(__currentDiv.getName())); if (__editable) { p1.add(__addReturnFlow); p1.add(__deleteReturnFlow); __deleteReturnFlow.setEnabled(false); } // p1.add(__helpJButton); p1.add(applyJButton); p1.add(cancelJButton); p1.add(__closeJButton); PropList p = new PropList("StateMod_Diversion_ReturnFlow_JFrame" + ".JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_RiverNetworkNode> nodes = (java.util.List <StateMod_RiverNetworkNode>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData()); IList <StateMod_RiverNetworkNode> nodes = (IList <StateMod_RiverNetworkNode>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData()); IList <StateMod_ReturnFlow> v = new List <StateMod_ReturnFlow>(); IList <StateMod_ReturnFlow> v2 = __currentDiv.getReturnFlows(); int size = v2.Count; StateMod_ReturnFlow rf; for (int i = 0; i < size; i++) { rf = (StateMod_ReturnFlow)v2[i].clone(); rf.setCrtnid(rf.getCrtnid() + StateMod_Util.findNameInVector(rf.getCrtnid(), nodes, true)); v.Add(rf); } StateMod_ReturnFlow_TableModel tmd = new StateMod_ReturnFlow_TableModel(__dataset, v, __editable, true); StateMod_ReturnFlow_CellRenderer crd = new StateMod_ReturnFlow_CellRenderer(tmd); jsw = new JScrollWorksheet(crd, tmd, p); __worksheet = jsw.getJWorksheet(); // TODO SAM 2017-03-15 something not right here - looks like original list variable was wrong //v = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null); __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, v, false); // 10 System.Collections.IList delayIDs = null; if (__dataset.getIday() == 1) { delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData()); } else { delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData()); } v = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null); __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, v, false); widths = crd.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); main_panel.add(jsw, "Center"); main_panel.add(p1, "South"); JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH); __addReturnFlow.addActionListener(this); __deleteReturnFlow.addActionListener(this); __closeJButton.addActionListener(this); __helpJButton.addActionListener(this); cancelJButton.addActionListener(this); applyJButton.addActionListener(this); getContentPane().add(bigPanel); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); pack(); setSize(530, 280); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }
/// <summary> /// Sets up the GUI. /// </summary> public virtual void setupGUI() { string routine = "setupGUI"; addWindowListener(this); PropList p = new PropList("StateMod_Reservoir_JFrame.JWorksheet"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.CellFont=Courier"); p.add("JWorksheet.CellStyle=Plain"); p.add("JWorksheet.CellSize=11"); p.add("JWorksheet.HeaderFont=Arial"); p.add("JWorksheet.HeaderStyle=Plain"); p.add("JWorksheet.HeaderSize=11"); p.add("JWorksheet.HeaderBackground=LightGray"); p.add("JWorksheet.RowColumnPresent=false"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { IList <StateMod_ReservoirAccount> accounts = __currentRes.getAccounts(); IList <string> v3 = new List <string>(); int size = accounts.Count; StateMod_ReservoirAccount ra = null; for (int i = 0; i < size; i++) { ra = accounts[i]; v3.Add("" + ra.getID() + " - " + ra.getName()); } for (int i = 1; i < size; i++) { v3.Add("-" + (i + 1) + " - Fill first " + (i + 1) + " accounts"); } IList <StateMod_ReservoirRight> v = new List <StateMod_ReservoirRight>(); IList <StateMod_ReservoirRight> v2 = __currentRes.getRights(); StateMod_ReservoirRight rr; for (int i = 0; i < v2.Count; i++) { rr = (StateMod_ReservoirRight)v2[i].clone(); v.Add(rr); } StateMod_ReservoirRight_TableModel tmr = new StateMod_ReservoirRight_TableModel(v, __editable); StateMod_ReservoirRight_CellRenderer crr = new StateMod_ReservoirRight_CellRenderer(tmr); jsw = new JScrollWorksheet(crr, tmr, p); __worksheet = jsw.getJWorksheet(); IList <string> onOff = StateMod_ReservoirRight.getIrsrswChoices(true); __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_ON_OFF, onOff, false); __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_ACCOUNT_DIST, v3, false); IList <string> rightTypes = StateMod_ReservoirRight.getItyrsrChoices(true); __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_RIGHT_TYPE, rightTypes, false); IList <string> fillTypes = StateMod_ReservoirRight.getN2fillChoices(true); __worksheet.setColumnJComboBoxValues(StateMod_ReservoirRight_TableModel.COL_FILL_TYPE, fillTypes, false); 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); __addRight = new JButton(__BUTTON_ADD_RIGHT); __deleteRight = new JButton(__BUTTON_DEL_RIGHT); __deleteRight.setEnabled(false); __helpJButton = new JButton(__BUTTON_HELP); __helpJButton.setEnabled(false); __closeJButton = new JButton(__BUTTON_CLOSE); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton applyJButton = new JButton(__BUTTON_APPLY); GridBagLayout gb = new GridBagLayout(); JPanel bigPanel = new JPanel(); bigPanel.setLayout(gb); FlowLayout fl = new FlowLayout(FlowLayout.RIGHT); JPanel p1 = new JPanel(); p1.setLayout(fl); GridLayout gl = new GridLayout(2, 2, 1, 1); JPanel info_panel = new JPanel(); info_panel.setLayout(gl); JPanel main_panel = new JPanel(); main_panel.setLayout(new BorderLayout()); info_panel.add(new JLabel("Reservoir:")); info_panel.add(new JLabel(__currentRes.getID())); info_panel.add(new JLabel("Reservoir name:")); info_panel.add(new JLabel(__currentRes.getName())); if (__editable) { p1.add(__addRight); p1.add(__deleteRight); } p1.add(applyJButton); p1.add(cancelJButton); // p1.add(__helpJButton); p1.add(__closeJButton); main_panel.add(jsw, "Center"); main_panel.add(p1, "South"); JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH); __addRight.addActionListener(this); __deleteRight.addActionListener(this); __helpJButton.addActionListener(this); __closeJButton.addActionListener(this); applyJButton.addActionListener(this); cancelJButton.addActionListener(this); getContentPane().add(bigPanel); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); pack(); setSize(760, 400); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(__parent); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; IList <string> nodeIds = new List <object>(__nodes.Length); for (int i = 0; i < __nodes.Length; i++) { nodeIds.Add(__nodes[i].getCommonID()); } nodeIds.Sort(); JPanel top = new JPanel(); top.setLayout(new GridBagLayout()); JGUIUtil.addComponent(panel, top, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.WEST); y = 0; __node1ComboBox = new SimpleJComboBox(nodeIds); __node1ComboBox.addItemListener(this); __node1ComboBox.addActionListener(this); JGUIUtil.addComponent(top, new JLabel("From node: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __node1ComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); __node2ComboBox = new SimpleJComboBox(nodeIds); __node2ComboBox.addItemListener(this); __node2ComboBox.addActionListener(this); JGUIUtil.addComponent(top, new JLabel("To node: "), 0, ++y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __node2ComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); __linkId_JTextField = new JTextField(10); JGUIUtil.addComponent(top, new JLabel("Link ID: "), 0, ++y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __linkId_JTextField, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); IList <string> lineStyleChoices = new List <object>(); lineStyleChoices.Add("" + GRLineStyleType.DASHED); lineStyleChoices.Add("" + GRLineStyleType.SOLID); __lineStyleComboBox = new SimpleJComboBox(lineStyleChoices); __lineStyleComboBox.addItemListener(this); __lineStyleComboBox.addActionListener(this); JGUIUtil.addComponent(top, new JLabel("Line style: "), 0, ++y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __lineStyleComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); IList <string> arrowEndChoices = new List <object>(); arrowEndChoices.Add("" + GRArrowStyleType.NONE); arrowEndChoices.Add("" + GRArrowStyleType.SOLID); __fromArrowStyleComboBox = new SimpleJComboBox(arrowEndChoices); __fromArrowStyleComboBox.addItemListener(this); __fromArrowStyleComboBox.addActionListener(this); JGUIUtil.addComponent(top, new JLabel("Arrow (from) style: "), 0, ++y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __fromArrowStyleComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); __toArrowStyleComboBox = new SimpleJComboBox(arrowEndChoices); __toArrowStyleComboBox.addItemListener(this); __toArrowStyleComboBox.addActionListener(this); JGUIUtil.addComponent(top, new JLabel("Arrow (to) style: "), 0, ++y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __toArrowStyleComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); __okJButton = new JButton(__BUTTON_OK); __okJButton.addActionListener(this); __okJButton.setEnabled(false); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.addActionListener(this); JGUIUtil.addComponent(southPanel, __okJButton, 0, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, cancelButton, 1, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); getContentPane().add(panel); getContentPane().add(southPanel, "South"); pack(); JGUIUtil.center(this); setVisible(true); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "setupGUI"; addWindowListener(this); __addReturnFlow = new JButton(__BUTTON_ADD_RETURN_FLOW); __deleteReturnFlow = new JButton(__BUTTON_DEL_RETURN_FLOW); __deleteReturnFlow.setEnabled(false); __helpJButton = new JButton(__BUTTON_HELP); __helpJButton.setEnabled(false); __closeJButton = new JButton(__BUTTON_CLOSE); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton applyJButton = new JButton(__BUTTON_APPLY); GridBagLayout gb = new GridBagLayout(); JPanel mainJPanel = new JPanel(); mainJPanel.setLayout(gb); FlowLayout fl = new FlowLayout(FlowLayout.RIGHT); JPanel p1 = new JPanel(); p1.setLayout(fl); GridLayout gl = new GridLayout(2, 2, 1, 1); JPanel info_panel = new JPanel(); info_panel.setLayout(gl); JPanel main_panel = new JPanel(); main_panel.setLayout(new BorderLayout()); info_panel.add(new JLabel("Well:")); info_panel.add(new JLabel(__currentWell.getID())); info_panel.add(new JLabel("Well name:")); info_panel.add(new JLabel(__currentWell.getName())); if (__editable) { p1.add(__addReturnFlow); p1.add(__deleteReturnFlow); } p1.add(applyJButton); p1.add(cancelJButton); // p1.add(__helpJButton); p1.add(__closeJButton); PropList p = new PropList("StateMod_Well_ReturnFlow_JFrame.JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { System.Collections.IList nodes = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData()); System.Collections.IList v = new List <object>(); System.Collections.IList v2 = __currentWell.getReturnFlows(); StateMod_ReturnFlow rf; for (int i = 0; i < v2.Count; i++) { rf = (StateMod_ReturnFlow)((StateMod_ReturnFlow)v2[i]).clone(); rf.setCrtnid(rf.getCrtnid() + StateMod_Util.findNameInVector(rf.getCrtnid(), nodes, true)); v.Add(rf); } StateMod_ReturnFlow_TableModel tmw = new StateMod_ReturnFlow_TableModel(__dataset, v, __editable, true); StateMod_ReturnFlow_CellRenderer crw = new StateMod_ReturnFlow_CellRenderer(tmw); jsw = new JScrollWorksheet(crw, tmw, p); __worksheet = jsw.getJWorksheet(); v = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null); __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, v, false); // 10 System.Collections.IList delayIDs = null; if (__dataset.getIday() == 1) { delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData()); } else { delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData()); } v = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null); __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, v, false); widths = crw.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); main_panel.add(jsw, "Center"); main_panel.add(p1, "South"); JGUIUtil.addComponent(mainJPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(mainJPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH); getContentPane().add(mainJPanel); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); __addReturnFlow.addActionListener(this); __deleteReturnFlow.addActionListener(this); __closeJButton.addActionListener(this); __helpJButton.addActionListener(this); applyJButton.addActionListener(this); cancelJButton.addActionListener(this); pack(); setSize(520, 280); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(__parent); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; __downstreamIDJTextField = new JTextField(10); __downstreamIDJTextField.setEditable(false); __downstreamIDJTextField.setText(__ds.getCommonID()); __upstreamIDComboBox = new SimpleJComboBox(false); __upstreamIDComboBox.setPrototypeDisplayValue("[none] - Start a new TributaryXX"); __nodeNameJTextField = new JTextField(10); __nodeNameJTextField.addKeyListener(this); string[] usid = __ds.getUpstreamNodesIDs(); for (int i = 0; i < usid.Length; i++) { __upstreamIDComboBox.add(usid[i]); } __upstreamIDComboBox.add("[none] - Start a new Tributary"); __nodeTypeComboBox = new SimpleJComboBox(); __nodeTypeComboBox.add(__NODE_CONFLUENCE); __nodeTypeComboBox.add(__NODE_DIVERSION); __nodeTypeComboBox.add(__NODE_DIVERSION_AND_WELL); __nodeTypeComboBox.add(__NODE_INSTREAM_FLOW); __nodeTypeComboBox.add(__NODE_OTHER); __nodeTypeComboBox.add(__NODE_PLAN); __nodeTypeComboBox.add(__NODE_RESERVOIR); __nodeTypeComboBox.add(__NODE_STREAMFLOW); __nodeTypeComboBox.add(__NODE_WELL); __nodeTypeComboBox.add(__NODE_XCONFLUENCE); __nodeTypeComboBox.select(__NODE_STREAMFLOW); __nodeTypeComboBox.setMaximumRowCount(__nodeTypeComboBox.getItemCount()); __nodeTypeComboBox.addActionListener(this); __naturalFlowJCheckBox = new JCheckBox(); __naturalFlowJCheckBox.addActionListener(this); __importJCheckBox = new JCheckBox(); __importJCheckBox.addActionListener(this); JPanel top = new JPanel(); top.setLayout(new GridBagLayout()); top.setBorder(BorderFactory.createTitledBorder("Existing nodes")); JPanel bottom = new JPanel(); bottom.setLayout(new GridBagLayout()); bottom.setBorder(BorderFactory.createTitledBorder("New Node Data")); JGUIUtil.addComponent(panel, top, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, bottom, 0, 1, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.WEST); y = 0; JGUIUtil.addComponent(top, new JLabel("Downstream node: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __downstreamIDJTextField, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(top, new JLabel("Upstream node: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __upstreamIDComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; y = 0; JGUIUtil.addComponent(bottom, new JLabel("Node ID: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __nodeNameJTextField, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(bottom, new JLabel("Node type: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __nodeTypeComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(bottom, new JLabel("Is natural flow?: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __naturalFlowJCheckBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(bottom, new JLabel("Is import?: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __importJCheckBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); __okJButton = new JButton(__BUTTON_OK); __okJButton.addActionListener(this); __okJButton.setEnabled(false); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.addActionListener(this); JGUIUtil.addComponent(southPanel, __okJButton, 0, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, cancelButton, 1, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); getContentPane().add(panel); getContentPane().add(southPanel, "South"); pack(); JGUIUtil.center(this); setVisible(true); }
/// <summary> /// Sets up the GUI. </summary> /// <param name="index"> the index to select </param> private void setupGUI(int index) { string routine = "setupGUI"; addWindowListener(this); JPanel p1 = new JPanel(); // first 6 months' effeciency //JPanel p2 = new JPanel(); // last 6 months' effeciency JPanel p3 = new JPanel(); // div sta id -> switch for diversion JPanel p4 = new JPanel(); // user name -> data type switch JPanel left_panel = new JPanel(); // multilist and search area __stationIDJTextField = new JTextField(12); __nameJTextField = new JTextField(24); __latitudeJTextField = new JTextField(12); __elevationJTextField = new JTextField(12); __region1JTextField = new JTextField(12); __region2JTextField = new JTextField(12); __searchID = new JTextField(10); __searchName = new JTextField(10); __searchName.setEditable(false); __findNextStation = new JButton(__BUTTON_FIND_NEXT); __searchCriteriaGroup = new ButtonGroup(); __searchIDJRadioButton = new JRadioButton(__BUTTON_ID, true); __searchNameJRadioButton = new JRadioButton(__BUTTON_NAME, false); __searchCriteriaGroup.add(__searchIDJRadioButton); __searchCriteriaGroup.add(__searchNameJRadioButton); JButton applyJButton = new JButton(__BUTTON_APPLY); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton helpJButton = new JButton(__BUTTON_HELP); helpJButton.setEnabled(false); JButton closeJButton = new JButton(__BUTTON_CLOSE); GridBagLayout gb = new GridBagLayout(); JPanel mainJPanel = new JPanel(); mainJPanel.setLayout(gb); p1.setLayout(new GridLayout(4, 6, 2, 0)); p3.setLayout(gb); p4.setLayout(gb); left_panel.setLayout(gb); int y; PropList p = new PropList("StateCU_ClimateStation_JFrame.JWorksheet"); p.add("JWorksheet.CellFont=Courier"); p.add("JWorksheet.CellStyle=Plain"); p.add("JWorksheet.CellSize=11"); p.add("JWorksheet.HeaderFont=Arial"); p.add("JWorksheet.HeaderStyle=Plain"); p.add("JWorksheet.HeaderSize=11"); p.add("JWorksheet.HeaderBackground=LightGray"); p.add("JWorksheet.RowColumnPresent=false"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; try { StateCU_ClimateStation_TableModel tmw = new StateCU_ClimateStation_TableModel(__stationsVector); StateCU_ClimateStation_CellRenderer crw = new StateCU_ClimateStation_CellRenderer(tmw); __worksheet = new JWorksheet(crw, tmw, p); widths = crw.getColumnWidths(); } catch (Exception e) { Message.printWarning(2, routine, e); __worksheet = new JWorksheet(0, 0, p); Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.setHourglassJFrame(this); __worksheet.addMouseListener(this); __worksheet.addKeyListener(this); JGUIUtil.addComponent(left_panel, new JScrollPane(__worksheet), 0, 0, 6, 6, 1, 1, 0, 0, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); y = 0; JGUIUtil.addComponent(p3, new JLabel("Station ID:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __stationIDJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); __stationIDJTextField.setEditable(false); y++; JGUIUtil.addComponent(p3, new JLabel("Name:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __nameJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Latitude (Dec. Deg.):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __latitudeJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Elevation (Feet):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __elevationJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Region 1:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __region1JTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Region 2:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __region2JTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JPanel graphPanel = new JPanel(); graphPanel.setLayout(gb); graphPanel.setBorder(BorderFactory.createTitledBorder("Time Series")); int yy = 0; __precipitationCheckBox = new JCheckBox("Precipitation (Monthly)"); __temperatureCheckBox = new JCheckBox("Temperature (Monthly)"); __frostDatesCheckBox = new JCheckBox("Frost Dates (Yearly)"); JGUIUtil.addComponent(graphPanel, __precipitationCheckBox, 0, yy++, 3, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, __temperatureCheckBox, 0, yy++, 3, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, __frostDatesCheckBox, 0, yy++, 3, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); if (!__dataset.getComponentForComponentType(StateCU_DataSet.COMP_PRECIPITATION_TS_MONTHLY).hasData()) { __precipitationCheckBox.setEnabled(false); } if (!__dataset.getComponentForComponentType(StateCU_DataSet.COMP_TEMPERATURE_TS_MONTHLY_AVERAGE).hasData()) { __temperatureCheckBox.setEnabled(false); } if (!__dataset.getComponentForComponentType(StateCU_DataSet.COMP_FROST_DATES_TS_YEARLY).hasData()) { __frostDatesCheckBox.setEnabled(false); } JButton graphButton = new SimpleJButton(__BUTTON_GRAPH, __BUTTON_GRAPH, this); JButton tableButton = new SimpleJButton(__BUTTON_TABLE, __BUTTON_TABLE, this); JButton summaryButton = new SimpleJButton(__BUTTON_SUMMARY, __BUTTON_SUMMARY, this); JGUIUtil.addComponent(graphPanel, graphButton, 0, yy, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, tableButton, 1, yy, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, summaryButton, 2, yy++, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p3, graphPanel, 0, y++, 2, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST); // add search areas y = 7; JPanel searchPanel = new JPanel(); searchPanel.setLayout(gb); searchPanel.setBorder(BorderFactory.createTitledBorder("Search above list for: ")); JGUIUtil.addComponent(left_panel, searchPanel, 0, y, 4, 1, 0, 0, 10, 10, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); int y2 = 0; JGUIUtil.addComponent(searchPanel, __searchIDJRadioButton, 0, y2, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __searchIDJRadioButton.addActionListener(this); JGUIUtil.addComponent(searchPanel, __searchID, 1, y2, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); __searchID.addActionListener(this); y2++; JGUIUtil.addComponent(searchPanel, __searchNameJRadioButton, 0, y2, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __searchNameJRadioButton.addActionListener(this); JGUIUtil.addComponent(searchPanel, __searchName, 1, y2, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); __searchName.addActionListener(this); y2++; JGUIUtil.addComponent(searchPanel, __findNextStation, 0, y2, 4, 1, 0, 0, 20, 10, 20, 10, GridBagConstraints.NONE, GridBagConstraints.WEST); __findNextStation.addActionListener(this); // add buttons which lead to station water rights, // direct flow demand, and return flow information y = 6; FlowLayout fl = new FlowLayout(FlowLayout.CENTER); JPanel p5 = new JPanel(); p5.setLayout(new GridLayout(5, 2)); // add help and close buttons y = 10; JPanel p6 = new JPanel(); p6.setLayout(fl); if (__editable) { p6.add(applyJButton); p6.add(cancelJButton); } p6.add(helpJButton); p6.add(closeJButton); // two top panels of info JGUIUtil.addComponent(mainJPanel, p3, 6, 0, 1, 6, 0, 1, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(mainJPanel, p6, 6, 7, 1, 1, 0, 0, 30, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH); applyJButton.addActionListener(this); cancelJButton.addActionListener(this); helpJButton.addActionListener(this); closeJButton.addActionListener(this); JGUIUtil.addComponent(mainJPanel, left_panel, 0, 0, 4, 10, 1, 1, 10, 10, 10, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); getContentPane().add(mainJPanel); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); initializeDisables(); // JGUIUtil.center(this); pack(); setSize(900,440); selectTableIndex(index); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(this); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; JGUIUtil.addComponent(panel, new JLabel("Text:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("X:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Y:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Text Position:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Font Name:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Font Size:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Font Style:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); __textTextField = new JTextField(30); __textFieldBackground = __textTextField.getBackground(); __xTextField = new JTextField(15); __yTextField = new JTextField(15); __textPositionComboBox = new SimpleJComboBox(false); string[] positions = GRText.getTextPositions(); __textPositionComboBox.setMaximumRowCount(positions.Length); IList <string> positionsChoices = new List <string>(); for (int i = 0; i < positions.Length; i++) { positionsChoices.Add(positions[i]); } __textPositionComboBox.setData(positionsChoices); __fontNameComboBox = JGUIUtil.newFontNameJComboBox(); __fontSizeTextField = new JTextField(7); __fontStyleComboBox = JGUIUtil.newFontStyleJComboBox(); displayPropListValues(); __textTextField.addKeyListener(this); __xTextField.addKeyListener(this); __yTextField.addKeyListener(this); __fontSizeTextField.addKeyListener(this); __textPositionComboBox.addActionListener(this); __fontNameComboBox.addActionListener(this); __fontStyleComboBox.addActionListener(this); y = 0; JGUIUtil.addComponent(panel, __textTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __xTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __yTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __textPositionComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __fontNameComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __fontSizeTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __fontStyleComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); if (!__editable) { __textTextField.setEditable(false); __xTextField.setEditable(false); __yTextField.setEditable(false); __textPositionComboBox.setEnabled(false); __fontNameComboBox.setEnabled(false); __fontSizeTextField.setEditable(false); __fontStyleComboBox.setEnabled(false); } __applyButton = new JButton(__BUTTON_APPLY); if (__editable) { __applyButton.setToolTipText("Apply changes."); __applyButton.addActionListener(this); } __applyButton.setEnabled(false); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.setToolTipText("Discard changes and return."); cancelButton.addActionListener(this); __okButton = new JButton(__BUTTON_OK); __okButton.setToolTipText("Accept changes and return."); __okButton.setEnabled(false); __okButton.addActionListener(this); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); if (__editable) { JGUIUtil.addComponent(southPanel, __applyButton, 0, 0, 1, 1, 1, 1, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST); } int space = 0; if (!__editable) { space = 1; } JGUIUtil.addComponent(southPanel, __okButton, 1, 0, 1, 1, space, space, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST); if (__editable) { JGUIUtil.addComponent(southPanel, cancelButton, 2, 0, 1, 1, 0, 0, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST); } else { __okButton.setEnabled(true); } getContentPane().add("Center", panel); getContentPane().add("South", southPanel); string app = JGUIUtil.getAppNameForWindows(); if (string.ReferenceEquals(app, null) || app.Trim().Equals("")) { app = ""; } else { app += " - "; } setTitle(app + "Node Properties"); pack(); setSize(getWidth() + 100, getHeight()); JGUIUtil.center(this); setVisible(true); }
private void initGUI() { try { setPreferredSize(new Dimension(400, 300)); { generalPanel = new JPanel(); FlowLayout generalPanelLayout = new FlowLayout(); generalPanelLayout.setAlignment(FlowLayout.LEFT); generalPanel.setLayout(generalPanelLayout); this.addTab("General", null, generalPanel, null); { resolutionPanel = new JPanel(); generalPanel.add(resolutionPanel); FlowLayout resolutionPanelLayout = new FlowLayout(); resolutionPanel.setLayout(resolutionPanelLayout); resolutionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Resolution", TitledBorder.LEADING, TitledBorder.TOP)); { resolutionCheckBox = new JCheckBox(); resolutionPanel.add(resolutionCheckBox); resolutionCheckBox.setText("Override"); } { jLabel1 = new JLabel(); resolutionPanel.add(jLabel1); jLabel1.setText("Image Width:"); } { resolutionXTextField = new JTextField(); resolutionPanel.add(resolutionXTextField); resolutionXTextField.setText("640"); resolutionXTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } { jLabel2 = new JLabel(); resolutionPanel.add(jLabel2); jLabel2.setText("Image Height:"); } { resolutionYTextField = new JTextField(); resolutionPanel.add(resolutionYTextField); resolutionYTextField.setText("480"); resolutionYTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } } { threadsPanel = new JPanel(); generalPanel.add(threadsPanel); threadsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Threads", TitledBorder.LEADING, TitledBorder.TOP)); { threadCheckBox = new JCheckBox(); threadsPanel.add(threadCheckBox); threadCheckBox.setText("Use All Processors"); } { jLabel3 = new JLabel(); threadsPanel.add(jLabel3); jLabel3.setText("Threads:"); } { threadTextField = new JTextField(); threadsPanel.add(threadTextField); threadTextField.setText("1"); threadTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } } } { rendererPanel = new JPanel(); FlowLayout rendererPanelLayout = new FlowLayout(); rendererPanelLayout.setAlignment(FlowLayout.LEFT); rendererPanel.setLayout(rendererPanelLayout); this.addTab("Renderer", null, rendererPanel, null); { defaultRendererRadioButton = new JRadioButton(); rendererPanel.add(defaultRendererRadioButton); defaultRendererRadioButton.setText("Default Renderer"); } { bucketRendererPanel = new JPanel(); BoxLayout bucketRendererPanelLayout = new BoxLayout(bucketRendererPanel, javax.swing.BoxLayout.Y_AXIS); bucketRendererPanel.setLayout(bucketRendererPanelLayout); rendererPanel.add(bucketRendererPanel); bucketRendererPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Bucket Renderer", TitledBorder.LEADING, TitledBorder.TOP)); { bucketRendererRadioButton = new JRadioButton(); bucketRendererPanel.add(bucketRendererRadioButton); bucketRendererRadioButton.setText("Enable"); } { samplingPanel = new JPanel(); GridLayout samplingPanelLayout = new GridLayout(2, 2); samplingPanelLayout.setColumns(2); samplingPanelLayout.setHgap(5); samplingPanelLayout.setVgap(5); samplingPanelLayout.setRows(2); samplingPanel.setLayout(samplingPanelLayout); bucketRendererPanel.add(samplingPanel); { jLabel5 = new JLabel(); samplingPanel.add(jLabel5); jLabel5.setText("Min:"); } { ComboBoxModel minSamplingComboBoxModel = new DefaultComboBoxModel(new string[] { "Item One", "Item Two" }); minSamplingComboBox = new JComboBox(); samplingPanel.add(minSamplingComboBox); minSamplingComboBox.setModel(minSamplingComboBoxModel); } { jLabel6 = new JLabel(); samplingPanel.add(jLabel6); jLabel6.setText("Max:"); } { ComboBoxModel maxSamplingComboxBoxModel = new DefaultComboBoxModel(new string[] { "Item One", "Item Two" }); maxSamplingComboxBox = new JComboBox(); samplingPanel.add(maxSamplingComboxBox); maxSamplingComboxBox.setModel(maxSamplingComboxBoxModel); } } } } } catch (Exception e) { e.printStackTrace(); } }
public FactsPanel(JamochaGui gui) : base(gui) { //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' setLayout(new BorderLayout()); dataModel = new FactsTableModel(this); TableSorter sorter = new TableSorter(new TableMap()); ((TableMap) sorter.Model).setModel(dataModel); factsTable = new JTable(sorter); sorter.addMouseListenerToHeaderInTable(factsTable); factsTable.setShowHorizontalLines(true); factsTable.setRowSelectionAllowed(true); factsTable.TableHeader.setReorderingAllowed(false); factsTable.TableHeader.setToolTipText("Click to sort ascending. Click while pressing the shift-key down to sort descending"); factsTable.SelectionModel.addListSelectionListener(this); dumpArea = new JTextArea(); dumpArea.setLineWrap(true); dumpArea.setWrapStyleWord(true); dumpArea.setEditable(false); //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"' //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"' dumpArea.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle) System.Drawing.FontStyle.Regular)); pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(factsTable), new JScrollPane(dumpArea)); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' add(pane, BorderLayout.CENTER); pane.setDividerLocation(gui.Preferences.getInt("facts.dividerlocation", 300)); reloadButton = new JButton("Reload Facts", IconLoader.getImageIcon("database_refresh")); reloadButton.addActionListener(this); assertButton = new JButton("Assert Fact", IconLoader.getImageIcon("database_add")); assertButton.addActionListener(this); JPanel buttonPanel = new JPanel(); //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"' //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.RIGHT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"' buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 1)); buttonPanel.add(reloadButton); buttonPanel.add(assertButton); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000"' add(buttonPanel, BorderLayout.PAGE_END); initPopupMenu(); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(this); __descriptionTextField = new JTextField(25); __origDesc = __nodes[__nodeNum].getDescription(); __descriptionTextField.setText(__origDesc); __idTextField = new JTextField(10); __origID = __nodes[__nodeNum].getCommonID(); __idTextField.setText(__origID); __idTextField.addKeyListener(this); __xTextField = new JTextField(10); __origX = StringUtil.formatString(__nodes[__nodeNum].getX(), "%13.6f").Trim(); __xTextField.setText(__origX); __xTextField.addKeyListener(this); __yTextField = new JTextField(10); __origY = StringUtil.formatString(__nodes[__nodeNum].getY(), "%13.6f").Trim(); __yTextField.setText(__origY); __yTextField.addKeyListener(this); __areaTextField = new JTextField(10); __origArea = StringUtil.formatString(__nodes[__nodeNum].getArea(), "%13.6f").Trim(); __areaTextField.setText(__origArea); __areaTextField.addKeyListener(this); __precipitationTextField = new JTextField(10); __origPrecipitation = StringUtil.formatString(__nodes[__nodeNum].getPrecip(), "%13.6f").Trim(); __precipitationTextField.setText(__origPrecipitation); __precipitationTextField.addKeyListener(this); __typeComboBox = new SimpleJComboBox(false); __typeComboBox.add(__NODE_DIVERSION); __typeComboBox.add(__NODE_DIVERSION_AND_WELL); __typeComboBox.add(__NODE_INSTREAM_FLOW); __typeComboBox.add(__NODE_OTHER); __typeComboBox.add(__NODE_PLAN); __typeComboBox.add(__NODE_RESERVOIR); __typeComboBox.add(__NODE_STREAMFLOW); __typeComboBox.add(__NODE_WELL); int type = __nodes[__nodeNum].getType(); if (type == HydrologyNode.NODE_TYPE_CONFLUENCE) { __typeComboBox.select(__NODE_CONFLUENCE); } else if (type == HydrologyNode.NODE_TYPE_DIV) { __typeComboBox.select(__NODE_DIVERSION); } else if (type == HydrologyNode.NODE_TYPE_DIV_AND_WELL) { __typeComboBox.select(__NODE_DIVERSION_AND_WELL); } else if (type == HydrologyNode.NODE_TYPE_END) { __typeComboBox.removeAll(); __typeComboBox.add(__NODE_END); } else if (type == HydrologyNode.NODE_TYPE_ISF) { __typeComboBox.select(__NODE_INSTREAM_FLOW); } else if (type == HydrologyNode.NODE_TYPE_OTHER) { __typeComboBox.select(__NODE_OTHER); } else if (type == HydrologyNode.NODE_TYPE_PLAN) { __typeComboBox.select(__NODE_PLAN); } else if (type == HydrologyNode.NODE_TYPE_RES) { __typeComboBox.select(__NODE_RESERVOIR); } else if (type == HydrologyNode.NODE_TYPE_FLOW) { __typeComboBox.select(__NODE_STREAMFLOW); } else if (type == HydrologyNode.NODE_TYPE_WELL) { __typeComboBox.select(__NODE_WELL); } else if (type == HydrologyNode.NODE_TYPE_XCONFLUENCE) { __typeComboBox.select(__NODE_XCONFLUENCE); } else { __typeComboBox.removeAll(); __typeComboBox.add("Unknown Type: " + type); } __typeComboBox.setMaximumRowCount(__typeComboBox.getItemCount()); __origIType = type; __origType = __typeComboBox.getSelected(); __labelPositionComboBox = new SimpleJComboBox(false); __labelPositionComboBox.add(__ABOVE_CENTER); __labelPositionComboBox.add(__UPPER_RIGHT); __labelPositionComboBox.add(__RIGHT); __labelPositionComboBox.add(__LOWER_RIGHT); __labelPositionComboBox.add(__BELOW_CENTER); __labelPositionComboBox.add(__LOWER_LEFT); __labelPositionComboBox.add(__LEFT); __labelPositionComboBox.add(__UPPER_LEFT); __labelPositionComboBox.add(__CENTER); __labelPositionComboBox.setMaximumRowCount(__labelPositionComboBox.getItemCount()); int dir = __nodes[__nodeNum].getLabelDirection() % 10; if (dir == 2) { __labelPositionComboBox.select(__BELOW_CENTER); } else if (dir == 1) { __labelPositionComboBox.select(__ABOVE_CENTER); } else if (dir == 4) { __labelPositionComboBox.select(__RIGHT); } else if (dir == 3) { __labelPositionComboBox.select(__LEFT); } else if (dir == 7) { __labelPositionComboBox.select(__UPPER_RIGHT); } else if (dir == 8) { __labelPositionComboBox.select(__LOWER_RIGHT); } else if (dir == 5) { __labelPositionComboBox.select(__LOWER_LEFT); } else if (dir == 6) { __labelPositionComboBox.select(__UPPER_LEFT); } else if (dir == 9) { __labelPositionComboBox.select(__CENTER); } else { __labelPositionComboBox.removeAll(); __labelPositionComboBox.add("Unknown Position: " + dir); } __origIDir = dir; __origDir = __labelPositionComboBox.getSelected(); __isNaturalFlowCheckBox = new JCheckBox(); __isImportCheckBox = new JCheckBox(); __origDirty = __nodes[__nodeNum].isDirty(); __reservoirDirectionLabel = new JLabel("Reservoir Direction: "); __reservoirDirectionComboBox = new SimpleJComboBox(false); __reservoirDirectionComboBox.setToolTipText("Reservoir body is to the indicated direction " + "(downstream follows the arrow)."); __reservoirDirectionComboBox.add(__TOP); __reservoirDirectionComboBox.add(__BOTTOM); __reservoirDirectionComboBox.add(__LEFT); __reservoirDirectionComboBox.add(__RIGHT); int resDir = __nodes[__nodeNum].getLabelDirection() / 10; if (resDir == 1) { __reservoirDirectionComboBox.select(__BOTTOM); } else if (resDir == 2) { __reservoirDirectionComboBox.select(__TOP); } else if (resDir == 3) { __reservoirDirectionComboBox.select(__RIGHT); } else if (resDir == 4) { __reservoirDirectionComboBox.select(__LEFT); } else if (resDir == 0) { } else { __reservoirDirectionComboBox.removeAll(); __reservoirDirectionComboBox.add("Unknown direction: " + resDir); } __origResIDir = resDir; __origResDir = __reservoirDirectionComboBox.getSelected(); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; JGUIUtil.addComponent(panel, new JLabel("ID: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __idTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Type: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __typeComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Description: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __descriptionTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("X: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __xTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Y: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __yTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Is natural flow?: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __isNaturalFlowCheckBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Is import?: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __isImportCheckBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Area: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __areaTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Precipitation: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __precipitationTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); if (__nodes[__nodeNum].getIsNaturalFlow()) { __isNaturalFlowCheckBox.setSelected(true); } else { __isNaturalFlowCheckBox.setSelected(false); __areaTextField.setEnabled(false); __precipitationTextField.setEnabled(false); } __isNaturalFlowCheckBox.addActionListener(this); if (__nodes[__nodeNum].getIsImport()) { __isImportCheckBox.setSelected(true); } else { __isImportCheckBox.setSelected(false); } __isImportCheckBox.addActionListener(this); __origNaturalFlow = __isNaturalFlowCheckBox.isSelected(); __origImport = __isImportCheckBox.isSelected(); y++; JGUIUtil.addComponent(panel, new JLabel("Label Position: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __labelPositionComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, __reservoirDirectionLabel, 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __reservoirDirectionComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; y = addUpstreamNodesToPanel(panel, y); addDownstreamNodeToPanel(panel, y); getContentPane().add(panel); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); __applyButton = new JButton(__BUTTON_APPLY); __applyButton.addActionListener(this); __okButton = new JButton(__BUTTON_OK); __okButton.addActionListener(this); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.addActionListener(this); JGUIUtil.addComponent(southPanel, __applyButton, 0, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, __okButton, 2, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, cancelButton, 3, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); getContentPane().add(southPanel, "South"); pack(); if (__origIType != HydrologyNode.NODE_TYPE_RES) { __reservoirDirectionLabel.setVisible(false); __reservoirDirectionComboBox.setVisible(false); } __typeComboBox.addActionListener(this); if (__parent.inStateModGUI()) { __typeComboBox.setEnabled(false); __precipitationTextField.setEditable(false); __precipitationTextField.removeKeyListener(this); __descriptionTextField.setEditable(false); __descriptionTextField.removeKeyListener(this); __areaTextField.removeKeyListener(this); __areaTextField.setEditable(false); __idTextField.removeKeyListener(this); __idTextField.setEditable(false); __isNaturalFlowCheckBox.setEnabled(false); __isImportCheckBox.setEnabled(false); } 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> private void setupGUI() { string routine = "setupGUI"; addWindowListener(this); __addRight = new JButton(__BUTTON_ADD_RIGHT); __deleteRight = new JButton(__BUTTON_DEL_RIGHT); __deleteRight.setEnabled(false); __closeJButton = new JButton(__BUTTON_CLOSE); __helpJButton = new JButton(__BUTTON_HELP); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton applyJButton = new JButton(__BUTTON_APPLY); GridBagLayout gb = new GridBagLayout(); JPanel mainJPanel = new JPanel(); mainJPanel.setLayout(gb); FlowLayout fl = new FlowLayout(FlowLayout.RIGHT); JPanel p1 = new JPanel(); p1.setLayout(fl); GridLayout gl = new GridLayout(2, 2, 1, 1); JPanel info_panel = new JPanel(); info_panel.setLayout(gl); JPanel main_panel = new JPanel(); main_panel.setLayout(new BorderLayout()); info_panel.add(new JLabel("Well: ")); info_panel.add(new JLabel(__currentWell.getID())); info_panel.add(new JLabel("Well name: ")); info_panel.add(new JLabel(__currentWell.getName())); if (__editable) { p1.add(__addRight); p1.add(__deleteRight); } p1.add(applyJButton); p1.add(cancelJButton); // p1.add(__helpJButton); p1.add(__closeJButton); PropList p = new PropList("StateMod_Well_Right_JFrame.JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { IList <StateMod_WellRight> v = new List <StateMod_WellRight>(); IList <StateMod_WellRight> v2 = __currentWell.getRights(); for (int i = 0; i < v2.Count; i++) { v.Add((StateMod_WellRight)v2[i].clone()); } StateMod_WellRight_TableModel tmw = new StateMod_WellRight_TableModel(v, __editable, true); StateMod_WellRight_CellRenderer crw = new StateMod_WellRight_CellRenderer(tmw); jsw = new JScrollWorksheet(crw, tmw, p); __worksheet = jsw.getJWorksheet(); widths = crw.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); IList <string> v = new List <string>(); v.Add("0 - Off"); v.Add("1 - On"); __worksheet.setColumnJComboBoxValues(StateMod_WellRight_TableModel.COL_ON_OFF, v); main_panel.add(jsw, "Center"); main_panel.add(p1, "South"); // assemble window from parts JGUIUtil.addComponent(mainJPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(mainJPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH); __addRight.addActionListener(this); __deleteRight.addActionListener(this); __closeJButton.addActionListener(this); __helpJButton.addActionListener(this); __helpJButton.setEnabled(false); applyJButton.addActionListener(this); cancelJButton.addActionListener(this); getContentPane().add(mainJPanel); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); pack(); setSize(670, 400); 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); }
private void initFactEditPanel() { factComponents.clear(); //UPGRADE_ISSUE: Class 'java.awt.GridBagLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagLayout"' //UPGRADE_ISSUE: Constructor 'java.awt.GridBagLayout.GridBagLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagLayout"' GridBagLayout gridbag = new GridBagLayout(); //UPGRADE_ISSUE: Class 'java.awt.GridBagConstraints' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Constructor 'java.awt.GridBagConstraints.GridBagConstraints' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' GridBagConstraints c = new GridBagConstraints(); //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' JPanel factEditPanel = new JPanel(new BorderLayout()); JPanel innerPanel = new JPanel(gridbag); factEditPanel.setBorder(BorderFactory.createTitledBorder("Set the Slots for the Fact")); if (templateList.SelectedIndex > - 1) { Module module = engine.WorkingMemory.findModule(System.String.valueOf(moduleList.SelectedValue)); Template tmp = module.getTemplate(System.String.valueOf(templateList.SelectedValue)); //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.weightx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.weightx = 1.0; Slot[] slots = tmp.AllSlots; for (int i = 0; i < slots.Length; ++i) { //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridx = 0; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridy' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridy = i; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.fill' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.VERTICAL' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.fill = GridBagConstraints.VERTICAL; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.anchor' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.EAST' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.anchor = GridBagConstraints.EAST; JLabel label = new JLabel(slots[i].Name + ": "); gridbag.setConstraints(label, c); innerPanel.add(label); //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridx = 1; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.fill' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.BOTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.fill = GridBagConstraints.BOTH; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.anchor' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.WEST' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.anchor = GridBagConstraints.WEST; if (slots[i] is MultiSlot) { MultiSlotEditor multislotEditor = new MultiSlotEditor(this); JScrollPane scrollPane = new JScrollPane(multislotEditor.List); gridbag.setConstraints(scrollPane, c); innerPanel.add(scrollPane); factComponents.put(slots[i], multislotEditor.List); } else if (slots[i].ValueType == Constants.FACT_TYPE) { // TODO Fact-Selector JComboBox factBox = new JComboBox(); factComponents.put(slots[i], factBox); } else { JTextField textField = new JTextField(); gridbag.setConstraints(textField, c); innerPanel.add(textField); factComponents.put(slots[i], textField); } } } //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' factEditPanel.add(new JScrollPane(innerPanel), BorderLayout.CENTER); JPanel dumpAreaPanel = new JPanel(); dumpAreaPanel.setLayout(new BoxLayout(dumpAreaPanel, BoxLayout.Y_AXIS)); dumpAreaPanel.add(new JLabel("Fact Preview:")); dumpAreaPanel.add(new JScrollPane(dumpAreaFact)); reloadButtondumpAreaFact = new JButton("Reload Fact Preview", IconLoader.getImageIcon("arrow_refresh")); reloadButtondumpAreaFact.addActionListener(this); dumpAreaPanel.add(reloadButtondumpAreaFact); //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.weightx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.weightx = 0.0; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridwidth' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridwidth = 2; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridy' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridy = 1; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.gridx' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.gridx = 0; //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.fill' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' //UPGRADE_ISSUE: Field 'java.awt.GridBagConstraints.BOTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridBagConstraints"' c.fill = GridBagConstraints.BOTH; gridbag.setConstraints(dumpAreaPanel, c); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.SOUTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' factEditPanel.add(dumpAreaPanel, BorderLayout.SOUTH); contentPanel.add("factEdit", factEditPanel); }
/// <summary> /// Sets up the GUI. </summary> /// <exception cref="Exception"> if there is an error setting up the worksheet. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void setupGUI() throws Exception private void setupGUI() { addWindowListener(this); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); // buildJScrollWorksheet is defined in the derived classes (it is // abstract in this class). It creates a JScrollWorksheet and returns it. __scrollWorksheet = buildJScrollWorksheet(); _worksheet = __scrollWorksheet.getJWorksheet(); JGUIUtil.addComponent(panel, __scrollWorksheet, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); getContentPane().add("Center", panel); SimpleJButton exportButton = new SimpleJButton(_BUTTON_EXPORT, this); SimpleJButton printButton = new SimpleJButton(_BUTTON_PRINT, this); SimpleJButton okButton = new SimpleJButton(_BUTTON_OK, this); SimpleJButton applyButton = null; SimpleJButton cancelButton = null; if (_editable) { applyButton = new SimpleJButton(_BUTTON_APPLY, this); cancelButton = new SimpleJButton(_BUTTON_CANCEL, this); } JPanel bottomPanel = new JPanel(); bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); bottomPanel.add(exportButton); bottomPanel.add(printButton); bottomPanel.add(okButton); if (_editable) { bottomPanel.add(applyButton); bottomPanel.add(cancelButton); } getContentPane().add("South", bottomPanel); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); setTitle(_titleString); pack(); setSize(800, 400); JGUIUtil.center(this); setVisible(true); JWorksheet_DefaultTableCellRenderer renderer = _worksheet.getCellRenderer(); int[] widths = renderer.getColumnWidths(); if (widths != null) { _worksheet.setColumnWidths(widths); } }
public LogPanel(JamochaGui gui) : base(gui) { InitBlock(); //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' setLayout(new BorderLayout()); logChannel = gui.Engine.MessageRouter.openChannel("gui_log", InterestType.ALL); detailView = new JTextArea(); detailView.setEditable(false); //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"' //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"' detailView.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle) System.Drawing.FontStyle.Regular)); cellRenderer = new LogTableCellRenderer(this); logTable = new AnonymousClassJTable(this, dataModel); logTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); logTable.SelectionModel.addListSelectionListener(this); pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(logTable), new JScrollPane(detailView)); pane.setDividerLocation(gui.Preferences.getInt("log.dividerlocation", 300)); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"' add(pane, BorderLayout.CENTER); SupportClass.ThreadClass logThread = new AnonymousClassThread(this); logThread.Start(); clearButton = new JButton("Clear Log", IconLoader.getImageIcon("monitor")); clearButton.addActionListener(this); JPanel buttonPanel = new JPanel(); //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"' //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.RIGHT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"' buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 1)); buttonPanel.add(clearButton); //UPGRADE_ISSUE: Field 'java.awt.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000"' add(buttonPanel, BorderLayout.PAGE_END); }
/// <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); }