Beispiel #1
0
  protected void makeGantt() {
    gantt_ = new GanttTable(makeTableModel(model_));

    // System.out.println("model rows:"+model.getTableModel().getRowCount());
    TableColumnModel columnModel = gantt_.getColumnModel(1);
    TableColumn column = columnModel.getColumn(0);

    // Enable drag and drop
    TableCellEditor editor = gantt_.getDefaultEditor(1, AbstractDrawingState.class);
    column.setCellEditor(editor);

    gantt_
        .getDrawingContext()
        .put(ContextConstants.EDITING_AXIS, ContextResources.OTHER_PROPERTY, GanttTable.TIME_AXIS);

    gantt_
        .getDrawingContext()
        .put(
            ContextConstants.EDITING_MODE,
            ContextResources.OTHER_PROPERTY,
            EditorDrawingModule.MOVE_RESIZE_EDITOR);

    // Display timeline at the top
    column.setHeaderValue(GanttEntryHelper.createCalendar());
    gantt_.setTimeRange(start_.getTime(), end_.getTime());
    gantt_.addMouseMotionListener(this);

    /* TODO: Disable row selection?
    JTable activityTable = gantt_.getTableComponent(1);
    activityTable.setRowSelectionAllowed(false);
    activityTable.setColumnSelectionAllowed(false);
    activityTable.setCellSelectionEnabled(false);
    */
  }
Beispiel #2
0
  public PSEGantt(PSGanttModel model, Calendar start, Calendar end) {
    super(model);
    start_ = start;
    end_ = end;
    colorProvider_ = new DefaultColorProvider();

    makeGantt();

    refreshBtn_ = new JButton("Refresh");
    setLayout(new BorderLayout());
    // add(BorderLayout.NORTH,refreshBtn_);
    add(BorderLayout.CENTER, gantt_);
    add(new GanttToolBar(gantt_.getViewManager(GanttTable.TIME_AXIS)), BorderLayout.SOUTH);
  }