Package net.sourceforge.ganttproject.resource

Examples of net.sourceforge.ganttproject.resource.ResourceColumn


        cols[INDEX_RESOURCE_PHONE] = strResourcePhone;
        cols[INDEX_RESOURCE_ROLE] = strResourceRole;
        cols[INDEX_RESOURCE_ROLE_TASK] = strResourceRoleForTask;
        for (int i = 0; i < cols.length; i++)
        {
          ResourceColumn col = (ResourceColumn)columns.get(new Integer(i));
          if (col != null)
            col.setTitle(cols[i]);
        }

    }
View Full Code Here


     */
    public Class getColumnClass(int colIndex) {
      if (colIndex == 0) {
            return hierarchicalColumnClass;
      }
      ResourceColumn column = (ResourceColumn)columns.get(new Integer(colIndex));
        return column==null ? String.class : column.getType();
    }
View Full Code Here

      columns.put(new Integer(index), col);
    }

    /** deletes a custom column from the datamodel */
    public ResourceColumn deleteCustomColumn(String name){
      ResourceColumn toDel = null;
      Collection vals = columns.values();
      Iterator i = vals.iterator();

      while (i.hasNext()) {
        toDel = (ResourceColumn)i.next();
        if (name.equals( toDel.getTitle() )) {
          ((HumanResourceManager)myResourceManager).removeCustomField(toDel.getTitle());
          /* this deletes the object from the Hashtable too */
          vals.remove(toDel);
          return toDel;
        }
      }
View Full Code Here

        tce4.setTitle(ResourceTreeTableModel.strResourcePhone);
        TableColumnExt tce5 = newTableColumnExt(4);
        tce5.setTitle(ResourceTreeTableModel.strResourceRoleForTask);
       
        /* adding the columns on the screen and to the data model*/
        this.addMandatoryColumn(new ResourceColumn(tce1, ttModel.useNextIndex(), String.class));
        this.addMandatoryColumn(new ResourceColumn(tce2, ttModel.useNextIndex(), String.class));
        this.addMandatoryColumn(new ResourceColumn(tce3, ttModel.useNextIndex(), String.class));
        this.addMandatoryColumn(new ResourceColumn(tce4, ttModel.useNextIndex(), String.class));
        this.addMandatoryColumn(new ResourceColumn(tce5, ttModel.useNextIndex(), String.class));
       
        initColumnsAlignements();
        ArrayList cols = ttModel.getColumns();
        for (int i=2; i<cols.size(); i++) {
            hideColumn((ResourceColumn) cols.get(i));
View Full Code Here

    }

    protected void updateColumnOrders(int fromIndex, int toIndex) {
    List columns = ttModel.getColumns();
    for (int i=0; i<columns.size(); i++) {
      ResourceColumn nextColumn = (ResourceColumn) columns.get(i);
      if (nextColumn.getOrder()==fromIndex) {
        nextColumn.setOrder(toIndex);
        continue;
      }
      if (nextColumn.getOrder()==toIndex) {
        nextColumn.setOrder(fromIndex);
        continue;
      }
    }
  }
View Full Code Here

    private void createPopup() {
      popupMenu = new JPopupMenu();
   
      /* show columns list */
      ArrayList cols = ttModel.getColumns();
      ResourceColumn col;
    int size = cols.size();
    for (int i =0; i < size; i++) {
      col = (ResourceColumn)cols.get(i);
      JCheckBoxMenuItem item = new JCheckBoxMenuItem(col.getTitle(), col.isVisible());
      item.addActionListener(new ColumnHandler(col));
      popupMenu.add(item);
    }
    popupMenu.addSeparator();
   
    /* 'display all columns' button*/
    JMenuItem showAllItem = new JMenuItem(language.getText("displayAll"));
    showAllItem.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                /* TODO the undo management */
                Mediator.getGanttProjectSingleton().getUndoManager()
                    .undoableEdit("displayAllColumns", new Runnable() {
                          public void run() {
                            /* sets all the columns visible */
                            ArrayList cols = ttModel.getColumns();
                            for (int i =0; i < cols.size(); i++) {
                              ResourceColumn col = (ResourceColumn)cols.get(i);
                              if (!col.isVisible()) {
                                showColumn(col);
                              }
                            }
                              getProject().setModified(true);
                          }
                      });
              }
      });
    popupMenu.add(showAllItem);
    popupMenu.addSeparator();
   
    /* 'add new column' button */
    JMenuItem addColumnItem = new JMenuItem(language.getText("addCustomColumn"));
    addColumnItem.setIcon(new ImageIcon(getClass().getResource("/icons/addCol_16.gif")));
    addColumnItem.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                /* TODO the undo management */
                Mediator.getGanttProjectSingleton().getUndoManager()
                    .undoableEdit("addCustomColumn", new Runnable() {
                          public void run() {
                            ResourceColumn column = null;
                            addCustomColumn(column);
                            getProject().setModified();
                          }
                      });
              }
View Full Code Here

      ttModel.addMandatoryColumn(column);
    }

    private ResourceColumn newResourceColumn() {
    TableColumnExt col = newTableColumnExt(ttModel.useNextIndex());
    ResourceColumn result = new ResourceColumn(col, col.getModelIndex());
    return result;
    }
View Full Code Here

    return result;
    }

    private ResourceColumn newResourceColumn(int id) {
    TableColumnExt col = newTableColumnExt(ttModel.useNextIndex());
    ResourceColumn result = new ResourceColumn(col, id);
    return result;
    }
View Full Code Here

      }
    }
   
    /* deletes the column from the screen and the data model */
    public void deleteCustomColumn(String name) {
      ResourceColumn col = null;
      col = ttModel.deleteCustomColumn(name);
      this.removeColumn(col.getColumn());
    }
View Full Code Here

            }
        }
    }

  public   CustomPropertyDefinition createDefinition(String id, String typeAsString, String name, String defaultValueAsString) {
    final ResourceColumn newColumn = newResourceColumn(Integer.valueOf(id).intValue());
    newColumn.setTitle(name);
    final CustomPropertyDefinition stubDefinition = CustomPropertyManager.PropertyTypeEncoder.decodeTypeAndDefaultValue(typeAsString, defaultValueAsString);
    newColumn.setType(stubDefinition.getType());
    newColumn.setDefaultVal(stubDefinition.getDefaultValue());
    assert String.valueOf(newColumn.getIndex()).equals(id);
    addCustomColumn(newColumn);
    List definitions = myResourceManager.getDefinitions();
    return (CustomPropertyDefinition) definitions.get(definitions.size()-1);
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.resource.ResourceColumn

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.