MyJTable( IDataSetTableControls creator, IDataSetUpdateableModel updateableObject, int listSelectionMode, ISession session) { super(new SortableTableModel(new DataSetViewerTableModel(creator))); _creator = creator; _typedModel = (DataSetViewerTableModel) ((SortableTableModel) getModel()).getActualModel(); _multiplier = getFontMetrics(getFont()).stringWidth(data) / data.length(); setRowHeight(getFontMetrics(getFont()).getHeight()); boolean allowUpdate = false; // we want to allow editing of read-only tables on-demand, but // it would be confusing to include the "Make Editable" option // when we are already in edit mode, so only allow that option when // the background model is updateable AND we are not already editing if (updateableObject != null && !creator.isTableEditable()) allowUpdate = true; createGUI(allowUpdate, updateableObject, listSelectionMode, session); // just in case table is editable, call creator to set up cell editors _creator.setCellEditors(this); /* * TODO: When 1.4 is the earliest version supported, add the following line: * setSurrendersFocusOnKeystroke(true); * This should help handle some problems with navigation using tab & return * to move through cells. */ }
public void setColumnDefinitions(ColumnDisplayDefinition[] colDefs) { TableColumnModel tcm = createColumnModel(colDefs); setColumnModel(tcm); _typedModel.setHeadings(colDefs); // just in case table is editable, call creator to set up cell editors _creator.setCellEditors(this); _tablePopupMenu.reset(); }