Package realcix20.guis.components

Examples of realcix20.guis.components.CacheTableModel


    protected void contactRelationship1_12(final JComponent component, final JComponent childComponent) {               
       
        //set initial value
        if (ComponentManager.getValue(component) != null) {
            CurrencyPlugin cp = CurrencyPlugin.getInstance();
            UomPlugin up = UomPlugin.getInstance();
            StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
            int fraction = up.getFraction(ComponentManager.getValue(component).toString());
            if (fraction > 0) {
                sb.append(".");
            }
            for (int i = 1; i <= fraction; i++) {
                sb.append("0");
            }
            DecimalFormat df = new DecimalFormat(sb.toString());
            NumberFormatter nf = new NumberFormatter(df);
            DefaultFormatterFactory factory = new DefaultFormatterFactory(nf);
            ((JFormattedTextField)childComponent).setFormatterFactory(factory);
        }
       
        ((JComboBox)component).addActionListener(
                new ActionAdapter() {
           
                    public void actionPerformed(ActionEvent e) {
                                               
                        if (ComponentManager.getValue(component) != null) {
                            CurrencyPlugin cp = CurrencyPlugin.getInstance();
                            UomPlugin up = UomPlugin.getInstance();
                            StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
                            int fraction = up.getFraction(ComponentManager.getValue(component).toString());
                            if (fraction > 0) {
                                sb.append(".");
                            }
                            for (int i = 1; i <= fraction; i++) {
                                sb.append("0");
View Full Code Here


                });                              
            }            
            getObjectLayoutTable().setModel(new DefaultTableModel());
            //TODO maybe...shuould be used?
            if(reportViewTable!=null&&reportViewTable.getTable()!=null){
              CacheTableModel tm = (CacheTableModel)reportViewTable.getTable().getModel();
              int selectedRowNumber = reportViewTable.getTable().getSelectedRow();                       
              if ( (!tm.isNoRow()) && (selectedRowNumber != -1) ) {
                  String sql = null;
                  String basic_sql = currentObject.getBasicSQL();
                  if (basic_sql.indexOf("WHERE") > -1) {
                      StringBuffer sb = new StringBuffer(basic_sql.substring(
                              0, basic_sql.indexOf("WHERE") + 5));
                      for (int i = 0; i < tm.getTables().size(); i++) {
                          String tableName = (String)tm.getTables().get(i);                  
                          String columnName = (String)tm.getColumns().get(i);
                          Object value = tm.getValueAt(selectedRowNumber, i + 1);
                          if (tableName.trim().length() > 0) {
                              String insert_sql = " " + tableName + "." + columnName + "=" + "'" + value + "'" + " AND ";
                              sb.append(insert_sql);
                          }
                      }
                      sb.append(basic_sql.indexOf("WHERE") + 5);
                      sql = sb.toString();
                  } else {
                      StringBuffer sb = new StringBuffer(basic_sql);
                      int n = 0;
                      for (int i = 0; i < tm.getTables().size(); i++) {
                          String tableName = (String)tm.getTables().get(i);                  
                          String columnName = (String)tm.getColumns().get(i);
                          Object value = tm.getDataAt(selectedRowNumber, i + 1);
                          //�������޶���
                          if(value==null){
                            sb.setLength(0);
                            break;
                          }
                          if (tableName.trim().length() > 0) {
                              String insert_sql = null;
                              if (n == 0)
                                  insert_sql = " WHERE " + tableName + "." + columnName + "=" + "'" + value + "'";
                              else
                                  insert_sql = " AND " + tableName + "." + columnName + "=" + "'" + value + "'";
                              n++;
                              sb.append(insert_sql);
                          }                       
                      }
                      sql = sb.toString();
                  }
                  getObjectLayoutTable().setModel(new CacheTableModel(currentObject, sql, "object"));
                  getObjectLayoutTable().updateUI();
              }             
            }
        }
View Full Code Here

        public void updateObjectChildTable() {                                       
            if (!getCurrentObject().isSlayerMaster()) {
                objectTableSplitPane.setBottomComponent(null);
                objectTableSplitPane.setDividerLocation(900);
            } else {
                CacheTableModel tm = (CacheTableModel)objectViewTable.getTable().getModel();
                int selectedRowNumber = objectViewTable.getTable().getSelectedRow();
                if ( (!tm.isNoRow()) && (selectedRowNumber != -1) ) {
                    Vector values = new Vector();
                    for (int i = 1; i < tm.getColumnCount(); i++) {
                        String tableName = tm.getColumn(i).getTableName();
                        String columnName = tm.getColumn(i).getColumnName();
                        Object value = tm.getValueAt(selectedRowNumber, i);
                        //TODO
                        /**
                         * because this tablemodel isn't based row, so..no way to find one cell true value...
                         * just get the substring before '-'.....
                         * these will be resolved in next version
View Full Code Here

                    if (objectLayoutTable.getSelectedRows().length > 0)
                        objectLayoutTable.removeRowSelectionInterval(0, objectLayoutTable.getRowCount() - 1);
                    objectLayoutTable.addRowSelectionInterval(objectLayoutTable.rowAtPoint(e.getPoint()), objectLayoutTable.rowAtPoint(e.getPoint()));
                }
            } else if (e.getSource().equals(objectViewTable) && (e.getButton() == e.BUTTON3)) {
                CacheTableModel model = (CacheTableModel)objectViewTable.getTable().getModel();
                if ( (!model.isNoRow()) && (objectViewTable.getTable().rowAtPoint(e.getPoint()) != -1) )
                    objectViewTable.getTable().addRowSelectionInterval(objectViewTable.getTable().rowAtPoint(e.getPoint()),
                            objectViewTable.getTable().rowAtPoint(e.getPoint()));
            }
       
    }
View Full Code Here

   
    //specify, Used by Budget
    private void initialCopyToAnotherMonth() {
        //fix
        if(container.getObjectViewTable()==null||container.getObjectViewTable().getTable()==null) return;
        CacheTableModel tm = (CacheTableModel)container.getObjectViewTable().getTable().getModel();
        int[] rows= getContainer().getObjectViewTable().getTable().getSelectedRows();
        if ( (!tm.isNoRow()) && (rows.length!=0) ) {
          Vector selectedRows = new Vector();
          for (int rowIndex : rows) {
                Vector values = new Vector();
                for (int i = 1; i < tm.getColumnCount(); i++) {
                    String tableName = tm.getColumn(i).getTableName();
                    String columnName = tm.getColumn(i).getColumnName();
                    Item item = (Item)tm.getValueAt(rowIndex, i);
                    Cell cell = new Cell(tableName, columnName, item.getFactValue());
                    values.add(cell);
                }
                Row selectedRow = new Row(values, container.getCurrentObject().getRowType());
                selectedRows.add(selectedRow);
View Full Code Here

       
    }
   
    private void initialCreateByMultiRows() {       
      //fix...
        CacheTableModel tm = (CacheTableModel)container.getObjectViewTable().getTable().getModel();
        int[] rows = getContainer().getObjectViewTable().getTable().getSelectedRows();
        if ( (!tm.isNoRow()) && (rows.length>0) ) {
            boolean isLedgerTypeEqualsXVC = false;
            boolean isTAmtEqualsZero = false;
            Vector needRemoveRows = new Vector();

            Row newRow=null;
          for (int i = 0; i < rows.length; i++) {
                Vector values = new Vector();
                for (int j = 1; j < tm.getColumnCount(); j++) {
                    String tableName = tm.getColumn(j).getTableName();
                    String columnName = tm.getColumn(j).getColumnName();
                    Item item = (Item)tm.getValueAt(rows[i], j);
                    Cell cell = new Cell(tableName, columnName, item.getFactValue());
                    values.add(cell);
                }
                Row row = new Row(values, container.getCurrentObject().getRowType());             
              int newR = 0;
View Full Code Here

    }
   
   
    //used by RegClass
    private void initialCreateByObject() {       
        CacheTableModel tm = (CacheTableModel)container.getObjectViewTable().getTable().getModel();
        int selectedRowNumber = getContainer().getObjectViewTable().getTable().getSelectedRow();
        if ( (!tm.isNoRow()) && (selectedRowNumber != -1) ) {
            Vector values = new Vector();
            for (int i = 1; i < tm.getColumnCount(); i++) {
                String tableName = tm.getColumn(i).getTableName();
                String columnName = tm.getColumn(i).getColumnName();
                Item item = (Item)tm.getValueAt(selectedRowNumber, i);
                Cell cell = new Cell(tableName, columnName, item.getFactValue());
                values.add(cell);
            }
            Row selectedRow = new Row(values, container.getCurrentObject().getRowType());
            container.getCurrentObject().loadChilds(selectedRow);           
View Full Code Here

    }       
   
    public void initialObjectEdit() {     
      //fix
      if(container.getObjectViewTable()==null||container.getObjectViewTable().getTable()==null) return;
        CacheTableModel tm = (CacheTableModel)container.getObjectViewTable().getTable().getModel();
        int selectedRowNumber = getContainer().getObjectViewTable().getTable().getSelectedRow();
       
        if ( (!tm.isNoRow()) && (selectedRowNumber != -1) ) {
            Vector values = new Vector();
            for (int i = 1; i < tm.getColumnCount(); i++) {
                String tableName = tm.getColumn(i).getTableName();
                String columnName = tm.getColumn(i).getColumnName();
                Item item = (Item)tm.getValueAt(selectedRowNumber, i);
                Cell cell = new Cell(tableName, columnName, item.getFactValue());
                values.add(cell);
            }
            Row selectedRow = new Row(values, container.getCurrentObject().getRowType());
            getContainer().getCurrentObject().loadChilds(selectedRow);
View Full Code Here

            getContainer().setEnabled(false);
        }       
    }
   
    private void initObjectEditFromReport() {     
        CacheTableModel tm = (CacheTableModel)container.getObjectLayoutTable().getModel();
        int selectedRowNumber = getContainer().getObjectLayoutTable().getSelectedRow();
        if ( (!tm.isNoRow()) && (selectedRowNumber != -1) ) {
            Vector values = new Vector();
            for (int i = 1; i < tm.getColumnCount(); i++) {
                String tableName = tm.getColumn(i).getTableName();
                String columnName = tm.getColumn(i).getColumnName();
                Item item = (Item)tm.getValueAt(selectedRowNumber, i);
                Cell cell = new Cell(tableName, columnName, item.getFactValue());
                values.add(cell);
            }
            Row selectedRow = new Row(values, container.getCurrentObject().getRowType());
            getContainer().getCurrentObject().loadChilds(selectedRow);
View Full Code Here

                && (clsId != 190)
                && (clsId != 539)
                && (clsId != 230)
                && (clsId != 270) ) {
            XTable objectViewTable = container.getObjectViewTable();
            CacheTableModel model = (CacheTableModel)objectViewTable.getTable().getModel();
            int selectedRowNumber = objectViewTable.getTable().getSelectedRow();
           
            //fix give all selections to Reg delete
            int[] selectedRowNumbers = objectViewTable.getTable().getSelectedRows();           

           
            if ( (selectedRowNumber != -1) && (!model.isNoRow()) ) {
                Vector values = new Vector();
                for (int i = 1; i < model.getColumnCount(); i++) {
                    String tableName = model.getColumn(i).getTableName();
                    String columnName = model.getColumn(i).getColumnName();
                    Item item = (Item)model.getValueAt(selectedRowNumber, i);
                    Cell cell = new Cell(tableName, columnName, item.getFactValue());
                    values.add(cell);
                }
                Row row = new Row(values, container.getCurrentObject().getRowType());
                //specify,used by BudgetSettingClass
                if (getContainer().getCurrentObject() instanceof BudgetSettingClass) {
                    if ((DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("BUDGETSETTING.DELETEALERT"))) == 0) {
                        container.getCurrentObject().classDelete_WholeObject(row);
                        ((BudgetSettingClass)getContainer().getCurrentObject()).deleteAllRelateItems(row);
                        container.updateObjectViewTable();
                    }
                }
                //specify,used by TaxTypeClass
                else if (getContainer().getCurrentObject() instanceof TaxTypeClass) {
                    if ( ((TaxTypeClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by UserClass
                else if (getContainer().getCurrentObject() instanceof UserClass) {
                    if ( ((UserClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            ((UserClass)getContainer().getCurrentObject()).deleteDependThings(row);
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by AnaTypeClass
                else if (getContainer().getCurrentObject() instanceof AnaTypeClass) {
                    if ( ((AnaTypeClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            ((AnaTypeClass)getContainer().getCurrentObject()).deleteDependThings(row);
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by UomClass
                else if (getContainer().getCurrentObject() instanceof UomClass) {
                    if ( ((UomClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by LedgerClass
                else if (getContainer().getCurrentObject() instanceof LedgerClass) {
                    if ( ((LedgerClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by FixedAssetClass
                else if (getContainer().getCurrentObject() instanceof FixedAssetClass) {
                    if ( ((FixedAssetClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by NameSpaceClass
                else if (getContainer().getCurrentObject() instanceof NameSpaceClass) {
                    if ( ((NameSpaceClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by PartnerClass
                else if (getContainer().getCurrentObject() instanceof PartnerClass) {
                    if ( ((PartnerClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            ((PartnerClass)getContainer().getCurrentObject()).deleteDependThings(row);
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by TaxDepClass
                else if (getContainer().getCurrentObject() instanceof TaxDepClass) {
                    if ( ((TaxDepClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            ((TaxDepClass)getContainer().getCurrentObject()).deleteDependThings(row);
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by InvestMarketClass
                else if (getContainer().getCurrentObject() instanceof InvestMarketClass) {
                    if ( ((InvestMarketClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by InvestProductClass
                else if (getContainer().getCurrentObject() instanceof InvestProductClass) {
                    if ( ((InvestProductClass)getContainer().getCurrentObject()).validateDelete(row, getContainer()) ) {
                        if ( (DialogManager.showYesNoDialog(getContainer(), TxtManager.getTxt("MAINFRAME.DELETE.CONFIRM"))) == 0) {
                            getContainer().getCurrentObject().classDelete_WholeObject(row);
                            container.updateObjectViewTable();
                        }
                    }
                }
                //specify,used by RegClass
                //fix add batch delete
                else if (getContainer().getCurrentObject() instanceof RegClass) {
                    if ((!model.isNoRow())&&(selectedRowNumbers.length>0)) {
                      Vector tablerows=new Vector();
                      deleteSelectSet.clear();
                      for (int j = 0; j < selectedRowNumbers.length; j++) {
                        Vector tablerow=new Vector();
                            Vector cells = new Vector();
                            for (int i = 1; i < model.getColumnCount(); i++) {
                                String tableName = model.getColumn(i).getTableName();
                                String columnName = model.getColumn(i).getColumnName();
                                Item item = (Item)model.getValueAt(selectedRowNumbers[j], i);
                                Cell cell = new Cell(tableName, columnName, item.getFactValue());
                                cells.add(cell);
                            }
                            Row regrow = new Row(cells, container.getCurrentObject().getRowType());
                            //TODO !!
View Full Code Here

TOP

Related Classes of realcix20.guis.components.CacheTableModel

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.