Package com.commander4j.gui

Examples of com.commander4j.gui.JButton4j


        jDesktopPane1.setBackground(Color.WHITE);
        getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
        jDesktopPane1.setPreferredSize(new java.awt.Dimension(350, 182));
        jDesktopPane1.setLayout(null);
        {
          jButtonUpdate = new JButton4j(Common.icon_save);
          jDesktopPane1.add(jButtonUpdate);
          jButtonUpdate.setEnabled(false);
          jButtonUpdate.setText(lang.get("btn_Save"));
          jButtonUpdate.setMnemonic(lang.getMnemonicChar());
          jButtonUpdate.setBounds(6, 102, 112, 28);
          jButtonUpdate.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {

              try
              {
                materiallocation.setStatus((String) jComboBoxStatus.getSelectedItem());
              }
              catch (Exception e)
              {
                materiallocation.setStatus("");
              }

              if (materiallocation.isValidMaterialLocation())
              {
                materiallocation.update();
              }
              else
              {
                materiallocation.create(jTextFieldMaterial.getText(),jTextFieldLocation.getText());
                materiallocation.update();
              }
              jButtonUpdate.setEnabled(false);
            }
          });
        }
        {
          jButtonHelp = new JButton4j(Common.icon_help);
          jDesktopPane1.add(jButtonHelp);
          jButtonHelp.setText(lang.get("btn_Help"));
          jButtonHelp.setMnemonic(lang.getMnemonicChar());
          jButtonHelp.setBounds(118, 102, 112, 28);
        }
        {
          jButtonCancel = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonCancel);
          jButtonCancel.setText(lang.get("btn_Close"));
          jButtonCancel.setMnemonic(lang.getMnemonicChar());
          jButtonCancel.setBounds(230, 102, 112, 28);
          jButtonCancel.addActionListener(new ActionListener() {
View Full Code Here


              }
            }
          }
        }
        {
          jButtonSearch = new JButton4j(Common.icon_search);
          jButtonSearch.setBounds(1, 143, 109, 32);
          jDesktopPane1.add(jButtonSearch);
          jButtonSearch.setText(lang.get("btn_Search"));
          jButtonSearch.setMnemonic(lang.getMnemonicChar());
          jButtonSearch.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              search();

            }
          });
        }
        {
          jButtonAdd = new JButton4j(Common.icon_add);
          jButtonAdd.setBounds(221, 143, 109, 32);
          jDesktopPane1.add(jButtonAdd);
          jButtonAdd.setText(lang.get("btn_Add"));
          jButtonAdd.setMnemonic(lang.getMnemonicChar());
          jButtonAdd.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_PROCESS_ORDER_ADD"));
          jButtonAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              addRecord();

            }
          });
        }
        {
          jButtonEdit = new JButton4j(Common.icon_edit);
          jButtonEdit.setBounds(331, 143, 109, 32);
          jDesktopPane1.add(jButtonEdit);
          jButtonEdit.setText(lang.get("btn_Edit"));
          jButtonEdit.setMnemonic(lang.getMnemonicChar());
          jButtonEdit.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_PROCESS_ORDER_EDIT"));
          jButtonEdit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              editRecord();
            }
          });
        }
        {
          jButtonDelete = new JButton4j(Common.icon_delete);
          jButtonDelete.setBounds(441, 143, 109, 32);
          jDesktopPane1.add(jButtonDelete);
          jButtonDelete.setText(lang.get("btn_Delete"));
          jButtonDelete.setMnemonic(lang.getMnemonicChar());
          jButtonDelete.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_PROCESS_ORDER_DELETE"));
          jButtonDelete.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              delete();
            }
          });
        }
        {
          jButtonPrint = new JButton4j(Common.icon_report);
          jButtonPrint.setBounds(551, 143, 109, 32);
          jDesktopPane1.add(jButtonPrint);
          jButtonPrint.setText(lang.get("btn_Print"));
          jButtonPrint.setMnemonic(lang.getMnemonicChar());
          jButtonPrint.setEnabled(true);
          jButtonPrint.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {

              print();
            }
          });
        }
        {
          jButtonLabel = new JButton4j(Common.icon_report);
          jButtonLabel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              printLabels();
            }
          });
          jButtonLabel.setBounds(661, 143, 109, 32);
          jDesktopPane1.add(jButtonLabel);
          jButtonLabel.setText(lang.get("btn_Label"));
          jButtonLabel.setMnemonic(java.awt.event.KeyEvent.VK_H);
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          jButtonClose.setBounds(881, 143, 109, 32);
          jDesktopPane1.add(jButtonClose);
          jButtonClose.setText(lang.get("btn_Close"));
          jButtonClose.setMnemonic(lang.getMnemonicChar());
          jButtonClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JDBQuery.closeStatement(listStatement);
              dispose();
            }
          });
        }
        {
          jLabel1 = new JLabel4j_std();
          jLabel1.setBounds(275, 45, 98, 22);
          jDesktopPane1.add(jLabel1);
          jLabel1.setText(lang.get("lbl_Material"));
          jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jLabel12 = new JLabel4j_std();
          jLabel12.setBounds(275, 11, 98, 22);
          jDesktopPane1.add(jLabel12);
          jLabel12.setText(lang.get("lbl_Customer_ID"));
          jLabel12.setHorizontalAlignment(SwingConstants.TRAILING);
        }       
        {
          jLabel3 = new JLabel4j_std();
          jLabel3.setBounds(521, 11, 98, 22);
          jDesktopPane1.add(jLabel3);
          jLabel3.setText(lang.get("lbl_Description"));
          jLabel3.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jTextFieldDescription = new JTextField4j();
          jTextFieldDescription.setBounds(629, 11, 354, 22);
          jDesktopPane1.add(jTextFieldDescription);
        }
        {
          jTextFieldMaterial = new JTextField4j();
          jTextFieldMaterial.setBounds(383, 45, 98, 22);
          jDesktopPane1.add(jTextFieldMaterial);
        }
        {
          jTextFieldCustomer = new JTextField4j();
          jTextFieldCustomer.setBounds(383, 11, 98, 22);
          jDesktopPane1.add(jTextFieldCustomer);
       
        {
          JLabel4j_std label4j_std = new JLabel4j_std();
          label4j_std.setText(lang.get("lbl_Customer_ID"));
          label4j_std.setHorizontalAlignment(SwingConstants.TRAILING);
          label4j_std.setBounds(275, 110, 98, 21);
          jDesktopPane1.add(label4j_std);
        }
        {
          jLabel2 = new JLabel4j_std();
          jLabel2.setBounds(758, 45, 89, 22);
          jDesktopPane1.add(jLabel2);
          jLabel2.setText(lang.get("lbl_Location_ID"));
          jLabel2.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jTextFieldProcessOrder = new JTextField4j();
          jTextFieldProcessOrder.setBounds(148, 11, 105, 22);
          jDesktopPane1.add(jTextFieldProcessOrder);
        }
        {
          jLabel4 = new JLabel4j_std();
          jLabel4.setBounds(7, 11, 132, 22);
          jDesktopPane1.add(jLabel4);
          jLabel4.setText(lang.get("lbl_Process_Order"));
          jLabel4.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jLabel5 = new JLabel4j_std();
          jLabel5.setBounds(7, 45, 132, 22);
          jDesktopPane1.add(jLabel5);
          jLabel5.setText(lang.get("lbl_Process_Order_Status"));
          jLabel5.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jTextFieldLocation = new JTextField4j();
          jTextFieldLocation.setBounds(857, 45, 105, 22);
          jDesktopPane1.add(jTextFieldLocation);
        }
        {
          jTextFieldRecipe = new JTextField4j();
          jTextFieldRecipe.setBounds(629, 45, 125, 22);
          jDesktopPane1.add(jTextFieldRecipe);
        }
        {
          jLabel6 = new JLabel4j_std();
          jLabel6.setBounds(510, 110, 109, 21);
          jDesktopPane1.add(jLabel6);
          jLabel6.setText(lang.get("lbl_Sort_By"));
          jLabel6.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          dueDateFrom = new JDateControl();
          dueDateFrom.setBounds(172, 77, 120, 22);
          jDesktopPane1.add(dueDateFrom);
          dueDateFrom.setEnabled(false);
          dueDateFrom.getEditor().setPreferredSize(new java.awt.Dimension(86, 32));
        }
        {
          jLabel7 = new JLabel4j_std();
          jLabel7.setBounds(0, 80, 139, 22);
          jDesktopPane1.add(jLabel7);
          jLabel7.setText(lang.get("lbl_Process_Order_Due_Date"));
          jLabel7.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jCheckBoxDueDateFrom = new JCheckBox4j();
          jCheckBoxDueDateFrom.setBounds(146, 77, 21, 22);
          jDesktopPane1.add(jCheckBoxDueDateFrom);
          jCheckBoxDueDateFrom.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxDueDateFrom.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              System.out.println("jCheckBoxDueDateFrom.actionPerformed, event=" + evt);
              if (jCheckBoxDueDateFrom.isSelected())
              {
                dueDateFrom.setEnabled(true);
                calendarButtondueDateFrom.setEnabled(true);
              }
              else
              {
                dueDateFrom.setEnabled(false);
                calendarButtondueDateFrom.setEnabled(false);
              }
            }
          });
        }
        {
          jCheckBoxDueDateTo = new JCheckBox4j();
          jCheckBoxDueDateTo.setBounds(352, 77, 21, 22);
          jDesktopPane1.add(jCheckBoxDueDateTo);
          jCheckBoxDueDateTo.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxDueDateTo.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              System.out.println("jCheckBoxDueDateFrom.actionPerformed, event=" + evt);
              if (jCheckBoxDueDateTo.isSelected())
              {
                dueDateTo.setEnabled(true);
                calendarButtondueDateTo.setEnabled(true);
              }
              else
              {
                dueDateTo.setEnabled(false);
                calendarButtondueDateTo.setEnabled(false);
              }
            }
          });
        }
        {
          dueDateTo = new JDateControl();
          dueDateTo.setBounds(382, 77, 120, 22);
          jDesktopPane1.add(dueDateTo);
          dueDateTo.setEnabled(false);
        }
        {
          ComboBoxModel<String> jComboBoxStatusModel = new DefaultComboBoxModel<String>(Common.processOrderStatusincBlank);
          jComboBoxStatus = new JComboBox4j<String>();
          jComboBoxStatus.setBounds(148, 44, 126, 23);
          jDesktopPane1.add(jComboBoxStatus);
          jComboBoxStatusModel.setSelectedItem("");
          jComboBoxStatus.setModel(jComboBoxStatusModel);
        }
        {
          ComboBoxModel<String> jComboBoxSortByModel = new DefaultComboBoxModel<String>(new String[] { "PROCESS_ORDER", "MATERIAL", "DESCRIPTION", "STATUS", "LOCATION_ID", "DUE_DATE", "RECIPE_ID" });
          jComboBoxSortBy = new JComboBox4j<String>();
          jComboBoxSortBy.setBounds(629, 110, 168, 23);
          jDesktopPane1.add(jComboBoxSortBy);
          jComboBoxSortBy.setModel(jComboBoxSortByModel);
          jComboBoxSortBy.getModel().setSelectedItem("DUE_DATE");
        }
        {
          jLabel8 = new JLabel4j_std();
          jLabel8.setBounds(524, 45, 95, 22);
          jDesktopPane1.add(jLabel8);
          jLabel8.setText(lang.get("lbl_Process_Order_Recipe"));
          jLabel8.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jToggleButtonSequence = new JToggleButton();
          jToggleButtonSequence.setBounds(795, 110, 21, 21);
          jDesktopPane1.add(jToggleButtonSequence);
          jToggleButtonSequence.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              setSequence(jToggleButtonSequence.isSelected());
            }
          });

        }
        {
          jButtonMaterialLookuo = new JButton4j(Common.icon_lookup);
          jButtonMaterialLookuo.setBounds(481, 45, 21, 22);
          jDesktopPane1.add(jButtonMaterialLookuo);
          jButtonMaterialLookuo.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchLookup.dlgAutoExec = false;
              JLaunchLookup.dlgCriteriaDefault = "";
              if (JLaunchLookup.materials())
              {
                jTextFieldMaterial.setText(JLaunchLookup.dlgResult);
              }
            }
          });
        }
        {
        jButtonCustomerLookup = new JButton4j(Common.icon_lookup);
        jButtonCustomerLookup.setBounds(481, 11, 21, 22);
        jDesktopPane1.add(jButtonCustomerLookup);
        jButtonCustomerLookup.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            JLaunchLookup.dlgAutoExec = false;
            JLaunchLookup.dlgCriteriaDefault = "";
            if (JLaunchLookup.customers())
            {
              jTextFieldCustomer.setText(JLaunchLookup.dlgResult);
            }
          }
        });
      }       
        {
          jButtonProcessOrderLookup = new JButton4j(Common.icon_lookup);
          jButtonProcessOrderLookup.setBounds(253, 11, 21, 22);
          jDesktopPane1.add(jButtonProcessOrderLookup);
          jButtonProcessOrderLookup.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchLookup.dlgCriteriaDefault = "Ready";
              JLaunchLookup.dlgAutoExec = true;
              if (JLaunchLookup.processOrders())
              {
                jTextFieldProcessOrder.setText(JLaunchLookup.dlgResult);
              }
            }
          });
        }
        {
          jButtonLocationLookup = new JButton4j(Common.icon_lookup);
          jButtonLocationLookup.setBounds(962, 45, 21, 22);
          jDesktopPane1.add(jButtonLocationLookup);
          jButtonLocationLookup.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchLookup.dlgAutoExec = true;
              JLaunchLookup.dlgCriteriaDefault = "Y";
              if (JLaunchLookup.locations())
              {
                jTextFieldLocation.setText(JLaunchLookup.dlgResult);
              }
            }
          });
        }
        {
          jLabel10 = new JLabel4j_std();
          jLabel10.setBounds(793, 110, 100, 21);
          jDesktopPane1.add(jLabel10);
          jLabel10.setText(lang.get("lbl_Limit"));
          jLabel10.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jCheckBoxLimit = new JCheckBox4j();
          jCheckBoxLimit.setBounds(900, 110, 21, 21);
          jDesktopPane1.add(jCheckBoxLimit);
          jCheckBoxLimit.setSelected(true);
          jCheckBoxLimit.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxLimit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (jCheckBoxLimit.isSelected())
              {
                jSpinnerLimit.setEnabled(true);
              }
              else
              {
                jSpinnerLimit.setEnabled(false);
              }
            }
          });
        }
        {
         
          SpinnerNumberModel jSpinnerIntModel = new SpinnerNumberModel();
          jSpinnerIntModel.setMinimum(1);
          jSpinnerIntModel.setMaximum(5000);
          jSpinnerIntModel.setStepSize(1);         
         
          jSpinnerLimit = new JSpinner();
          jDesktopPane1.add(jSpinnerLimit);
         
          jSpinnerLimit.setModel(jSpinnerIntModel);
          JSpinner.NumberEditor ne = new JSpinner.NumberEditor(jSpinnerLimit);
          ne.getTextField().setFont(Common.font_std);
          jSpinnerLimit.setEditor(ne);
          jSpinnerLimit.setBounds(921, 109, 63, 22);
          jSpinnerLimit.setValue(1000);
          jSpinnerLimit.getEditor().setSize(45, 21);
         

        }

        {
          jStatusText = new JLabel4j_std();
          jStatusText.setBounds(0, 540, 979, 21);
          jStatusText.setForeground(new Color(255, 0, 0));
          jStatusText.setBackground(Color.GRAY);
          jDesktopPane1.add(jStatusText);
        }

        {
          jButtonExcel = new JButton4j(Common.icon_XLS);
          jButtonExcel.setBounds(771, 143, 109, 32);
          jButtonExcel.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              excel();
            }
          });
          jButtonExcel.setMnemonic(KeyEvent.VK_H);
          jButtonExcel.setText(lang.get("btn_Excel"));
          jDesktopPane1.add(jButtonExcel);
        }

        {
          jLabelQuantity = new JLabel4j_std();
          jLabelQuantity.setBounds(525, 77, 94, 22);
          jLabelQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabelQuantity.setText(lang.get("lbl_Process_Order_Required_Quantity"));
          jDesktopPane1.add(jLabelQuantity);
        }

        {
          jCheckBoxQuantity = new JCheckBox4j();
          jCheckBoxQuantity.setBounds(625, 77, 21, 22);
          jCheckBoxQuantity.setBackground(new Color(255, 255, 255));

          jCheckBoxQuantity.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (jCheckBoxQuantity.isSelected())
              {
                jFormattedTextFieldQuantity.setValue(0);
                jFormattedTextFieldQuantity.setEnabled(true);
              }
              else
              {
                jFormattedTextFieldQuantity.setValue(0);
                jFormattedTextFieldQuantity.setEnabled(false);
              }
            }
          });
          jDesktopPane1.add(jCheckBoxQuantity);
        }

        {
          jFormattedTextFieldQuantity = new JQuantityInput(new BigDecimal("0"));
          jFormattedTextFieldQuantity.setBounds(646, 77, 108, 22);
          jFormattedTextFieldQuantity.setVerifyInputWhenFocusTarget(false);
          jFormattedTextFieldQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
          jFormattedTextFieldQuantity.setFont(Common.font_std);
          jFormattedTextFieldQuantity.setEnabled(false);
          jDesktopPane1.add(jFormattedTextFieldQuantity);
        }

        {
          jLabel4_1 = new JLabel4j_std();
          jLabel4_1.setBounds(768, 77, 79, 22);
          jLabel4_1.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel4_1.setText(lang.get("lbl_Process_Order_Required_UOM"));
          jDesktopPane1.add(jLabel4_1);
        }

        {
          ComboBoxModel<JDBUom> jComboBox2Model = new DefaultComboBoxModel<JDBUom>(uomList);
          jComboBoxUOM = new JComboBox4j<JDBUom>();
          jComboBoxUOM.setBounds(857, 77, 127, 23);
          jComboBoxUOM.setModel(jComboBox2Model);
          jComboBoxUOM.setMaximumRowCount(12);
          jDesktopPane1.add(jComboBoxUOM);
        }

        {
          jButtonClear = new JButton4j(Common.icon_clear);
          jButtonClear.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              clearFilter();
            }
          });
          jButtonClear.setBounds(111, 143, 109, 32);
          jButtonClear.setText(lang.get("btn_Clear_Filter"));
          jDesktopPane1.add(jButtonClear);
        }
       
        {
          JButton4j btnLookupCustomer = new JButton4j("");
          btnLookupCustomer.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JLaunchLookup.dlgAutoExec = true;
              JLaunchLookup.dlgCriteriaDefault = "";
              if (JLaunchLookup.customers())
              {
                jTextFieldCustomerID.setText(JLaunchLookup.dlgResult);
              }
            }
          });
          btnLookupCustomer.setBounds(498, 110, 22, 21);
          jDesktopPane1.add(btnLookupCustomer);
        }
      }
    }
    catch (Exception e)
View Full Code Here

        jDesktopPane1 = new JDesktopPane();
        jDesktopPane1.setBackground(Color.WHITE);
        getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
        jDesktopPane1.setLayout(null);
        {
          jButtonAdd = new JButton4j(Common.icon_add);
          jDesktopPane1.add(jButtonAdd);
          jButtonAdd.setText(lang.get("btn_Add"));
          jButtonAdd.setMnemonic(lang.getMnemonicChar());
          jButtonAdd.setBounds(525, 12, 126, 28);
          jButtonAdd.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MHN_DECISION_ADD"));
          jButtonAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              create();

            }
          });
        }
        {
          jButtonDelete = new JButton4j(Common.icon_delete);
          jDesktopPane1.add(jButtonDelete);
          jButtonDelete.setText(lang.get("btn_Delete"));
          jButtonDelete.setMnemonic(lang.getMnemonicChar());
          jButtonDelete.setBounds(525, 41, 126, 28);
          jButtonDelete.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MHN_DECISION_DELETE"));
          jButtonDelete.setFocusTraversalKeysEnabled(false);
          jButtonDelete.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              delete();

            }
          });
        }
        {
          jButtonEdit = new JButton4j(Common.icon_edit);
          jDesktopPane1.add(jButtonEdit);
          jButtonEdit.setText(lang.get("btn_Edit"));
          jButtonEdit.setMnemonic(lang.getMnemonicChar());
          jButtonEdit.setBounds(525, 70, 126, 28);
          jButtonEdit.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MHN_DECISION_EDIT"));
          jButtonEdit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              editRecord();
            }
          });
        }
        {
          jButtonRename = new JButton4j(Common.icon_rename);
          jDesktopPane1.add(jButtonRename);
          jButtonRename.setText(lang.get("btn_Rename"));
          jButtonRename.setMnemonic(lang.getMnemonicChar());
          jButtonRename.setBounds(525, 99, 126, 28);
          jButtonRename.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MHN_DECISION_RENAME"));
          jButtonRename.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              rename();

            }
          });
        }
        {
          jButtonPrint = new JButton4j(Common.icon_report);
          jDesktopPane1.add(jButtonPrint);
          jButtonPrint.setText(lang.get("btn_Print"));
          jButtonPrint.setMnemonic(lang.getMnemonicChar());
          jButtonPrint.setBounds(525, 128, 126, 28);
          jButtonPrint.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              print();
            }
          });
        }
        {
          jButtonHelp = new JButton4j(Common.icon_help);
          jDesktopPane1.add(jButtonHelp);
          jButtonHelp.setText(lang.get("btn_Help"));
          jButtonHelp.setMnemonic(lang.getMnemonicChar());
          jButtonHelp.setBounds(525, 157, 126, 28);
        }
        {
          jButtonRefresh = new JButton4j(Common.icon_refresh);
          jDesktopPane1.add(jButtonRefresh);
          jButtonRefresh.setText(lang.get("btn_Refresh"));
          jButtonRefresh.setMnemonic(lang.getMnemonicChar());
          jButtonRefresh.setBounds(525, 186, 126, 28);
          jButtonRefresh.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              populateList("");
            }
          });
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonClose);
          jButtonClose.setText(lang.get("btn_Close"));
          jButtonClose.setMnemonic(lang.getMnemonicChar());
          jButtonClose.setBounds(525, 215, 126, 28);
          jButtonClose.addActionListener(new ActionListener() {
View Full Code Here

    JLabel4j_std lblReport = new JLabel4j_std(lang.get("lbl_Database_Tables"));
    lblReport.setBounds(12, 12, 126, 15);
    desktopPane.add(lblReport);
   
    JButton4j button4jClose = new JButton4j(Common.icon_close);
    button4jClose.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        dispose();
      }
    });
    button4jClose.setText(lang.get("btn_Close"));
    button4jClose.setMnemonic('0');
    button4jClose.setBounds(215, 495, 126, 29);
    desktopPane.add(button4jClose);

    populateListTables("");

  }
View Full Code Here

      jTextFieldInspectionID.setBounds(172, 391, 85, 21);
      jDesktopPane1.add(jTextFieldInspectionID);
    }   

    {
      JButton4j btnLookupInspection = new JButton4j("");
      btnLookupInspection.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          JLaunchLookup.dlgAutoExec = true;
          if (JLaunchLookup.qmInspections())
          {
            jTextFieldInspectionID.setText(JLaunchLookup.dlgResult);
          }
        }
      });
      btnLookupInspection.setBounds(255, 391, 22, 21);
      jDesktopPane1.add(btnLookupInspection);
    }
   
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
View Full Code Here

              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jButtonSave = new JButton4j(Common.icon_update);
          jDesktopPane1.add(jButtonSave);
          jButtonSave.setEnabled(false);
          jButtonSave.setText(lang.get("btn_Save"));
          jButtonSave.setMnemonic(lang.getMnemonicChar());
          jButtonSave.setBounds(110, 522, 139, 32);
          jButtonSave.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              boolean result = true;

              material.setDescription(jTextFieldDescription.getText());
              material.setMaterialType(((JDBMaterialType) jComboBoxMaterialType.getSelectedItem()).getType());
              material.setBaseUom(((JDBUom) jComboBoxBaseUOM.getSelectedItem()).getInternalUom());

              material.setShelfLife((Integer) jSpinnerShelfLife.getValue());
              material.setShelfLifeUom(((JShelfLifeUom) jComboBoxShelfLifeUOM.getSelectedItem()).getUom());
              material.setShelfLifeRule(((JShelfLifeRoundingRule) jComboBoxRoundingRule.getSelectedItem()).getRule());

              material.setDefaultBatchStatus((String) jComboBoxDefaultBatchStatus.getSelectedItem());

              BigDecimal bd = new BigDecimal(0).setScale(3, BigDecimal.ROUND_HALF_UP);
              bd = BigDecimal.valueOf(grossweightnumbermodel.getNumber().doubleValue()).setScale(3, BigDecimal.ROUND_HALF_UP);
              material.setGrossWeight(bd);
              bd = BigDecimal.valueOf(netweightnumbermodel.getNumber().doubleValue()).setScale(3, BigDecimal.ROUND_HALF_UP);
              material.setNetWeight(bd);

              try
              {
                material.setWeightUom(((JDBUom) jComboBoxWeightUOM.getSelectedItem()).getInternalUom());
              }
              catch (Exception e)
              {
                material.setWeightUom("");
              }

              material.setOldMaterial(jTextFieldLegacyCode.getText());

              material.setEquipmentType(jTextFieldEquipmentType.getText());
             
              material.setInspectionID(jTextFieldInspectionID.getText());

              if (checkBoxOverridePackLabel.isSelected())
              {
                if (comboBoxPackModuleID.getSelectedItem().toString().equals(""))
                {
                  material.setOverridePackLabel("N");
                  material.setPackLabelModuleID("");
                }
                else
                {
                  material.setOverridePackLabel("Y");
                  material.setPackLabelModuleID(comboBoxPackModuleID.getSelectedItem().toString());
                }
               
              }
              else
              {
                material.setOverridePackLabel("N");
                material.setPackLabelModuleID("");
              }
             
              if (checkBoxOverridePalletLabel.isSelected())
              {
                if (comboBoxPalletModuleID.getSelectedItem().toString().equals(""))
                {
                  material.setOverridePalletLabel("N");
                  material.setPalletLabelModuleID("");
                }
                else
                {
                  material.setOverridePalletLabel("Y");
                  material.setPalletLabelModuleID(comboBoxPalletModuleID.getSelectedItem().toString());
                }
              }
              else
              {
                material.setOverridePalletLabel("N");
                material.setPalletLabelModuleID("");
             

             
             
             
              if (material.isValidMaterial() == false)
              {
                result = material.create();
                if (result == true)
                {
                  result = material.update();
                }
              }
              else
              {
                result = material.update();
              }
              if (result == false)
              {
                JOptionPane.showMessageDialog(Common.mainForm, material.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE,Common.icon_confirm);
              }
              else
              {
                jButtonSave.setEnabled(false);
              }

            }
          });
        }
        {
          jButtonHelp = new JButton4j(Common.icon_help);
          jDesktopPane1.add(jButtonHelp);
          jButtonHelp.setText(lang.get("btn_Help"));
          jButtonHelp.setMnemonic(lang.getMnemonicChar());
          jButtonHelp.setBounds(254, 522, 139, 32);
        }
        {
          jButtonCancel = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonCancel);
          jButtonCancel.setText(lang.get("btn_Close"));
          jButtonCancel.setMnemonic(lang.getMnemonicChar());
          jButtonCancel.setBounds(395, 522, 139, 32);
          jButtonCancel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              dispose();
            }
          });
        }
        {
          ComboBoxModel<JDBUom> jComboBoxBaseUOMModel = new DefaultComboBoxModel<JDBUom>(uomList);
          jComboBoxBaseUOM = new JComboBox4j<JDBUom>();
          jDesktopPane1.add(jComboBoxBaseUOM);
          jComboBoxBaseUOM.setModel(jComboBoxBaseUOMModel);
          jComboBoxBaseUOM.setMaximumRowCount(12);
          jComboBoxBaseUOM.setBounds(172, 97, 248, 23);
          jComboBoxBaseUOM.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });

          jComboBoxBaseUOMModel.setSelectedItem(baseuom);

        }
        {
          ComboBoxModel<JDBMaterialType> jComboBoxMaterialTypeModel = new DefaultComboBoxModel<JDBMaterialType>(typeList);
          jComboBoxMaterialType = new JComboBox4j<JDBMaterialType>();
          jDesktopPane1.add(jComboBoxMaterialType);
          jComboBoxMaterialType.setModel(jComboBoxMaterialTypeModel);
          jComboBoxMaterialType.setBounds(172, 68, 248, 23);
          jComboBoxMaterialType.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });

          jComboBoxMaterialTypeModel.setSelectedItem(materialtype);
        }
        {
          jLabel12 = new JLabel4j_std();
          jDesktopPane1.add(jLabel12);
          jLabel12.setText(lang.get("lbl_Material_Default_Batch_Status"));
          jLabel12.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel12.setBounds(6, 332, 159, 21);
        }
        {
          jLabel13 = new JLabel4j_std();
          jDesktopPane1.add(jLabel13);
          jLabel13.setText(lang.get("lbl_Material_Shelf_Life_UOM"));
          jLabel13.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel13.setBounds(6, 155, 159, 21);
        }
        {
          ComboBoxModel<JShelfLifeUom> jComboBoxShelfLifeUOMModel = new DefaultComboBoxModel<JShelfLifeUom>(shelfLifeUomList);
          jComboBoxShelfLifeUOM = new JComboBox4j<JShelfLifeUom>();
          jDesktopPane1.add(jComboBoxShelfLifeUOM);
          jComboBoxShelfLifeUOM.setModel(jComboBoxShelfLifeUOMModel);
          jComboBoxShelfLifeUOM.setMaximumRowCount(12);
          jComboBoxShelfLifeUOM.setBounds(172, 156, 165, 21);
          jComboBoxShelfLifeUOM.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });

          jComboBoxShelfLifeUOMModel.setSelectedItem(sluom);
        }
        {
          jLabel14 = new JLabel4j_std();
          jDesktopPane1.add(jLabel14);
          jLabel14.setText(lang.get("lbl_Material_Shelf_Life_Rounding_Rule"));
          jLabel14.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel14.setBounds(6, 184, 159, 21);
        }
        {
          ComboBoxModel<JShelfLifeRoundingRule> jComboBoxRoundingRuleModel = new DefaultComboBoxModel<JShelfLifeRoundingRule>(shelfLifeRule);
          jComboBoxRoundingRule = new JComboBox4j<JShelfLifeRoundingRule>();
          jDesktopPane1.add(jComboBoxRoundingRule);
          jComboBoxRoundingRule.setModel(jComboBoxRoundingRuleModel);
          jComboBoxRoundingRule.setBounds(172, 185, 165, 21);
          jComboBoxRoundingRule.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });

          jComboBoxRoundingRuleModel.setSelectedItem(slrr);
        }
        {
          jLabel1 = new JLabel4j_std();
          jDesktopPane1.add(jLabel1);
          jLabel1.setText(lang.get("lbl_Material"));
          jLabel1.setBounds(6, 8, 159, 21);
          jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jLabel3 = new JLabel4j_std();
          jDesktopPane1.add(jLabel3);
          jLabel3.setText(lang.get("lbl_Description"));
          jLabel3.setBounds(6, 38, 159, 21);
          jLabel3.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jLabel5 = new JLabel4j_std();
          jDesktopPane1.add(jLabel5);
          jLabel5.setText(lang.get("lbl_Material_Base_UOM"));
          jLabel5.setBounds(6, 96, 159, 21);
          jLabel5.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jLabel2 = new JLabel4j_std();
          jDesktopPane1.add(jLabel2);
          jLabel2.setText(lang.get("lbl_Material_Type"));
          jLabel2.setBounds(6, 67, 159, 21);
          jLabel2.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        {
          jLabel4 = new JLabel4j_std();
          jDesktopPane1.add(jLabel4);
          jLabel4.setText(lang.get("lbl_Material_Shelf_Life"));
          jLabel4.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel4.setBounds(6, 126, 159, 21);
        }
        {
          jLabel8 = new JLabel4j_std();
          jDesktopPane1.add(jLabel8);
          jLabel8.setText(lang.get("lbl_Material_Gross_Weight"));
          jLabel8.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel8.setBounds(6, 214, 159, 21);
          jLabel8.setFocusTraversalPolicyProvider(true);
        }
        {
          jLabel9 = new JLabel4j_std();
          jDesktopPane1.add(jLabel9);
          jLabel9.setText(lang.get("lbl_Material_Net_Weight"));
          jLabel9.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel9.setBounds(6, 244, 159, 21);
        }
        {
          jLabel10 = new JLabel4j_std();
          jDesktopPane1.add(jLabel10);
          jLabel10.setText(lang.get("lbl_Material_Weight_UOM"));
          jLabel10.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel10.setBounds(6, 273, 159, 21);
        }
        {
          jTextFieldLegacyCode = new JTextField4j();
          AbstractDocument doc = (AbstractDocument) jTextFieldLegacyCode.getDocument();
          doc.setDocumentFilter(new JFixedSizeFilter(20));
          jDesktopPane1.add(jTextFieldLegacyCode);
          jTextFieldLegacyCode.setBounds(172, 303, 125, 21);
          jTextFieldLegacyCode.addKeyListener(new KeyAdapter() {
            public void keyTyped(KeyEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          ComboBoxModel<JDBUom> jComboBox1Model = new DefaultComboBoxModel<JDBUom>(uomList);
          jComboBoxWeightUOM = new JComboBox4j<JDBUom>();
          jDesktopPane1.add(jComboBoxWeightUOM);
          jComboBoxWeightUOM.setModel(jComboBox1Model);
          jComboBoxWeightUOM.setBounds(172, 274, 248, 23);
          jComboBoxWeightUOM.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
          jComboBox1Model.setSelectedItem(weightuom);
        }
        {
          jSpinnerShelfLife = new JSpinner();
          jDesktopPane1.add(jSpinnerShelfLife);
          jSpinnerShelfLife.setModel(shelflifenumbermodel);
          jSpinnerShelfLife.setBounds(172, 126, 60, 21);
          JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerShelfLife);
          nec2.getTextField().setFont(Common.font_std);
          jSpinnerShelfLife.setEditor(nec2);
          jSpinnerShelfLife.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jSpinnerGrossWeight = new JSpinner();

          jDesktopPane1.add(jSpinnerGrossWeight);
          jSpinnerGrossWeight.setModel(grossweightnumbermodel);

          jSpinnerGrossWeight.setBounds(172, 214, 95, 21);
          JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerGrossWeight);
          nec2.getTextField().setFont(Common.font_std);
          jSpinnerGrossWeight.setEditor(nec2);
          jSpinnerGrossWeight.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jSpinnerNetWeight = new JSpinner();
          jDesktopPane1.add(jSpinnerNetWeight);
          jSpinnerNetWeight.setModel(netweightnumbermodel);
          JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerNetWeight);
          nec2.getTextField().setFont(Common.font_std);
          jSpinnerNetWeight.setEditor(nec2);
          jSpinnerNetWeight.setBounds(172, 244, 95, 21);
          jSpinnerNetWeight.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jButtonUOMs = new JButton4j();
          jDesktopPane1.add(jButtonUOMs);
          jButtonUOMs.setText(lang.get("btn_Material_UOM_Conversions"));
          jButtonUOMs.setIcon(Common.icon_uom);
          jButtonUOMs.setBounds(437, 178, 175, 32);
          jButtonUOMs.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_UOM"));
          jButtonUOMs.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              String base = ((JDBUom) jComboBoxBaseUOM.getSelectedItem()).getInternalUom();
              JLaunchMenu.runForm("FRM_ADMIN_MATERIAL_UOM", lmaterial, base);
            }
          });
        }
        {
          JDBControl ctrl = new JDBControl(Common.selectedHostID, Common.sessionID);
          String value = ctrl.getKeyValue("SSCC_LOCATION_VALIDATION");
          Boolean enabled = Boolean.valueOf(value);
          jButtonLocations = new JButton4j();
          jDesktopPane1.add(jButtonLocations);
          jButtonLocations.setText(lang.get("btn_Material_Locations"));
          jButtonLocations.setEnabled(enabled);
          jButtonLocations.setBounds(245, 124, 175, 25);
          if (enabled)
          {
            jButtonLocations.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_LOCATION"));
          }
          jButtonLocations.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {

              JLaunchMenu.runForm("FRM_ADMIN_MATERIAL_LOCATION", lmaterial);
            }
          });
         
        }
        {
          jButtonBatches = new JButton4j();
          jDesktopPane1.add(jButtonBatches);
          jButtonBatches.setIcon(Common.icon_batch);
          jButtonBatches.setText(lang.get("btn_Material_Batches"));
          jButtonBatches.setBounds(437, 149, 175, 32);
          jButtonBatches.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_BATCH"));
          jButtonBatches.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchMenu.runForm("FRM_ADMIN_MATERIAL_BATCH", lmaterial);
            }
          });
        }
        {
          jLabel11 = new JLabel4j_std();
          jDesktopPane1.add(jLabel11);
          jLabel11.setText(lang.get("lbl_Material_Legacy_Code"));
          jLabel11.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel11.setBounds(6, 302, 159, 21);
        }
        {
          ComboBoxModel<String> jComboBoxDefaultBatchStatusModel = new DefaultComboBoxModel<String>(Common.batchStatusIncBlank);
          jComboBoxDefaultBatchStatus = new JComboBox4j<String>();
          jDesktopPane1.add(jComboBoxDefaultBatchStatus);
          jComboBoxDefaultBatchStatus.setModel(jComboBoxDefaultBatchStatusModel);
          jComboBoxDefaultBatchStatus.setBounds(173, 332, 164, 23);
          jComboBoxDefaultBatchStatus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
       
        checkBoxOverridePackLabel.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            setButtonStates();
          }
        });
       

        checkBoxOverridePackLabel.setBackground(Color.WHITE);
        checkBoxOverridePackLabel.setBounds(166, 420, 21, 24);
        jDesktopPane1.add(checkBoxOverridePackLabel);
        checkBoxOverridePalletLabel.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setButtonStates();
          }
        });
       

        checkBoxOverridePalletLabel.setBackground(Color.WHITE);
        checkBoxOverridePalletLabel.setBounds(166, 453, 21, 24);
        jDesktopPane1.add(checkBoxOverridePalletLabel);
       
        JLabel4j_std label4j_std = new JLabel4j_std();
        label4j_std.setText(lang.get("lbl_Override_Pack_Label"));
        label4j_std.setHorizontalTextPosition(SwingConstants.RIGHT);
        label4j_std.setHorizontalAlignment(SwingConstants.RIGHT);
        label4j_std.setBounds(6, 420, 159, 21);
        jDesktopPane1.add(label4j_std);
       
        JLabel4j_std label4j_std_1 = new JLabel4j_std();
        label4j_std_1.setText(lang.get("lbl_Override_Pallet_Label"));
        label4j_std_1.setHorizontalTextPosition(SwingConstants.RIGHT);
        label4j_std_1.setHorizontalAlignment(SwingConstants.RIGHT);
        label4j_std_1.setBounds(7, 453, 159, 21);
        jDesktopPane1.add(label4j_std_1);
       
        ComboBoxModel<JDBListData> jComboBox1Model = new DefaultComboBoxModel<JDBListData>(moduleList);
        comboBoxPackModuleID.setModel(jComboBox1Model);
        comboBoxPackModuleID.setEnabled(false);
        comboBoxPackModuleID.setBounds(199, 420, 208, 27);
        comboBoxPackModuleID.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            jButtonSave.setEnabled(true);
          }
        });
       
        jDesktopPane1.add(comboBoxPackModuleID);
       
        ComboBoxModel<JDBListData> jComboBox2Model = new DefaultComboBoxModel<JDBListData>(moduleList);
        comboBoxPalletModuleID.setModel(jComboBox2Model);
        comboBoxPalletModuleID.setEnabled(false);
        comboBoxPalletModuleID.setBounds(199, 453, 208, 27);
        comboBoxPalletModuleID.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            jButtonSave.setEnabled(true);
          }
        });
        jDesktopPane1.add(comboBoxPalletModuleID);
       
        jButtonCustomerData.setText(lang.get("btn_Material_Customer_Data"));
        jButtonCustomerData.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_CUST_DATA"));
        jButtonCustomerData.setBounds(437, 208, 175, 32);
        jButtonCustomerData.setIcon(Common.icon_customer);
        jDesktopPane1.add(jButtonCustomerData);       
        jButtonCustomerData.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JLaunchMenu.runForm("FRM_ADMIN_MATERIAL_CUST_DATA", lmaterial);
          }
        });
       
       
        JButton4j button4jDataIDs = new JButton4j(Common.icon_material);
        button4jDataIDs.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JLaunchMenu.runForm("FRM_ADMIN_DATA_IDS");
          }
        });
        button4jDataIDs.setText(lang.get("mod_FRM_ADMIN_DATA_IDS"));
        button4jDataIDs.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_DATA_IDS"));
        button4jDataIDs.setBounds(437, 238, 175, 32);
        jDesktopPane1.add(button4jDataIDs);

      }
    }
    catch (Exception e)
View Full Code Here

              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jButton3 = new JButton4j(Common.icon_lookup);
          jDesktopPane1.add(jButton3);
          jButton3.setBounds(287, 386, 21, 21);
          jButton3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchLookup.dlgAutoExec = true;
              JLaunchLookup.dlgCriteriaDefault = "";
              if (JLaunchLookup.customers())
              {
                jTextFieldCustomer.setText(JLaunchLookup.dlgResult);
                jButtonSave.setEnabled(true);
              }
            }
          });
        }
        {
          jComboBoxRequiredUOM.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              jButtonSave.setEnabled(true);
            }
          });

          jComboBoxRequiredUOM.setBounds(163, 195, 301, 23);
          jDesktopPane1.add(jComboBoxRequiredUOM);
        }
        {
          jLabel14 = new JLabel4j_std();
          jDesktopPane1.add(jLabel14);
          jLabel14.setText(lang.get("lbl_Process_Order_Status"));
          jLabel14.setHorizontalAlignment(SwingConstants.TRAILING);
          jLabel14.setBounds(12, 286, 144, 21);
        }
        {
          ComboBoxModel jComboBoxStatusModel = new DefaultComboBoxModel(Common.processOrderStatus);
          jComboBoxStatus = new JComboBox4j();
          jDesktopPane1.add(jComboBoxStatus);
          jComboBoxStatus.setModel(jComboBoxStatusModel);
          jComboBoxStatus.setBounds(163, 286, 150, 21);
          jComboBoxStatus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jButtonSave = new JButton4j(Common.icon_save);
          jDesktopPane1.add(jButtonSave);
          jButtonSave.setText(lang.get("btn_Save"));
          jButtonSave.setBounds(62, 453, 112, 28);
          jButtonSave.setEnabled(false);
          jButtonSave.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              processorder.setDescription(jTextFieldDescription.getText());
              processorder.setRecipe(jTextFieldRecipeID.getText());
              processorder.setLocation(jTextFieldLocation.getText());
              processorder.setCustomerID(jTextFieldCustomer.getText());
              processorder.setInspectionID(jTextFieldInspectionID.getText());
              processorder.setMaterial(jTextFieldMaterial.getText());
              processorder.setRequiredQuantity(JUtility.stringToBigDecimal(jFormattedTextFieldRequiredQuantity.getText().toString()));
              processorder.setRequiredUom(((JDBUom) jComboBoxRequiredUOM.getSelectedItem()).getInternalUom());
              processorder.setRequiredResource(jTextFieldRequiredResource.getText());
              try
              {
                processorder.setStatus((String) jComboBoxStatus.getSelectedItem());
              }
              catch (Exception e)
              {
                processorder.setStatus("");
              }

              try
              {
                processorder.setDefaultPalletStatus((String) jComboBoxPalletStatus.getSelectedItem());
              }
              catch (Exception e)
              {
                processorder.setDefaultPalletStatus("");
              }

              Date d = jSpinnerDueDate.getDate();
              processorder.setDueDate(JUtility.getTimestampFromDate(d));
              if (processorder.isValidProcessOrder() == false)
              {
                processorder.create();
              }
              if (processorder.update())
              {
                jButtonSave.setEnabled(false);
              }
              else
              {
                JUtility.errorBeep();
                JOptionPane.showMessageDialog(Common.mainForm, processorder.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
              }

              jComboBoxPalletStatus.setSelectedItem(processorder.getDefaultPalletStatus());

            }
          });
        }
        {
          jButtonHelp = new JButton4j(Common.icon_help);
          jDesktopPane1.add(jButtonHelp);
          jButtonHelp.setText(lang.get("btn_Help"));
          jButtonHelp.setBounds(181, 453, 112, 28);
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonClose);
          jButtonClose.setText(lang.get("btn_Close"));
          jButtonClose.setBounds(300, 453, 112, 28);
          jButtonClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              dispose();
            }
          });
        }
        {
          jButton1 = new JButton4j(Common.icon_lookup);
          jDesktopPane1.add(jButton1);
          jButton1.setBounds(287, 75, 20, 20);
          jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchLookup.dlgAutoExec = false;
              JLaunchLookup.dlgCriteriaDefault = "";
              if (JLaunchLookup.materials())
              {
                jTextFieldMaterial.setText(JLaunchLookup.dlgResult);
                materialChanged();
                jButtonSave.setEnabled(true);
              }
            }
          });
        }
        {
          jButton3 = new JButton4j(Common.icon_lookup);
          jDesktopPane1.add(jButton3);
          jButton3.setBounds(287, 258, 21, 21);
          jButton3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JLaunchLookup.dlgAutoExec = true;
View Full Code Here

        {
          getHostDataTo();
        }
      });

      jButtonClone = new JButton4j(Common.icon_clone);
      desktopPane.add(jButtonClone);
      jButtonClone.setText("Clone Database");
      jButtonClone.setBounds(129, 444, 160, 36);
      jButtonClone.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent evt)
        {

          String schemaFrom = "";
          String schemaTo = "";
          JDBControl ctrl;

          // Source & Destination must be different Hosts//
          setStatusBarText("Validating selected hosts");
          if (hostIDFrom.equals(hostIDTo) == false)
          {

            // Check we can connect to Source //
            setStatusBarText("Connecting to source...");
            if (hstFrom.connect(sessionFrom, hostIDFrom))
            {
             
              // Check we can connect to Destination //
              setStatusBarText("Connecting to destination...");
              if (hstTo.connect(sessionTo, hostIDTo))
              {

                // Check Application Schema Versions are the
                // same in Source and Destination //
                setStatusBarText("Checking schema versions...");
                ctrl = new JDBControl(hostIDFrom, sessionFrom);
                schemaFrom = ctrl.getKeyValue("SCHEMA VERSION");
                ctrl = new JDBControl(hostIDTo, sessionTo);
                schemaTo = ctrl.getKeyValue("SCHEMA VERSION");

                if (schemaFrom.equals(schemaTo))
                {
                  // OK //
                  setStatusBarText("Getting source table names...");
                  int tableCountFrom = 0;
                  JDBStructure strucFrom = new JDBStructure(hostIDFrom, sessionFrom);
                  LinkedList<String> tablesFrom = strucFrom.getTableNames();
                  tableCountFrom = tablesFrom.size();
                  progressBar.setMinimum(1);
                  progressBar.setMaximum(tableCountFrom);

                  setStatusBarText("Getting destination table names...");
                  int tableCountTo = 0;
                  JDBStructure strucTo = new JDBStructure(hostIDTo, sessionTo);
                  LinkedList<String> tablesTo = strucTo.getTableNames();
                  tableCountTo = tablesTo.size();

                  if (tableCountFrom == tableCountTo)
                  {
                    String table = "";
                    for (int tf = 0; tf < tableCountFrom; tf++)
                    {
                      table = tablesFrom.get(tf);
                      progressBar.setValue(tf+1);
                      progressBar.paintImmediately(progressBar.getVisibleRect());
                      if (tablesTo.contains(table))
                      {

                        // GET FIELDS FOR CURRENT TABLE
                        setStatusBarText("Getting field names for "+table);
                        LinkedList<JDBField> fieldNames = strucFrom.getFieldNames(table);
                        JWait.milliSec(100);

                        // CREATE INSERT STATEMENT FOR
                        // TARGET DATABASE //
                        setStatusBarText("Generating insert SQL for "+table);
                        String insertTable = "insert into " + table;
                        String insertFields = "";
                        String insertPlaceMarkers = "";
                        String comma = "";

                        for (int temp = 0; temp < fieldNames.size(); temp++)
                        {
                          if (temp == 0)
                          {
                            comma = "";
                          } else
                          {
                            comma = ",";
                          }
                          insertFields = insertFields + comma + fieldNames.get(temp).getfieldName();
                          insertPlaceMarkers = insertPlaceMarkers + comma + "?";
                        }

                        String insertStatement = insertTable + " (" + insertFields + ") values (" + insertPlaceMarkers + ")";

                        // SELECT ALL SOURCE RECORDS //
                        setStatusBarText("Copying table "+table);
                        Long recordsCopied = (long) 0;
                        try
                        {
                          hstFrom.getConnection(sessionFrom).setAutoCommit(false);
                          hstTo.getConnection(sessionTo).setAutoCommit(false);
                          PreparedStatement truncateData = hstTo.getConnection(sessionTo).prepareStatement("truncate table " + table);
                          PreparedStatement destinationData = hstTo.getConnection(sessionTo).prepareStatement(insertStatement);
                          PreparedStatement sourceData = hstFrom.getConnection(sessionFrom).prepareStatement("select * from " + table);
                          sourceData.setFetchDirection(ResultSet.FETCH_FORWARD);
                          destinationData.setFetchDirection(ResultSet.FETCH_FORWARD);
                          sourceData.setFetchSize(1);
                          destinationData.setFetchSize(1);
                          truncateData.setFetchSize(1);
                          ResultSet sourceResultset = sourceData.executeQuery();

                          truncateData.execute();
                          truncateData.close();
                          truncateData = null;


                          while (sourceResultset.next())
                          {
                            for (int fldfrom = 0; fldfrom < fieldNames.size(); fldfrom++)
                            {
                              JDBField field = fieldNames.get(fldfrom);
                              if (field.getfieldType().toLowerCase().equals("varchar"))
                              {
                                String value;
                                value = sourceResultset.getString(field.getfieldName());
                                destinationData.setString(fldfrom + 1, value);
                                //System.out.println("Table = \"" + table + "\" Field = \"" + field.getfieldName() + "\" Value = \"" + value + "\"");
                              }
                              if ((field.getfieldType().toLowerCase().equals("decimal")) | (field.getfieldType().toLowerCase().equals("numeric")) | (field.getfieldType().toLowerCase().equals("float")))
                              {
                                BigDecimal value;
                                value = sourceResultset.getBigDecimal(field.getfieldName());
                                destinationData.setBigDecimal(fldfrom + 1, value);
                                //System.out.println("Table = \"" + table + "\" Field = \"" + field.getfieldName() + "\" Value = \"" + JUtility.replaceNullObjectwithBlank(value).toString() + "\"");
                              }
                              if (field.getfieldType().toLowerCase().equals("datetime"))
                              {
                                Timestamp value;
                                value = sourceResultset.getTimestamp(field.getfieldName());
                                destinationData.setTimestamp(fldfrom + 1, value);
                                //System.out.println("Table = \"" + table + "\" Field = \"" + field.getfieldName() + "\" Value = \""
                                //    + JUtility.replaceNullObjectwithBlank(value).toString() + "\"");
                              }
                              if ((field.getfieldType().toLowerCase().equals("int")) | (field.getfieldType().toLowerCase().equals("bigint")))
                              {
                                Integer value;
                                value = sourceResultset.getInt(field.getfieldName());
                                destinationData.setInt(fldfrom + 1, value);
                                //System.out.println("Table = \"" + table + "\" Field = \"" + field.getfieldName() + "\" Value = \""
                                //    + JUtility.replaceNullObjectwithBlank(value).toString() + "\"");
                              }
                              field=null;
                            }
                            try
                            {
                              destinationData.execute();
                              hstTo.getConnection(sessionTo).commit();
                              destinationData.clearParameters();
                              recordsCopied++;
                             
                            } catch (Exception ex)
                            {
                              System.out.println(ex.getMessage());
                            }
                          }

                          sourceResultset.close();
                          sourceResultset = null;
                          destinationData.close();
                          destinationData = null;
                          sourceData.close();
                          sourceData = null;
                          setStatusBarText("Copying complete");

                        } catch (SQLException e)
                        {
                          labelCommand.setText("Error reading "+table);
                        }

                      } else
                      {
                        labelCommand.setText("Table "+table+" does not exist in destination");
                      }

                    }
                  } else
                  {
                   
                    labelCommand.setText("Number of tables mismatch "+String.valueOf(tableCountFrom)+"/"+String.valueOf(tableCountTo));
                  }

                } else
                {
                  labelCommand.setText("Schema version mismatch "+String.valueOf(schemaFrom)+"/"+String.valueOf(schemaTo));
                }

              } else
              {
                labelCommand.setText("Cannot connect to destination.");
              }
              hstFrom.disconnect(Common.sessionID);
            } else
            {
              labelCommand.setText("Cannot connect to source.");
            }
          } else
          {
            labelCommand.setText("Cannot clone to self.");
          }
        }
      });

      jButtonClose = new JButton4j(Common.icon_close);
      desktopPane.add(jButtonClose);
      jButtonClose.setText("Close");
      jButtonClose.setBounds(293, 444, 160, 36);
      jButtonClose.addActionListener(new ActionListener()
      {
View Full Code Here

            jListUnAssigned.setCellRenderer(Common.renderer_list_unassigned);
            jListUnAssigned.setModel(jListUnAssignedModel);
          }
        }
        {
          jButtonAssign = new JButton4j(Common.icon_arrow_left);
          jDesktopPane1.add(jButtonAssign);
          jButtonAssign.setBounds(267, 151, 25, 25);
          jButtonAssign.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (jListUnAssigned.getSelectedIndex() > -1)
              {
                for (int j = jListUnAssigned.getMaxSelectionIndex(); j >= jListUnAssigned.getMinSelectionIndex(); j--)
                {
                  if (jListUnAssigned.isSelectedIndex(j))
                  {
                    JDBListData item = (JDBListData) jListUnAssigned.getModel().getElementAt(j);

                    addToList(assignedList, item, false);
                  }
                }

                for (int j = jListUnAssigned.getMaxSelectionIndex(); j >= jListUnAssigned.getMinSelectionIndex(); j--)
                {
                  if (jListUnAssigned.isSelectedIndex(j))
                  {
                    Object item = jListUnAssigned.getModel().getElementAt(j);

                    removeFromList(unassignedList, item);
                  }
                }

                refreshJList(jListAssigned, assignedModel, assignedList);
                refreshJList(jListUnAssigned, unassignedModel, unassignedList);

                setButtonState();

              }

            }
          });
        }
        {
          jButtonUnAssign = new JButton4j(Common.icon_arrow_right);
          jDesktopPane1.add(jButtonUnAssign);
          jButtonUnAssign.setBounds(267, 186, 25, 25);
          jButtonUnAssign.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (jListAssigned.getSelectedIndex() > -1)
              {
                for (int j = jListAssigned.getMaxSelectionIndex(); j >= jListAssigned.getMinSelectionIndex(); j--)
                {
                  if (jListAssigned.isSelectedIndex(j))
                  {
                    JDBListData item = (JDBListData) jListAssigned.getModel().getElementAt(j);

                    addToList(unassignedList, item, true);
                  }
                }

                for (int j = jListAssigned.getMaxSelectionIndex(); j >= jListAssigned.getMinSelectionIndex(); j--)
                {
                  if (jListAssigned.isSelectedIndex(j))
                  {
                    Object item = jListAssigned.getModel().getElementAt(j);

                    removeFromList(assignedList, item);
                  }
                }
                refreshJList(jListUnAssigned, unassignedModel, unassignedList);
                refreshJList(jListAssigned, assignedModel, assignedList);

                setButtonState();
              }

            }
          });
        }
        {
          jButtonUp = new JButton4j(Common.icon_arrow_up);
          jDesktopPane1.add(jButtonUp);
          jButtonUp.setBounds(267, 118, 25, 25);
          jButtonUp.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              int sel = jListAssigned.getSelectedIndex();
              JDBListData element = ((JDBListData) jListAssigned.getModel().getElementAt(sel));
              assignedList = JDBModule.moveElementUp(assignedList, element);
              refreshJList(jListAssigned, assignedModel, assignedList);
              jListAssigned.setSelectedIndex(assignedList.indexOf(element));
              jButtonSave.setEnabled(true);
              jButtonUndo.setEnabled(true);
            }
          });
        }
        {
          jButtonDown = new JButton4j(Common.icon_arrow_down);
          jDesktopPane1.add(jButtonDown);
          jButtonDown.setBounds(267, 223, 25, 25);
          jButtonDown.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              int j = jListAssigned.getSelectedIndex();
              JDBListData element = ((JDBListData) jListAssigned.getModel().getElementAt(j));
              assignedList = JDBModule.moveElementDown(assignedList, element);
              refreshJList(jListAssigned, assignedModel, assignedList);
              jListAssigned.setSelectedIndex(assignedList.indexOf(element));
              jButtonSave.setEnabled(true);
              jButtonUndo.setEnabled(true);
            }
          });
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonClose);
          jButtonClose.setText(lang.get("btn_Close"));
          jButtonClose.setBounds(387, 408, 110, 30);
          jButtonClose.setMnemonic(lang.getMnemonicChar());
          jButtonClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              dispose();
            }
          });
        }
        {
          jButtonHelp = new JButton4j(Common.icon_help);
          jDesktopPane1.add(jButtonHelp);
          jButtonHelp.setText(lang.get("btn_Help"));
          jButtonHelp.setBounds(275, 408, 110, 30);
          jButtonHelp.setMnemonic(lang.getMnemonicChar());
        }
        {
          jButtonSave = new JButton4j(Common.icon_update);
          jDesktopPane1.add(jButtonSave);
          jButtonSave.setText(lang.get("btn_Save"));
          jButtonSave.setBounds(45, 408, 112, 30);
          jButtonSave.setEnabled(false);
          jButtonSave.setMnemonic(lang.getMnemonicChar());
          jButtonSave.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JDBToolbar t = new JDBToolbar(Common.selectedHostID, Common.sessionID);
              t.rewriteToolbar(assignedList);
              jButtonSave.setEnabled(false);
              jButtonUndo.setEnabled(false);
            }
          });
        }
        {
          jButtonUndo = new JButton4j(Common.icon_undo);
          jDesktopPane1.add(jButtonUndo);
          jButtonUndo.setText(lang.get("btn_Undo"));
          jButtonUndo.setBounds(160, 408, 112, 30);
          jButtonUndo.setEnabled(false);
          jButtonUndo.setMnemonic(lang.getMnemonicChar());
View Full Code Here

      {
        jDesktopPane1 = new JDesktopPane();
        jDesktopPane1.setBackground(Color.WHITE);
        getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
        {
          jButtonAdd = new JButton4j(Common.icon_add);
          jDesktopPane1.add(jButtonAdd);
          jButtonAdd.setText(lang.get("btn_Add"));
          jButtonAdd.setMnemonic(lang.getMnemonicChar());
          jButtonAdd.setBounds(231, 7, 126, 28);
          jButtonAdd.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_TYPE_ADD"));
          jButtonAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              add();

            }
          });
        }
        {
          jButtonDelete = new JButton4j(Common.icon_delete);
          jDesktopPane1.add(jButtonDelete);
          jButtonDelete.setText(lang.get("btn_Delete"));
          jButtonDelete.setMnemonic(lang.getMnemonicChar());
          jButtonDelete.setBounds(231, 36, 126, 28);
          jButtonDelete.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_TYPE_DELETE"));
          jButtonDelete.setFocusTraversalKeysEnabled(false);
          jButtonDelete.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              delete();

            }
          });
        }
        {
          jButtonEdit = new JButton4j(Common.icon_edit);
          jDesktopPane1.add(jButtonEdit);
          jButtonEdit.setText(lang.get("btn_Edit"));
          jButtonEdit.setMnemonic(lang.getMnemonicChar());
          jButtonEdit.setBounds(231, 65, 126, 28);
          jButtonEdit.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_TYPE_EDIT"));
          jButtonEdit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              editRecord();
            }
          });
        }
        {
          jButtonRename = new JButton4j(Common.icon_rename);
          jDesktopPane1.add(jButtonRename);
          jButtonRename.setText(lang.get("btn_Rename"));
          jButtonRename.setMnemonic(lang.getMnemonicChar());
          jButtonRename.setBounds(231, 94, 126, 28);
          jButtonRename.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_ADMIN_MATERIAL_TYPE_RENAME"));
          jButtonRename.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              rename();

            }
          });
        }
        {
          jButtonPrint = new JButton4j(Common.icon_report);
          jDesktopPane1.add(jButtonPrint);
          jButtonPrint.setText(lang.get("btn_Print"));
          jButtonPrint.setMnemonic(lang.getMnemonicChar());;
          jButtonPrint.setBounds(231, 123, 126, 28);
          jButtonPrint.setEnabled(Common.userList.getUser(Common.sessionID).isModuleAllowed("RPT_TYPES"));
          jButtonPrint.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              print();
            }
          });
        }
        {
          jButtonHelp = new JButton4j(Common.icon_help);
          jDesktopPane1.add(jButtonHelp);
          jButtonHelp.setText(lang.get("btn_Help"));
          jButtonHelp.setMnemonic(lang.getMnemonicChar());
          jButtonHelp.setBounds(231, 152, 126, 28);
        }
        {
          jButtonRefresh = new JButton4j(Common.icon_refresh);
          jDesktopPane1.add(jButtonRefresh);
          jButtonRefresh.setText(lang.get("btn_Refresh"));
          jButtonRefresh.setMnemonic(lang.getMnemonicChar());
          jButtonRefresh.setBounds(231, 181, 126, 28);
          jButtonRefresh.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              populateList("");
            }
          });
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonClose);
          jButtonClose.setText(lang.get("btn_Close"));
          jButtonClose.setMnemonic(lang.getMnemonicChar());
          jButtonClose.setBounds(231, 210, 126, 28);
          jButtonClose.addActionListener(new ActionListener() {
View Full Code Here

TOP

Related Classes of com.commander4j.gui.JButton4j

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.