Package org.jallinone.variants.java

Examples of org.jallinone.variants.java.VariantsMatrixColumnVO


          grid.reloadData();
        }
        else {
          Object[] row = null;
          VariantsMatrixRowVO rowVO = null;
          VariantsMatrixColumnVO colMatrixVO = null;
          VariantsMatrixVO matrixVO = variantsPanel.getVariantsMatrixVO();
          String descr = vo.getDescriptionSYS10();
          for(int i=0;i<cells.length;i++) {
            row = cells[i];
            for(int j=0;j<row.length;j++) {
              if (cells[i][j]!=null) {
                BigDecimal qty = null;
                try {
                  qty = (BigDecimal) cells[i][j];
                }
                catch (Exception ex2) {
                  qty = new BigDecimal(0);
                }
                if (qty.intValue()>0) {
                  try {
                    vo = (ItemToPrintVO) vo.clone();
                  }
                  catch (CloneNotSupportedException ex) {
                  }
                  vo.setQty(qty);
                  rowVO = (VariantsMatrixRowVO) matrixVO.getRowDescriptors()[i];
                  vo.setDescriptionSYS10(descr+" "+rowVO.getRowDescription());

                  if (variantsPanel.getVariantsMatrixVO().getColumnDescriptors().length==0) {
                    VariantsMatrixUtils.setVariantTypesAndCodes(vo,"",variantsPanel.getVariantsMatrixVO(),rowVO,null);
                  }
                  else {
                    colMatrixVO = (VariantsMatrixColumnVO )variantsPanel.getVariantsMatrixVO().getColumnDescriptors()[j];
                    VariantsMatrixUtils.setVariantTypesAndCodes(vo,"",variantsPanel.getVariantsMatrixVO(),rowVO,colMatrixVO);
                    vo.setDescriptionSYS10(vo.getDescriptionSYS10()+" "+colMatrixVO.getColumnDescription());
                  }


                  rows.add(vo);
                } // end if on qty >0
View Full Code Here


      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+1));
        col.setColumnRequired(false);
        col.setMinWidth(90);

        col.setPreferredWidth(20+this.getFontMetrics(this.getFont()).stringWidth(col.getHeaderColumnName()));
View Full Code Here

      var1Col.setShowAttributeValue(true);
      var1Col.setHeaderColumnName(" ");
      var1Col.setColumnSelectable(false);
      grid.getColumnContainer().add(var1Col,null);

      VariantsMatrixColumnVO colVO = null;
      TextColumn col = null;
      for(int i=0;i<vo.getColumnDescriptors().length;i++) {
        colVO = (VariantsMatrixColumnVO)vo.getColumnDescriptors()[i];
        col = new TextColumn();
        col.setColumnSelectable(false);
        col.setEditableOnEdit(true);
        col.setHeaderColumnName(colVO.getColumnDescription());
        col.setColumnName("attributeNameS"+(i+1));
        col.setColumnRequired(false);
        col.setMinWidth(90);

        col.setPreferredWidth(20+this.getFontMetrics(this.getFont()).stringWidth(col.getHeaderColumnName()));
View Full Code Here

      bean.setConn(conn); // use same transaction...
      totals.setConn(conn); // use same transaction...
      serialNumBean.setConn(conn); // use same transaction...
      bean.setConn(conn);

      VariantsMatrixColumnVO colVO = null;
      VariantsMatrixRowVO rowVO = null;
      DetailSaleDocRowVO vo = null;
      Response res = null;
      for(int i=0;i<cells.length;i++) {
        rowVO = (VariantsMatrixRowVO)matrixVO.getRowDescriptors()[i];
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];
            if ((varVO.getTableName().equals("ITM11_VARIANTS_1")?true:colVO.getVariantCodeITM11().equals(vo.getVariantCodeItm11PUR05())) &&
                (varVO.getTableName().equals("ITM12_VARIANTS_2")?true:colVO.getVariantCodeITM12().equals(vo.getVariantCodeItm12PUR05())) &&
                (varVO.getTableName().equals("ITM13_VARIANTS_3")?true:colVO.getVariantCodeITM13().equals(vo.getVariantCodeItm13PUR05())) &&
                (varVO.getTableName().equals("ITM14_VARIANTS_4")?true:colVO.getVariantCodeITM14().equals(vo.getVariantCodeItm14PUR05())) &&
                (varVO.getTableName().equals("ITM15_VARIANTS_5")?true:colVO.getVariantCodeITM15().equals(vo.getVariantCodeItm15PUR05())) &&
                (varVO.getTableName().equals("ITM11_VARIANTS_1")?true:colVO.getVariantTypeITM06().equals(vo.getVariantTypeItm06PUR05())) &&
                (varVO.getTableName().equals("ITM12_VARIANTS_2")?true:colVO.getVariantTypeITM07().equals(vo.getVariantTypeItm07PUR05())) &&
                (varVO.getTableName().equals("ITM13_VARIANTS_3")?true:colVO.getVariantTypeITM08().equals(vo.getVariantTypeItm08PUR05())) &&
                (varVO.getTableName().equals("ITM14_VARIANTS_4")?true:colVO.getVariantTypeITM09().equals(vo.getVariantTypeItm09PUR05())) &&
                (varVO.getTableName().equals("ITM15_VARIANTS_5")?true:colVO.getVariantTypeITM10().equals(vo.getVariantTypeItm10PUR05()))) {
              try {
                CustomValueObject.class.getMethod("setAttributeNameN" + j,new Class[] {BigDecimal.class}).invoke(customVO, new Object[] {vo.getValuePUR05()});
              }
              catch (Throwable ex) {
                ex.printStackTrace();
View Full Code Here

      // insert into PUR05...
      SupplierVariantsPriceVO vo = null;
      Response res = null;
      Object[] row = null;
      VariantsMatrixColumnVO colVO = null;
      VariantsMatrixRowVO rowVO = null;
      BigDecimal price = null;
      for(int i=0;i<variantsPrice.getCells().length;i++) {
        row = variantsPrice.getCells()[i];
        rowVO = (VariantsMatrixRowVO)variantsPrice.getMatrixVO().getRowDescriptors()[i];
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];
            if ((varVO.getTableName().equals("ITM11_VARIANTS_1")?true:colVO.getVariantCodeITM11().equals(vo.getVariantCodeItm11SAL11())) &&
                (varVO.getTableName().equals("ITM12_VARIANTS_2")?true:colVO.getVariantCodeITM12().equals(vo.getVariantCodeItm12SAL11())) &&
                (varVO.getTableName().equals("ITM13_VARIANTS_3")?true:colVO.getVariantCodeITM13().equals(vo.getVariantCodeItm13SAL11())) &&
                (varVO.getTableName().equals("ITM14_VARIANTS_4")?true:colVO.getVariantCodeITM14().equals(vo.getVariantCodeItm14SAL11())) &&
                (varVO.getTableName().equals("ITM15_VARIANTS_5")?true:colVO.getVariantCodeITM15().equals(vo.getVariantCodeItm15SAL11())) &&
                (varVO.getTableName().equals("ITM11_VARIANTS_1")?true:colVO.getVariantTypeITM06().equals(vo.getVariantTypeItm06SAL11())) &&
                (varVO.getTableName().equals("ITM12_VARIANTS_2")?true:colVO.getVariantTypeITM07().equals(vo.getVariantTypeItm07SAL11())) &&
                (varVO.getTableName().equals("ITM13_VARIANTS_3")?true:colVO.getVariantTypeITM08().equals(vo.getVariantTypeItm08SAL11())) &&
                (varVO.getTableName().equals("ITM14_VARIANTS_4")?true:colVO.getVariantTypeITM09().equals(vo.getVariantTypeItm09SAL11())) &&
                (varVO.getTableName().equals("ITM15_VARIANTS_5")?true:colVO.getVariantTypeITM10().equals(vo.getVariantTypeItm10SAL11()))) {
              try {
                CustomValueObject.class.getMethod("setAttributeNameN" + j,new Class[] {BigDecimal.class}).invoke(customVO, new Object[] {vo.getValueSAL11()});
              }
              catch (Throwable ex) {
                ex.printStackTrace();
View Full Code Here

      // insert into SAL11...
      VariantsPriceVO vo = null;
      Response res = null;
      Object[] row = null;
      VariantsMatrixColumnVO colVO = null;
      VariantsMatrixRowVO rowVO = null;
      BigDecimal price = null;
      for(int i=0;i<variantsPrice.getCells().length;i++) {
        row = variantsPrice.getCells()[i];
        rowVO = (VariantsMatrixRowVO)variantsPrice.getMatrixVO().getRowDescriptors()[i];
View Full Code Here

   * @param depth current dept
   * @param colVO parent column to "duplicate" for each current variant's elements
   */
   private void createCombinations(ArrayList managedVariants,ArrayList[] tmp,boolean[] tmpSameVarType,ArrayList cols,int depth,VariantsMatrixColumnVO colVO) throws Exception {
     ItemVariantVO vo = null;
     VariantsMatrixColumnVO col2VO = null;
     for(int i=0;i<tmp[depth].size();i++) {
       vo = (ItemVariantVO)tmp[depth].get(i); // colors: red, black, orange...
       if (!Boolean.TRUE.equals(vo.getSelected()))
         // skip variant's element, if not associated to the current item...
         continue;

       if (depth < tmp.length - 1) {
         if (colVO == null) {
           col2VO = new VariantsMatrixColumnVO();
           setVariantDescription(col2VO,vo,tmpSameVarType[depth]);
         }
         else {
           col2VO = (VariantsMatrixColumnVO)colVO.clone();
           setVariantDescription(col2VO,vo,tmpSameVarType[depth]);
         }
         setVariantTypeAndCode(managedVariants,col2VO,vo,depth);
         createCombinations(managedVariants, tmp, tmpSameVarType, cols, depth + 1, (VariantsMatrixColumnVO)col2VO.clone());
       }
       else {
         if (colVO == null) {
           col2VO = new VariantsMatrixColumnVO();
           setVariantDescription(col2VO,vo,tmpSameVarType[depth]);
         }
         else {
           col2VO = (VariantsMatrixColumnVO)colVO.clone();
           setVariantDescription(col2VO,vo,tmpSameVarType[depth]);
View Full Code Here

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

TOP

Related Classes of org.jallinone.variants.java.VariantsMatrixColumnVO

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.