Class AbstractCRUDTable<T>
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.client.util.gui.AbstractCRUDTable<T>
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
TermTable
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected class
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Action
protected Action
protected AbstractCRUDTable<T>.com.inductiveautomation.ignition.client.util.gui.AbstractCRUDTable.DeleteConfirm
protected Action
protected Action
protected LoadingIcon
protected JLabel
protected LoggerEx
protected AbstractCRUDTable<T>.CRUDModel
protected boolean
protected JScrollPane
protected TouchscreenTable
protected List<AbstractCRUDTable<T>.Column<?>>
protected Action
protected PropertyChangeListener
A property change listener that simply calls update()Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
ConstructorsModifierConstructorDescriptionprotected
protected
AbstractCRUDTable
(boolean initialize) If initialize is false, the sub class must make sure to call initialize() in order to actually build the component. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canAdd()
protected boolean
protected boolean
canEdit()
protected JButton
createToolbarButton
(Action action) protected Icon
protected Icon
protected Icon
protected Icon
Gets the table's header background color.Gets the table's header text color.getItems()
protected abstract String
getNoun()
Return the noun that describes the item being manipulated.Returns a list of the selected itemsgetTable()
Getter for the internalJTable
Gets the table's background color.Gets the table's text color.protected Icon
protected void
Called on the EDT if items() throws an exceptionprotected void
Create the addAction, editAction, and deleteActionprotected abstract void
initColumns
(List<AbstractCRUDTable<T>.Column<?>> columns) Add your columns to the listprotected void
initialize
(boolean callUpdate) This sets up the UI.protected void
protected LoggerEx
protected AbstractCRUDTable<T>.CRUDModel
initModel
(List<AbstractCRUDTable<T>.Column<?>> columns) protected JScrollPane
initScrollPane
(JTable table) protected TouchscreenTable
initTable
(TableModel model) protected abstract Collection<T>
items()
Load the available items.protected String
protected abstract void
onAdd()
Callback when the add action is pressed.protected void
Called on the EDT after the table has re-loaded rows.protected void
Called on the EDT before the table re-loads its rowsprotected abstract void
Callback when the delete action is pressed.protected void
By default, simply calls onEdit if editing is allowedprotected abstract void
Callback when the edit action is pressed.protected void
onMoveDown
(T toMove) protected void
protected boolean
ordered()
Override this to have up and down arrowsvoid
setEnabled
(boolean enabled) void
void
setHeaderBackground
(Color color) Sets the header background to this table.void
setHeaderTextColor
(Color color) Sets the header text color to this table.void
setRowHeight
(int height) Sets the height of the rows of the child tablevoid
setTableBackground
(Color color) Sets the background to this table.void
setTableForeground
(Color color) Sets the text color to this table.void
setWindowBackground
(Color color) Sets the background color of the window to the passedColor
.void
setWindowForeground
(Color color) Sets the text color of the window to the passedColor
.void
update()
Call this when the item list has changed and needs to be reloadedprotected void
updateAddText
(String message) void
Call this if you have altered the columns (for example, changing visibility)protected void
updateDeleteConfirm
(String message, String yesText, String noText, LoggerEx log) protected void
updateDeleteText
(String message) protected void
updateDownText
(String message) protected void
updateEditText
(String message) void
Call to update the enabled-ness of the button actions.void
Rebuilds the columns and the model.protected void
updateUpText
(String message) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, 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, doLayout, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
model
-
scrollPane
-
table
-
tableColumns
-
loadingIcon
-
loadingOverlay
-
deleteConfirmPanel
protected AbstractCRUDTable<T>.com.inductiveautomation.ignition.client.util.gui.AbstractCRUDTable.DeleteConfirm deleteConfirmPanel -
addAction
-
editAction
-
deleteAction
-
upAction
-
downAction
-
requireConfirmOnDelete
protected boolean requireConfirmOnDelete -
actions
-
log
-
updatePCL
A property change listener that simply calls update()
-
-
Constructor Details
-
AbstractCRUDTable
protected AbstractCRUDTable() -
AbstractCRUDTable
protected AbstractCRUDTable(boolean initialize) If initialize is false, the sub class must make sure to call initialize() in order to actually build the component.On a side note, if the subclass does not want "update" to be called immediately, it must pass false to this function, and then manually call initialize, passing in "false" for the "call update" argument.
-
-
Method Details
-
initialize
protected void initialize(boolean callUpdate) This sets up the UI. Only call it once. -
initLogger
-
updateEnabled
public void updateEnabled()Call to update the enabled-ness of the button actions. Automatically called when the selection changes. -
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabled
in classJComponent
-
getNoun
Return the noun that describes the item being manipulated. -
initColumns
Add your columns to the list -
initModel
-
initTable
-
initScrollPane
-
getAddIcon
-
getEditIcon
-
getDeleteIcon
-
getUpIcon
-
getDownIcon
-
initActions
protected void initActions()Create the addAction, editAction, and deleteAction -
updateAddText
-
updateEditText
-
updateDeleteText
-
updateUpText
-
updateDownText
-
updateDeleteConfirm
-
createToolbarButton
-
initLayout
protected void initLayout() -
migInsets
-
setFont
- Overrides:
setFont
in classJComponent
-
setWindowBackground
Sets the background color of the window to the passedColor
.- Parameters:
color
- theColor
the window is to be set to. Must not be null.
-
setWindowForeground
Sets the text color of the window to the passedColor
.- Parameters:
color
- theColor
the windows text is to be set to. Must not be null.
-
setHeaderBackground
Sets the header background to this table. This is here for setting this components color via a property.- Parameters:
color
- the specified color. Must not be null
-
setHeaderTextColor
Sets the header text color to this table. This is here for setting this components color via a property.- Parameters:
color
- the specified color. Must not be null
-
setTableBackground
Sets the background to this table. This is here for setting this components color via a property.- Parameters:
color
- the specified color. Must not be null
-
setTableForeground
Sets the text color to this table. This is here for setting this components color via a property.- Parameters:
color
- the specified color. Must not be null
-
getHeaderBackground
Gets the table's header background color. This is here for setting this components color via a property.- Returns:
- the table's header background color. Will not be null
-
getHeaderTextColor
Gets the table's header text color. This is here for setting this components color via a property.- Returns:
- the table's header text color. Will not be null
-
getTableBackground
Gets the table's background color. This is here for setting this components color via a property.- Returns:
- the table's background color. Will not be null
-
getTableForeground
Gets the table's text color. This is here for setting this components color via a property.- Returns:
- the table's text color. Will not be null
-
getSelected
Returns a list of the selected items -
getItems
-
canAdd
protected boolean canAdd()- Returns:
- if adding an item is currently available
-
canEdit
protected boolean canEdit()- Returns:
- if editing an item is currently available
-
canDelete
protected boolean canDelete()- Returns:
- if deleting an item is currently available
-
ordered
protected boolean ordered()Override this to have up and down arrows -
onAdd
protected abstract void onAdd()Callback when the add action is pressed. Take some action to add an item, and later call update() -
onEdit
Callback when the edit action is pressed. Take some action to edit the item(s), and later call update() -
onDelete
Callback when the delete action is pressed. Take some action to edit the item(s), and later call update() -
onDoubleClick
protected void onDoubleClick()By default, simply calls onEdit if editing is allowed -
onMoveUp
-
onMoveDown
-
onAfterLoad
protected void onAfterLoad()Called on the EDT after the table has re-loaded rows. -
onBeforeLoad
protected void onBeforeLoad()Called on the EDT before the table re-loads its rows -
items
Load the available items. Note that this is always called OFF the EDT so it is safe to do network access here if need be. (but it is NOT safe to interact with the UI)- Throws:
Exception
-
updateColumns
public void updateColumns()Call this if you have altered the columns (for example, changing visibility) -
update
public void update()Call this when the item list has changed and needs to be reloaded -
updateModel
public void updateModel()Rebuilds the columns and the model. -
handleLoadingError
Called on the EDT if items() throws an exception -
setRowHeight
public void setRowHeight(int height) Sets the height of the rows of the child table -
getTable
Getter for the internalJTable
- Returns:
- The internal
JTable
-