Package org.openswing.swing.customvo.java

Examples of org.openswing.swing.customvo.java.CustomValueObject


        if (newValue==null)
          return true;

        if (pricesMatrix!=null) {
          CustomValueObject vo = (CustomValueObject)pricesMatrix.get(rowNumber);
          Object lastPrice = null;
          Object currentPrice = null;
          try {
            lastPrice = CustomValueObject.class.getMethod("getAttributeNameN"+(colNumber-1),new Class[0]).invoke(vo,new Object[0]);
          }
View Full Code Here


            return u1.getUsername().compareTo(u2.getUsername());
          }

        });
        List usersList = new ArrayList();
        CustomValueObject vo = null;
        for(int i=0;i<uList.length;i++) {
          vo = new CustomValueObject();
          vo.setAttributeNameS0(uList[i].getUsername());
          vo.setAttributeNameS1(uList[i].getName_1());
          vo.setAttributeNameS2(uList[i].getName_2());
          usersList.add(vo);
        }

        return new VOListResponse(usersList,false,usersList.size());
    } catch (Exception ex1) {
View Full Code Here

        if (newValue==null)
          return true;

        if (pricesMatrix!=null) {
          CustomValueObject vo = (CustomValueObject)pricesMatrix.get(rowNumber);
          Object lastPrice = null;
          Object currentPrice = null;
          try {
            lastPrice = CustomValueObject.class.getMethod("getAttributeNameN"+(colNumber-1),new Class[0]).invoke(vo,new Object[0]);
          }
View Full Code Here

        if (newValue==null)
          return true;

        if (pricesMatrix!=null) {
          CustomValueObject vo = (CustomValueObject)pricesMatrix.get(rowNumber);
          Object lastPrice = null;
          Object currentPrice = null;
          try {
            lastPrice = CustomValueObject.class.getMethod("getAttributeNameN"+(colNumber-1),new Class[0]).invoke(vo,new Object[0]);
          }
View Full Code Here

        if (newValue==null)
          return true;

        if (pricesMatrix!=null) {
          CustomValueObject vo = (CustomValueObject)pricesMatrix.get(rowNumber);
          Object lastPrice = null;
          Object currentPrice = null;
          try {
            lastPrice = CustomValueObject.class.getMethod("getAttributeNameN"+(colNumber-1),new Class[0]).invoke(vo,new Object[0]);
          }
View Full Code Here

        if (newValue==null)
          return true;

        if (pricesMatrix!=null) {
          CustomValueObject vo = (CustomValueObject)pricesMatrix.get(rowNumber);
          Object lastPrice = null;
          Object currentPrice = null;
          try {
            lastPrice = CustomValueObject.class.getMethod("getAttributeNameN"+(colNumber-1),new Class[0]).invoke(vo,new Object[0]);
          }
View Full Code Here


      // convert the records list in matrix format...
      ArrayList matrixRows = new ArrayList();
      SupplierVariantsPriceVO vo = null;
      CustomValueObject customVO = null;
      VariantsMatrixRowVO rowVO = null;
      VariantsMatrixColumnVO colVO = null;
      HashMap indexes = new HashMap();
      int cols = matrixVO.getColumnDescriptors().length==0?1:matrixVO.getColumnDescriptors().length;
      for(int i=0;i<matrixVO.getRowDescriptors().length;i++) {
        rowVO = (VariantsMatrixRowVO)matrixVO.getRowDescriptors()[i];

        customVO = new CustomValueObject();
        customVO.setAttributeNameS0(rowVO.getRowDescription());
        matrixRows.add(customVO);
        indexes.put(
          VariantsMatrixUtils.getVariantType(matrixVO,rowVO)+" "+VariantsMatrixUtils.getVariantCode(matrixVO,rowVO),
          customVO
        );
      }
      VariantNameVO varVO = (VariantNameVO)matrixVO.getManagedVariants()[0];
      for(int i=0;i<rows.size();i++) {
        vo = (SupplierVariantsPriceVO)rows.get(i);

        if (varVO.getTableName().equals("ITM11_VARIANTS_1")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm06PUR05()+" "+vo.getVariantCodeItm11PUR05());
        }
        else if (varVO.getTableName().equals("ITM12_VARIANTS_2")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm07PUR05()+" "+vo.getVariantCodeItm12PUR05());
        }
        else if (varVO.getTableName().equals("ITM13_VARIANTS_3")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm08PUR05()+" "+vo.getVariantCodeItm13PUR05());
        }
        else if (varVO.getTableName().equals("ITM14_VARIANTS_4")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm09PUR05()+" "+vo.getVariantCodeItm14PUR05());
        }
        else if (varVO.getTableName().equals("ITM15_VARIANTS_5")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm10PUR05()+" "+vo.getVariantCodeItm15PUR05());
        }

        if (matrixVO.getColumnDescriptors().length==0) {
          customVO.setAttributeNameN0(vo.getValuePUR05());
        }
        else {

          for(int j=0;j<cols;j++) {
            colVO = (VariantsMatrixColumnVO)matrixVO.getColumnDescriptors()[j];
View Full Code Here

        if (newValue==null)
          return true;

        if (pricesMatrix!=null) {
          CustomValueObject vo = (CustomValueObject)pricesMatrix.get(rowNumber);
          Object lastPrice = null;
          Object currentPrice = null;
          try {
            lastPrice = CustomValueObject.class.getMethod("getAttributeNameN"+(colNumber-1),new Class[0]).invoke(vo,new Object[0]);
          }
View Full Code Here


      // convert the records list in matrix format...
      ArrayList matrixRows = new ArrayList();
      VariantsPriceVO vo = null;
      CustomValueObject customVO = null;
      VariantsMatrixRowVO rowVO = null;
      VariantsMatrixColumnVO colVO = null;
      HashMap indexes = new HashMap();
      for(int i=0;i<matrixVO.getRowDescriptors().length;i++) {
        rowVO = (VariantsMatrixRowVO)matrixVO.getRowDescriptors()[i];

        customVO = new CustomValueObject();
        customVO.setAttributeNameS0(rowVO.getRowDescription());
        matrixRows.add(customVO);
        indexes.put(
          VariantsMatrixUtils.getVariantType(matrixVO,rowVO)+" "+VariantsMatrixUtils.getVariantCode(matrixVO,rowVO),
          customVO
        );
      }
      VariantNameVO varVO = (VariantNameVO)matrixVO.getManagedVariants()[0];
      for(int i=0;i<rows.size();i++) {
        vo = (VariantsPriceVO)rows.get(i);

        if (varVO.getTableName().equals("ITM11_VARIANTS_1")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm06SAL11()+" "+vo.getVariantCodeItm11SAL11());
        }
        else if (varVO.getTableName().equals("ITM12_VARIANTS_2")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm07SAL11()+" "+vo.getVariantCodeItm12SAL11());
        }
        else if (varVO.getTableName().equals("ITM13_VARIANTS_3")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm08SAL11()+" "+vo.getVariantCodeItm13SAL11());
        }
        else if (varVO.getTableName().equals("ITM14_VARIANTS_4")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm09SAL11()+" "+vo.getVariantCodeItm14SAL11());
        }
        else if (varVO.getTableName().equals("ITM15_VARIANTS_5")) {
          customVO = (CustomValueObject)indexes.get(vo.getVariantTypeItm10SAL11()+" "+vo.getVariantCodeItm15SAL11());
        }

        if (matrixVO.getColumnDescriptors().length==0) {
          customVO.setAttributeNameN0(vo.getValueSAL11());
        }
        else {

          for(int j=0;j<matrixVO.getColumnDescriptors().length;j++) {
            colVO = (VariantsMatrixColumnVO)matrixVO.getColumnDescriptors()[j];
View Full Code Here

                                   ArrayList currentSortedColumns,
                                   ArrayList currentSortedVersusColumns,
                                   Class valueObjectType, Map otherGridParams) {
            VariantsMatrixVO matrixVO = (VariantsMatrixVO)otherGridParams.get(ApplicationConsts.VARIANTS_MATRIX_VO);
            ArrayList rows = new ArrayList();
            CustomValueObject vo = null;
            VariantsMatrixRowVO rowVO = null;
            for(int i=0;i<matrixVO.getRowDescriptors().length;i++) {
              rowVO = (VariantsMatrixRowVO)matrixVO.getRowDescriptors()[i];

              vo = new CustomValueObject();
              vo.setAttributeNameS0(rowVO.getRowDescription());
              rows.add(vo);
            }
            return new VOListResponse(rows,false,rows.size());
          }

        });

      grid.setValueObjectClassName("org.openswing.swing.customvo.java.CustomValueObject");
      grid.getOtherGridParams().put(ApplicationConsts.VARIANTS_MATRIX_VO,vo);
      grid.setReorderingAllowed(false);
      grid.setVisibleStatusPanel(false);
//      if (vo.getManagedVariants().length>1)
//        grid.setHeaderHeight(grid.getHeaderHeight()*(vo.getManagedVariants().length-1));

      // create grid columns...
      ButtonColumn var1Col = new ButtonColumn();
      var1Col.setColumnName("attributeNameS0");
      var1Col.setEnableInReadOnlyMode(true);
      var1Col.setShowAttributeValue(true);
      var1Col.setHeaderColumnName(" ");
      var1Col.setColumnSelectable(false);
      grid.getColumnContainer().add(var1Col,null);

      VariantsMatrixColumnVO colVO = null;
      DecimalColumn col = null;
      for(int i=0;i<vo.getColumnDescriptors().length;i++) {
        colVO = (VariantsMatrixColumnVO)vo.getColumnDescriptors()[i];
        col = new DecimalColumn();
        col.setColumnSelectable(false);
        col.setEditableOnEdit(true);
        col.setHeaderColumnName(colVO.getColumnDescription());
        col.setColumnName("attributeNameN"+i);
        col.setColumnRequired(false);
        col.setDecimals(vo.getDecimals());
        col.setMinWidth(50);

        col.setPreferredWidth(20+this.getFontMetrics(this.getFont()).stringWidth(col.getHeaderColumnName()));

        grid.getColumnContainer().add(col,null);
      }
      if (vo.getColumnDescriptors().length==0) {
        col = new DecimalColumn();
        col.setColumnSelectable(false);
        col.setEditableOnEdit(true);
        col.setHeaderColumnName(" ");
        col.setColumnName("attributeNameN0");
        col.setDecimals(vo.getDecimals());
        //col.setPreferredWidth(110*(vo.getManagedVariants().length-1));

        col.setPreferredWidth(50);

        grid.getColumnContainer().add(col,null);
      }

      grid.addFocusListener(new FocusAdapter() {
        public void focusLost(FocusEvent e) {
          if (!onValidating)
            grid.getTable().getGrid().stopCellEditing();
        }
      });


      buttonsPanel.removeAll();
      final VariantNameVO varVO = (VariantNameVO)getVariantsMatrixVO().getManagedVariants()[0];
      buttonsPanel.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
      if (showButtons && vo.getManagedVariants().length>1) {
        // create a buttons panel used to copy the same qty for all cells matching the same variant value...
        for(int i=0;i<vo.getManagedVariants().length;i++) {
          GenericButton btn = new GenericButton(new ImageIcon(ClientUtils.getImage("copy.gif")));
          final VariantNameVO vnVO = (VariantNameVO)vo.getManagedVariants()[i];
          btn.setButtonBehavior(Consts.BUTTON_IMAGE_AND_TEXT);
          btn.setHorizontalTextPosition(SwingConstants.LEADING);
          btn.setVerticalTextPosition(SwingConstants.CENTER);
          btn.setText(vnVO.getDescriptionSYS10());
          btn.setToolTipText(ClientSettings.getInstance().getResources().getResource("set the same value when matching the same")+" "+vnVO.getDescriptionSYS10());
          btn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
             if (!onValidating)
               grid.getTable().getGrid().stopCellEditing();
            try {
               int row = grid.getSelectedRow();
               int col = grid.getTable().getGrid().getSelectedColumn();
               if (row!=-1 && col!=-1 && grid.getTable().getGrid().getValueAt(row,col)!=null) {
                 BigDecimal qty = (BigDecimal)grid.getTable().getGrid().getValueAt(row,col);
                 VariantsMatrixRowVO currentRowVO = (VariantsMatrixRowVO)getVariantsMatrixVO().getRowDescriptors()[row];
                 VariantsMatrixColumnVO currentColVO = (VariantsMatrixColumnVO)getVariantsMatrixVO().getColumnDescriptors()[col-1];
                 String rowtype = null,rowcode = null;
                 String coltype = null,colcode = null;
                 String rowtypename = null,rowcodename = null;
                 String coltypename = null,colcodename = null;


                 if (getVariantsMatrixVO().getColumnDescriptors().length==0 ||
                     varVO.getTableName().equals(vnVO.getTableName())) {
                   rowtype = VariantsMatrixUtils.getVariantType(getVariantsMatrixVO(),currentRowVO);
                   rowcode = VariantsMatrixUtils.getVariantCode(getVariantsMatrixVO(),currentRowVO);

                   if (varVO.getTableName().equals("ITM11_VARIANTS_1")) {
                     rowtypename = "getVariantTypeITM06";
                     rowcodename = "getVariantCodeITM11";
                   }
                   else if (varVO.getTableName().equals("ITM12_VARIANTS_2")) {
                     rowtypename = "getVariantTypeITM07";
                     rowcodename = "getVariantCodeITM12";
                   }
                   else if (varVO.getTableName().equals("ITM13_VARIANTS_3")) {
                     rowtypename = "getVariantTypeITM08";
                     rowcodename = "getVariantCodeITM13";
                   }
                   else if (varVO.getTableName().equals("ITM14_VARIANTS_4")) {
                     rowtypename = "getVariantTypeITM09";
                     rowcodename = "getVariantCodeITM14";
                   }
                   else if (varVO.getTableName().equals("ITM15_VARIANTS_5")) {
                     rowtypename = "getVariantTypeITM10";
                     rowcodename = "getVariantCodeITM15";
                   }

                 }
                 else {
                   if (vnVO.getTableName().equals("ITM11_VARIANTS_1")) {
                     rowtype = currentRowVO.getVariantTypeITM06();
                     rowcode = currentRowVO.getVariantCodeITM11();
                     rowtypename = "getVariantTypeITM06";
                     rowcodename = "getVariantCodeITM11";
                   }
                   else if (vnVO.getTableName().equals("ITM12_VARIANTS_2")) {
                     coltype = currentColVO.getVariantTypeITM07();
                     colcode = currentColVO.getVariantCodeITM12();
                     coltypename = "getVariantTypeITM07";
                     colcodename = "getVariantCodeITM12";
                   }
                   else if (vnVO.getTableName().equals("ITM13_VARIANTS_3")) {
                     coltype = currentColVO.getVariantTypeITM08();
                     colcode = currentColVO.getVariantCodeITM13();
                     coltypename = "getVariantTypeITM08";
                     colcodename = "getVariantCodeITM13";
                   }
                   else if (vnVO.getTableName().equals("ITM14_VARIANTS_4")) {
                     coltype = currentColVO.getVariantTypeITM09();
                     colcode = currentColVO.getVariantCodeITM14();
                     coltypename = "getVariantTypeITM09";
                     colcodename = "getVariantCodeITM14";
                   }
                   else if (vnVO.getTableName().equals("ITM15_VARIANTS_5")) {
                     coltype = currentColVO.getVariantTypeITM10();
                     colcode = currentColVO.getVariantCodeITM15();
                     coltypename = "getVariantTypeITM10";
                     colcodename = "getVariantCodeITM15";
                   }
                 }


                 VariantsMatrixRowVO rowVO = null;
                 VariantsMatrixColumnVO colVO = null;
                 for(int r=0;r<grid.getVOListTableModel().getRowCount();r++) {
                   rowVO = (VariantsMatrixRowVO)getVariantsMatrixVO().getRowDescriptors()[r];
                   for (int c = 0;c < getVariantsMatrixVO().getColumnDescriptors().length;c++)
                     if (! (r == row && c + 1 == col)) {
                       colVO = (VariantsMatrixColumnVO) getVariantsMatrixVO().getColumnDescriptors()[c];
                      try {
                        if (rowtype!=null && rowcode!=null) {
                          if (rowtype.equals(rowVO.getClass().getMethod(rowtypename,new Class[0]).invoke(rowVO,new Object[0])) &&
                              rowcode.equals(rowVO.getClass().getMethod(rowcodename,new Class[0]).invoke(rowVO,new Object[0])))
                            grid.getVOListTableModel().setValueAt(qty, r, c + 1);
                        }
                        else if (coltype!=null && colcode!=null) {
                          if (coltype.equals(colVO.getClass().getMethod(coltypename,new Class[0]).invoke(colVO,new Object[0])) &&
                              colcode.equals(colVO.getClass().getMethod(colcodename,new Class[0]).invoke(colVO,new Object[0])))
                           grid.getVOListTableModel().setValueAt(qty, r, c + 1);
                        }
                      }
                      catch (Exception ex) {
                        ex.printStackTrace();
                      }
                     }
                 }
                 grid.repaint();
               }

              }
              catch (Throwable t) {
                t.printStackTrace();
              }
            } // end actionPerformed
          });
          buttonsPanel.add(btn);
        }
      }
      this.add(buttonsPanel,BorderLayout.NORTH);


      // add grid to panel...
      this.add(grid,BorderLayout.CENTER);
      //grid.setSize(new Dimension(form.getWidth(),(splitPane==null?20:0)+40+vo.getRowDescriptors().length*20));
      this.setMinimumSize(new Dimension(form.getWidth(),(splitPane==null?20:0)+30+vo.getRowDescriptors().length*20));
      //form.setSize(new Dimension(form.getWidth(),form.getHeight()+(splitPane==null?20:0)+30+vo.getRowDescriptors().length*20));
      if (splitPane!=null)
        splitPane.setDividerLocation(Math.max(100,initialDiv-grid.getHeaderHeight()-30-vo.getRowDescriptors().length*20));
      this.revalidate();
      this.repaint();
      form.revalidate();
      form.repaint();
    }
View Full Code Here

TOP

Related Classes of org.openswing.swing.customvo.java.CustomValueObject

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.