Package realcix20.classes.basic

Examples of realcix20.classes.basic.Column


                String value = null;
                StringTokenizer st = new StringTokenizer(name, "_");
                st.nextElement();
                String tableName = (String)st.nextElement();
                String columnName = (String)st.nextElement();         
                Column column = ObjectUtil.findColumn(object, tableName, columnName);
                if (column != null)
                    value = column.toString();
                else
                    value = tableName + "_" + columnName;
                if (name.indexOf("SUM_") > -1)
                    tcolumn.setHeaderRenderer(new ImageRenderer("SUM(" + value + ")", ImageManager.getImage(ImageManager.SUM_IMAGE)));
                else if (name.indexOf("COUNT_") > -1)
                    tcolumn.setHeaderRenderer(new ImageRenderer("COUNT(" + value + ")", ImageManager.getImage(ImageManager.COUNT_IMAGE)));
            }                       
        }
        try {
            for (int i = 1; i < tm.getColumnCount(); i++) {
                if (tm.getRs().getMetaData().getColumnDisplaySize(i) == 6)
                    cm.getColumn(i - 1).setPreferredWidth(150);
                else if (tm.getRs().getMetaData().getColumnDisplaySize(i) >= 256)
                    cm.getColumn(i -1).setPreferredWidth(100);
                else
                    cm.getColumn(i - 1).setMinWidth(tm.getRs().getMetaData().getColumnDisplaySize(i) * 5);
                cm.getColumn(i - 1).setMaxWidth(200);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        int n = 0;
        Iterator keyIter = sortStates.keySet().iterator();
        CacheTableModel model = (CacheTableModel)table.getModel();
        if (stat.equals("object")) {
            while (keyIter.hasNext()) {           
                Column column = (Column)keyIter.next();
                for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
                    String columnName = (String)table.getColumnModel().getColumn(i).getHeaderValue();
                    if (column.toString().equals(columnName)) {
                        table.getColumnModel().getColumn(i).setHeaderRenderer(new SortRenderer((String)sortStates.get(column), n + 1));
                        break;
                    }
                }
                n++;
View Full Code Here


                    columnName = (String)st.nextElement();
                } else {
                    tableName = (String)model.getTables().get(i);
                    columnName = (String)model.getColumns().get(i);
                }
                Column column = ObjectUtil.findColumn(object, tableName, columnName);
                if (column != null)
                    value = column.toString();
                else
                    value = tableName + "_" + columnName;
                id = tableName + "." + columnName;
                if (name.indexOf("SUM_") > -1) {
                    id = "SUM_" + id;
View Full Code Here

       
    private void search() {
        sortStates.clear();
        if (stat.equals("object")) {
            if (searchText.getText().trim().length() > 0) {
                Column selectColumn = (Column)searchField.getSelectedItem();               
                //fix
                current_sql = object.getBasicSQL().concat(" WHERE UPPER(" + selectColumn.getTableName() + "." +
                        selectColumn.getColumnName()  + ") LIKE " + "'%" + searchText.getText().trim().toUpperCase() + "%'");
                initTableProperties(current_sql);
            } else {
                initTableProperties(object.getBasicSQL());
            }
        } else if (stat.equals("report")) {
View Full Code Here

        TableColumnModel colModel = table.getColumnModel();
        int columnModelIndex = colModel.getColumnIndexAtX(e.getX());
        int modelIndex = colModel.getColumn(columnModelIndex)
          .getModelIndex();
        CacheTableModel model = (CacheTableModel)table.getModel();
        Column column = model.getColumn(modelIndex);
        String sortOrder = "ASC";       
        if (sortStates.get(column) != null) {
            if (sortStates.get(column).equals("DESC"))
                sortStates.remove(column);
            else if (sortStates.get(column).equals("ASC")) {
                sortOrder = "DESC";
                sortStates.put(column, sortOrder);
            }
        } else {
            sortStates.clear();
            sortStates.put(column, sortOrder);
        }
        Iterator keyIter = sortStates.keySet().iterator();
        int n = 0;
        String sortSql = current_sql;
        while (keyIter.hasNext()) {
            Column tempColumn = (Column)keyIter.next();
            if (n == 0)
                sortSql = sortSql.concat(" ORDER BY " + tempColumn.getTableName() + "." +
                        tempColumn.getColumnName() + " " + sortStates.get(tempColumn));
            else
                sortSql = sortSql.concat(", " + tempColumn.getTableName() + "." +
                        tempColumn.getColumnName() + " " + sortStates.get(tempColumn));
            n++;
        }
        initTableProperties(sortSql);
    }
View Full Code Here

            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));
                        } else {
View Full Code Here

            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();
                    Vector columns = detailList.getColumns();
                    DefaultTableModel model = (DefaultTableModel)detailList.getTable().getModel();
                    Vector dataVector = model.getDataVector();            
                    Vector tDataVector = detailList.tDataVector;
                    Iterator dataVectorsIter = dataVector.iterator();
                    Iterator tDataVectorsIter = tDataVector.iterator();
                    while (dataVectorsIter.hasNext()) {
                        Vector rowDatas = (Vector)dataVectorsIter.next();
                        Vector tRowDatas = (Vector)tDataVectorsIter.next();
                        Object rowValue = rowDatas.get(rowDatas.size() - 1);
                        if (value == null)
                            value = "";
                        if (rowValue == null)
                            rowValue = "";
                        if (value.equals(rowValue)) {                           
                            if (column.getCControls() == null) {
                                cellResult = true;
                                break;
                            } else {       
                                StringTokenizer st = new StringTokenizer(column.getCControls(), "!!");
                                boolean childResult = true;
                                while (st.hasMoreElements()) {
                                    StringTokenizer stt = new StringTokenizer((String)st.nextElement(), ".");
                                    String tableName = (String)stt.nextElement();
                                    String columnName = (String)stt.nextElement();
                                    Object newValue = ObjectUtil.findNewCell(container.getSelectedRow(), tableName, columnName).getColumnValue();                          
                                    Column tempColumn = ObjectUtil.findColumn(container.getObject(), tableName, columnName);
                                    if ( (tempColumn.getInputType() != 81) && (tempColumn.getInputType() != 101) ) {
                                        childResult = true;
                                    } else {
                                        if (newValue == null)
                                        newValue = "";
                                        boolean find = false;
View Full Code Here

       
        Iterator cellIter = row.getNewCells().iterator();       
        int currentColumn = 0;     
        while (cellIter.hasNext()) {           
            Cell cell = (Cell)cellIter.next();
            Column column = findColumn(container.getObject(), cell.getTableName(), cell.getColumnName());
            if (column.isItemField()) {
                model.setValueAt(cell.getColumnValue(), container.getSelectedRowNumber(), currentColumn);
                currentColumn++;
            }           
        }
        container.getContainer().updateTable();
View Full Code Here

                   
           
            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())) ) {
                       
                        if (column.getInputType() == 24) {//lastchanged by
                            Row currentRow = Session.getInstance().getCurrentUser();
                            Iterator tempCellIter = currentRow.getOldCells().iterator();
                            while (tempCellIter.hasNext()) {
                                Cell tempCell = (Cell)tempCellIter.next();
                                if (tempCell.getColumnName().equals("RUSER"))
                                    cell.setColumnValue(tempCell.getColumnValue());
                            }
                        } else if (column.getInputType() == 23) {//lastchanged
                            Date date = new Date();
                            Calendar cal = Calendar.getInstance();
                            cal.setTime(date);
                            int year = cal.get(Calendar.YEAR);
                            int month = cal.get(Calendar.MONTH) + 1;
View Full Code Here

    }
   
    //help methods
    private Column findColumn(BaseClass object, String tableName, String columnName) {
       
            Column rColumn = null;
       
            Iterator columnIter = object.getColumns().iterator();
            while (columnIter.hasNext()) {
                Column column = (Column)columnIter.next();
                if ( (column.getTableName().equals(tableName)) && (column.getColumnName().equals(columnName)) ) {
                    rColumn = column;
                    break;
                }
            }
           
View Full Code Here

       
    }
   
    public void init81Or82Or83ComponentAction(ComponentExt componentExt) {
                   
            final Column column = componentExt.getColumn();
            JComponent component = componentExt.getComponent();
            if (column.getInputType() == 83) {
                final XrCalculator xrCalculator = (XrCalculator)component;
                xrCalculator.setRelationManager(this);
                final Vector parameters = getParameters(componentExt);
                final String sql = getSQL(componentExt, parameters);
                xrCalculator.addActionListener(
                    new ActionAdapter() {
                        public void actionPerformed(ActionEvent e) {

                            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 componentExt = findComponentExt(tableName, columnName);
                                JComponent component = componentExt.getComponent();
                                dao.setObject(i+1, ComponentManager.getValue(component));

                            }

                            ResultSet rs = dao.executeQuery();
                            try {
                                ResultSetMetaData rsmd = rs.getMetaData();
                                Vector columns = new Vector();
                                for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                    ComponentExt tempComponentExt = findComponentExt(column.getTableName(), rsmd.getColumnName(i));
                                    boolean isThisObjectColumn = (tempComponentExt != null);
                                    if (isThisObjectColumn)
                                        columns.add(column.getTableName() + "-" + rsmd.getColumnName(i));
                                    else
                                        columns.add(rsmd.getTableName(i) + "-" + rsmd.getColumnName(i));

                                }                                                                               
                                xrCalculator.setColumns(columns);
                            } catch (Exception ee) {
                                ee.printStackTrace();
                            }                                     

                        }     
                });
            } else if ( (column.getInputType() == 81) || (column.getInputType() == 82) ) {                    
                final DetailList detailList = (DetailList)component;
                detailList.setRelationManager(this);
                final Vector parameters = getParameters(componentExt);
                final String sql = getSQL(componentExt, parameters);
                detailList.addActionListener(
                    new ActionAdapter() {
                        public void actionPerformed(ActionEvent e) {

//                            System.err.println("81 = 82");
                            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();
//                                System.err.println("TABLENAME=" + tableName + "  COLUMNNAME=" + columnName);
                                ComponentExt componentExt = findComponentExt(tableName, columnName);
//                                System.err.println("componentExt = " + componentExt);
                                JComponent component = componentExt.getComponent();
                                dao.setObject(i+1, ComponentManager.getValue(component));
                            }
                            ResultSet rs = dao.executeQuery();                           
                            try {
//                                System.err.println(rs.getStatement());
                                ResultSetMetaData rsmd = rs.getMetaData();
                                Vector columns = new Vector();
                                Vector columnNames = new Vector();
                                Vector datas = new Vector();
                                detailList.tDataVector = new Vector();
                                for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                    ComponentExt tempComponentExt = findComponentExt(column.getTableName(), rsmd.getColumnName(i));
                                    boolean isThisObjectColumn = (tempComponentExt != null);
                                    if (isThisObjectColumn)
                                        columns.add(column.getTableName() + "-" + rsmd.getColumnName(i));
                                    else
                                        columns.add(rsmd.getTableName(i) + "-" + rsmd.getColumnName(i));

                                    Column tempColumn = null;
                                    if (isThisObjectColumn)
                                        tempColumn = ColumnManager.getColumn(column.getTableName(), rsmd.getColumnName(i));
                                    else
                                        tempColumn = ColumnManager.getColumn(rsmd.getTableName(i), rsmd.getColumnName(i));
                                    if (tempColumn != null) {
                                        String columnName = ObjectUtil.findColumnTxt(tempColumn.getClsId(), tempColumn.getTableName(), tempColumn.getColumnName());
                                        if (columnName != null)
                                            columnNames.add(columnName);
                                        else {
                                            columnNames.add("Txt");
                                        }
                                    } else {
                                        columnNames.add("Txt");
                                    }
                                }                                       
                                columnNames.add("value");//restore value
                                detailList.setColumns(columns);
                               
                                while (rs.next()) {
                                    Vector rowDatas = new Vector();
                                    detailList.tRowDatas = new Vector();
                                    for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                        Object columnValue = rs.getObject(rsmd.getColumnName(i));
                                        ComponentExt tempComponentExt = findComponentExt(column.getTableName(), rsmd.getColumnName(i));
                                        boolean isThisObjectColumn = (tempComponentExt != null);
                                        Column tempColumn = null;
                                        if (isThisObjectColumn) {
                                            tempColumn = ColumnManager.getColumn(column.getTableName(), rsmd.getColumnName(i));
                                        } else {
                                            tempColumn = ColumnManager.getColumn(rsmd.getTableName(i), rsmd.getColumnName(i));
                                        }
                                        if (tempColumn != null) {
                                            if (tempColumn.isI18N()) {
                                                String i18nString = I18NManager.getI18NString(tempColumn.getI18nPrefix(), columnValue);
                                                if (GlobalValueManager.getValue("APPLICATION.ZIC").equals("1")) {
                                                    rowDatas.add(i18nString);
                                                } else if (GlobalValueManager.getValue("APPLICATION.ZIC").equals("2")) {
                                                    rowDatas.add(columnValue);
                                                } else if (GlobalValueManager.getValue("APPLICATION.ZIC").equals("3")) {
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.