Package javax.swing.text

Examples of javax.swing.text.AbstractDocument


          jTextFieldMaterial.setEnabled(false);
          jTextFieldMaterial.setBounds(172, 9, 146, 21);
        }
        {
          jTextFieldDescription = new JTextField4j();
          AbstractDocument doc = (AbstractDocument) jTextFieldDescription.getDocument();
          doc.setDocumentFilter(new JFixedSizeFilter(80));
          jDesktopPane1.add(jTextFieldDescription);
          jTextFieldDescription.setBounds(172, 38, 288, 21);
          jTextFieldDescription.addKeyListener(new KeyAdapter() {
            public void keyTyped(KeyEvent evt) {
              jButtonSave.setEnabled(true);
            }
          });
        }
        {
          jButtonSave = new JButton4j(Common.icon_save);
          jDesktopPane1.add(jButtonSave);
          jButtonSave.setEnabled(false);
          jButtonSave.setText(lang.get("btn_Save"));
          jButtonSave.setMnemonic(lang.getMnemonicChar());
          jButtonSave.setBounds(54, 495, 112, 28);
          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);
              }
              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(176, 495, 112, 28);
        }
        {
          jButtonCancel = new JButton4j(Common.icon_close);
          jDesktopPane1.add(jButtonCancel);
          jButtonCancel.setText(lang.get("btn_Close"));
          jButtonCancel.setMnemonic(lang.getMnemonicChar());
          jButtonCancel.setBounds(300, 495, 112, 28);
          jButtonCancel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              dispose();
            }
          });
        }
        {
          ComboBoxModel jComboBoxBaseUOMModel = new DefaultComboBoxModel(uomList);
          jComboBoxBaseUOM = new JComboBox4j();
          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 jComboBoxMaterialTypeModel = new DefaultComboBoxModel(typeList);
          jComboBoxMaterialType = new JComboBox4j();
          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 jComboBoxShelfLifeUOMModel = new DefaultComboBoxModel(shelfLifeUomList);
          jComboBoxShelfLifeUOM = new JComboBox4j();
          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 jComboBoxRoundingRuleModel = new DefaultComboBoxModel(shelfLifeRule);
          jComboBoxRoundingRule = new JComboBox4j();
          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);
View Full Code Here


        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)
          {
View Full Code Here

      jPanelProcessOrder.setBorder(BorderFactory.createTitledBorder(lang.get("lbl_Process_Order")));
      jPanelProcessOrder.setLayout(null);
      jPanelProcessOrder.setBackground(Common.color_app_window);
      jTextFieldProcessOrder = new JTextField4j();
      jPanelProcessOrder.add(jTextFieldProcessOrder);
      AbstractDocument doc = (AbstractDocument) jTextFieldProcessOrder.getDocument();
      doc.setDocumentFilter(new JFixedSizeFilter(JDBProcessOrder.field_process_order));
      jTextFieldProcessOrder.setBounds(161, 21, 119, 21);
      jTextFieldProcessOrder.addKeyListener(new KeyAdapter()
      {
        public void keyReleased(KeyEvent evt)
        {
          processOrderChanged(jTextFieldProcessOrder.getText());
        }
      });

      jLabelProcessOrder = new JLabel4j_std();
      jPanelProcessOrder.add(jLabelProcessOrder);
      jLabelProcessOrder.setText(lang.get("lbl_Process_Order"));
      jLabelProcessOrder.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelProcessOrder.setBounds(12, 21, 142, 21);
      jTextFieldProcessOrderDescription = new JTextField4j();
      jPanelProcessOrder.add(jTextFieldProcessOrderDescription);
      jTextFieldProcessOrderDescription.setBounds(449, 21, 287, 21);
      jTextFieldProcessOrderDescription.setEditable(false);
      jTextFieldProcessOrderDescription.setEnabled(false);
      jLabelOrderDescription = new JLabel4j_std();
      jPanelProcessOrder.add(jLabelOrderDescription);
      jLabelOrderDescription.setText(lang.get("lbl_Description"));
      jLabelOrderDescription.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelOrderDescription.setBounds(306, 21, 136, 21);
      jLabelOrderStatus = new JLabel4j_std();
      jPanelProcessOrder.add(jLabelOrderStatus);
      jLabelOrderStatus.setText(lang.get("lbl_Process_Order_Status"));
      jLabelOrderStatus.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelOrderStatus.setBounds(290, 49, 152, 21);
      jSpinnerDueDate = new JDateControl();
      jPanelProcessOrder.add(jSpinnerDueDate);
      jSpinnerDueDate.setEnabled(false);
      jSpinnerDueDate.setBounds(161, 49, 137, 21);
      jSpinnerDueDate.getEditor().setOpaque(true);
      jSpinnerDueDate.setForeground(new java.awt.Color(238, 238, 238));
      jLabelDueDate = new JLabel4j_std();
      jPanelProcessOrder.add(jLabelDueDate);
      jLabelDueDate.setText(lang.get("lbl_Process_Order_Due_Date"));
      jLabelDueDate.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelDueDate.setBounds(12, 49, 142, 21);
      jTextFieldProcessOrderStatus = new JTextField4j();
      jPanelProcessOrder.add(jTextFieldProcessOrderStatus);
      jTextFieldProcessOrderStatus.setBounds(449, 49, 126, 21);
      jTextFieldProcessOrderStatus.setEditable(false);
      jTextFieldProcessOrderStatus.setEnabled(false);
      jTextFieldRecipe = new JTextField4j();
      jPanelProcessOrder.add(jTextFieldRecipe);
      jTextFieldRecipe.setBounds(161, 77, 139, 21);
      jTextFieldRecipe.setEditable(false);
      jTextFieldRecipe.setEnabled(false);
      jLabelRecipe = new JLabel4j_std();
      jPanelProcessOrder.add(jLabelRecipe);
      jLabelRecipe.setText(lang.get("lbl_Process_Order_Recipe"));
      jLabelRecipe.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelRecipe.setBounds(12, 77, 142, 21);
      jTextFieldLocation = new JTextField4j();
      jPanelProcessOrder.add(jTextFieldLocation);
      jTextFieldLocation.setBounds(449, 77, 126, 21);
      jTextFieldLocation.setEditable(false);
      jTextFieldLocation.setEnabled(false);
      jLabelLocation = new JLabel4j_std();
      jPanelProcessOrder.add(jLabelLocation);
      jLabelLocation.setText(lang.get("lbl_Location_ID"));
      jLabelLocation.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelLocation.setBounds(290, 77, 152, 21);
      jButtonPOLookup = new JButton4j(Common.icon_lookup);
      jPanelProcessOrder.add(jButtonPOLookup);
      jButtonPOLookup.setBounds(280, 21, 20, 20);
      jButtonPOLookup.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent evt)
        {
          JLaunchLookup.dlgCriteriaDefault = "Ready";
          JLaunchLookup.dlgAutoExec = true;

          if (JLaunchLookup.processOrders())
          {
            String po = JLaunchLookup.dlgResult;
            processOrderChanged(po);
          }
        }
      });

      jPanelMaterial = new JPanel();
      jPanelMaterial.setBackground(Common.color_app_window);
      jDesktopPane1.add(jPanelMaterial);
      jPanelMaterial.setBounds(7, 119, 748, 112);
      jPanelMaterial.setBorder(BorderFactory.createTitledBorder(lang.get("lbl_Material")));
      jPanelMaterial.setLayout(null);
      jPanelMaterial.setFont(Common.font_title);
      jTextFieldMaterial = new JTextField4j();
      jPanelMaterial.add(jTextFieldMaterial);
      jTextFieldMaterial.setBounds(161, 21, 128, 21);
      jTextFieldMaterial.setEditable(false);
      jTextFieldMaterial.setEnabled(false);
      jLabelMaterial = new JLabel4j_std();
      jPanelMaterial.add(jLabelMaterial);
      jLabelMaterial.setText(lang.get("lbl_Material"));
      jLabelMaterial.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelMaterial.setBounds(12, 21, 142, 21);
      jTextFieldMaterialDescription = new JTextField4j();
      jPanelMaterial.add(jTextFieldMaterialDescription);
      jTextFieldMaterialDescription.setBounds(449, 21, 287, 21);
      jTextFieldMaterialDescription.setEditable(false);
      jTextFieldMaterialDescription.setEnabled(false);
      jLabelDescription = new JLabel4j_std();
      jPanelMaterial.add(jLabelDescription);
      jLabelDescription.setText(lang.get("lbl_Description"));
      jLabelDescription.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelDescription.setBounds(291, 21, 151, 21);
      jSpinnerShelfLife = new JSpinner();
      jPanelMaterial.add(jSpinnerShelfLife);
      jSpinnerShelfLife.setModel(shelflifenumbermodel);
      JSpinner.NumberEditor nec = new JSpinner.NumberEditor(jSpinnerShelfLife);
      nec.getTextField().setFont(Common.font_std);
      jSpinnerShelfLife.setEditor(nec);
      jSpinnerShelfLife.setBounds(161, 49, 63, 21);
      jSpinnerShelfLife.setEnabled(false);
      jTextFieldShelfLifeRoundingRule = new JTextField4j();
      jPanelMaterial.add(jTextFieldShelfLifeRoundingRule);
      jTextFieldShelfLifeRoundingRule.setBounds(638, 49, 98, 21);
      jTextFieldShelfLifeRoundingRule.setEditable(false);
      jTextFieldShelfLifeRoundingRule.setEnabled(false);
      jLabelRounding = new JLabel4j_std();
      jPanelMaterial.add(jLabelRounding);
      jLabelRounding.setText(lang.get("lbl_Material_Shelf_Life_Rounding_Rule"));
      jLabelRounding.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelRounding.setBounds(546, 49, 85, 21);
      jTextFieldShelfLifeUOM = new JTextField4j();
      jPanelMaterial.add(jTextFieldShelfLifeUOM);
      jTextFieldShelfLifeUOM.setBounds(449, 49, 91, 21);
      jTextFieldShelfLifeUOM.setEditable(false);
      jTextFieldShelfLifeUOM.setEnabled(false);
      jLabel1ShelfLifeUOM = new JLabel4j_std();
      jPanelMaterial.add(jLabel1ShelfLifeUOM);
      jLabel1ShelfLifeUOM.setText(lang.get("lbl_Material_Shelf_Life_UOM"));
      jLabel1ShelfLifeUOM.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabel1ShelfLifeUOM.setBounds(281, 49, 161, 21);
      jLabelShelfLife = new JLabel4j_std();
      jPanelMaterial.add(jLabelShelfLife);
      jLabelShelfLife.setText(lang.get("lbl_Material_Shelf_Life"));
      jLabelShelfLife.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelShelfLife.setBounds(12, 49, 142, 21);
      jTextFieldLegacyCode = new JTextField4j();
      jPanelMaterial.add(jTextFieldLegacyCode);
      jTextFieldLegacyCode.setBounds(161, 77, 128, 21);
      jTextFieldLegacyCode.setEditable(false);
      jTextFieldLegacyCode.setEnabled(false);
      jLabelLegacyCode = new JLabel4j_std();
      jPanelMaterial.add(jLabelLegacyCode);
      jLabelLegacyCode.setText(lang.get("lbl_Material_Legacy_Code"));
      jLabelLegacyCode.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelLegacyCode.setBounds(12, 77, 142, 21);
      jPanelLabel = new JPanel();
      jDesktopPane1.add(jPanelLabel);
      jPanelLabel.setBounds(7, 231, 748, 136);
      jPanelLabel.setBorder(BorderFactory.createTitledBorder(null, lang.get("btn_Label"), TitledBorder.LEADING, TitledBorder.TOP));
      jPanelLabel.setLayout(null);
      jPanelLabel.setFont(Common.font_std);
      jPanelLabel.setBackground(Common.color_app_window);
      comboBoxPrintQueue = new JComboBox4j<String>();
      comboBoxPrintQueue.setBounds(115, 436, 621, 23);
      jDesktopPane1.add(comboBoxPrintQueue);
      jSpinnerProductionDate = new JDateControl();
      jPanelLabel.add(jSpinnerProductionDate);
      jSpinnerProductionDate.setFont(new java.awt.Font("Dialog", 0, 12));
      jSpinnerProductionDate.setBounds(176, 21, 136, 21);
      jSpinnerProductionDate.getEditor().addKeyListener(new KeyAdapter()
      {
        public void keyPressed(KeyEvent e)
        {
          calcBBEBatch();
        }
      });

      jSpinnerProductionDate.addChangeListener(new ChangeListener()
      {
        public void stateChanged(final ChangeEvent e)
        {
          calcBBEBatch();
        }
      });

      try
      {
        jSpinnerProductionDate.setDate(JUtility.getSQLDate());
        jSpinnerProductionDate.setEnabled(false);
      } catch (Exception e)
      {
      }

      jLabelProductionDate = new JLabel4j_std();
      jPanelLabel.add(jLabelProductionDate);
      jLabelProductionDate.setText(lang.get("lbl_Pallet_DOM"));
      jLabelProductionDate.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelProductionDate.setBounds(46, 21, 108, 21);

      jFormattedTextFieldBaseUOMQuantity = new JQuantityInput(new BigDecimal("0"));
      jFormattedTextFieldBaseUOMQuantity.setEditable(false);
      jPanelLabel.add(jFormattedTextFieldBaseUOMQuantity);
      jFormattedTextFieldBaseUOMQuantity.setFont(Common.font_std);
      jFormattedTextFieldBaseUOMQuantity.setBounds(349, 85, 94, 21);
      jFormattedTextFieldBaseUOMQuantity.setValue(0);
      jFormattedTextFieldBaseUOMQuantity.setEnabled(false);
      jFormattedTextFieldBaseUOMQuantity.setHorizontalAlignment(SwingConstants.TRAILING);

      jFormattedTextFieldRequiredUOMQuantity = new JQuantityInput(new BigDecimal("0"));
      jFormattedTextFieldRequiredUOMQuantity.setEditable(false);
      jFormattedTextFieldRequiredUOMQuantity.addPropertyChangeListener(new PropertyChangeListener()
      {
        public void propertyChange(PropertyChangeEvent arg0)
        {
          Color background = Color.WHITE;

          try
          {
            if (jTextFieldProcessOrder.getText().equals("") == false)
            {
              BigDecimal newval = new BigDecimal(jFormattedTextFieldRequiredUOMQuantity.getValue().toString());
              int res = newval.compareTo(new BigDecimal(0));
              if (res == 0)
              {
                background = Color.YELLOW;
              }
            }
          } catch (Exception e)
          {
            background = Color.YELLOW;
          }
          jFormattedTextFieldRequiredUOMQuantity.setBackground(background);
        }
      });

      jPanelLabel.add(jFormattedTextFieldRequiredUOMQuantity);
      jFormattedTextFieldRequiredUOMQuantity.setFont(Common.font_std);
      jFormattedTextFieldRequiredUOMQuantity.setBounds(349, 52, 94, 21);
      jFormattedTextFieldRequiredUOMQuantity.setValue(0);
      jFormattedTextFieldRequiredUOMQuantity.setEnabled(false);
      jFormattedTextFieldRequiredUOMQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
      jFormattedTextFieldRequiredUOMQuantity.addKeyListener(new KeyAdapter()
      {
        public void keyReleased(KeyEvent evt)
        {
          pallet.setUom(jTextFieldRequiredUom.getText());
          pallet.setQuantity(JUtility.stringToBigDecimal(jFormattedTextFieldRequiredUOMQuantity.getText().toString()));
        }
      });

      jTextFieldRequiredUom = new JTextField4j();
      jTextFieldRequiredUom.setHorizontalAlignment(SwingConstants.CENTER);
      jPanelLabel.add(jTextFieldRequiredUom);
      jTextFieldRequiredUom.setBounds(462, 85, 56, 21);
      jTextFieldRequiredUom.setEditable(false);
      jTextFieldRequiredUom.setEnabled(false);

      jTextFieldBaseUom = new JTextField4j();
      jTextFieldBaseUom.setHorizontalAlignment(SwingConstants.CENTER);
      jPanelLabel.add(jTextFieldBaseUom);
      jTextFieldBaseUom.setBounds(462, 52, 56, 21);
      jTextFieldBaseUom.setEditable(false);
      jTextFieldBaseUom.setEnabled(false);

      jCheckBoxDOMOverride = new JCheckBox4j();
      jPanelLabel.add(jCheckBoxDOMOverride);
      jCheckBoxDOMOverride.setBackground(new java.awt.Color(255, 255, 255));
      jCheckBoxDOMOverride.setBounds(153, 21, 21, 21);
      jCheckBoxDOMOverride.setEnabled(false);
      jCheckBoxDOMOverride.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent evt)
        {
          enableField(jSpinnerProductionDate, jCheckBoxDOMOverride.isSelected());
          enableField(calendarButtonjSpinnerProductionDate, jCheckBoxDOMOverride.isSelected());
        }
      });

      calendarButtonjSpinnerProductionDate = new JCalendarButton(jSpinnerProductionDate);
      calendarButtonjSpinnerProductionDate.setEnabled(false);
      calendarButtonjSpinnerProductionDate.setBounds(308, 21, 21, 21);
      jPanelLabel.add(calendarButtonjSpinnerProductionDate);
      jLabelBatch = new JLabel4j_std();
      jPanelLabel.add(jLabelBatch);
      jLabelBatch.setText(lang.get("lbl_Material_Batch"));
      jLabelBatch.setHorizontalAlignment(SwingConstants.TRAILING);
      jLabelBatch.setBounds(46, 85, 108, 21);
      jTextFieldBatchPrefix = new JTextField4j();
      jPanelLabel.add(jTextFieldBatchPrefix);
      AbstractDocument doc2 = (AbstractDocument) jTextFieldBatchPrefix.getDocument();
      doc2.setDocumentFilter(new JFixedSizeFilter(JDBMaterialBatch.field_batch_number));
      jTextFieldBatchPrefix.setBounds(176, 85, 108, 21);
      jTextFieldBatchPrefix.setEnabled(false);
      jSpinnerExpiryDate = new JDateControl();
      jSpinnerExpiryDate.addFocusListener(new FocusAdapter()
      {
View Full Code Here

          jTextFieldUOM.setBounds(165, 34, 60, 21);
          jTextFieldUOM.setEnabled(false);
        }
        {
          jTextFieldEAN = new JTextField4j();
          AbstractDocument doc = (AbstractDocument) jTextFieldEAN.getDocument();
          doc.setDocumentFilter(new JFixedSizeFilter(JDBMaterialUom.field_ean));
          jDesktopPane1.add(jTextFieldEAN);
          jTextFieldEAN.setPreferredSize(new java.awt.Dimension(40, 20));
          jTextFieldEAN.setFocusCycleRoot(true);
          jTextFieldEAN.setBounds(165, 59, 175, 21);
          jTextFieldEAN.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {

              jButtonUpdate.setEnabled(true);
            }
          });
        }
        {
          jTextFieldVariant = new JTextField4j();
          AbstractDocument doc = (AbstractDocument) jTextFieldVariant.getDocument();
          doc.setDocumentFilter(new JFixedSizeFilter(JDBMaterialUom.field_variant));
          jDesktopPane1.add(jTextFieldVariant);
          jTextFieldVariant.setPreferredSize(new java.awt.Dimension(40, 20));
          jTextFieldVariant.setFocusCycleRoot(true);
          jTextFieldVariant.setBounds(165, 83, 34, 21);
          jTextFieldVariant.addKeyListener(new KeyAdapter()
View Full Code Here

     * paragraph element.
     */
    public static final Element getParagraphElement(final Document doc,
                                                    final int p) {
        if (doc instanceof AbstractDocument) {
            AbstractDocument abstrDoc = (AbstractDocument) doc;
            abstrDoc.readLock();
            Element elem = null;
            int length = 0;
            boolean incorrectPosition = false;
            try {
                length = doc.getLength();
                incorrectPosition = (p < 0 || p > length)
                        && (doc instanceof PlainDocument);
                if (!incorrectPosition) {
                    elem = abstrDoc.getParagraphElement(p);
                }
            } finally {
                abstrDoc.readUnlock();
            }
            return elem;
        }

        Element root = doc.getDefaultRootElement();
View Full Code Here

     * paragraph element.
     */
    public static final Element getParagraphElement(final Document doc,
                                                    final int p) {
        if (doc instanceof AbstractDocument) {
            AbstractDocument abstrDoc = (AbstractDocument) doc;
            abstrDoc.readLock();
            Element elem = null;
            int length = 0;
            boolean incorrectPosition = false;
            try {
                length = doc.getLength();
                incorrectPosition = (p < 0 || p > length)
                        && (doc instanceof PlainDocument);
                if (!incorrectPosition) {
                    elem = abstrDoc.getParagraphElement(p);
                }
            } finally {
                abstrDoc.readUnlock();
            }
            return elem;
        }

        Element root = doc.getDefaultRootElement();
View Full Code Here

       
        getRootPane().setDefaultButton(ok);
       
        final Document doc = field.getDocument();
        if (doc instanceof AbstractDocument) {
          AbstractDocument ad = (AbstractDocument) doc;
          ad.setDocumentFilter(new DocumentFilter() {
            @Override
            public void insertString(FilterBypass bypass, int offset,
                String str, AttributeSet attr)
                throws BadLocationException {
              if (doc.getLength() + str.length() < 2 && !str.trim().isEmpty()) {
View Full Code Here

   
     final JFormattedTextField myTextField = ((NumberEditor) spinner
              .getEditor()).getTextField();
     final Document doc = myTextField.getDocument();
     if (doc instanceof PlainDocument) {
       AbstractDocument abstractDoc = new PlainDocument() {

                 /**
         *
         */
        private static final long serialVersionUID = 6648357467446359739L;

        @Override
                 public void setDocumentFilter(DocumentFilter filter) {
                     if (filter instanceof NumberFilter) {
                         super.setDocumentFilter(filter);
                     }
                 }
             };
             abstractDoc.setDocumentFilter(new NumberFilter());
             try {
        abstractDoc.insertString(0, spinner.getValue().toString(), null);
      } catch (BadLocationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
             myTextField.setDocument(abstractDoc);
View Full Code Here

    {
        DocumentListener[] docListeners = (DocumentListener[])in.readObject();
        if (docListeners != null && docListeners.length > 0)
        {
            ItsNatHTMLFormTextComponentInternal comp = getItsNatHTMLFormTextComponentInternal();
            AbstractDocument dataModel = (AbstractDocument)comp.getDocument();
            if (dataModel.getDocumentListeners().length == 0)
            {
                // Persiste el bug, no ha sido arreglado pues hemos salvado alg�n listener
                for(int i = 0; i < docListeners.length; i++)
                {
                    DocumentListener listener = docListeners[i];
                    dataModel.addDocumentListener(listener);
                }
            }
        }
        UndoableEditListener[] undoListeners = (UndoableEditListener[])in.readObject();
        if (undoListeners != null && undoListeners.length > 0)
        {
            ItsNatHTMLFormTextComponentInternal comp = getItsNatHTMLFormTextComponentInternal();
            AbstractDocument dataModel = (AbstractDocument)comp.getDocument();
            if (dataModel.getUndoableEditListeners().length == 0)
            {
                // Persiste el bug, no ha sido arreglado pues hemos salvado alg�n listener
                for(int i = 0; i < undoListeners.length; i++)
                {
                    UndoableEditListener listener = undoListeners[i];
                    dataModel.addUndoableEditListener(listener);
                }
            }
        }
    }
View Full Code Here

        assertEquals(new Dimension(1 * jta.getColumnWidth(), jta.getPreferredSize().height),
                jta.getPreferredScrollableViewportSize());
    }

    public void testGetLineStartEndOffset() {
        AbstractDocument doc = (AbstractDocument) jta.getDocument();
        int count = jta.getLineCount();
        doc.readLock();
        Element root = doc.getDefaultRootElement();
        for (int j = 0; j < count; j++) {
            Element currentElement = root.getElement(j);
            try {
                assertEquals(currentElement.getStartOffset(), jta.getLineStartOffset(j));
                int end = currentElement.getEndOffset();
                if (j == count - 1) {
                    end--;
                }
                assertEquals(end, jta.getLineEndOffset(j));
            } catch (BadLocationException e) {
            }
        }
        doc.readUnlock();
        try {
            jta.getLineStartOffset(count);
        } catch (BadLocationException e) {
            bWasException = true;
            message = e.getMessage();
View Full Code Here

TOP

Related Classes of javax.swing.text.AbstractDocument

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.