Package DisplayProject

Examples of DisplayProject.ArrayColumnModel


         * to the sorting column.
         */
        //  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());
            }
View Full Code Here


     * The GetColumnList method returns a copy of an outline field�s array of outline column descriptors
     * @return
     */
    public Array_Of_OutlineColumnDesc<OutlineColumnDesc> getColumnList(){
        Array_Of_OutlineColumnDesc<OutlineColumnDesc> columns = new Array_Of_OutlineColumnDesc<OutlineColumnDesc>();
        ArrayColumnModel acm = (ArrayColumnModel)this.table.getColumnModel();
       
        // CraigM:22/08/2008 - Get the real columns
        /*
        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

     * You use setColumnList to produce the column descriptors for outline fields for code generation; you cannot use it to dynamically change the outline column descriptors for a ListView field displaying data.
     * @param columns
     */
    public void setColumnList(Array_Of_OutlineColumnDesc<OutlineColumnDesc> columns){
        //  === Column model setup ===
        ArrayColumnModel cm = new ArrayColumnModel();
        int colNum = 0;
        // TF:14 Jul 2009:Placing a check if columns are null
        if (columns == null) {
          return;
       
        String[] propNames = new String[columns.size()];
        boolean isDraggable = false;

        for (OutlineColumnDesc col : (List<OutlineColumnDesc>)columns){
            int alignment = JLabel.LEFT;
            switch (col.getAlignment()){
            case Constants.TA_LEFT:
                alignment = JLabel.LEFT;
                break;
            case Constants.TA_RIGHT:
                alignment = JLabel.RIGHT;
                break;
            case Constants.TA_CENTER:
                alignment = JLabel.CENTER;
                break;
            }
            int colWidth = 0;
            if (col.getArrayColumn() != null) {
                colWidth = col.getArrayColumn().getMinWidth();
            }
            else if (col.getActualWidth() >= 0) {
              colWidth = col.getActualWidth();
            }
            else {
              // 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();
            colNum++;
           
            if (col.getState() == Constants.FS_DRAG) {
View Full Code Here

   * @param setNumber
   * @param mcat
   */
  //PM:23/4/08
  public void loadColumnHeadings(int setNumber, MsgCatalog mcat) {
    ArrayColumnModel acm = (ArrayColumnModel)this.table.getColumnModel();
   
    // CraigM:01/05/2008:Use the total array collection (including invisible columns)
    ArrayList<ArrayColumn> allColumns = acm.getColumnList();

    for (int i = 0; i < allColumns.size(); i++){
            ArrayColumn col = allColumns.get(i);
            if (col.getTitleMsgNumber() > 0){
              String titleString = mcat.getString(setNumber, col.getTitleMsgNumber());
View Full Code Here

    /**
     * Determine the index of the first visible column. If no visible column is found, this method returns -1
     * @return integer index of the first visible column.
     */
    public int getFirstVisibleColumnIndex() {
        ArrayColumnModel acm = (ArrayColumnModel)this.table.getColumnModel();
        for (int i = 0; i < acm.getRealColumnCount(); i++){
            ArrayColumn col = (ArrayColumn)acm.getRealColumn(i);
          if (col.isVisible()) {
            return i;
          }
        }
    return -1;
View Full Code Here

     * @param name
     */
    public TableHelper(int rowHeight, String name)
    {
        table = TableFactory.newArrayField(name, rowHeight);
        ArrayColumnModel cm = new ArrayColumnModel();
        table.setColumnModel(cm);
    }
View Full Code Here

    setColumnSelectionAllowed(false);
    setName(name);
    if (rowHeight > 0){//PM:22/05/2008:fixed for express
      setRowHeight( rowHeight );
    }
    setColumnModel(new ArrayColumnModel()); //Added to reduce code generated
    setRowSelectionAllowed(true);
    setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    setSelectionBackground(UIutils.PaleYellow); // This is the pale yellow row highlight - If you want it yellow use: UIutils.PaleYellow
    setSelectionForeground(Color.BLACK);
    setIntercellSpacing(new Dimension()); // CraigM: 19/07/2007 - Remove the gaps between the rows
View Full Code Here

      // notify the Model that a new row has bee added
      ((ArrayFieldModel)this.getModel()).shouldIgnoreRowChange(e); //Required to prevent multiple AfterRowEntry events

      // CraigM:12/06/2008 - If they created a new row on a button column, create an event as if they had pressed the button
      ArrayColumnModel cm = (ArrayColumnModel)getColumnModel();

      // CraigM:26/06/2008 - Don't use the getRealColumn method as we have obtained this column from x,y coords
      Component comp = this.getColumnTemplate((ArrayColumn)cm.getColumn(col));

      // CraigM:25/07/2008 - Do this for DataFields as well
      if (comp instanceof TableJButton || comp instanceof DataField) {
        // CraigM:12/06/2008 - Create a new mouse event with x,y coords in the middle of the button
        e = new MouseEvent(comp,
View Full Code Here

   * The pCol parameter is a 1-based index which represents the real column in the array field
   * @param pCol
   * @return
   */
  public JComponent getColumnTemplate(int pCol) {
    ArrayColumnModel cm = (ArrayColumnModel)getColumnModel();
    //PM:28/4/08 corrected for real column
    return this.getColumnTemplate(cm.getRealColumn(pCol-1));
  }
View Full Code Here

   * @param column the 0-based index into the array column model (using the real model)
   * @return the TextGraphic used to render the column title.
   */
  public TextGraphic getColumnTitle(int column){
    //PM:28/4/08 corrected for real column
    ArrayColumnModel cm = (ArrayColumnModel)getColumnModel();
    // TF:3/7/08:Made this 0-based for consistency with Java, not 1-based as per Forte
    String title = cm.getRealColumn(column).getHeaderValue().toString();
    return (TextGraphic)getTableHeader().getDefaultRenderer().getTableCellRendererComponent(this, title, false, false, 0, column);

  }
View Full Code Here

TOP

Related Classes of DisplayProject.ArrayColumnModel

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.