Beispiel #1
0
            public RegisterValueEditor(RegisterTable outerInstance) : base(new JTextField())
            {
                this.outerInstance = outerInstance;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'sealed override':
//ORIGINAL LINE: sealed override javax.swing.JTextField tf = ((javax.swing.JTextField) getComponent());
                JTextField tf = ((JTextField)Component);

                tf.Font = tableFont;
            }
Beispiel #2
0
        private void initComponents()
        {
            scrollPane        = new JScrollPane();
            chatMessagesLabel = new JLabel();
            chatMessage       = new JTextField();
            sendButton        = new JButton();
            adhocIDLabel      = new JLabel();
            groupNameLabel    = new JLabel();
            membersLabel      = new JLabel();
            membersList       = new JLabel();

            Title     = "Chat";
            Resizable = true;

            sendButton.Text           = "Send";
            sendButton.DefaultCapable = true;
            RootPane.DefaultButton    = sendButton;
            sendButton.addActionListener(new ActionListenerAnonymousInnerClass(this));

            // Start displaying the chat message from the bottom
            chatMessagesLabel.VerticalAlignment = SwingConstants.BOTTOM;
            chatMessagesLabel.PreferredSize     = new Dimension(500, 300);

            scrollPane.ViewportView = chatMessagesLabel;

            adhocIDLabel.Text   = AdhocID;
            groupNameLabel.Text = GroupName;
            membersLabel.Text   = "Members:";

            membersList.PreferredSize = new Dimension(100, chatMessagesLabel.PreferredSize.height);

            chatMessage.Editable = true;

            //
            // Layout:
            //
            // +-------------------------------------------+-----------------+
            // |                                           | adhocIDLabel    |
            // |                                           | groupNameLabel  |
            // | chatMessageLabel in scrollPane            | membersLabel    |
            // |                                           +-----------------+
            // |                                           | membersList     |
            // |                                           |                 |
            // |                                           |                 |
            // |                                           |                 |
            // |                                           |                 |
            // +-------------------------------------------+----+------------+
            // | chatMessage                                    | sendButton |
            // +------------------------------------------------+------------+
            //
            GroupLayout layout = new GroupLayout(ContentPane);

            ContentPane.Layout     = layout;
            layout.HorizontalGroup = layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(scrollPane).addGroup(layout.createParallelGroup().addGroup(layout.createParallelGroup().addComponent(adhocIDLabel)).addGroup(layout.createParallelGroup().addComponent(groupNameLabel)).addComponent(membersLabel).addComponent(membersList))).addGroup(layout.createSequentialGroup().addComponent(chatMessage).addComponent(sendButton));
            layout.VerticalGroup   = layout.createSequentialGroup().addGroup(layout.createParallelGroup().addComponent(scrollPane).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup().addComponent(adhocIDLabel)).addGroup(layout.createParallelGroup().addComponent(groupNameLabel)).addComponent(membersLabel).addComponent(membersList))).addGroup(layout.createParallelGroup().addComponent(chatMessage).addComponent(sendButton));
            pack();
        }
Beispiel #3
0
            public AddressCellEditor(MemoryBreakpointsDialog outerInstance) : base(new JTextField())
            {
                this.outerInstance = outerInstance;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'sealed override':
//ORIGINAL LINE: sealed override javax.swing.JTextField tf = ((javax.swing.JTextField) getComponent());
                JTextField tf = ((JTextField)Component);

                tf.Font = tableFont;
            }
 /// <summary>
 /// Used to set a numeric value in a JTextField.  This method will check the value
 /// and see if it is missing, and if so, will set the JTextField to "".  Otherwise
 /// the text field will be filled with the value of the specified double. </summary>
 /// <param name="d"> the double to check and possibly put in the text field. </param>
 /// <param name="textField"> the JTextField to put the value in. </param>
 public static void checkAndSet(double d, JTextField textField)
 {
     if (StateMod_Util.isMissing(d))
     {
         textField.setText("");
     }
     else
     {
         textField.setText("" + d);
     }
 }
 /// <summary>
 /// Used to set a numeric value in a JTextField.  This method will check the value
 /// and see if it is missing, and if so, will set the JTextField to "".  Otherwise
 /// the text field will be filled with the value of the specified int. </summary>
 /// <param name="i"> the int to check and possibly put in the text field. </param>
 /// <param name="textField"> the JTextField to put the value in. </param>
 public static void checkAndSet(int i, JTextField textField)
 {
     if (StateMod_Util.isMissing(i))
     {
         textField.setText("");
     }
     else
     {
         textField.setText("" + i);
     }
 }
Beispiel #6
0
        /// <summary>
        /// This method is called from within the constructor to initialize the form.
        /// WARNING: Do NOT modify this code. The content of this method is always
        /// regenerated by the Form Editor.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private void initComponents()
        private void initComponents()
        {
            lblStartAddress = new javax.swing.JLabel();
            txtStartAddress = new JTextField();
            lblEndAddress   = new javax.swing.JLabel();
            lblFilename     = new javax.swing.JLabel();
            txtEndAddress   = new JTextField();
            txtFilename     = new JTextField();
            btnFilename     = new javax.swing.JButton();
            btnOk           = new javax.swing.JButton();
            btnCancel       = new pspsharp.GUI.CancelButton();

            DefaultCloseOperation = javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
            java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pspsharp/languages/pspsharp"); // NOI18N
            Title     = bundle.getString("DumpCodeDialog.title");                                                // NOI18N
            Resizable = false;

            lblStartAddress.Text = bundle.getString("DumpCodeDialog.lblStartAddress.text"); // NOI18N

            txtStartAddress.Font = new java.awt.Font("Courier New", 0, 12);                 // NOI18N
            txtStartAddress.HorizontalAlignment = JTextField.CENTER;
            txtStartAddress.Text          = "0x00000000";                                   // NOI18N
            txtStartAddress.InputVerifier = new AddressInputVerifier(this);

            lblEndAddress.Text = bundle.getString("DumpCodeDialog.lblEndAddress.text"); // NOI18N

            lblFilename.Text = bundle.getString("DumpCodeDialog.lblFilename.text");     // NOI18N

            txtEndAddress.Font = new java.awt.Font("Courier New", 0, 12);               // NOI18N
            txtEndAddress.HorizontalAlignment = JTextField.CENTER;
            txtEndAddress.Text          = "0x00000000";                                 // NOI18N
            txtEndAddress.InputVerifier = new AddressInputVerifier(this);

            txtFilename.Editable = false;
            txtFilename.Text     = "dump.txt";    // NOI18N

            btnFilename.Text          = "...";    // NOI18N
            btnFilename.PreferredSize = new java.awt.Dimension(25, 25);
            btnFilename.addActionListener(new ActionListenerAnonymousInnerClass(this));

            btnOk.Text = bundle.getString("OkButton.text");             // NOI18N
            btnOk.addActionListener(new ActionListenerAnonymousInnerClass2(this));

            btnCancel.Text   = bundle.getString("CancelButton.text");           // NOI18N
            btnCancel.Parent = this;

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(ContentPane);
            ContentPane.Layout     = layout;
            layout.HorizontalGroup = layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(lblStartAddress).addComponent(lblEndAddress).addComponent(lblFilename)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(txtStartAddress).addComponent(txtEndAddress).addGroup(layout.createSequentialGroup().addComponent(txtFilename, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, short.MaxValue).addComponent(btnFilename, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))).addGroup(layout.createSequentialGroup().addComponent(btnOk, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, short.MaxValue).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, short.MaxValue))).addContainerGap());
            layout.VerticalGroup   = layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(lblStartAddress).addComponent(txtStartAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(lblEndAddress).addComponent(txtEndAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(txtFilename, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(btnFilename, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(lblFilename)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(btnOk).addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap());

            pack();
        }         // </editor-fold>//GEN-END:initComponents
Beispiel #7
0
//JAVA TO C# CONVERTER WARNING: 'sealed override' parameters are not available in .NET:
//ORIGINAL LINE: @Override public java.awt.Component getTableCellEditorComponent(sealed override javax.swing.JTable table, sealed override Object value, sealed override bool isSelected, sealed override int row, sealed override int column)
            public override Component getTableCellEditorComponent(JTable table, object value, bool isSelected, int row, int column)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'sealed override':
//ORIGINAL LINE: sealed override javax.swing.JTextField tf = ((javax.swing.JTextField) getComponent());
                JTextField tf = ((JTextField)Component);

                tf.Text = string.Format("0x{0:X}", Integer.decode((string)table.Model.getValueAt(row, column)));

                // needed for double-click to work, otherwise the second click
                // is interpreted to position the caret
                SwingUtilities.invokeLater(() =>
                {
                    // automatically select text after '0x'
                    tf.select(2, tf.Text.Length());
                });
                return(tf);
            }
Beispiel #8
0
    public static JTextField[][][] ReturnRectangularJTextFieldArray(int size1, int size2, int size3)
    {
        JTextField[][][] newArray = new JTextField[size1][][];
        for (int array1 = 0; array1 < size1; array1++)
        {
            newArray[array1] = new JTextField[size2][];
            if (size3 > -1)
            {
                for (int array2 = 0; array2 < size2; array2++)
                {
                    newArray[array1][array2] = new JTextField[size3];
                }
            }
        }

        return(newArray);
    }
Beispiel #9
0
        private JComponent getLogComponent()
        {
            var jpanel    = new JPanel(new BorderLayout());
            var jtextarea = new JTextArea();

            logger.addHandler(new GuiLogOutputHandler(jtextarea));
            var jscrollpane = new JScrollPane(jtextarea, 22, 30);

            jtextarea.setEditable(false);
            var jtextfield = new JTextField();

            jtextfield.addActionListener(new ServerGuiCommandListener(this, jtextfield));
            jtextarea.addFocusListener(new ServerGuiFocusAdapter(this));
            jpanel.add(jscrollpane, "Center");
            jpanel.add(jtextfield, "South");
            jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Log and chat"));
            return(jpanel);
        }
Beispiel #10
0
            public override bool verify(JComponent input)
            {
                try
                {
                    JTextField tf    = (JTextField)input;
                    int        value = Integer.decode(tf.Text);

                    // code always starts at DWORD address
                    if ((value % 4) != 0)
                    {
                        value /= 4;
                    }

                    tf.Text = string.Format("0x{0:X8}", value);
                    return(true);
                }
                catch (System.FormatException)
                {
                    return(false);
                }
            }
Beispiel #11
0
        private VfpuFrame()
        {
            DefaultCloseOperation = DISPOSE_ON_CLOSE;
            Title = java.util.ResourceBundle.getBundle("pspsharp/languages/pspsharp").getString("VfpuFrame.title");             // NOI18N

            for (int i = 0; i < 8; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    for (int k = 0; k < 4; ++k)
                    {
                        registers[i][j][k] = new JTextField();
                    }
                }
            }

            GroupLayout layout = new GroupLayout(ContentPane);

            ContentPane.Layout = layout;

            for (int i = 0; i < panels.Length; ++i)
            {
                JPanel panel = new JPanel();
                panels[i] = panel;

                GroupLayout l = new GroupLayout(panel);
                panel.Layout = l;
                panel.Border = BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Block " + i), null);

                l.HorizontalGroup = l.createSequentialGroup().addGroup(l.createParallelGroup().addComponent(registers[i][0][0]).addComponent(registers[i][1][0]).addComponent(registers[i][2][0]).addComponent(registers[i][3][0])).addGroup(l.createParallelGroup().addComponent(registers[i][0][1]).addComponent(registers[i][1][1]).addComponent(registers[i][2][1]).addComponent(registers[i][3][1])).addGroup(l.createParallelGroup().addComponent(registers[i][0][2]).addComponent(registers[i][1][2]).addComponent(registers[i][2][2]).addComponent(registers[i][3][2])).addGroup(l.createParallelGroup().addComponent(registers[i][0][3]).addComponent(registers[i][1][3]).addComponent(registers[i][2][3]).addComponent(registers[i][3][3]));
                l.VerticalGroup   = l.createSequentialGroup().addGroup(l.createParallelGroup().addComponent(registers[i][0][0]).addComponent(registers[i][0][1]).addComponent(registers[i][0][2]).addComponent(registers[i][0][3])).addGroup(l.createParallelGroup().addComponent(registers[i][1][0]).addComponent(registers[i][1][1]).addComponent(registers[i][1][2]).addComponent(registers[i][1][3])).addGroup(l.createParallelGroup().addComponent(registers[i][2][0]).addComponent(registers[i][2][1]).addComponent(registers[i][2][2]).addComponent(registers[i][2][3])).addGroup(l.createParallelGroup().addComponent(registers[i][3][0]).addComponent(registers[i][3][1]).addComponent(registers[i][3][2]).addComponent(registers[i][3][3]));
            }

            layout.HorizontalGroup = layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(panels[0]).addComponent(panels[1])).addGroup(layout.createSequentialGroup().addComponent(panels[2]).addComponent(panels[3])).addGroup(layout.createSequentialGroup().addComponent(panels[4]).addComponent(panels[5])).addGroup(layout.createSequentialGroup().addComponent(panels[6]).addComponent(panels[7]));
            layout.VerticalGroup   = layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(panels[0]).addComponent(panels[2]).addComponent(panels[4]).addComponent(panels[6])).addGroup(layout.createSequentialGroup().addComponent(panels[1]).addComponent(panels[3]).addComponent(panels[5]).addComponent(panels[7]));

            MinimumSize = new Dimension(450, 450);
            WindowPropSaver.loadWindowProperties(this);
        }
 /// <summary>
 /// This method is called from within the constructor to
 /// initialize the form.
 /// </summary>
 /// <remarks>
 /// This method is called from within the constructor to
 /// initialize the form.
 /// WARNING: Do NOT modify this code. The content of this method is
 /// always regenerated by the Form Editor.
 /// </remarks>
 private void InitComponents()
 {
     //GEN-BEGIN:initComponents
     jPanel1      = new JPanel();
     jLabel2      = new JLabel();
     jPanel3      = new JPanel();
     jLabel1      = new JLabel();
     urlTextField = new JTextField();
     jPanel2      = new JPanel();
     openButton   = new JButton();
     cancelButton = new JButton();
     browseButton = new JButton();
     AddWindowListener(new _WindowAdapter_96(this));
     jPanel1.SetLayout(new BoxLayout(jPanel1, BoxLayout.YAxis));
     jLabel2.SetText("Type in the internet address of a document or web page.");
     jPanel1.Add(jLabel2);
     jLabel1.SetText("Open");
     jPanel3.Add(jLabel1);
     urlTextField.SetMinimumSize(new Dimension(100, 20));
     urlTextField.SetPreferredSize(new Dimension(300, 20));
     urlTextField.GetDocument().AddDocumentListener(new _IDocumentListener_113(this));
     urlTextField.AddActionListener(null);
     jPanel3.Add(urlTextField);
     jPanel1.Add(jPanel3);
     GetContentPane().Add(jPanel1, BorderLayout.North);
     openButton.SetText("Open");
     openButton.SetEnabled(false);
     openButton.AddActionListener(null);
     jPanel2.Add(openButton);
     cancelButton.SetText("Cancel");
     cancelButton.AddActionListener(null);
     jPanel2.Add(cancelButton);
     browseButton.SetText("Browse");
     browseButton.AddActionListener(null);
     jPanel2.Add(browseButton);
     GetContentPane().Add(jPanel2, BorderLayout.South);
     Pack();
 }
        /// <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);
        }
Beispiel #14
0
        private void initComponents()
        {
            Title = "Banking Application";
            LocationByPlatform    = true;
            DefaultCloseOperation = WindowConstants.EXIT_ON_CLOSE;

            JPanel overallPanel = new JPanel();

            Dimension dim  = new Dimension(130, 20);
            Dimension dim2 = new Dimension(80, 20);

            JPanel namesAndFields = new JPanel();
            JLabel nameLabel      = new JLabel("Customer Name: ");

            nameField = new JTextField();
            nameField.PreferredSize = dim;
            JLabel addressLabel = new JLabel("Address: ");

            addressField = new JTextField();
            addressField.PreferredSize = dim;
            JLabel phoneLabel = new JLabel("Phone Number: ");

            phoneField = new JTextField();
            phoneField.PreferredSize = dim;
            JLabel accountNumLabel = new JLabel("Account Number: ");

            accountNumField = new JTextField();
            accountNumField.PreferredSize = dim;
            JLabel balanceLabel = new JLabel("Balance: ");

            balanceField = new JTextField();
            balanceField.PreferredSize = dim;
            balanceField.Editable      = false;
            JLabel wDLabel = new JLabel("Withdrawal/Deposit: ");

            wDField = new JTextField();
            wDField.PreferredSize = dim;

            namesAndFields.Layout = new GridBagLayout();
            namesAndFields.add(nameLabel, getConstraints(0, 0));
            namesAndFields.add(nameField, getConstraints(1, 0));
            namesAndFields.add(addressLabel, getConstraints(0, 1));
            namesAndFields.add(addressField, getConstraints(1, 1));
            namesAndFields.add(phoneLabel, getConstraints(0, 2));
            namesAndFields.add(phoneField, getConstraints(1, 2));
            namesAndFields.add(accountNumLabel, getConstraints(0, 3));
            namesAndFields.add(accountNumField, getConstraints(1, 3));
            namesAndFields.add(balanceLabel, getConstraints(0, 4));
            namesAndFields.add(balanceField, getConstraints(1, 4));
            namesAndFields.add(wDLabel, getConstraints(0, 5));
            namesAndFields.add(wDField, getConstraints(1, 5));
            //---BUTTON PANELS------------------------------------
            JPanel buttonsP = new JPanel();

            searchCustomerB = new JButton("Search Customer");
            searchCustomerB.PreferredSize = dim;
            searchCustomerB.addActionListener(e => searchButtonClicked());
            previousB = new JButton("Previous Customer");
            previousB.PreferredSize = dim;
            previousB.addActionListener(e => previousClicked());
            nextB = new JButton("Next Customer");
            nextB.PreferredSize = dim;
            nextB.addActionListener(e => nextButtonClicked());
            addB = new JButton("Add Customer");
            addB.PreferredSize = dim;
            addB.addActionListener(e => addButtonClicked());
            updateB = new JButton("Update Customer");
            updateB.PreferredSize = dim;
            updateB.addActionListener(e => updateClicked());
            openAcctB = new JButton("Open Account");
            openAcctB.PreferredSize = dim;
            openAcctB.addActionListener(e => openAcctButtonClicked());

            buttonsP.Layout = new GridBagLayout();
            buttonsP.add(searchCustomerB, getConstraints(0, 0));
            buttonsP.add(previousB, getConstraints(0, 1));
            buttonsP.add(nextB, getConstraints(0, 2));
            buttonsP.add(addB, getConstraints(0, 3));
            buttonsP.add(updateB, getConstraints(0, 4));
            buttonsP.add(openAcctB, getConstraints(0, 5));

            JPanel buttonsP2 = new JPanel();

            depositB = new JButton("Deposit");
            depositB.PreferredSize = dim;
            depositB.addActionListener(e => depositButtonClicked());
            withdrawB = new JButton("Withdraw");
            withdrawB.PreferredSize = dim;
            withdrawB.addActionListener(e => withdrawButtonClicked());

            buttonsP2.Layout = new GridBagLayout();
            buttonsP2.add(depositB, getConstraints(0, 0));
            buttonsP2.add(withdrawB, getConstraints(0, 1));

            JPanel buttonsP3 = new JPanel();

            calcInterestB = new JButton("Calculate Interest");
            calcInterestB.PreferredSize = dim;
            calcInterestB.addActionListener(e => calculateInterestClicked());

            buttonsP3.Layout = new GridBagLayout();
            buttonsP3.add(calcInterestB, getConstraints(0, 0));
            //---INTEREST PANEL-----------------------------------
            JPanel interest       = new JPanel();
            JLabel interestMonthL = new JLabel("Interest Month: ");

            interestField = new JTextField();
            interestField.PreferredSize = dim2;
            JLabel calcInterestL = new JLabel("Calculated Interest: ");

            calcInterestField = new JTextField();
            calcInterestField.PreferredSize = dim2;
            calcInterestField.Editable      = false;

            interest.Layout = new GridBagLayout();
            interest.add(interestMonthL, getConstraints(0, 0));
            interest.add(interestField, getConstraints(1, 0));
            interest.add(calcInterestL, getConstraints(0, 1));
            interest.add(calcInterestField, getConstraints(1, 1));

            //---MAIN PANEL---------------------------------------
            overallPanel.Layout = new GridBagLayout();
            overallPanel.add(namesAndFields, getConstraints(0, 0));
            overallPanel.add(buttonsP, getConstraints(1, 0));
            overallPanel.add(buttonsP2, getConstraints(1, 1));
            overallPanel.add(buttonsP3, getConstraints(1, 2));
            overallPanel.add(interest, getConstraints(0, 1));
            add(overallPanel, BorderLayout.CENTER);
            Resizable = false;

            setSize(450, 350);
        }
Beispiel #15
0
 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();
     }
 }
    //--------
    //-------- Constructors
    //--------

    /// <summary>
    /// Constructor a frame to contain the device data.  Provide
    /// the device and the log file name
    /// </summary>
    public TagMainFrame() : base("1-Wire Tag Viewer")
    {
        // construct the frame

        //set the look and feel to the system look and feel
        try
        {
            UIManager.LookAndFeel = UIManager.SystemLookAndFeelClassName;
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            Console.Write(e.StackTrace);
        }

        // add an event listener to end the aplication when the frame is closed
        addWindowListener(new WindowAdapterAnonymousInnerClassHelper(this, e));

        // create the main panel
        mainPanel = new JPanel(new BorderLayout(10, 10));

        // create the sub-pannels
        northPanel        = new JPanel();
        northPanel.Border = BorderFactory.createLoweredBevelBorder();

        centerPanel        = new JPanel();
        centerPanel.Layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS);

        southPanel        = new JPanel();
        southPanel.Layout = new BoxLayout(southPanel, BoxLayout.Y_AXIS);
        southPanel.Border = BorderFactory.createLoweredBevelBorder();

        westPanel        = new JPanel();
        westPanel.Border = BorderFactory.createRaisedBevelBorder();
        westPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10);

        eastPanel        = new JPanel();
        eastPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10);

        // fill the panels

        // north
        logLabel = new JLabel("Log Filename: ");
        northPanel.add(logLabel);

        logField = new JTextField("log.txt", 20);
        logField.addActionListener(this);
        northPanel.add(logField);

        // center
        listData = new DefaultListModel();
        listData.addElement("                                                                     ");
        listData.addElement("                                                                     ");
        listData.addElement("                                                                     ");
        listData.addElement("                                                                     ");
        pathList = new JList(listData);
        pathList.VisibleRowCount = 5;
        scrollPanel        = new JScrollPane(pathList);
        scrollPanel.Border = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "1-Wire Paths to Search");
        centerPanel.add(scrollPanel);

        // west
        scanCheck = new JCheckBox("Scan 1-Wire Paths for XML Tags", false);
        scanCheck.addActionListener(this);
        westPanel.add(scanCheck);

        // south
        portLabel = new JLabel("Adapter:");
        southPanel.add(portLabel);

        statusLabel = new JLabel("Status:");
        southPanel.add(statusLabel);

        // add to main
        mainPanel.add(northPanel, BorderLayout.NORTH);
        mainPanel.add(centerPanel, BorderLayout.CENTER);
        mainPanel.add(southPanel, BorderLayout.SOUTH);
        mainPanel.add(eastPanel, BorderLayout.EAST);
        mainPanel.add(westPanel, BorderLayout.WEST);

        // add to frame
        ContentPane.add(mainPanel);

        // pack the frame
        pack();

        // resize the window and put in random location
        Dimension current_sz = Size;

        Size = new Dimension(current_sz.width * 5 / 4, current_sz.height);
        Toolkit   tool = Toolkit.DefaultToolkit;
        Dimension mx   = tool.ScreenSize;
        Dimension sz   = Size;
        Random    rand = new Random();

        setLocation((mx.width - sz.width) / 2, (mx.height - sz.height) / 2);

        // clear out the listbox data
        listData.removeAllElements();

        // make visible
        Visible = true;
    }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addOwner    = new JButton(__BUTTON_ADD_OWNER);
            __deleteOwner = new JButton(__BUTTON_DEL_OWNER);
            __deleteOwner.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 ID:"));
            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(__addOwner);
                p1.add(__deleteOwner);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Reservoir_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_ReservoirAccount> v  = new List <StateMod_ReservoirAccount>();
                IList <StateMod_ReservoirAccount> v2 = __currentRes.getAccounts();
                StateMod_ReservoirAccount         ra;
                for (int i = 0; i < v2.Count; i++)
                {
                    ra = (StateMod_ReservoirAccount)v2[i].clone();
                    v.Add(ra);
                }
                StateMod_ReservoirAccount_TableModel   tmr = new StateMod_ReservoirAccount_TableModel(v, __editable, true);
                StateMod_ReservoirAccount_CellRenderer crr = new StateMod_ReservoirAccount_CellRenderer(tmr);

                jsw         = new JScrollWorksheet(crr, tmr, p);
                __worksheet = jsw.getJWorksheet();

                IList <string> owner = StateMod_ReservoirAccount.getN2ownChoices(true);
                __worksheet.setColumnJComboBoxValues(StateMod_ReservoirAccount_TableModel.COL_OWNERSHIP_TIE, owner, 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);

            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);
            __addOwner.addActionListener(this);
            __deleteOwner.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(700, 400);
            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);

            __addPrecip     = new JButton(__BUTTON_ADD_PRECIPITATION_STATION);
            __addEvap       = new JButton(__BUTTON_ADD_EVAPORATION_STATION);
            __deleteStation = new JButton(__BUTTON_DELETE_PRECIPITATION_STATION);
            __deleteStation.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(__addPrecip);
                p1.add(__addEvap);
                p1.add(__deleteStation);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Reservoir_Climate_JFrame.JWorksheet");

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

            int[]            widthsP = null;
            JScrollWorksheet jswP    = null;
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<String> stations = StateMod_Util.createIdentifierListFromTS(combineData((java.util.List<RTi.TS.MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData(), (java.util.List<RTi.TS.MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY).getData()), true, null);
            IList <string> stations = StateMod_Util.createIdentifierListFromTS(combineData((IList <MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData(), (IList <MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY).getData()), true, null);

            try
            {
                IList <StateMod_ReservoirClimate> temp   = getPrecipitationStations(__currentRes.getClimates());
                IList <StateMod_ReservoirClimate> clones = new List <StateMod_ReservoirClimate>();
                StateMod_ReservoirClimate         r      = null;
                int size = temp.Count;
                for (int i = 0; i < size; i++)
                {
                    r = temp[i];
                    clones.Add((StateMod_ReservoirClimate)r.clone());
                }

                __tableModelP = new StateMod_ReservoirClimate_TableModel(clones, __editable, true);
                StateMod_ReservoirClimate_CellRenderer crr = new StateMod_ReservoirClimate_CellRenderer(__tableModelP);

                jswP         = new JScrollWorksheet(crr, __tableModelP, p);
                __worksheetP = jswP.getJWorksheet();

                __worksheetP.setColumnJComboBoxValues(StateMod_ReservoirClimate_TableModel.COL_STATION, stations, true);

                widthsP = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.", this);
                Message.printWarning(2, routine, e);
                jswP         = new JScrollWorksheet(0, 0, p);
                __worksheetP = jswP.getJWorksheet();
            }
            __worksheetP.setPreferredScrollableViewportSize(null);

            __worksheetP.setHourglassJFrame(this);
            __worksheetP.addMouseListener(this);
            __worksheetP.addKeyListener(this);

            int[]            widthsE = null;
            JScrollWorksheet jswE    = null;

            try
            {
                IList <StateMod_ReservoirClimate> temp   = getEvaporationStations(__currentRes.getClimates());
                IList <StateMod_ReservoirClimate> clones = new List <StateMod_ReservoirClimate>();
                StateMod_ReservoirClimate         r      = null;
                int size = temp.Count;
                for (int i = 0; i < size; i++)
                {
                    r = temp[i];
                    clones.Add((StateMod_ReservoirClimate)r.clone());
                }

                __tableModelE = new StateMod_ReservoirClimate_TableModel(clones, __editable, true);
                StateMod_ReservoirClimate_CellRenderer crr = new StateMod_ReservoirClimate_CellRenderer(__tableModelE);

                jswE         = new JScrollWorksheet(crr, __tableModelE, p);
                __worksheetE = jswE.getJWorksheet();

                __worksheetE.setColumnJComboBoxValues(StateMod_ReservoirClimate_TableModel.COL_STATION, stations, true);
                widthsE = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.", this);
                Message.printWarning(2, routine, e);
                jswE         = new JScrollWorksheet(0, 0, p);
                __worksheetE = jswE.getJWorksheet();
            }
            __worksheetE.setPreferredScrollableViewportSize(null);

            __worksheetE.setHourglassJFrame(this);
            __worksheetE.addMouseListener(this);
            __worksheetE.addKeyListener(this);

            JPanel worksheets = new JPanel();

            worksheets.setLayout(gb);

            JPanel panelP = new JPanel();

            panelP.setLayout(gb);
            panelP.setBorder(BorderFactory.createTitledBorder("Precipitation Stations"));
            JGUIUtil.addComponent(panelP, jswP, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            JPanel panelE = new JPanel();

            panelE.setLayout(gb);
            panelE.setBorder(BorderFactory.createTitledBorder("Evaporation Stations"));
            JGUIUtil.addComponent(panelE, jswE, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(worksheets, panelP, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(worksheets, panelE, 0, 1, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            main_panel.add(worksheets, "Center");
            main_panel.add(p1, "South");

            // assemble parts
            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);
            __addEvap.addActionListener(this);
            __addPrecip.addActionListener(this);
            __deleteStation.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(650, 400);
            JGUIUtil.center(this);
            setVisible(true);

            if (widthsP != null)
            {
                __worksheetP.setColumnWidths(widthsP);
            }
            if (widthsE != null)
            {
                __worksheetE.setColumnWidths(widthsE);
            }
        }
Beispiel #19
0
 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();
     }
 }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            PropList p = new PropList("StateMod_Reservoir_Return_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
            {
                /* TODO SAM 2011-01-02 Comment out - might allow something similar if editing is enabled
                 * and choices of IDs are provided
                 * List accounts = __currentRes.getAccounts();
                 * List v3 = new Vector();
                 * int size = accounts.size();
                 * StateMod_ReservoirAccount ra = null;
                 * for (int i = 0; i < size; i++) {
                 *      ra = (StateMod_ReservoirAccount)accounts.get(i);
                 *      v3.add("" + ra.getID() + " - " + ra.getName());
                 * }
                 * for (int i = 1; i < size; i++) {
                 *      v3.add("-" + (i + 1) + " - Fill first " + (i + 1)
                 + " accounts");
                 + }
                 +
                 + List v = new Vector();
                 + List v2 = __currentRes.getRights();
                 + StateMod_ReservoirRight rr;
                 + for (int i = 0; i < v2.size(); i++) {
                 +      rr = (StateMod_ReservoirRight)
                 +              ((StateMod_ReservoirRight)v2.get(i))
                 +              .clone();
                 +      v.add(rr);
                 + }
                 */
                // Get the list of all returns and filter for this reservoir
                // TODO SAM 2011-01-02 The code needs to use a table model with lists if editing is enabled
                StateMod_Reservoir_Return_Data_TableModel   tmr = new StateMod_Reservoir_Return_Data_TableModel(__currentResReturnList, __editable);
                StateMod_Reservoir_Return_Data_CellRenderer crr = new StateMod_Reservoir_Return_Data_CellRenderer(tmr);

                jsw         = new JScrollWorksheet(crr, tmr, p);
                __worksheet = jsw.getJWorksheet();

                /*
                 * List 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);
                 * List rightTypes =
                 *      StateMod_ReservoirRight.getItyrsrChoices(true);
                 * __worksheet.setColumnJComboBoxValues(
                 *      StateMod_ReservoirRight_TableModel.COL_RIGHT_TYPE,
                 *      rightTypes, false);
                 * List 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);

            __addReturn_JButton    = new JButton(__BUTTON_ADD_RETURN);
            __deleteReturn_JButton = new JButton(__BUTTON_DEL_RETURN);
            __deleteReturn_JButton.setEnabled(false);
            __help_JButton = new JButton(__BUTTON_HELP);
            __help_JButton.setEnabled(false);
            __close_JButton = 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(__addReturn_JButton);
                p1.add(__deleteReturn_JButton);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__close_JButton);
            if (!__editable)
            {
                applyJButton.setEnabled(false);
                applyJButton.setToolTipText("Editing reservoir return data is not implemented.");
                __close_JButton.setEnabled(false);
                __close_JButton.setToolTipText("Editing reservoir return data is not implemented.");
            }

            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);
            __addReturn_JButton.addActionListener(this);
            __deleteReturn_JButton.addActionListener(this);
            __help_JButton.addActionListener(this);
            __close_JButton.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(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);
        }
Beispiel #22
0
        /// <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);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            __helpJButton  = new JButton(__BUTTON_HELP);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

            __helpJButton.setEnabled(false);

            GridBagLayout gbl      = new GridBagLayout();
            JPanel        bigPanel = new JPanel();

            bigPanel.setLayout(gbl);

            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 ID: "));
            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(__addRight);
                p1.add(__deleteRight);
                __deleteRight.setEnabled(false);
            }
            //p1.add(__helpJButton);
            p1.add(applyJButton);
            p1.add(cancelJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Diversion_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
            {
                System.Collections.IList v  = new List <object>();
                System.Collections.IList v2 = __currentDiv.getRights();
                for (int i = 0; i < v2.Count; i++)
                {
                    v.Add(((StateMod_DiversionRight)(v2[i])).clone());
                }
                StateMod_DiversionRight_TableModel tmd = new StateMod_DiversionRight_TableModel(v, __editable, false);

                StateMod_DiversionRight_CellRenderer crd = new StateMod_DiversionRight_CellRenderer(tmd);

                jsw         = new JScrollWorksheet(crd, tmd, p);
                __worksheet = jsw.getJWorksheet();

                widths = crd.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);
            __worksheet.addMouseListener(this);
            __worksheet.addKeyListener(this);

            System.Collections.IList v = new List <object>();
            v.Add("0 - Off");
            v.Add("1 - On");

            __worksheet.setColumnJComboBoxValues(StateMod_DiversionRight_TableModel.COL_ON_OFF, v);

            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);

            getContentPane().add(bigPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gbl);
            __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);

            __addRight.addActionListener(this);
            __deleteRight.addActionListener(this);
            __closeJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            cancelJButton.addActionListener(this);
            applyJButton.addActionListener(this);

            pack();
            setSize(600, 450);
            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);
        }
Beispiel #24
0
        /// <summary>
        /// Sets up the GUI. </summary>
        /// <param name="index"> the index in the worksheet to first 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
            JPanel right_panel = new JPanel(); // everything else

            __cropIDJTextField            = new JTextField(12);
            __nameJTextField              = new JTextField(24);
            __plantMonthJTextField        = new JTextField(6);
            __plantDayJTextField          = new JTextField(6);
            __harvestMonthJTextField      = new JTextField(6);
            __harvestDayJTextField        = new JTextField(6);
            __daysToCoverJTextField       = new JTextField(6);
            __seasonLengthJTextField      = new JTextField(6);
            __earliestValueJTextField     = new JTextField(6);
            __latestValueJTextField       = new JTextField(6);
            __maxRootFeetJTextField       = new JTextField(6);
            __maxAppDepthJTextField       = new JTextField(6);
            __firstDaysBetweenJTextField  = new JTextField(6);
            __secondDaysBetweenJTextField = new JTextField(6);

            IList <string> v = new List <string>();

            v.Add(__0_MEAN_TEMP);
            v.Add(__1_28_DEG_FROST);
            v.Add(__2_32_DEG_FROST);
            v.Add(__999_NONE);
            __earliestFlagComboBox = new SimpleJComboBox(v);
            __latestFlagComboBox   = new SimpleJComboBox(v);

            __searchID   = new JTextField(10);
            __searchName = new JTextField(10);
            __searchName.setEditable(false);
            __findNextCrop           = 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);
            right_panel.setLayout(gb);
            left_panel.setLayout(gb);

            int y;

            PropList p = new PropList("StateCU_CropCharacteristics_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_CropCharacteristics_TableModel   tmw = new StateCU_CropCharacteristics_TableModel(__cropsVector);
                StateCU_CropCharacteristics_CellRenderer crw = new StateCU_CropCharacteristics_CellRenderer(tmw);

                __worksheet = new JWorksheet(crw, tmw, p);

                __worksheet.removeColumn(3);
                __worksheet.removeColumn(4);
                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, 14, 1, 1, 0, 0, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER);

            y = 0;
            JGUIUtil.addComponent(p3, new JLabel("Crop ID:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __cropIDJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __cropIDJTextField.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, 3, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Planting Month and Day:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __plantMonthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __plantDayJTextField, 2, y, 2, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Harvest Month and Day:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __harvestMonthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __harvestDayJTextField, 2, y, 2, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Days to Full Cover:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __daysToCoverJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Length of Season (days):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __seasonLengthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Earliest Moisture Use:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __earliestFlagComboBox, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, new JLabel("Value (F Deg.):"), 2, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __earliestValueJTextField, 3, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Latest Moisture Use:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __latestFlagComboBox, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, new JLabel("Value (F Deg.):"), 2, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __latestValueJTextField, 3, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Maximum Root Zone (feet):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __maxRootFeetJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Maximum Application Depth (inches):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __maxAppDepthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Days between 1st and 2nd cuttings:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __firstDaysBetweenJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Days between 2nd and 3rd cuttings:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __secondDaysBetweenJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            // two top panels of info
            JGUIUtil.addComponent(right_panel, p3, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            int[] widths2 = null;
            try
            {
                __blaneyModel = new StateCU_CropCharacteristics_TableModel(__cropsVector);
                StateCU_CropCharacteristics_CellRenderer crw = new StateCU_CropCharacteristics_CellRenderer(__blaneyModel);

                __coeffWorksheet = new JWorksheet(crw, __blaneyModel, p);

                __coeffWorksheet.removeColumn(1);
                __coeffWorksheet.removeColumn(2);
                widths2 = crw.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(2, routine, e);
                __coeffWorksheet = new JWorksheet(0, 0, p);
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
            __coeffWorksheet.setPreferredScrollableViewportSize(null);
            __coeffWorksheet.setHourglassJFrame(this);

            JScrollPane jsp = new JScrollPane(__coeffWorksheet);

            jsp.setBorder(BorderFactory.createTitledBorder(jsp.getBorder(), "Blaney-Criddle Crop Coefficients"));
            JGUIUtil.addComponent(right_panel, jsp, 0, y, 4, 4, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            // add search areas
            y = 14;
            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, __findNextCrop, 0, y2, 4, 1, 0, 0, 20, 10, 20, 10, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __findNextCrop.addActionListener(this);
            // add buttons which lead to crop
            // direct flow demand, and return flow information
            FlowLayout fl = new FlowLayout(FlowLayout.CENTER);

            // add help and close buttons
            y++;
            JPanel p6 = new JPanel();

            p6.setLayout(fl);
            if (__editable)
            {
                p6.add(applyJButton);
                p6.add(cancelJButton);
            }
            p6.add(helpJButton);
            p6.add(closeJButton);
            JGUIUtil.addComponent(right_panel, p6, GridBagConstraints.RELATIVE, y, 4, 1, 1, 0, 30, 0, 0, 0, GridBagConstraints.BOTH, 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);
            JGUIUtil.addComponent(mainJPanel, right_panel, GridBagConstraints.RELATIVE, 0, 4, 10, 0, 1, 10, 10, 10, 10, GridBagConstraints.BOTH, GridBagConstraints.EAST);

            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(850, 620);
            selectTableIndex(index);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
            if (widths2 != null)
            {
                __coeffWorksheet.setColumnWidths(widths2);
            }
        }
Beispiel #25
0
        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);
        }
Beispiel #26
0
        /// <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);
        }
Beispiel #27
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addAreaCap    = new JButton(__BUTTON_ADD_AREA_CAPACITY);
            __deleteAreaCap = new JButton(__BUTTON_DEL_AREA_CAPACITY);
            __deleteAreaCap.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     p0 = new JPanel();

            p0.setLayout(fl);
            p0.add(__GraphArea_JButton    = new SimpleJButton(__GraphArea_String, __GraphArea_String, this));
            p0.add(__GraphSeepage_JButton = new SimpleJButton(__GraphSeepage_String, __GraphSeepage_String, this));

            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()));

            JPanel p1 = new JPanel();

            p1.setLayout(fl);
            if (__editable)
            {
                p1.add(__addAreaCap);
                p1.add(__deleteAreaCap);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Reservoir__AreaCap_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.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

            int[]            widths = null;
            JScrollWorksheet jsw    = null;

            try
            {
                IList <StateMod_ReservoirAreaCap> v  = new List <StateMod_ReservoirAreaCap>();
                IList <StateMod_ReservoirAreaCap> v2 = __currentRes.getAreaCaps();
                for (int i = 0; i < v2.Count; i++)
                {
                    v.Add((StateMod_ReservoirAreaCap)v2[i].clone());
                }
                StateMod_ReservoirAreaCap_TableModel   tmr = new StateMod_ReservoirAreaCap_TableModel(v, __editable, true);
                StateMod_ReservoirAreaCap_CellRenderer crr = new StateMod_ReservoirAreaCap_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);

            //main_panel.add(jsw, "Center");
            // Does not work well...
            //main_panel.add(p1, "South");

            // assemble parts
            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(bigPanel, jsw, 0, 1, 10, 10, 1.0, 1.0, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            JPanel button_panel = new JPanel();

            button_panel.setLayout(gb);
            JGUIUtil.addComponent(button_panel, p0, 0, 0, 10, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHEAST);
            JGUIUtil.addComponent(button_panel, p1, 0, 1, 10, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHEAST);
            JGUIUtil.addComponent(bigPanel, button_panel, 0, 11, 10, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHEAST);
            __addAreaCap.addActionListener(this);
            __deleteAreaCap.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();
            checkGUIState();
            setSize(420, 400);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
Beispiel #28
0
        private void InitComponents()
        {
            JComponent.SetDefaultLocale(Locale.US);
            java.awt.GridBagConstraints gridBagConstraints;
            choosePanel  = new JPanel();
            statusPanel  = new JPanel();
            status       = new JLabel("initializing Q2Sharp...");
            jTextField1  = new JTextField();
            changeButton = new JButton();
            cancelButton = new JButton();
            exitButton   = new JButton();
            okButton     = new JButton();
            SetDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
            SetTitle("Jake2 - Bytonic Software");
            SetResizable(false);
            AddWindowListener(new AnonymousWindowAdapter(this));
            choosePanel.SetLayout(new GridBagLayout());
            choosePanel.SetMaximumSize(new Size(400, 100));
            choosePanel.SetMinimumSize(new Size(400, 100));
            choosePanel.SetPreferredSize(new Size(400, 100));
            gridBagConstraints           = new GridBagConstraints();
            gridBagConstraints.gridx     = 0;
            gridBagConstraints.gridy     = 0;
            gridBagConstraints.gridwidth = 1;
            gridBagConstraints.insets    = new Insets(5, 5, 5, 5);
            gridBagConstraints.weightx   = 0;
            gridBagConstraints.anchor    = GridBagConstraints.SOUTHWEST;
            choosePanel.Add(new JLabel("baseq2 directory"), gridBagConstraints);
            gridBagConstraints.gridx     = 1;
            gridBagConstraints.gridy     = 0;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill      = java.awt.GridBagConstraints.BOTH;
            gridBagConstraints.insets    = new Insets(5, 2, 5, 2);
            gridBagConstraints.weightx   = 1;
            choosePanel.Add(jTextField1, gridBagConstraints);
            changeButton.SetText("...");
            changeButton.AddActionListener(new AnonymousActionListener(this));
            gridBagConstraints.gridx     = 3;
            gridBagConstraints.gridy     = 0;
            gridBagConstraints.gridwidth = 1;
            gridBagConstraints.weightx   = 0;
            gridBagConstraints.fill      = java.awt.GridBagConstraints.NONE;
            gridBagConstraints.insets    = new Insets(5, 2, 5, 5);
            gridBagConstraints.anchor    = java.awt.GridBagConstraints.EAST;
            choosePanel.Add(changeButton, gridBagConstraints);
            gridBagConstraints.gridx     = 0;
            gridBagConstraints.gridy     = 1;
            gridBagConstraints.gridwidth = 4;
            gridBagConstraints.weightx   = 0;
            gridBagConstraints.weighty   = 1;
            gridBagConstraints.fill      = java.awt.GridBagConstraints.VERTICAL;
            choosePanel.Add(new JPanel(), gridBagConstraints);
            cancelButton.SetText("Cancel");
            cancelButton.AddActionListener(new AnonymousActionListener1(this));
            gridBagConstraints.gridx     = 0;
            gridBagConstraints.gridy     = 2;
            gridBagConstraints.gridwidth = 4;
            gridBagConstraints.weighty   = 0;
            gridBagConstraints.insets    = new Insets(5, 5, 5, 5);
            gridBagConstraints.anchor    = java.awt.GridBagConstraints.SOUTH;
            choosePanel.Add(cancelButton, gridBagConstraints);
            exitButton.SetText("Exit");
            exitButton.AddActionListener(new AnonymousActionListener2(this));
            gridBagConstraints.gridx     = 0;
            gridBagConstraints.gridy     = 2;
            gridBagConstraints.gridwidth = 1;
            gridBagConstraints.anchor    = java.awt.GridBagConstraints.SOUTHWEST;
            choosePanel.Add(exitButton, gridBagConstraints);
            okButton.SetText("OK");
            okButton.AddActionListener(new AnonymousActionListener3(this));
            gridBagConstraints.gridx     = 2;
            gridBagConstraints.gridy     = 2;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.anchor    = java.awt.GridBagConstraints.SOUTHEAST;
            choosePanel.Add(okButton, gridBagConstraints);
            Jake2Canvas c = new Jake2Canvas();

            GetContentPane().Add(c, BorderLayout.CENTER);
            statusPanel.SetLayout(new GridBagLayout());
            statusPanel.SetMaximumSize(new Dimension(400, 100));
            statusPanel.SetMinimumSize(new Dimension(400, 100));
            statusPanel.SetPreferredSize(new Dimension(400, 100));
            gridBagConstraints           = new GridBagConstraints();
            gridBagConstraints.gridx     = 0;
            gridBagConstraints.gridy     = 0;
            gridBagConstraints.gridwidth = 1;
            gridBagConstraints.fill      = java.awt.GridBagConstraints.HORIZONTAL;
            gridBagConstraints.insets    = new Insets(10, 10, 10, 10);
            gridBagConstraints.weightx   = 1;
            statusPanel.Add(status, gridBagConstraints);
            GetContentPane().Add(statusPanel, java.awt.BorderLayout.SOUTH);
            progressPanel = new ProgressPanel(this);
            installPanel  = new InstallPanel(this);
            notFoundPanel = new NotFoundPanel(this);
            Pack();
        }
        /// <summary>
        /// Sets up the GUI
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addDepletion    = new JButton(__BUTTON_ADD_DEPLETION);
            __deleteDepletion = new JButton(__BUTTON_DELETE_DEPLETION);
            __deleteDepletion.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);

            // AWT portion
            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(__addDepletion);
                p1.add(__deleteDepletion);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Well_Depletion_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    = __currentWell.getDepletions();
                StateMod_ReturnFlow rf;
                for (int i = 0; i < v2.Count; i++)
                {
                    rf = (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, false);
                StateMod_ReturnFlow_CellRenderer crw = new StateMod_ReturnFlow_CellRenderer(tmw);

                jsw         = new JScrollWorksheet(crw, tmw, p);
                __worksheet = jsw.getJWorksheet();

                IList <string> ids = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, ids, false);

                IList <StateMod_DelayTable> delayIDs = null;
                if (__dataset.getIday() == 1)
                {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayIDs0 = (java.util.List<StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                    IList <StateMod_DelayTable> delayIDs0 = (IList <StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                    delayIDs = delayIDs0;
                }
                else
                {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayIDs0 = (java.util.List<StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                    IList <StateMod_DelayTable> delayIDs0 = (IList <StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                    delayIDs = delayIDs0;
                }
                ids = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, ids, 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);

            __addDepletion.addActionListener(this);
            __deleteDepletion.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(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_QueryTool_JFrame.setupGUI";

            addWindowListener(this);

            GridBagLayout gb = new GridBagLayout();

            JPanel main_JPanel = new JPanel();

            main_JPanel.setLayout(gb);
            JGUIUtil.addComponent(main_JPanel, new JLabel("Component:"), 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            __component_JComboBox = new SimpleJComboBox(false);
            __component_JComboBox.add("Diversion Stations");
            JGUIUtil.addComponent(main_JPanel, __component_JComboBox, 1, 0, 2, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);

            try
            {
                __input_filter_diversion_JPanel = new StateMod_Diversion_InputFilter_JPanel(__dataset);
                JGUIUtil.addComponent(main_JPanel, __input_filter_diversion_JPanel, 0, 1, 4, 4, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            }
            catch (Exception)
            {
                Message.printWarning(1, routine, "Unable to initialize input filter for diversion stations.");
            }
            getContentPane().add(main_JPanel);

            // add bottom buttons
            FlowLayout fl = new FlowLayout(FlowLayout.CENTER);

            JPanel buttonPanel = new JPanel();

            buttonPanel.setLayout(fl);
            __query_JButton = new SimpleJButton(__Query_String, this);
            __query_JButton.setToolTipText("Query the data set using specified criteria.");
            __display_JButton = new SimpleJButton(__Display_String, this);
            __display_JButton.setToolTipText("Display the results of the query.");
            __display_JButton.setEnabled(false);     // Enable after query.
            __cancel_JButton = new SimpleJButton(__Cancel_String, this);
            __cancel_JButton.setToolTipText("Cancel query and close window.");

            buttonPanel.add(__query_JButton);
            buttonPanel.add(__display_JButton);
            buttonPanel.add(__cancel_JButton);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            JGUIUtil.addComponent(bottomJPanel, buttonPanel, 0, 0, 8, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
            __message_JTextField = new JTextField();
            __message_JTextField.setText("Select filter criteria and then press Query");
            __message_JTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __message_JTextField, 0, 1, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __status_JTextField = new JTextField(5);
            __status_JTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __status_JTextField, 7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            if (__dataset_wm != null)
            {
                __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_CONTROL, this);
            }

            pack();
            setSize(550, 190);     // Allows replacement res option to display
            JGUIUtil.center(this);
            setResizable(true);
            setVisible(true);
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        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);
            }
        }