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:
- java.awt.image.ImageObserver,- java.awt.MenuContainer,- java.io.Serializable,- javax.accessibility.Accessible
 - Direct Known Subclasses:
- TermTable
 
 public abstract class AbstractCRUDTable<T> extends javax.swing.JPanel- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classAbstractCRUDTable.Column<C>protected classAbstractCRUDTable.CRUDModel- 
Nested classes/interfaces inherited from class javax.swing.JPaneljavax.swing.JPanel.AccessibleJPanel
 - 
Nested classes/interfaces inherited from class javax.swing.JComponentjavax.swing.JComponent.AccessibleJComponent
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected java.util.List<javax.swing.JButton>actionsprotected javax.swing.ActionaddActionprotected javax.swing.ActiondeleteActionprotected com.inductiveautomation.ignition.client.util.gui.AbstractCRUDTable.DeleteConfirmdeleteConfirmPanelprotected javax.swing.ActiondownActionprotected javax.swing.ActioneditActionprotected LoadingIconloadingIconprotected javax.swing.JLabelloadingOverlayprotected LoggerExlogprotected AbstractCRUDTable.CRUDModelmodelprotected booleanrequireConfirmOnDeleteprotected javax.swing.JScrollPanescrollPaneprotected TouchscreenTabletableprotected java.util.List<AbstractCRUDTable.Column<?>>tableColumnsprotected javax.swing.ActionupActionprotected java.beans.PropertyChangeListenerupdatePCLA property change listener that simply calls update()- 
Fields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractCRUDTable()protectedAbstractCRUDTable(boolean initialize)If initialize is false, the sub class must make sure to call initialize() in order to actually build the component.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancanAdd()protected booleancanDelete()protected booleancanEdit()protected javax.swing.JButtoncreateToolbarButton(javax.swing.Action action)protected javax.swing.IcongetAddIcon()protected javax.swing.IcongetDeleteIcon()protected javax.swing.IcongetDownIcon()protected javax.swing.IcongetEditIcon()java.awt.ColorgetHeaderBackground()Gets the table's header background color.java.awt.ColorgetHeaderTextColor()Gets the table's header text color.java.util.List<T>getItems()protected abstract java.lang.StringgetNoun()Return the noun that describes the item being manipulated.java.util.List<T>getSelected()Returns a list of the selected itemsjavax.swing.JTablegetTable()Getter for the internalJTablejava.awt.ColorgetTableBackground()Gets the table's background color.java.awt.ColorgetTableForeground()Gets the table's text color.protected javax.swing.IcongetUpIcon()protected voidhandleLoadingError(java.lang.Exception ex)Called on the EDT if items() throws an exceptionprotected voidinitActions()Create the addAction, editAction, and deleteActionprotected abstract voidinitColumns(java.util.List<AbstractCRUDTable.Column<?>> columns)Add your columns to the listprotected voidinitialize(boolean callUpdate)This sets up the UI.protected voidinitLayout()protected LoggerExinitLogger()protected AbstractCRUDTable.CRUDModelinitModel(java.util.List<AbstractCRUDTable.Column<?>> columns)protected javax.swing.JScrollPaneinitScrollPane(javax.swing.JTable table)protected TouchscreenTableinitTable(javax.swing.table.TableModel model)protected abstract java.util.Collection<T>items()Load the available items.protected java.lang.StringmigInsets()protected abstract voidonAdd()Callback when the add action is pressed.protected voidonAfterLoad()Called on the EDT after the table has re-loaded rows.protected voidonBeforeLoad()Called on the EDT before the table re-loads its rowsprotected abstract voidonDelete(java.util.List<T> toDelete)Callback when the delete action is pressed.protected voidonDoubleClick()By default, simply calls onEdit if editing is allowedprotected abstract voidonEdit(java.util.List<T> toEdit)Callback when the edit action is pressed.protected voidonMoveDown(T toMove)protected voidonMoveUp(T toMove)protected booleanordered()Override this to have up and down arrowsvoidsetEnabled(boolean enabled)voidsetFont(java.awt.Font font)voidsetHeaderBackground(java.awt.Color color)Sets the header background to this table.voidsetHeaderTextColor(java.awt.Color color)Sets the header text color to this table.voidsetRowHeight(int height)Sets the height of the rows of the child tablevoidsetTableBackground(java.awt.Color color)Sets the background to this table.voidsetTableForeground(java.awt.Color color)Sets the text color to this table.voidsetWindowBackground(java.awt.Color color)Sets the background color of the window to the passedColor.voidsetWindowForeground(java.awt.Color color)Sets the text color of the window to the passedColor.voidupdate()Call this when the item list has changed and needs to be reloadedprotected voidupdateAddText(java.lang.String message)voidupdateColumns()Call this if you have altered the columns (for example, changing visibility)protected voidupdateDeleteConfirm(java.lang.String message, java.lang.String yesText, java.lang.String noText, LoggerEx log)protected voidupdateDeleteText(java.lang.String message)protected voidupdateDownText(java.lang.String message)protected voidupdateEditText(java.lang.String message)voidupdateEnabled()Call to update the enabled-ness of the button actions.voidupdateModel()Rebuilds the columns and the model.protected voidupdateUpText(java.lang.String message)- 
Methods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 - 
Methods inherited from class javax.swing.JComponentaddAncestorListener, 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.Containeradd, 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.Componentaction, 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 Detail- 
modelprotected AbstractCRUDTable.CRUDModel model 
 - 
scrollPaneprotected javax.swing.JScrollPane scrollPane 
 - 
tableprotected TouchscreenTable table 
 - 
tableColumnsprotected java.util.List<AbstractCRUDTable.Column<?>> tableColumns 
 - 
loadingIconprotected LoadingIcon loadingIcon 
 - 
loadingOverlayprotected javax.swing.JLabel loadingOverlay 
 - 
deleteConfirmPanelprotected com.inductiveautomation.ignition.client.util.gui.AbstractCRUDTable.DeleteConfirm deleteConfirmPanel 
 - 
addActionprotected javax.swing.Action addAction 
 - 
editActionprotected javax.swing.Action editAction 
 - 
deleteActionprotected javax.swing.Action deleteAction 
 - 
upActionprotected javax.swing.Action upAction 
 - 
downActionprotected javax.swing.Action downAction 
 - 
requireConfirmOnDeleteprotected boolean requireConfirmOnDelete 
 - 
actionsprotected java.util.List<javax.swing.JButton> actions 
 - 
logprotected LoggerEx log 
 - 
updatePCLprotected java.beans.PropertyChangeListener updatePCL A property change listener that simply calls update()
 
- 
 - 
Constructor Detail- 
AbstractCRUDTableprotected AbstractCRUDTable() 
 - 
AbstractCRUDTableprotected 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 Detail- 
initializeprotected void initialize(boolean callUpdate) This sets up the UI. Only call it once.
 - 
initLoggerprotected LoggerEx initLogger() 
 - 
updateEnabledpublic void updateEnabled() Call to update the enabled-ness of the button actions. Automatically called when the selection changes.
 - 
setEnabledpublic void setEnabled(boolean enabled) - Overrides:
- setEnabledin class- javax.swing.JComponent
 
 - 
getNounprotected abstract java.lang.String getNoun() Return the noun that describes the item being manipulated.
 - 
initColumnsprotected abstract void initColumns(java.util.List<AbstractCRUDTable.Column<?>> columns) Add your columns to the list
 - 
initModelprotected AbstractCRUDTable.CRUDModel initModel(java.util.List<AbstractCRUDTable.Column<?>> columns) 
 - 
initTableprotected TouchscreenTable initTable(javax.swing.table.TableModel model) 
 - 
initScrollPaneprotected javax.swing.JScrollPane initScrollPane(javax.swing.JTable table) 
 - 
getAddIconprotected javax.swing.Icon getAddIcon() 
 - 
getEditIconprotected javax.swing.Icon getEditIcon() 
 - 
getDeleteIconprotected javax.swing.Icon getDeleteIcon() 
 - 
getUpIconprotected javax.swing.Icon getUpIcon() 
 - 
getDownIconprotected javax.swing.Icon getDownIcon() 
 - 
initActionsprotected void initActions() Create the addAction, editAction, and deleteAction
 - 
updateAddTextprotected void updateAddText(java.lang.String message) 
 - 
updateEditTextprotected void updateEditText(java.lang.String message) 
 - 
updateDeleteTextprotected void updateDeleteText(java.lang.String message) 
 - 
updateUpTextprotected void updateUpText(java.lang.String message) 
 - 
updateDownTextprotected void updateDownText(java.lang.String message) 
 - 
updateDeleteConfirmprotected void updateDeleteConfirm(java.lang.String message, java.lang.String yesText, java.lang.String noText, LoggerEx log)
 - 
createToolbarButtonprotected javax.swing.JButton createToolbarButton(javax.swing.Action action) 
 - 
initLayoutprotected void initLayout() 
 - 
migInsetsprotected java.lang.String migInsets() 
 - 
setFontpublic void setFont(java.awt.Font font) - Overrides:
- setFontin class- javax.swing.JComponent
 
 - 
setWindowBackgroundpublic void setWindowBackground(java.awt.Color color) Sets the background color of the window to the passedColor.- Parameters:
- color- the- Colorthe window is to be set to. Must not be null.
 
 - 
setWindowForegroundpublic void setWindowForeground(java.awt.Color color) Sets the text color of the window to the passedColor.- Parameters:
- color- the- Colorthe windows text is to be set to. Must not be null.
 
 - 
setHeaderBackgroundpublic void setHeaderBackground(java.awt.Color color) 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
 
 - 
setHeaderTextColorpublic void setHeaderTextColor(java.awt.Color color) 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
 
 - 
setTableBackgroundpublic void setTableBackground(java.awt.Color color) 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
 
 - 
setTableForegroundpublic void setTableForeground(java.awt.Color color) 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
 
 - 
getHeaderBackgroundpublic java.awt.Color 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
 
 - 
getHeaderTextColorpublic java.awt.Color 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
 
 - 
getTableBackgroundpublic java.awt.Color 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
 
 - 
getTableForegroundpublic java.awt.Color 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
 
 - 
getSelectedpublic java.util.List<T> getSelected() Returns a list of the selected items
 - 
getItemspublic java.util.List<T> getItems() 
 - 
canAddprotected boolean canAdd() - Returns:
- if adding an item is currently available
 
 - 
canEditprotected boolean canEdit() - Returns:
- if editing an item is currently available
 
 - 
canDeleteprotected boolean canDelete() - Returns:
- if deleting an item is currently available
 
 - 
orderedprotected boolean ordered() Override this to have up and down arrows
 - 
onAddprotected abstract void onAdd() Callback when the add action is pressed. Take some action to add an item, and later call update()
 - 
onEditprotected abstract void onEdit(java.util.List<T> toEdit) Callback when the edit action is pressed. Take some action to edit the item(s), and later call update()
 - 
onDeleteprotected abstract void onDelete(java.util.List<T> toDelete) Callback when the delete action is pressed. Take some action to edit the item(s), and later call update()
 - 
onDoubleClickprotected void onDoubleClick() By default, simply calls onEdit if editing is allowed
 - 
onMoveUpprotected void onMoveUp(T toMove) 
 - 
onMoveDownprotected void onMoveDown(T toMove) 
 - 
onAfterLoadprotected void onAfterLoad() Called on the EDT after the table has re-loaded rows.
 - 
onBeforeLoadprotected void onBeforeLoad() Called on the EDT before the table re-loads its rows
 - 
itemsprotected abstract java.util.Collection<T> items() throws java.lang.Exception 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:
- java.lang.Exception
 
 - 
updateColumnspublic void updateColumns() Call this if you have altered the columns (for example, changing visibility)
 - 
updatepublic void update() Call this when the item list has changed and needs to be reloaded
 - 
updateModelpublic void updateModel() Rebuilds the columns and the model.
 - 
handleLoadingErrorprotected void handleLoadingError(java.lang.Exception ex) Called on the EDT if items() throws an exception
 - 
setRowHeightpublic void setRowHeight(int height) Sets the height of the rows of the child table
 - 
getTablepublic javax.swing.JTable getTable() Getter for the internalJTable- Returns:
- The internal JTable
 
 
- 
 
-