public WarehouseDetailFrame(WarehouseController controller) {
    try {
      jbInit();
      setSize(750, 450);
      setMinimumSize(new Dimension(750, 450));

      // link the parent grid to the current Form...
      HashSet pk = new HashSet();
      pk.add("companyCodeSys01WAR01");
      pk.add("warehouseCodeWAR01");
      warehouseForm.linkGrid(
          controller.getGridFrame().getGrid(), pk, true, true, true, navigatorBar);

      warehouseForm.setFormController(controller);

      CustomizedControls customizedControls =
          new CustomizedControls(tabbedPane, warehouseForm, new BigDecimal(462));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  /** Load data from server and construct panel content. */
  public final void reloadData(DocumentsFrame frame) {
    try {
      // remove all panel content...
      clearData();
      frame.getGrid().getOtherGridParams().put(ApplicationConsts.PROPERTIES_FILTER, filters);

      // retrieve customized input controls list...
      GridParams gridParams = new GridParams();
      DefaultMutableTreeNode node = frame.getHierarTreePanel().getSelectedNode();
      if (node != null) {
        HierarchyLevelVO vo = (HierarchyLevelVO) node.getUserObject();
        HierarchyLevelVO root =
            (HierarchyLevelVO) ((DefaultMutableTreeNode) node.getRoot()).getUserObject();
        gridParams
            .getOtherGridParams()
            .put(ApplicationConsts.PROGRESSIVE_HIE01, vo.getProgressiveHIE01());
        gridParams
            .getOtherGridParams()
            .put(ApplicationConsts.ROOT_PROGRESSIVE_HIE01, root.getProgressiveHIE01());
      } else gridParams.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_HIE01);
      gridParams
          .getOtherGridParams()
          .put(
              ApplicationConsts.PROGRESSIVE_HIE02,
              frame.getHierarTreePanel().getProgressiveHIE02());
      gridParams.getOtherGridParams().put(ApplicationConsts.LOAD_ANCIENTS, Boolean.TRUE);
      Response res = ClientUtils.getData("loadLevelProperties", gridParams);
      if (res.isError()) {
        JOptionPane.showMessageDialog(
            ClientUtils.getParentFrame(this),
            ClientSettings.getInstance().getResources().getResource("Error while loading data")
                + ":\n"
                + res.getErrorMessage(),
            ClientSettings.getInstance().getResources().getResource("Loading Data Error"),
            JOptionPane.ERROR_MESSAGE);
        return;
      }
      ArrayList rows = ((VOListResponse) res).getRows();
      if (rows.size() > 0) {
        // adding customized input controls...
        LevelPropertyVO inputControlInfo = null;
        int row = 0;
        int col = 0;
        LabelControl labelControl = null;
        TextControl textControl = null;
        DateControl dateControl = null;
        NumericControl numericControl = null;
        for (int i = 0; i < rows.size(); i++) {
          inputControlInfo = (LevelPropertyVO) rows.get(i);
          labelControl = new LabelControl();
          labelControl.setText(inputControlInfo.getDescriptionSYS10());
          innerPanel.add(
              labelControl,
              new GridBagConstraints(
                  col++,
                  row,
                  1,
                  1,
                  0.0,
                  0.0,
                  GridBagConstraints.WEST,
                  GridBagConstraints.NONE,
                  new Insets(5, 5, 5, 5),
                  0,
                  0));

          if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_TEXT)) {
            textControl = new TextControl();
            textControl.setMaxCharacters(255);
            textControl.setLinkLabel(labelControl);
            innerPanel.add(
                textControl,
                new GridBagConstraints(
                    col,
                    row,
                    1,
                    1,
                    1.0,
                    0.0,
                    GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL,
                    new Insets(5, 5, 5, 15),
                    0,
                    0));
            textControl.addFocusListener(new ControlFocusListener(inputControlInfo, textControl));
          } else if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_DATE)) {
            dateControl = new DateControl();
            dateControl.setLinkLabel(labelControl);
            innerPanel.add(
                dateControl,
                new GridBagConstraints(
                    col,
                    row,
                    1,
                    1,
                    1.0,
                    0.0,
                    GridBagConstraints.WEST,
                    GridBagConstraints.NONE,
                    new Insets(5, 5, 5, 15),
                    0,
                    0));
            dateControl.addFocusListener(new ControlFocusListener(inputControlInfo, dateControl));
          } else if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_NUM)) {
            numericControl = new NumericControl();
            numericControl.setDecimals(5);
            numericControl.setLinkLabel(labelControl);
            innerPanel.add(
                numericControl,
                new GridBagConstraints(
                    col,
                    row,
                    1,
                    1,
                    1.0,
                    0.0,
                    GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL,
                    new Insets(5, 5, 5, 15),
                    0,
                    0));
            numericControl.addFocusListener(
                new ControlFocusListener(inputControlInfo, numericControl));
          }

          col++;
          if (col >= 2) {
            innerPanel.add(
                new JPanel(),
                new GridBagConstraints(
                    col,
                    row,
                    1,
                    1,
                    1.0,
                    0.0,
                    GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL,
                    new Insets(5, 5, 5, 5),
                    0,
                    0));
            row++;
            col = 0;
          }
        }
        row++;
        innerPanel.add(
            new JPanel(),
            new GridBagConstraints(
                col,
                row,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5),
                0,
                0));

        innerPanel.add(
            new JPanel(),
            new GridBagConstraints(
                0,
                row,
                1,
                1,
                0.0,
                1.0,
                GridBagConstraints.WEST,
                GridBagConstraints.VERTICAL,
                new Insets(5, 5, 5, 5),
                0,
                0));
        this.revalidate();
        this.repaint();
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public OperationsGridFrame(GridController controller) {
    try {
      jbInit();
      setSize(750, 550);
      setMinimumSize(new Dimension(750, 550));

      operationsGridControl.setController(controller);
      operationsGridControl.setGridDataLocator(opGridDataLocator);
      opGridDataLocator.setServerMethodName("loadOperations");

      // task lookup...
      taskDataLocator.setGridMethodName("loadTasks");
      taskDataLocator.setValidationMethodName("validateTaskCode");
      colTaskCode.setLookupController(taskController);
      colTaskCode.setControllerMethodName("getTasksList");
      taskController.setLookupDataLocator(taskDataLocator);
      taskController.setFrameTitle("tasks");
      taskController.setLookupValueObjectClassName("org.jallinone.registers.task.java.TaskVO");
      taskController.addLookup2ParentLink("taskCodeREG07", "taskCodeReg07PRO04");
      taskController.addLookup2ParentLink("descriptionSYS10", "taskDescriptionSYS10");
      taskController.setAllColumnVisible(false);
      taskController.setVisibleColumn("taskCodeREG07", true);
      taskController.setVisibleColumn("descriptionSYS10", true);
      taskController.addLookupListener(
          new LookupListener() {

            public void codeValidated(boolean validated) {}

            public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {}

            public void beforeLookupAction(ValueObject parentVO) {
              OperationVO vo = (OperationVO) parentVO;
              taskDataLocator
                  .getLookupFrameParams()
                  .put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01PRO04());
              taskDataLocator
                  .getLookupValidationParameters()
                  .put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01PRO04());
            }

            public void forceValidate() {}
          });
      new CustomizedColumns(new BigDecimal(192), taskController);

      // machineries lookup...
      macDataLocator.setGridMethodName("loadMachineries");
      macDataLocator.setValidationMethodName("validateMachineryCode");
      colMachCode.setLookupController(macController);
      colMachCode.setControllerMethodName("getMachineriesList");
      macController.setLookupDataLocator(macDataLocator);
      macController.setFrameTitle("machineries");
      macController.setLookupValueObjectClassName(
          "org.jallinone.production.machineries.java.MachineryVO");
      macController.addLookup2ParentLink("machineryCodePRO03", "machineryCodePro03PRO04");
      macController.addLookup2ParentLink("descriptionSYS10", "machineryDescriptionSYS10");
      macController.setAllColumnVisible(false);
      macController.setVisibleColumn("machineryCodePRO03", true);
      macController.setVisibleColumn("descriptionSYS10", true);
      macController.addLookupListener(
          new LookupListener() {

            public void codeValidated(boolean validated) {}

            public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {}

            public void beforeLookupAction(ValueObject parentVO) {
              OperationVO vo = (OperationVO) parentVO;
              macDataLocator
                  .getLookupFrameParams()
                  .put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01PRO04());
              macDataLocator
                  .getLookupValidationParameters()
                  .put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01PRO04());
            }

            public void forceValidate() {}
          });

    } catch (Exception e) {
      e.printStackTrace();
    }
  }