Package realcix20.classes.basic

Examples of realcix20.classes.basic.Column


       
            Iterator componentExtIter = componentExts.iterator();
            while (componentExtIter.hasNext()) {

                ComponentExt componentExt = (ComponentExt)componentExtIter.next();
                Column column = componentExt.getColumn();
                JComponent component = componentExt.getComponent();

                switch (column.getInputType()) {

                    case 1:
                    case 2:                   

                        if ( (column.getPControls() == null) || (column.getPControls().equals("")) ) {
                           
                            DAO dao = DAO.getInstance();
                            dao.query(column.getInputPar());
                            ResultSet rs = dao.executeQuery();
                            try {
                               
                                //add null
                                Item nilItem = new Item("", "");
                                ((JComboBox)component).addItem(nilItem);
                               
                                ResultSetMetaData rsmd = rs.getMetaData();
                                if (rsmd.getColumnCount() == 1) {
                                    while (rs.next()) {
                                        Item item = new Item(rs.getObject(1), rs.getObject(1));
                                        ((JComboBox)component).addItem(item);
                                    }
                                } else {
                                    while (rs.next()) {

                                        Object value = null;
                                        StringBuffer sb = new StringBuffer();
                                        sb.append("<html>");                                       
                                        for (int i = 1; i < rsmd.getColumnCount(); i++) {
                                            if (rsmd.getColumnName(i).equals(column.getColumnName())) {
                                                sb.append("<b>" + rs.getObject(i) + "</b> | ");
                                                value = rs.getObject(i);
                                            } else {
                                                sb.append(rs.getObject(i) + " | ");
                                            }
                                        }
                                                                                       
                                        if (rsmd.getColumnName(rsmd.getColumnCount()).equals(column.getColumnName())) {
                                            sb.append("<b>" + rs.getObject(rsmd.getColumnCount()) + "</b>");
                                            value = rs.getObject(rsmd.getColumnCount());
                                        } else {
                                            sb.append(rs.getObject(rsmd.getColumnCount()) + "");
                                        }
                                        sb.append("</html>");
                                       
                                        Item item = new Item(value, sb.toString());
                                        ((JComboBox)component).addItem(item);
                                    }
                                }
                                rs.close();

                            }
                            catch (SQLException sqle) {

                            }

                        }

                        break;

                    case 81:
                    case 82:
                       
                        if ( (column.getPControls() == null) || (column.getPControls().equals("")) ) {
                           
                            DAO dao = DAO.getInstance();
                            dao.query(column.getInputPar());
                            ResultSet rs = dao.executeQuery();
                            try {
                                ResultSetMetaData rsmd = rs.getMetaData();
                                Vector columnNames = new Vector();
                                Vector datas = new Vector();
                                for (int i = 1; i <= rsmd.getColumnCount(); i++) {                                  
                                    columnNames.add(ObjectUtil.findColumnTxt(column.getClsId(), column.getTableName(), rsmd.getColumnName(i)));
                                }
                                columnNames.add("value");//restore value
                                while (rs.next()) {
                                    Vector rowDatas = new Vector();
                                    for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                        Object columnValue = rs.getObject(rsmd.getColumnName(i));
                                        if (column.isI18N()) {
                                            String i18nString = I18NManager.getI18NString(column.getI18nPrefix(), columnValue);
                                            rowDatas.add(i18nString + "(" + columnValue + ")");
                                        } else {
                                            rowDatas.add(columnValue);
                                        }                                     
                                    }
                                    rowDatas.add(rs.getObject(column.getColumnName()));//value
                                    datas.add(rowDatas);
                                }
                                ListTableModel model = new ListTableModel(columnNames, datas);
                                ((DetailList)component).updateTable(model);
                               
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                           
                        }
                       
                        break;
                       
                    case 87:
                       
                        if (column.getInputPar().indexOf("[") == -1) {
                           
                            DAO dao = DAO.getInstance();
                            dao.query(column.getInputPar());
                            ResultSet rs = dao.executeQuery();
                            try {
                                ResultSetMetaData rsmd = rs.getMetaData();
                                Vector columnNames = new Vector();
                                Vector datas = new Vector();
                                for (int i = 1; i <= rsmd.getColumnCount(); i++) {                                  
                                    columnNames.add(ObjectUtil.findColumnTxt(column.getClsId(), column.getTableName(), rsmd.getColumnName(i)));
                                }
                                columnNames.add("value");//restore value
                                while (rs.next()) {
                                    Vector rowDatas = new Vector();
                                    for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                        Object columnValue = rs.getObject(rsmd.getColumnName(i));
                                        if (column.isI18N()) {
                                            String i18nString = I18NManager.getI18NString(column.getI18nPrefix(), columnValue);
                                            rowDatas.add(i18nString + "(" + columnValue + ")");
                                        } else {
                                            rowDatas.add(columnValue);
                                        }                                     
                                    }
                                    rowDatas.add(rs.getObject(column.getColumnName()));//value
                                    datas.add(rowDatas);
                                }
                                ListTableModel model = new ListTableModel(columnNames, datas);
                                ((DetailList)component).updateTable(model);
                               
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                           
                        }
                       
                        break;
                       
                    case 7:
                       
                        if (column.getInputPar().indexOf("[") == -1) {
                            DAO dao = DAO.getInstance();
                            dao.query(column.getInputPar());
                            ResultSet rs = dao.executeQuery();
                            try {
                               
                                while (rs.next()) {

                                    ResultSetMetaData rsmd = rs.getMetaData();
                                    Object value = null;
                                    String displayValue = "";
                                    displayValue += "<html>";
                                    for (int i = 1; i < rsmd.getColumnCount(); i++) {
                                        if (rsmd.getColumnName(i).equals(column.getColumnName())) {
                                            displayValue += "<i><b>";
                                            displayValue += rs.getObject(i);
                                            displayValue += "</i></b> ";
                                            value = rs.getObject(i);
                                        } else {
                                            displayValue += rs.getObject(i);
                                            displayValue += " ";
                                        }                                      
                                    }
                                   
                                    if (rsmd.getColumnName(rsmd.getColumnCount()).equals(column.getColumnName())) {
                                            displayValue += "<i><b>";
                                            displayValue += rs.getObject(rsmd.getColumnCount());
                                            displayValue += "</i></b> ";
                                            value = rs.getObject(rsmd.getColumnCount());
                                        } else {
View Full Code Here


    }
   
    //connect components
    private void connectComponents(ComponentExt pComponentExt, ComponentExt cComponentExt) {
       
            Column pColumn = pComponentExt.getColumn();
            Column cColumn = cComponentExt.getColumn();
            JComponent pComponent = pComponentExt.getComponent();
            JComponent cComponent = cComponentExt.getComponent();
           
//            System.err.print(pColumn.getTableName() + "." + pColumn.getColumnName() +
//                    " ------> " + cColumn.getTableName() + "." + cColumn.getColumnName() + " ==   ");
           
            if ( (pColumn.getInputType() == 1) && (cColumn.getInputType() == 1) ) {
//                System.err.println("connectComponents1_1");               
                Vector parameters = getParameters(cComponentExt);
                String sql = getSQL(cComponentExt, parameters);
                connectComponents1_1(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 1) && (cColumn.getInputType() == 7) ) {
//                System.err.println("connectComponents1_7");               
                Vector parameters = getParameters(cComponentExt);
                String sql = getSQL(cComponentExt, parameters);
                connectComponents1_7(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 1) && (cColumn.getInputType() == 11) ) {               
//                System.err.println("connectComponents1_11");               
                if (cColumn.getDefValue() != null) {                                   
                    Vector parameters = getParameters_Defvalue(cComponentExt);
                    String sql = getSQL_Defvalue(cComponentExt, parameters);
                    connectComponents1_3(pComponent, cComponent, sql, parameters);
                } else {
                    connectComponents1_11(pComponent, cComponent);
                }
            } else if ( (pColumn.getInputType() == 1) && (cColumn.getInputType() == 12) ) {
//                System.err.println("connectComponents1_12");
                connectComponents1_12(pComponent, cComponent);
            } else if ( (pColumn.getInputType() == 1) && (cColumn.getInputType() == 3) ) {
//                System.err.println("connectComponents1_3");
                Vector parameters = getParameters(cComponentExt);
                String sql = getSQL(cComponentExt, parameters);
                connectComponents1_3(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 3) && (cColumn.getInputType() == 3) ) {
//                System.err.println("connectComponents3_3");
                Vector parameters = getParameters(cComponentExt);
                String sql = getSQL(cComponentExt, parameters);
                connectComponents3_3(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 5) && (cColumn.getInputType() == 3) ) {
//                System.err.println("connectComponents5_3");
                Vector parameters = getParameters(cComponentExt);
                String sql = getSQL(cComponentExt, parameters);
                connectComponents5_3(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 7) && (cColumn.getInputType() == 1) ) {               
//                System.err.println("connectComponents7_1");
                Vector parameters = getParameters(cComponentExt);
                String sql = getSQL(cComponentExt, parameters);
                connectComponents7_1(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 7) && (cColumn.getInputType() == 7) ) {
//                System.err.println("connectComponents7_7");              
                connectComponents7_7(pComponent, cComponent);
            } else if ( (pColumn.getInputType() == 1) && (cColumn.getInputType() == 16) ) {
//                System.err.println("connectComponents1_16");
                Vector parameters = getParameters_Defvalue(cComponentExt);
                String sql = getSQL_Defvalue(cComponentExt, parameters);
                connectComponents1_16(pComponent, cComponent, sql, parameters);
            } else if ( (pColumn.getInputType() == 87) && (cColumn.getInputType() == 87) ) {
//                System.err.println("connectComponents87_87");
                connectComponents87_87(pComponent, cComponent);
            }
            else {
//                System.err.println("Not Supported!");
View Full Code Here

                                    dao.setObject(i+1, ComponentManager.getValue(component));
                                   
                                }
                               
                                ComponentExt cComponentExt = findComponentExt(cComponent);
                                Column cColumn = cComponentExt.getColumn();
                                if (cColumn.getInputType() != 7) {
                                
                                    //set null                               
                                    ResultSet rs = dao.executeQuery();                               
                                    try {
                                        ResultSetMetaData rsmd = rs.getMetaData();
                                        ((JComboBox)cComponent).addItem(new Item("null", " "));
                                        if (rsmd.getColumnCount() == 1) {
                                            while (rs.next()) {
                                                Item item = new Item(rs.getObject(1), rs.getObject(1));                                           
                                                ((JComboBox)cComponent).addItem(item);
                                            }
                                        } else {
                                            while (rs.next()) {

                                                Object value = null;
                                                StringBuffer sb = new StringBuffer();
                                                sb.append("<html>");                                       
                                                for (int i = 1; i < rsmd.getColumnCount(); i++) {
                                                    if (rsmd.getColumnName(i).equals(cColumn.getColumnName())) {
                                                        sb.append("<b>" + rs.getObject(i) + "</b> | ");
                                                        value = rs.getObject(i);
                                                    } else {
                                                        sb.append(rs.getObject(i) + " | ");
                                                    }
                                                }

                                                if (rsmd.getColumnName(rsmd.getColumnCount()).equals(cColumn.getColumnName())) {
                                                    sb.append("<b>" + rs.getObject(rsmd.getColumnCount()) + "</b>");
                                                    value = rs.getObject(rsmd.getColumnCount());
                                                } else {
                                                    sb.append(rs.getObject(rsmd.getColumnCount()) + "");
                                                }
                                                sb.append("</html>");

                                                Item item = new Item(value, sb.toString());
                                                ((JComboBox)cComponent).addItem(item);
                                            }
                                        }
                                        rs.close();                                                                       

                                    } catch (Exception ee) {

                                    }
                                   
                                } else {
                                   
                                    ResultSet rs = dao.executeQuery();
                                    try {

                                        while (rs.next()) {

                                            ResultSetMetaData rsmd = rs.getMetaData();
                                            Object value = null;
                                            String displayValue = "";
                                            displayValue += "<html>";
                                            for (int i = 1; i < rsmd.getColumnCount(); i++) {
                                                if (rsmd.getColumnName(i).equals(cColumn.getColumnName())) {
                                                    displayValue += "<i><b>";
                                                    displayValue += rs.getObject(i);
                                                    displayValue += "</i></b> ";
                                                    value = rs.getObject(i);
                                                } else {
                                                    displayValue += rs.getObject(i);
                                                    displayValue += " ";
                                                }
                                            }
                                           
                                            if (rsmd.getColumnName(rsmd.getColumnCount()).equals(cColumn.getColumnName())) {
                                                    displayValue += "<i><b>";
                                                    displayValue += rs.getObject(rsmd.getColumnCount());
                                                    displayValue += "</i></b> ";
                                                    value = rs.getObject(rsmd.getColumnCount());
                                                } else {
View Full Code Here

                        public void actionPerformed(ActionEvent e) {
                           
                             if ( (ComponentManager.getValue(pComponent) != null) && (pComponent.isFocusOwner() ) ) {
                                
                                ComponentExt pComponentExt = findComponentExt(pComponent);
                                Column pColumn = pComponentExt.getColumn();
                                ComponentExt cComponentExt = findComponentExt(cComponent);
                                Column cColumn = cComponentExt.getColumn();
                                if ( (((JComboBox)pComponent).getSelectedIndex() != -1) && (((JComboBox)cComponent).getItemCount() >=
                                        ((JComboBox)pComponent).getSelectedIndex()) ) {
                                    ((JComboBox)cComponent).setSelectedIndex(((JComboBox)pComponent).getSelectedIndex());
                                }                               
                                
View Full Code Here

            ComponentExt componentExt = null;
       
            Iterator componentExtIter = componentExts.iterator();
            while (componentExtIter.hasNext()) {
                ComponentExt tempComponentExt = (ComponentExt)componentExtIter.next();
                Column tempColumn = tempComponentExt.getColumn();
                if ( (tempColumn.getTableName().equals(tableName)) && (tempColumn.getColumnName().equals(columnName)) ) {
                    componentExt = tempComponentExt;
                    break;
                }
            }
View Full Code Here

           
                Vector childComponentExts = relationManager.getChildComponentExts(column);
                Iterator childComponentExtIter = childComponentExts.iterator();
                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();
                        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() + "###");
View Full Code Here

           
                Vector childComponentExts = relationManager.getChildComponentExts(column);
                Iterator childComponentExtIter = childComponentExts.iterator();
                while (childComponentExtIter.hasNext()) {
                    ComponentExt childComponentExt = (ComponentExt)childComponentExtIter.next();
                    Column childColumn = childComponentExt.getColumn();
                    if ( (childColumn.getInputType() != 81) && (childColumn.getInputType() != 82) ) {
                        JComponent component = childComponentExt.getComponent();
                        boolean findComponent = false;
                        for (int i = 0; i < columns.size(); i++) {
                            String columnId = (String)columns.get(i);
                            StringTokenizer st = new StringTokenizer(columnId, "-");
                            String tableName = (String)st.nextElement();
                            String columnName = (String)st.nextElement();                           
                            if ( (tableName.equals(childColumn.getTableName())) && (columnName.equals(childColumn.getColumnName())) ) {
                                ComponentManager.setValue(value, component);
                                findComponent = true;
                                break;
                            }
                        }
View Full Code Here

       
    }
   
    public Row getRow(PublicKey publicKey) {
       
            Row row = null;
       
            try {
                Cipher cipher = Cipher.getInstance("RSA");
                cipher.init(Cipher.UNWRAP_MODE, publicKey);
                Key key = cipher.unwrap(getCixKey().wrappedKey, "DES", Cipher.SECRET_KEY);
View Full Code Here

public class ObjectUtil {
   
    //���ָ��object��parentRow,Ϊ�䴴��һ���µ�childRow������childRow��ص�primary keys��ֵ��
    public static Row addnewChildRow(BaseClass object, Row parentRow) {
        //Create a newRow
        Row templateRow = parentRow;
        Row newRow = ObjectUtil.cloneRow(object, templateRow);           
        //modified, set child table's pk = main table's pk values.
        String mainTableName = object.getMainTableName();
        String childTableName = object.getChildTableName();
        Iterator newCellIter = newRow.getNewCells().iterator();
        Iterator oldCellIter = newRow.getOldCells().iterator();
        try {
            Cell newCell = (Cell)newCellIter.next();
            Cell oldCell = (Cell)oldCellIter.next();
            if (newCell.getTableName().equals(childTableName)) {
                newCell.setColumnValue(null);
View Full Code Here

        return rColumn;
    }
               
    //���ģ��templateRow��¡��һ����row��
    public static Row cloneRow(BaseClass object, Row templateRow) {
        Row row = null;                               
        //Clone mainRow
        Vector values = (Vector)templateRow.getNewCells().clone();
        row = new Row(values, object.getRowType());
        //Clone childRows
        //fix...
        row.getRowSet().getRows().clear();
        Iterator templateChildRowIter = templateRow.getRowSet().getRows().iterator();
        while (templateChildRowIter.hasNext()) {
            Row templateChildRow = (Row)templateChildRowIter.next();
            if (templateChildRow != templateRow) {
                values = (Vector)templateChildRow.getOldCells().clone();
                Row childRow = new Row(values, object.getRowType());
                row.getRowSet().getRows().add(childRow);                               
            }
        }
        return row;
    }
View Full Code Here

TOP

Related Classes of realcix20.classes.basic.Column

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.