private void initGUI() {
    try {
      this.setPreferredSize(new java.awt.Dimension(471, 531));
      this.setBounds(0, 0, 642, 304);
      setVisible(true);
      this.setIconifiable(true);
      this.setClosable(true);
      {
        jDesktopPane1 = new JDesktopPane();
        jDesktopPane1.setBackground(Color.WHITE);
        this.getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
        jDesktopPane1.setPreferredSize(new java.awt.Dimension(462, 497));
        jDesktopPane1.setLayout(null);

        jTextFieldSSCC = new JTextField4j();
        AbstractDocument doc = (AbstractDocument) jTextFieldSSCC.getDocument();
        doc.setDocumentFilter(new JFixedSizeFilter(JDBPallet.field_sscc));
        jTextFieldSSCC.addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyReleased(KeyEvent arg0) {
                refresh();
              }
            });
        jTextFieldSSCC.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                refresh();
              }
            });
        jDesktopPane1.add(jTextFieldSSCC);
        jTextFieldSSCC.setBounds(121, 24, 134, 21);

        jTextFieldNewSSCC = new JTextField4j();
        jDesktopPane1.add(jTextFieldNewSSCC);
        jTextFieldNewSSCC.setEditable(false);
        jTextFieldNewSSCC.setEnabled(false);
        jTextFieldNewSSCC.setBounds(121, 53, 134, 21);

        jFormattedTextFieldQuantity = new JQuantityInput(new BigDecimal("0"));
        jDesktopPane1.add(jFormattedTextFieldQuantity);
        jFormattedTextFieldQuantity.setFont(Common.font_std);
        jFormattedTextFieldQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        jFormattedTextFieldQuantity.setBounds(464, 24, 91, 21);
        jFormattedTextFieldQuantity.setVerifyInputWhenFocusTarget(false);
        jFormattedTextFieldQuantity.setEnabled(false);

        jFormattedTextFieldNewQuantity = new JQuantityInput(new BigDecimal("0"));
        jDesktopPane1.add(jFormattedTextFieldNewQuantity);
        jFormattedTextFieldNewQuantity.setFont(Common.font_std);
        jFormattedTextFieldNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        jFormattedTextFieldNewQuantity.setBounds(464, 53, 91, 21);
        jFormattedTextFieldNewQuantity.setVerifyInputWhenFocusTarget(false);
        jFormattedTextFieldNewQuantity.setEnabled(false);

        jFormattedTextFieldSplitQuantity = new JQuantityInput(new BigDecimal("0"));
        jDesktopPane1.add(jFormattedTextFieldSplitQuantity);
        jFormattedTextFieldSplitQuantity.setFont(Common.font_std);
        jFormattedTextFieldSplitQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        jFormattedTextFieldSplitQuantity.setBounds(269, 87, 91, 21);
        jFormattedTextFieldSplitQuantity.setVerifyInputWhenFocusTarget(false);

        labelSSCCQuantity = new JLabel4j_std();
        jDesktopPane1.add(labelSSCCQuantity);
        labelSSCCQuantity.setText(lang.get("lbl_Pallet_Quantity"));
        labelSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        labelSSCCQuantity.setBounds(369, 24, 88, 21);

        labelSSCCNewQuantity = new JLabel4j_std();
        jDesktopPane1.add(labelSSCCNewQuantity);
        labelSSCCNewQuantity.setText(lang.get("lbl_Pallet_Quantity"));
        labelSSCCNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        labelSSCCNewQuantity.setBounds(369, 53, 88, 21);

        labelNewSSCCQuantity = new JLabel4j_std();
        jDesktopPane1.add(labelNewSSCCQuantity);
        labelNewSSCCQuantity.setText(lang.get("lbl_Required_Quantity"));
        labelNewSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        labelNewSSCCQuantity.setBounds(137, 86, 125, 21);

        jButtonSplit = new JButton4j(Common.icon_split);
        jButtonSplit.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                String splitSSCC =
                    pal.splitPallet(
                        jTextFieldSSCC.getText(),
                        new BigDecimal(jFormattedTextFieldSplitQuantity.getValue().toString()));
                if (splitSSCC.equals("") == false) {
                  lblStatus.setText(
                      "SSCC "
                          + jTextFieldSSCC.getText()
                          + " updated, SSCC "
                          + splitSSCC
                          + " created.");
                  jTextFieldNewSSCC.setText(splitSSCC);
                  jFormattedTextFieldNewQuantity.setValue(
                      jFormattedTextFieldSplitQuantity.getValue());
                  String pq = comboBoxPrintQueue.getSelectedItem().toString();
                  if (checkBoxPrintOldSSCC.isSelected()) {
                    buildSQL1Record(jTextFieldSSCC.getText());
                    JLaunchReport.runReport(
                        "RPT_PALLET_LABEL",
                        listStatement,
                        jCheckBoxAutoPreview.isSelected(),
                        pq,
                        Integer.valueOf(jSpinnerCopies.getValue().toString()),
                        checkBoxIncHeaderText.isSelected());
                  }
                  if (checkBoxPrintNewSSCC.isSelected()) {
                    buildSQL1Record(jTextFieldNewSSCC.getText());
                    JLaunchReport.runReport(
                        "RPT_PALLET_LABEL",
                        listStatement,
                        jCheckBoxAutoPreview.isSelected(),
                        pq,
                        Integer.valueOf(jSpinnerCopies.getValue().toString()),
                        checkBoxIncHeaderText.isSelected());
                  }
                } else {
                  JUtility.errorBeep();
                  JOptionPane.showMessageDialog(
                      Common.mainForm,
                      pal.getErrorMessage(),
                      lang.get("dlg_Error"),
                      JOptionPane.WARNING_MESSAGE);
                }
              }
            });

        jDesktopPane1.add(jButtonSplit);
        jButtonSplit.setText(lang.get("btn_Split"));
        jButtonSplit.setMnemonic(lang.getMnemonicChar());
        jButtonSplit.setBounds(151, 205, 111, 28);

        jButtonHelp = new JButton4j(Common.icon_help);
        jDesktopPane1.add(jButtonHelp);
        jButtonHelp.setText(lang.get("btn_Help"));
        jButtonHelp.setMnemonic(lang.getMnemonicChar());
        jButtonHelp.setBounds(265, 205, 111, 28);

        jButtonCancel = new JButton4j(Common.icon_close);
        jDesktopPane1.add(jButtonCancel);
        jButtonCancel.setText(lang.get("btn_Close"));
        jButtonCancel.setMnemonic(lang.getMnemonicChar());
        jButtonCancel.setBounds(378, 205, 111, 28);
        jButtonCancel.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                dispose();
              }
            });

        labelSSCC = new JLabel4j_std();
        jDesktopPane1.add(labelSSCC);
        labelSSCC.setText(lang.get("lbl_Source_SSCC"));
        labelSSCC.setBounds(6, 24, 103, 21);
        labelSSCC.setHorizontalAlignment(SwingConstants.TRAILING);

        labelNewSSCC = new JLabel4j_std();
        jDesktopPane1.add(labelNewSSCC);
        labelNewSSCC.setText(lang.get("lbl_Destination_SSCC"));
        labelNewSSCC.setBounds(18, 53, 91, 21);
        labelNewSSCC.setHorizontalAlignment(SwingConstants.TRAILING);

        JLabel4j_std labelHeader = new JLabel4j_std();
        labelHeader.setHorizontalAlignment(SwingConstants.TRAILING);
        labelHeader.setText(lang.get("lbl_Label_Header_Text"));
        labelHeader.setBounds(18, 112, 91, 21);
        jDesktopPane1.add(labelHeader);

        checkBoxIncHeaderText.setText("New JCheckBox");
        checkBoxIncHeaderText.setSelected(true);
        checkBoxIncHeaderText.setBackground(Color.WHITE);
        checkBoxIncHeaderText.setBounds(121, 112, 21, 21);
        jDesktopPane1.add(checkBoxIncHeaderText);

        JLabel4j_std labelQuantity = new JLabel4j_std();
        labelQuantity.setBounds(248, 112, 182, 21);
        labelQuantity.setHorizontalAlignment(SwingConstants.RIGHT);
        labelQuantity.setText(lang.get("lbl_Number_of_SSCCs"));
        jDesktopPane1.add(labelQuantity);

        JLabel4j_std labelCopies = new JLabel4j_std();
        labelCopies.setHorizontalAlignment(SwingConstants.RIGHT);
        labelCopies.setBounds(248, 141, 182, 21);
        labelCopies.setText(lang.get("lbl_Labels_Per_SSCC"));
        jDesktopPane1.add(labelCopies);

        jSpinnerQuantity.setEnabled(false);
        jSpinnerQuantity.setModel(
            new SpinnerNumberModel(new Integer(1), null, null, new Integer(1)));
        jSpinnerQuantity.setFont(Common.font_std);
        jSpinnerQuantity.setBounds(437, 112, 39, 21);
        JSpinner.NumberEditor ne = new JSpinner.NumberEditor(jSpinnerQuantity);
        ne.getTextField().setFont(Common.font_std);
        jSpinnerQuantity.setEditor(ne);
        jDesktopPane1.add(jSpinnerQuantity);

        jSpinnerCopies.setFont(Common.font_std);
        jSpinnerCopies.setBounds(437, 141, 39, 21);
        jSpinnerCopies.setInputVerifier(null);
        jSpinnerCopies.setModel(copiesnumbermodel);
        JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerCopies);
        nec2.getTextField().setFont(Common.font_std);
        jSpinnerCopies.setEditor(nec2);
        jDesktopPane1.add(jSpinnerCopies);

        JLabel4j_std label_3 = new JLabel4j_std(lang.get("lbl_Print_Queue"));
        label_3.setHorizontalAlignment(SwingConstants.TRAILING);
        label_3.setBounds(18, 174, 91, 21);
        jDesktopPane1.add(label_3);

        comboBoxPrintQueue.setSelectedIndex(-1);
        comboBoxPrintQueue.setBounds(121, 170, 471, 23);
        jDesktopPane1.add(comboBoxPrintQueue);

        jCheckBoxAutoPreview = new JCheckBox();
        jCheckBoxAutoPreview.setToolTipText("Auto SSCC");
        jCheckBoxAutoPreview.setText("New JCheckBox");
        jCheckBoxAutoPreview.setSelected(true);
        jCheckBoxAutoPreview.setEnabled(false);
        jCheckBoxAutoPreview.setBackground(Color.WHITE);
        jCheckBoxAutoPreview.setBounds(121, 141, 21, 21);
        jCheckBoxAutoPreview.setEnabled(
            Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_PRODDEC_PREVIEW"));
        jDesktopPane1.add(jCheckBoxAutoPreview);

        labelPreview = new JLabel4j_std();
        labelPreview.setBounds(18, 141, 91, 21);
        labelPreview.setHorizontalTextPosition(SwingConstants.CENTER);
        labelPreview.setHorizontalAlignment(SwingConstants.TRAILING);
        labelPreview.setText(lang.get("lbl_Preview"));
        jDesktopPane1.add(labelPreview);

        lblStatus.setForeground(Color.RED);
        lblStatus.setBackground(Color.GRAY);
        lblStatus.setBounds(2, 235, 610, 21);
        jDesktopPane1.add(lblStatus);

        JPanel panel = new JPanel();
        panel.setBackground(Color.WHITE);
        panel.setBorder(
            new TitledBorder(
                null, lang.get("btn_Print"), TitledBorder.CENTER, TitledBorder.TOP, null, null));
        panel.setBounds(270, 6, 90, 75);
        jDesktopPane1.add(panel);
        panel.setLayout(null);

        checkBoxPrintOldSSCC.setSelected(true);
        checkBoxPrintOldSSCC.setBounds(32, 17, 28, 23);
        panel.add(checkBoxPrintOldSSCC);

        checkBoxPrintNewSSCC.setSelected(true);
        checkBoxPrintNewSSCC.setBounds(32, 46, 28, 23);
        panel.add(checkBoxPrintNewSSCC);

        mod.setModuleId("RPT_PALLET_LABEL");
        mod.getModuleProperties();

        if (mod.getReportType().equals("Label")) {
          jCheckBoxAutoPreview.setSelected(false);
          jCheckBoxAutoPreview.setEnabled(false);

        } else {
          jSpinnerCopies.setVisible(false);
          labelCopies.setVisible(false);
        }
        populatePrinterList(JPrint.getDefaultPrinterQueueName());
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  private void initGUI() {
    try {
      this.setPreferredSize(new java.awt.Dimension(538, 440));
      this.setBounds(0, 0, 526 + Common.LFAdjustWidth, 459 + Common.LFAdjustHeight);
      setVisible(true);

      this.setClosable(true);
      this.setIconifiable(true);
      {
        jDesktopPane1 = new JDesktopPane();
        jDesktopPane1.setBackground(Color.WHITE);
        this.getContentPane().add(jDesktopPane1, BorderLayout.NORTH);
        jDesktopPane1.setPreferredSize(new Dimension(536, 415));
        {
          jScrollPaneAssigned = new JScrollPane();
          jDesktopPane1.add(jScrollPaneAssigned);
          jScrollPaneAssigned.setBounds(10, 25, 220, 340);
          jScrollPaneAssigned.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
          {
            ListModel jListAssignedModel =
                new DefaultComboBoxModel(new String[] {"Item One", "Item Two"});
            jListAssigned = new JDBModuleJList(Common.selectedHostID, Common.sessionID);
            jScrollPaneAssigned.setViewportView(jListAssigned);

            jListAssigned.setBackground(Common.color_list_assigned);
            jListAssigned.setCellRenderer(Common.renderer_list_assigned);
            jListAssigned.setModel(jListAssignedModel);
          }
        }
        {
          jScrollPaneUnAssigned = new JScrollPane();
          jDesktopPane1.add(jScrollPaneUnAssigned);
          jScrollPaneUnAssigned.setBounds(272, 25, 220, 340);
          jScrollPaneUnAssigned.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
          {
            ListModel jListUnAssignedModel =
                new DefaultComboBoxModel(new String[] {"Item One", "Item Two"});
            jListUnAssigned = new JDBModuleJList(Common.selectedHostID, Common.sessionID);
            jScrollPaneUnAssigned.setViewportView(jListUnAssigned);
            jListUnAssigned.setBackground(Common.color_list_unassigned);
            jListUnAssigned.setCellRenderer(Common.renderer_list_unassigned);
            jListUnAssigned.setModel(jListUnAssignedModel);
          }
        }
        {
          jButtonAssign = new JButton4j(Common.icon_arrow_left);
          jDesktopPane1.add(jButtonAssign);
          jButtonAssign.setBounds(238, 133, 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(238, 168, 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(238, 100, 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(238, 205, 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(369, 373, 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(258, 373, 110, 30);
          jButtonHelp.setMnemonic(lang.getMnemonicChar());
        }
        {
          jButtonSave = new JButton4j(Common.icon_update);
          jDesktopPane1.add(jButtonSave);
          jButtonSave.setText(lang.get("btn_Save"));
          jButtonSave.setBounds(30, 373, 112, 30);
          jButtonSave.setEnabled(false);
          jButtonSave.setMnemonic(lang.getMnemonicChar());
          jButtonSave.addActionListener(
              new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                  JDBRFMenu t = new JDBRFMenu(Common.selectedHostID, Common.sessionID);
                  t.rewriteRFMenu(assignedList);
                  jButtonSave.setEnabled(false);
                  jButtonUndo.setEnabled(false);
                }
              });
        }
        {
          jButtonUndo = new JButton4j(Common.icon_undo);
          jDesktopPane1.add(jButtonUndo);
          jButtonUndo.setText(lang.get("btn_Undo"));
          jButtonUndo.setBounds(145, 373, 112, 30);
          jButtonUndo.setEnabled(false);
          jButtonUndo.setMnemonic(lang.getMnemonicChar());
          jButtonUndo.addActionListener(
              new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                  populateAssignedList();
                  populateUnAssignedList();
                  jButtonSave.setEnabled(false);
                  jButtonUndo.setEnabled(false);
                }
              });
        }
        {
          jLabel1 = new JLabel4j_title();
          jDesktopPane1.add(jLabel1);
          jLabel1.setText(lang.get("lbl_Assigned"));
          jLabel1.setBounds(10, 5, 208, 18);
          jLabel1.setFont(Common.font_title);
        }
        {
          jLabel2 = new JLabel4j_title();
          jDesktopPane1.add(jLabel2);
          jLabel2.setText(lang.get("lbl_Unassigned"));
          jLabel2.setBounds(272, 4, 154, 18);
          jLabel2.setFont(Common.font_title);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }