Package DisplayProject

Examples of DisplayProject.ArrayColumn


        } else {
            c = this.newColour;
        }

        // TF:22/11/07:If this component is a template for an array column, get the array column first
        ArrayColumn column = this.column;
        JTable t = ArrayFieldCellHelper.getArrayField(this._component);
        if (t != null) {
            int col = ArrayFieldCellHelper.getArrayFieldColumn((JComponent)this._component);
            ArrayColumnModel model = (ArrayColumnModel) t.getColumnModel();
            column = (ArrayColumn)model.getRealColumn(col);
        }

        switch (this.colourType) {
        case cBACKGROUND:
            if (column != null) {
                //PM:22/11/07 fixed case for new cell renderers/editors
                if (column.getCellEditor() instanceof ArrayFieldCellEditor){
                    ((ArrayFieldCellEditor)column.getCellEditor()).setBackground(c);
                    ((ArrayFieldCellRenderer)column.getCellRenderer()).setBackground(c);
                }else {
                    ((JComponent)column.getCellEditor()).setBackground(c);
                    ((JComponent)column.getCellRenderer()).setBackground(c);
                }
            }
       
            // TF:02/12/2009:Even if we are affecting something that is a table column template,
            // we must still affect the underlying component. Failure to do this means that if
            // the renderer or editor derives the colour to paint the component from the original
            // template (as it should) then this won't be set. This is particularly prevalent
            // in say fill-in fields that are on unused rows in array fields.
            // Owing to the risk involved in this change, removing the else { ... } around this
            // section of code has only been done for the background colour, not the foreground colour
            /*
             * this is a special case for DataFields
             * TF:8/11/07:Added in the check for using the colour index
             */
            if (((comp instanceof JTextComponent) || (comp instanceof JComboBox))
                    && (this.forteColour == Constants.C_DEFAULT) && useColourIndex) {
                c = Color.WHITE;
            }
            if (comp instanceof ListView) {
                c = Color.WHITE;
            }
            if (comp instanceof JTree) {
                comp.getParent().getParent().setBackground(c);
            }
            if (comp != null) {
              comp.setBackground(c);
            }
            if (innerComp != null) {
                innerComp.setBackground(c);
            }
            break;
        case cFOREGROUND:
            if (this.column != null) {
                //PM:22/11/07 fixed case for new cell renderers/editors
                if (column.getCellEditor() instanceof ArrayFieldCellEditor){
                    ((ArrayFieldCellEditor)column.getCellEditor()).setForeground(c);
                    ((ArrayFieldCellRenderer)column.getCellRenderer()).setForeground(c);
                }else {
                    ((JComponent)column.getCellEditor()).setForeground(c);
                    ((JComponent)column.getCellRenderer()).setForeground(c);
                }
            } else if (comp instanceof DataField){
                comp.setForeground(c);
                ((DataField)comp).setDisabledTextColor(c);
            } else {
View Full Code Here


                  try {
                    // CraigM:22/08/2008 - Corrected checking of column.
                    // CraigM:07/11/2008 - Note: If an object was replaced that maps to 0 or more columns, then updatedColumn will be set to -1.
                    if (otm.table.getColumnModel() instanceof ArrayColumnModel) {
                      ArrayColumn ac = ((ArrayColumnModel)otm.table.getColumnModel()).findColumn(columnAttributeName);
                      if (ac != null) {
                        updatedColumn = ac.getModelIndex();
                      }
                    }
                  }
                  catch (Throwable e) {
                    // The data may not even be mapped to a column in the table
View Full Code Here

        super(table);
        this.column = column;
    }

    public void performAction() {
        ArrayColumn ac = (ArrayColumn)((ArrayColumnModel)((JTable)this._component).getColumnModel()).getColumn(column -1);
        ((JTable)this._component).getColumnModel().removeColumn(ac);
    }
View Full Code Here

  public void addColumn(String header, int width, TableCellRenderer renderer, TableCellEditor editor, boolean editable)
    {
        logger.debug("Add Column [" + header + "]");
        if (renderer == null && editor == null)
        {
            getColumnModel().addColumn(new ArrayColumn(header, columnCount, width, editable));
        }
        else if (renderer != null && editor == null)
        {
            getColumnModel().addColumn(new ArrayColumn(header, columnCount, width, renderer, editable));
        }
        else
        {
            getColumnModel().addColumn(new ArrayColumn(header, columnCount, width, renderer, editor, editable));
        }
        getColumnModel().getColumn(columnCount).setHeaderValue(header);
        columnCount++;
    }
View Full Code Here

              af = ArrayFieldCellHelper.getArrayField(component);
            }
            if (af != null) {
                int col = ArrayFieldCellHelper.getArrayFieldColumn((JComponent)component);
                //PM:23/11/07 correct for invisible columns
                ArrayColumn ac = (ArrayColumn)((ArrayColumnModel)af.getColumnModel()).getRealColumn(col);
                col = ((ArrayColumnModel)af.getColumnModel()).getColumnIndex(ac.getIdentifier());

                // If an explicit focus request occurs on an empty array field that allows append, then create
                // a new row (that's what Forte did).  CraigM 16/10/2007.
                if (af.getRowCount() == 0 && af.isAllowsAppend()) {
                    af.appendRow(col);
View Full Code Here

         */
        //  Some test code to see if code below could be simplified
        if (this.getSorter().isSorting())  {
            int column = this.getSorter().getSortColumn();
            ArrayColumnModel columnModel = this.getColumnModel();
            ArrayColumn arrayColumn = columnModel.getRealColumn(column);
            TextData name = new TextData();
            name.setValue(arrayColumn.getName());
            if (name.moveToString("Item")) {
                name = name.copyRange(name.getOffset());
            }
            boolean ascending = (this.getSorter().getSortDirection() == TableSorter.ASCENDING);

View Full Code Here

        if (acm.getRealColumnCount() > 0) {
            columns = new Array_Of_OutlineColumnDesc<OutlineColumnDesc>();
        }
        */
        for (int i = 0; i < acm.getRealColumnCount(); i++){
            ArrayColumn col = (ArrayColumn)acm.getRealColumn(i);
            columns.add(this.getOutlineColumn(col, false));
        }
        return columns;
    }
View Full Code Here

              // TF:19/3/08: Added in a factor to make the columns approximately as wide as they are in Forte.
                colWidth = (int)(UIutils.colsToPixels(col.getMaxCharacters(), this) * UIutils.FORTE_COLUMNS_SCALING_FACTOR);
            }
            AlignedCellRenderer renderer = new AlignedCellRenderer(alignment, col.getName().toString());
            renderer.setInsets(0, 2, 0, 2);
            ArrayColumn ac = new ArrayColumn(col.getName().toString(),
                    colNum,
                    colWidth,
                    renderer,
                    false,
                    new Integer(col.getTitleMsgNum()));
           
            // CraigM:18/07/2008 - We need to set the size policy as it is used in ArrayFieldModel.resizeColumnIfNecessary()
            ac.setSizePolicy(col.getSizePolicy());
           
            // TF:19/06/2008:In Forte, the user could always adjust the widths of the columns in a list view. If we use
            // setMinWidth (as the ArrayColumn constructor does) then the user cannot reduce the columns smaller than
            // their initial size. Hence we use setMinWidth(0) and setPreferredWith. This is done here rather than in
            // the array column constructor as this rule applies only for list views, not array fields.
            ac.setMinWidth(0);
            ac.setPreferredWidth(colWidth);
           
            col.setArrayColumn(ac);
            cm.addColumn(ac, col.getTitle().toString(), col.getState() != Constants.FS_INVISIBLE);

            propNames[colNum] = col.getName().toString();
View Full Code Here

        } else {
            c = this.newColour;
        }

        // TF:22/11/07:If this component is a template for an array column, get the array column first
        ArrayColumn column = this.column;
        JTable t = ArrayFieldCellHelper.getArrayField(this._component);
        if (t != null) {
            int col = ArrayFieldCellHelper.getArrayFieldColumn((JComponent)this._component);
            ArrayColumnModel model = (ArrayColumnModel) t.getColumnModel();
            column = (ArrayColumn)model.getRealColumn(col);
        }

        switch (this.colourType) {
        case cBACKGROUND:
            if (column != null) {
                //PM:22/11/07 fixed case for new cell renderers/editors
                if (column.getCellEditor() instanceof ArrayFieldCellEditor){
                    ((ArrayFieldCellEditor)column.getCellEditor()).setBackground(c);
                    ((ArrayFieldCellRenderer)column.getCellRenderer()).setBackground(c);
                }else {
                    ((JComponent)column.getCellEditor()).setBackground(c);
                    ((JComponent)column.getCellRenderer()).setBackground(c);
                }
            }
       
            // TF:02/12/2009:Even if we are affecting something that is a table column template,
            // we must still affect the underlying component. Failure to do this means that if
            // the renderer or editor derives the colour to paint the component from the original
            // template (as it should) then this won't be set. This is particularly prevalent
            // in say fill-in fields that are on unused rows in array fields.
            // Owing to the risk involved in this change, removing the else { ... } around this
            // section of code has only been done for the background colour, not the foreground colour
            /*
             * this is a special case for DataFields
             * TF:8/11/07:Added in the check for using the colour index
             */
            if (((comp instanceof JTextComponent) || (comp instanceof JComboBox))
                    && (this.forteColour == Constants.C_DEFAULT) && useColourIndex) {
                c = Color.WHITE;
            }
            if (comp instanceof ListView) {
                c = Color.WHITE;
            }
            if (comp instanceof JTree) {
                comp.getParent().getParent().setBackground(c);
            }
            if (comp != null) {
              comp.setBackground(c);
            }
            if (innerComp != null) {
                innerComp.setBackground(c);
            }
            break;
        case cFOREGROUND:
          // TF:13/08/2010:Changed this to be the underlying column, using the getRealColumn call above.
            if (column != null) {
                //PM:22/11/07 fixed case for new cell renderers/editors
                if (column.getCellEditor() instanceof ArrayFieldCellEditor){
                    ((ArrayFieldCellEditor)column.getCellEditor()).setForeground(c);
                    ((ArrayFieldCellRenderer)column.getCellRenderer()).setForeground(c);
                }else {
                    ((JComponent)column.getCellEditor()).setForeground(c);
                    ((JComponent)column.getCellRenderer()).setForeground(c);
                }
            } else if (comp instanceof DataField){
                comp.setForeground(c);
                ((DataField)comp).setDisabledTextColor(c);
            } else {
View Full Code Here

TOP

Related Classes of DisplayProject.ArrayColumn

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.