Package realcix20.guis.utils

Examples of realcix20.guis.utils.ComponentExt


                Integer n = (Integer)itemGroupsIter.next();
                container.getPropertyPane().setIconAt(n, null);
            }
            itemGroupsIter = container.getItemGroups().iterator();
            while (componentExtIter.hasNext()) {               
                ComponentExt componentExt = (ComponentExt)componentExtIter.next();
                Integer n = (Integer)itemGroupsIter.next();
                JLabel alertLabel = (JLabel)alertLabelIter.next();
                JComponent component = componentExt.getComponent();
                Column column = componentExt.getColumn();               
                if (column.isMandatory()) {                   
                    if ( (ComponentManager.getValue(component) == null) || (ComponentManager.getValue(component).toString().trim().equals("")) ) {
                        alertLabel.setVisible(true);
                        alertLabel.setIcon(ImageManager.getImage(ImageManager.EXCLAMATION_IMAGE));
                        if (column.isPrimaryKey()) {
                            alertLabel.setText(TxtManager.getTxt("VALIDATE.PRIMARYKEYISMUST"));
                        } else {
                            alertLabel.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
                        }                       
                        container.getPropertyPane().setIconAt(n, ImageManager.getImage(ImageManager.ERROR_IMAGE));
                        result = false;
                    } else {
                        if (column.isPrimaryKey()) {
                            alertLabel.setIcon(ImageManager.getImage(ImageManager.HELP_IMAGE));
                            alertLabel.setText("");
                        } else {
                            alertLabel.setVisible(false);
                        }                       
                    }                   
                }               
            }                                     
            //second,validate insert or edit execute
            if (result) {
                setItemCellValue(container.getSelectedRow());
                Row row = container.getSelectedRow();
                if (row.isAdd()) {                   
                    result = container.getObject().classInsert_Child(row, true);                   
                    if (result) {                       
                        Iterator rowIter = container.getContainer().getCurrentRow().getRowSet().getRows().iterator();
                        while (rowIter.hasNext()) {                           
                            Row tempRow = (Row)rowIter.next();                           
                            if ( (row != tempRow) && (!tempRow.isDelete()) ) {                               
                                boolean flag = false;
                                Iterator cellIter = row.getNewCells().iterator();
                                Iterator tempCellIter = tempRow.getNewCells().iterator();                                   
                                while (cellIter.hasNext()) {
                                    Cell cell = (Cell)cellIter.next();
                                    Cell tempCell = (Cell)tempCellIter.next();
                                    Column column = findColumn(container.getObject(), cell.getTableName(), cell.getColumnName());
                                    if ( (column.isPrimaryKey()) && (column.getTableName().equals(container.getObject().getChildTableName())) ) {
                                        if (!cell.getColumnValue().equals(tempCell.getColumnValue())) {
                                            flag = true;
                                            break;
                                        }
                                    }
                                }
                                result = flag;
                                if (!result)
                                    break;                               
                            }                                                                                                              
                        }                                               
                    }                   
                }             
                else if (row.isModify()) {
                    result = container.getObject().classUpdate_Child(row, true);
                }
               
                componentExtIter = container.getItemComponentExts().iterator();
                alertLabelIter = container.getItemAlertLabels().iterator();
                itemGroupsIter = container.getItemGroups().iterator();
                while (componentExtIter.hasNext()) {
                    Integer n = (Integer)itemGroupsIter.next();
                    ComponentExt componentExt = (ComponentExt)componentExtIter.next();         
                    JLabel alertLabel = (JLabel)alertLabelIter.next();
                    Column column = componentExt.getColumn();
                    if (column.isPrimaryKey()) {
                        if (!result) {
                            alertLabel.setIcon(ImageManager.getImage(ImageManager.EXCLAMATION_IMAGE));
                            alertLabel.setText(TxtManager.getTxt("VALIDATE.PRIMARYKEYCONFLICT"));                           
                            container.getPropertyPane().setIconAt(n, ImageManager.getImage(ImageManager.ERROR_IMAGE));
View Full Code Here


            boolean result = true;           
            Iterator componentExtIter = container.getItemComponentExts().iterator();
            Iterator alertLabelIter = container.getItemAlertLabels().iterator();
            Iterator itemGroupsIter = container.getItemGroups().iterator();
            while (componentExtIter.hasNext()) {               
                ComponentExt componentExt = (ComponentExt)componentExtIter.next();         
                JLabel alertLabel = (JLabel)alertLabelIter.next();
                JComponent component = componentExt.getComponent();
                Integer n = (Integer)itemGroupsIter.next();
                Column column = componentExt.getColumn();
                if (column.getInputType() == 81) {
                    boolean cellResult = false;
                    DetailList detailList = (DetailList)component;
                    Object value = detailList.getValue();                   
                    detailList.getNotVisibleTableButton().doClick();
View Full Code Here

    private void setItemCellValue(Row row) {
                   
           
            Iterator componentExtIter = container.getItemComponentExts().iterator();
            while (componentExtIter.hasNext()) {
                ComponentExt componentExt = (ComponentExt)componentExtIter.next();
                Column column = componentExt.getColumn();
                JComponent component = componentExt.getComponent();
                Iterator cellIter = row.getNewCells().iterator();
                while (cellIter.hasNext()) {
                    Cell cell = (Cell)cellIter.next();
                    if ( (cell.getColumnName().equals(column.getColumnName())) && (cell.getTableName().equals(column.getTableName())) ) {
                       
View Full Code Here

            while (columnIter.hasNext()) {
                Column column = (Column)columnIter.next();
                if ( (column.isHeadField()) && (column.getGroupName() == groupName) ) {
                    JLabel label = new JLabel(column.toString());                                           
                    groupPanel.add(label, cc.xy(3, currentComponentNumber * 2 + 1));
                    ComponentExt componentExt = (ComponentExt)headComponentExtIter.next();
                    JComponent component = componentExt.getComponent();
                    groupPanel.add(component, cc.xy(5, currentComponentNumber * 2 + 1));
                    JLabel alertLabel = new JLabel();
                    componentExt.setAlertLabel(alertLabel);
                    alertLabel.setForeground(Color.RED);
                    if (column.isPrimaryKey()) {
                        alertLabel.setIcon(ImageManager.getImage(ImageManager.HELP_IMAGE));
                    } else {
                        alertLabel.setVisible(false);
View Full Code Here

        itemComponentExts = new Vector();
        Iterator columnIter = family.getColumns().iterator();
        while (columnIter.hasNext()) {
            Column column = (Column)columnIter.next();
            if (column.isHeadField()) {
                ComponentExt componentExt = new ComponentExt(ComponentManager.getComponent(column), column, currentRow);
                headComponentExts.add(componentExt);
            }
            else if (column.isItemField()) {
                ComponentExt componentExt = new ComponentExt(ComponentManager.getComponent(column), column, currentRow);
                itemComponentExts.add(componentExt);
            }
        }
    }
View Full Code Here

    }

    private void setAllComponentValue() {
        Iterator componentExtIter = componentExts.iterator();
        while (componentExtIter.hasNext()) {                   
            ComponentExt componentExt = (ComponentExt)componentExtIter.next();
            Column column = componentExt.getColumn();                   
            Row row = componentExt.getRow();
            JComponent component = componentExt.getComponent();
            if (action.equals("Add")) {
                Vector parameters = relationManager.getParameters_Defvalue(componentExt);
                if (parameters != null) {
                    String sql = relationManager.getSQL_Defvalue(componentExt, parameters);
                    DAO dao = DAO.getInstance();
                    dao.query(sql);
                    for (int i = 0; i < parameters.size(); i++) {
                        String parameter = (String)parameters.get(i);
                        StringTokenizer st = new StringTokenizer(parameter, ".");
                        String tableName = (String)st.nextElement();
                        String columnName = (String)st.nextElement();
                        ComponentExt tempComponentExt = relationManager.findComponentExt(tableName, columnName);
                        JComponent tempComponent = tempComponentExt.getComponent();                                   
                        dao.setObject(i+1, ComponentManager.getValue(tempComponent));
                    }
                    ResultSet rs = dao.executeQuery();
                    try {
                        if (rs.next()) {
                            ResultSetMetaData rsmd = rs.getMetaData();
                            for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                ComponentExt tempComponentExt = relationManager.findComponentExt(column.getTableName(), rsmd.getColumnName(i));
                                boolean isThisObjectColumn = (tempComponentExt != null);
                                if (isThisObjectColumn) {
                                    if (rs.getObject(i) != null) {
                                        ComponentManager.setValue(rs.getObject(i), tempComponentExt.getComponent());
                                    }
                                }
                            }
                        }
                        rs.close();
View Full Code Here

        boolean result = true;
        //first, validate the mandatory form components               
        Iterator componentExtIter = headComponentExts.iterator();
        Iterator alertLabelIter = headAlertLabels.iterator();
        while (componentExtIter.hasNext()) {
            ComponentExt componentExt = (ComponentExt)componentExtIter.next();         
            JLabel alertLabel = (JLabel)alertLabelIter.next();
            JComponent component = componentExt.getComponent();
            Column column = componentExt.getColumn();
            if (column.isMandatory()) {
                if ( (ComponentManager.getValue(component) == null) || (ComponentManager.getValue(component).equals("")) ) {
                    alertLabel.setVisible(true);
                    alertLabel.setIcon(ImageManager.getImage(ImageManager.EXCLAMATION_IMAGE));
                    if (column.isPrimaryKey()) {
                        alertLabel.setText(TxtManager.getTxt("VALIDATE.PRIMARYKEYISMUST"));
                    } else {
                        alertLabel.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
                    }
                    result = false;
                } else {
                    if (column.isPrimaryKey()) {
                        alertLabel.setIcon(ImageManager.getImage(ImageManager.HELP_IMAGE));
                        alertLabel.setText("");
                    } else {
                        alertLabel.setVisible(false);
                    }  
                }
            }
        }                         
        //second,validate insert or edit execute
        if (result) {
            setHeadCellValue(currentRow);
            if (action.equals("Add"))
                result = family.classInsert_WholeObject(currentRow, true);
            componentExtIter = headComponentExts.iterator();
            alertLabelIter = headAlertLabels.iterator();
            while (componentExtIter.hasNext()) {
                ComponentExt componentExt = (ComponentExt)componentExtIter.next();         
                JLabel alertLabel = (JLabel)alertLabelIter.next();
                Column column = componentExt.getColumn();
                if (column.isPrimaryKey()) {
                    if (!result) {
                        alertLabel.setIcon(ImageManager.getImage(ImageManager.EXCLAMATION_IMAGE));
                        alertLabel.setText(TxtManager.getTxt("VALIDATE.PRIMARYKEYCONFLICT"));
                    } else {
View Full Code Here

    private boolean validate81Components() {
        boolean result = true;               
        Iterator componentExtIter = headComponentExts.iterator();
        Iterator alertLabelIter = headAlertLabels.iterator();
        while (componentExtIter.hasNext()) {               
            ComponentExt componentExt = (ComponentExt)componentExtIter.next();         
            JLabel alertLabel = (JLabel)alertLabelIter.next();
            JComponent component = componentExt.getComponent();
            Column column = componentExt.getColumn();
            if (column.getInputType() == 81) {
                boolean cellResult = true;
                DetailList detailList = (DetailList)component;
                Object value = detailList.getValue();
                detailList.getNotVisibleTableButton().doClick();
View Full Code Here

    }

    private void setHeadCellValue(Row row) {
        Iterator componentExtIter = headComponentExts.iterator();
        while (componentExtIter.hasNext()) {                   
            ComponentExt componentExt = (ComponentExt)componentExtIter.next();
            Column column = componentExt.getColumn();
            JComponent component = componentExt.getComponent();
//            System.err.println(ComponentManager.getValue(component));
            Cell cell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
            if (action.equals("ADD")) {
                if ( (column.getInputType() == 22) || (column.getInputType() == 24) ) {//created by
                    cell.setColumnValue(GlobalValueManager.getValue("SESSION.LOGINUSER"));
View Full Code Here

        Vector childComponentExts = relationManager.getChildComponentExts(column);
        Iterator childComponentExtIter = childComponentExts.iterator();
        if (columns != null) {
//            System.err.println("format here");
            while (childComponentExtIter.hasNext()) {
                ComponentExt childComponentExt = (ComponentExt)childComponentExtIter.next();
                Column childColumn = childComponentExt.getColumn();
                if (childColumn.getInputType() == 11) {
                    Column column = childComponentExt.getColumn();
                    StringTokenizer st = new StringTokenizer(column.getPControls(), ".");
                    String tableName = (String)st.nextElement();
                    String columnName = (String) st.nextElement();
                    ComponentExt pComponentExt = relationManager.findComponentExt(tableName, columnName);
                    Object pValue = ComponentManager.getValue(pComponentExt.getComponent());
                    JComponent component = childComponentExt.getComponent();
                    CurrencyPlugin cp = CurrencyPlugin.getInstance();
                    StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
                    int fraction = Integer.parseInt(GlobalValueManager.getValue("APPLIATION.DEFFRACTION"));
                    if (pValue != null)
                        fraction = cp.getFraction(pValue.toString());
                    if (fraction > 0) {
                        sb.append(cp.getFpoint());
                    }
                    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)component).setFormatterFactory(factory);
                } else if (childColumn.getInputType() == 12) {
                    JComponent component = childComponentExt.getComponent();
                    CurrencyPlugin cp = CurrencyPlugin.getInstance();
                    UomPlugin up = UomPlugin.getInstance();
                    if (column.getPControls() != null) {
                        StringTokenizer st = new StringTokenizer(column.getPControls(), ".");
                        String tableName = (String)st.nextElement();
                        String columnName = (String)st.nextElement();
                        ComponentExt pComponentExt = relationManager.findComponentExt(tableName, columnName);
                        Object pValue = ComponentManager.getValue(pComponentExt.getComponent());
                        StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
                        int fraction = Integer.parseInt(GlobalValueManager.getValue("APPLIATION.DEFFRACTION"));
                        if (pValue != null)
                            fraction = up.getFraction(pValue.toString());
                        if (fraction > 0) {
View Full Code Here

TOP

Related Classes of realcix20.guis.utils.ComponentExt

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.