|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTable org.bibalex.daf.commongui.controls.FileLevelInfoTable
public class FileLevelInfoTable
A custom table that extends JTable to display FileLevelInfo.
The table consist primarily of 6 columns: 'Type', 'From', 'To', 'Phase', 'Reason' and 'Comment'.
2 optional columns can be added: 'User' and 'Done' column.
All the cells in the table are editable unless the 'Done' optional column is added.
If the 'Done' optional column is added it will be the only editable column.
The table provides customs editors and rendereres for columns:
'Type', 'Phase' & 'Reason' columns have a JComboBox editor.
'Done' column has a JCheckBox renderer and editor.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private int |
commentColumn
|
private int |
doneColumn
|
private FileLevelInfo[] |
fillingInfo
Holds the FileLevelInfo[] that was used to fill this JTable. |
private int |
fromColumn
|
private boolean |
haveDoneColumn
Whether the 'Done' column exists or not. |
private boolean |
haveUserColumn
Whether the 'User' column exists or not. |
private java.lang.String |
INFO
|
private java.lang.String |
INST
|
private int |
jobType
Holds the job type of the job we are viewing its status data. |
private java.lang.String |
ORIGINATED_FROM
|
private int |
phaseColumn
|
private javax.swing.JComboBox |
phaseCombo
The JComboBox used to edit the phase column. |
private java.util.Hashtable<java.lang.String,javax.swing.JComboBox> |
phaseReasonsCombos
A Hashtable that holds a JComboBox for each available phase. |
private int |
reasonColumn
|
private int |
toColumn
|
private int |
typeColumn
|
private javax.swing.JComboBox |
typeCombo
The JComboBox used to edit the type column. |
private java.lang.String |
UNKNOWN_PHASE
|
private java.lang.String |
UNKNOWN_REASON
|
private java.lang.String |
UNKNOWN_USER
|
private int |
userColumn
|
Fields inherited from class javax.swing.JTable |
---|
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
FileLevelInfoTable(int jobType,
boolean addUserColumn,
boolean addDoneColumn)
Creates a new instance of FileLevelInfoTable. |
Method Summary | |
---|---|
private void |
createEditingComboBoxes()
This method creates the following JComboBoxes: 1) One that holds the types of the FileLevelInfo. 2) One that holds the phases for the current job type. 3) One for each phase to hold the reasons corresponding to that phase. |
void |
fill(FileLevelInfo[] information)
Fills in the table with the given FileLevelInfo[]. |
javax.swing.table.TableCellEditor |
getCellEditor(int row,
int col)
Gets the editor for the given cell. |
java.lang.Class<?> |
getColumnClass(int column)
Gets the column class of the given column. |
private java.lang.String |
getComment(javax.swing.table.DefaultTableModel model,
int row)
Gets the Comment value. |
private boolean |
getDone(javax.swing.table.DefaultTableModel model,
int row)
Gets the Done value. |
private int |
getFrom(javax.swing.table.DefaultTableModel model,
int row,
boolean returnDefaultValue)
Converts the given String into int. |
private int |
getIndex(javax.swing.JComboBox combo,
java.lang.String value)
Gets the index of the given value. |
private int |
getPhase(javax.swing.table.DefaultTableModel model,
int row,
boolean returnDefaultValue)
Gets the ID of the given phase. |
private java.lang.String |
getPhase(int phaseID)
Gets the name of the given phase. |
private javax.swing.table.TableCellEditor |
getPhaseCellEditor(java.lang.Object cellValue)
Gets the CellEditor used to edit the Phase column. |
private javax.swing.JComboBox |
getPhaseComboBox(int jobTypeID)
Gets a JComboBox that contains all the phases of a certain jobType. |
private int |
getReason(javax.swing.table.DefaultTableModel model,
int row,
java.lang.String phaseName,
boolean returnDefaultValue)
Gets the ID of the given reason. |
private java.lang.String |
getReason(int reasonID,
java.lang.String phaseName)
Gets the name of the given reason. |
private javax.swing.table.TableCellEditor |
getReasonCellEditor(java.lang.Object phaseValue,
java.lang.Object cellValue)
Gets the CellEditor used to edit the Reason column. |
private javax.swing.JComboBox |
getReasonComboBox(int phaseID)
Gets a JComboBox that conatins all the reasons of a certain phase. |
private int |
getTo(javax.swing.table.DefaultTableModel model,
int row,
boolean returnDefaultValue)
Converts the given String into int. |
private java.lang.String |
getType(javax.swing.table.DefaultTableModel model,
int row)
Gets the Type value. |
private java.lang.String |
getType(java.lang.String type)
Gets the display name of the given type. |
private javax.swing.table.TableCellEditor |
getTypeCellEditor(java.lang.Object cellValue)
Gets the CellEditor used to edit the Type column. |
private javax.swing.JComboBox |
getTypeComboBox()
Gets a JComboBox that contains all the types of the FileLevelInfo. |
private int |
getTypeIndex(java.lang.String value)
Gets the index of the given value. |
private int |
getUser(javax.swing.table.DefaultTableModel model,
int row)
Gets the User ID value. |
private java.lang.String |
getUser(int userID)
Gets the name of the given User. |
boolean |
isCellEditable(int row,
int column)
Determine whether the cell at the specified row and column is editable or not. |
java.util.ArrayList<FileLevelInfo> |
toFileLevelInfoArrayList(Holder<java.lang.Boolean> rowsSkipped)
Converts the valid rows of the table into an array of FileLevelInfo. |
Methods inherited from class javax.swing.JTable |
---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int typeColumn
private int fromColumn
private int toColumn
private int phaseColumn
private int reasonColumn
private int userColumn
private int doneColumn
private int commentColumn
private final java.lang.String INFO
private final java.lang.String INST
private final java.lang.String UNKNOWN_PHASE
private final java.lang.String UNKNOWN_REASON
private final java.lang.String UNKNOWN_USER
private final java.lang.String ORIGINATED_FROM
private javax.swing.JComboBox typeCombo
private javax.swing.JComboBox phaseCombo
private java.util.Hashtable<java.lang.String,javax.swing.JComboBox> phaseReasonsCombos
private boolean haveUserColumn
private boolean haveDoneColumn
private int jobType
private FileLevelInfo[] fillingInfo
Constructor Detail |
---|
public FileLevelInfoTable(int jobType, boolean addUserColumn, boolean addDoneColumn) throws java.lang.InstantiationException
jobType
- The job type ID, used to determine the phases to include and reasons.addUserColumn
- Whether to add a 'User' column to the table or not.addDoneColumn
- Whether to add a 'Done' column to the table or not.
If true only to 'Done' column will be editable.
java.lang.InstantiationException
- If the database couldn't be queried.Method Detail |
---|
private void createEditingComboBoxes() throws java.lang.InstantiationException
java.lang.InstantiationException
- If the combo boxes cannot be created.private javax.swing.JComboBox getTypeComboBox()
private javax.swing.JComboBox getPhaseComboBox(int jobTypeID) throws java.lang.InstantiationException
jobTypeID
- The jobType ID.
java.lang.InstantiationException
- If the database couldn't be queried.private javax.swing.JComboBox getReasonComboBox(int phaseID) throws java.lang.InstantiationException
phaseID
- The phase ID.
java.lang.InstantiationException
- If the database couldn't be queried.public java.lang.Class<?> getColumnClass(int column)
getColumnClass
in class javax.swing.JTable
column
- The column to get its type.
public boolean isCellEditable(int row, int column)
isCellEditable
in class javax.swing.JTable
row
- The row of the cell in question.column
- The column of the cell in question.
public javax.swing.table.TableCellEditor getCellEditor(int row, int col)
getCellEditor
in class javax.swing.JTable
row
- The row to get its editor.col
- The columns to get its editor.
private javax.swing.table.TableCellEditor getTypeCellEditor(java.lang.Object cellValue)
cellValue
- The current value of the cell.
private javax.swing.table.TableCellEditor getPhaseCellEditor(java.lang.Object cellValue)
cellValue
- The current value of the cell.
private javax.swing.table.TableCellEditor getReasonCellEditor(java.lang.Object phaseValue, java.lang.Object cellValue)
phaseValue
- The value of the corresponding phase cell.cellValue
- The current value of the cell.
private int getTypeIndex(java.lang.String value)
value
- The value to search for.
private int getIndex(javax.swing.JComboBox combo, java.lang.String value)
combo
- The JComboBox to search for the value in.value
- The value to search for.
public void fill(FileLevelInfo[] information)
information
- A FileLevelInfo[] to fill the table with.private java.lang.String getType(java.lang.String type)
type
- The type.
private java.lang.String getPhase(int phaseID)
phaseID
- The ID of the phase.
private java.lang.String getReason(int reasonID, java.lang.String phaseName)
reasonID
- The ID of the reason.phaseName
- The name of the phase.
private java.lang.String getUser(int userID) throws java.security.InvalidParameterException
userID
- The ID of the user.
java.security.InvalidParameterException
- If the given user ID doesn't correspond to a user.public java.util.ArrayList<FileLevelInfo> toFileLevelInfoArrayList(Holder<java.lang.Boolean> rowsSkipped)
rowsSkipped
- Whether 1 or more rows have been skipped while converting the table to ArrayList.
private java.lang.String getType(javax.swing.table.DefaultTableModel model, int row) throws java.security.InvalidParameterException
model
- The model to extract data from.row
- The row to retrieve its data.
java.security.InvalidParameterException
- If the strType doesn't correspond to a type.private int getFrom(javax.swing.table.DefaultTableModel model, int row, boolean returnDefaultValue) throws java.lang.NumberFormatException
model
- The model to extract data from.row
- The row to retrieve its data.returnDefaultValue
- whether to return -1 as a default value instead of throwing exception.
java.lang.NumberFormatException
- If the strForm is not in correct format.private int getTo(javax.swing.table.DefaultTableModel model, int row, boolean returnDefaultValue) throws java.lang.NumberFormatException
model
- The model to extract data from.row
- The row to retrieve its data.returnDefaultValue
- whether to return -1 as a default value instead of throwing exception.
java.lang.NumberFormatException
- If the strTo is not in correct format.private int getPhase(javax.swing.table.DefaultTableModel model, int row, boolean returnDefaultValue) throws java.security.InvalidParameterException, java.lang.NumberFormatException
model
- The model to extract data from.row
- The row to retrieve its data.returnDefaultValue
- whether to return -1 as a default value instead of throwing exception.
java.security.InvalidParameterException
- If the given phase name doesn't correspond to a phase.
java.lang.NumberFormatException
- If the phase ID couldn't be parsed.private int getReason(javax.swing.table.DefaultTableModel model, int row, java.lang.String phaseName, boolean returnDefaultValue) throws java.security.InvalidParameterException, java.lang.NumberFormatException
model
- The model to extract data from.row
- The row to retrieve its data.phaseName
- The name of the phase.returnDefaultValue
- whether to return -1 as a default value instead of throwing exception.
java.security.InvalidParameterException
- If the given reason name doesn't correspond to a reason.
java.lang.NumberFormatException
- If the reason ID couldn't be parsed.private int getUser(javax.swing.table.DefaultTableModel model, int row) throws java.security.InvalidParameterException
model
- The model to extract data from.row
- The row to retrieve its data.
java.security.InvalidParameterException
- If the given user name doesn't correspond to a user.private boolean getDone(javax.swing.table.DefaultTableModel model, int row)
model
- The model to extract data from.row
- The row to retrieve its data.
private java.lang.String getComment(javax.swing.table.DefaultTableModel model, int row)
model
- The model to extract data from.row
- The row to retrieve its data.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |