use of javax.swing.table.TableColumn in project processdash by dtuma.
the class TaskScheduleDialog method createFlatColumnModel.
private TableColumnModel createFlatColumnModel() {
DefaultTableColumnModel result = new DefaultTableColumnModel();
int extraWidth = 0;
for (int i = 0; i < treeColumnModel.getColumnCount(); i++) {
TableColumn c = treeColumnModel.getColumn(i);
switch(c.getModelIndex()) {
case EVTaskList.TASK_COLUMN:
case EVTaskList.NODE_TYPE_COLUMN:
case EVTaskList.PLAN_TIME_COLUMN:
case EVTaskList.PLAN_DTIME_COLUMN:
//case EVTaskList.ACT_DTIME_COLUMN:
case EVTaskList.PLAN_DATE_COLUMN:
case EVTaskList.REPLAN_DATE_COLUMN:
case EVTaskList.FORECAST_DATE_COLUMN:
case EVTaskList.MILESTONE_COLUMN:
case EVTaskList.LABELS_COLUMN:
case EVTaskList.NOTES_COLUMN:
case EVTaskList.DEPENDENCIES_COLUMN:
case EVTaskList.PCT_SPENT_COLUMN:
result.addColumn(TableUtils.cloneTableColumn(c));
break;
default:
extraWidth += c.getPreferredWidth();
break;
}
}
TableColumn c = result.getColumn(0);
c.setPreferredWidth(c.getWidth() + extraWidth);
return result;
}
use of javax.swing.table.TableColumn in project processdash by dtuma.
the class TableUtils method cloneTableColumn.
public static TableColumn cloneTableColumn(TableColumn c) {
TableColumn result = new TableColumn(c.getModelIndex(), c.getPreferredWidth(), c.getCellRenderer(), c.getCellEditor());
result.setMaxWidth(c.getMaxWidth());
result.setMinWidth(c.getMinWidth());
result.setResizable(c.getResizable());
result.setHeaderValue(c.getHeaderValue());
result.setHeaderRenderer(c.getHeaderRenderer());
result.setIdentifier(c.getIdentifier());
return result;
}
use of javax.swing.table.TableColumn in project processdash by dtuma.
the class SizeMetricsTableModel method createJTable.
public JTable createJTable() {
JTable table = new ItemListJTable(this);
// adjust column widths
table.getColumnModel().getColumn(0).setPreferredWidth(100);
table.getColumnModel().getColumn(1).setPreferredWidth(200);
table.getColumnModel().getColumn(2).setPreferredWidth(100);
table.setRowHeight(table.getRowHeight() + 4);
// draw read-only phases with a different appearance
table.setDefaultRenderer(String.class, new ItemTableCellRenderer());
// install a combo box as the editor for the "phase type" column
TableColumn unitsColumn = table.getColumnModel().getColumn(UNITS_COL);
JComboBox unitsEditor = new JComboBox(UNITS_TYPES);
unitsEditor.setRenderer(new UnitsCellRenderer());
unitsEditor.setFont(unitsEditor.getFont().deriveFont(Font.PLAIN));
unitsColumn.setCellEditor(new DefaultCellEditor(unitsEditor));
return table;
}
use of javax.swing.table.TableColumn in project processdash by dtuma.
the class TimeLogEditor method constructEditPanel.
private JPanel constructEditPanel() {
JPanel retPanel = new JPanel(false);
retPanel.setLayout(new BorderLayout());
tableModel = new TimeLogTableModel();
if (Settings.isReadOnly() || forceReadOnly)
tableModel.setEditable(false);
tableModel.setApprover(approver);
tableModel.addTableModelListener(this);
table = new TimeLogJTable(tableModel);
TableUtils.configureTable(table, TimeLogTableModel.COLUMN_WIDTHS, TimeLogTableModel.COLUMN_TOOLTIPS);
TableColumn startTimeCol = table.getColumnModel().getColumn(TimeLogTableModel.COL_START_TIME);
startTimeCol.setCellEditor(new JDateTimeChooserCellEditor(Settings.getVal("timelog.dateTimeEditFormat", DATE_TIME_FORMAT)));
retPanel.add("Center", new JScrollPane(table));
JPanel btnPanel = new JPanel(false);
addButton = createButton(btnPanel, "Add", "addRow");
createButton(btnPanel, "Delete", "deleteSelectedRow");
createButton(btnPanel, "Summarize_Button", "summarizeWarning");
if (Settings.isReadWrite() && !forceReadOnly)
retPanel.add("South", btnPanel);
return retPanel;
}
use of javax.swing.table.TableColumn in project processdash by dtuma.
the class InstructionTable method setUpWrappedTextColumn.
void setUpWrappedTextColumn() {
TableColumn column = getColumnModel().getColumn(1);
column.setCellRenderer(new WrappedTextTableCellRenderer(this));
}
Aggregations