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 classprotected classNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Actionprotected Actionprotected AbstractCRUDTable<T>.com.inductiveautomation.ignition.client.util.gui.AbstractCRUDTable.DeleteConfirmprotected Actionprotected Actionprotected LoadingIconprotected JLabelprotected LoggerExprotected AbstractCRUDTable<T>.CRUDModelprotected booleanprotected JScrollPaneprotected TouchscreenTableprotected List<AbstractCRUDTable<T>.Column<?>>protected Actionprotected PropertyChangeListenerA 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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractCRUDTable(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 booleancanAdd()protected booleanprotected booleancanEdit()protected JButtoncreateToolbarButton(Action action) protected Iconprotected Iconprotected Iconprotected IconGets the table's header background color.Gets the table's header text color.getItems()protected abstract StringgetNoun()Return the noun that describes the item being manipulated.Returns a list of the selected itemsgetTable()Getter for the internalJTableGets the table's background color.Gets the table's text color.protected Iconprotected voidCalled on the EDT if items() throws an exceptionprotected voidCreate the addAction, editAction, and deleteActionprotected abstract voidinitColumns(List<AbstractCRUDTable<T>.Column<?>> columns) Add your columns to the listprotected voidinitialize(boolean callUpdate) This sets up the UI.protected voidprotected LoggerExprotected AbstractCRUDTable<T>.CRUDModelinitModel(List<AbstractCRUDTable<T>.Column<?>> columns) protected JScrollPaneinitScrollPane(JTable table) protected TouchscreenTableinitTable(TableModel model) protected abstract Collection<T>items()Load the available items.protected Stringprotected abstract voidonAdd()Callback when the add action is pressed.protected voidCalled on the EDT after the table has re-loaded rows.protected voidCalled on the EDT before the table re-loads its rowsprotected abstract voidCallback when the delete action is pressed.protected voidBy default, simply calls onEdit if editing is allowedprotected abstract voidCallback when the edit action is pressed.protected voidonMoveDown(T toMove) protected voidprotected booleanordered()Override this to have up and down arrowsvoidsetEnabled(boolean enabled) voidvoidsetHeaderBackground(Color color) Sets the header background to this table.voidsetHeaderTextColor(Color color) Sets the header text color to this table.voidsetRowHeight(int height) Sets the height of the rows of the child tablevoidsetTableBackground(Color color) Sets the background to this table.voidsetTableForeground(Color color) Sets the text color to this table.voidsetWindowBackground(Color color) Sets the background color of the window to the passedColor.voidsetWindowForeground(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(String message) voidCall this if you have altered the columns (for example, changing visibility)protected voidupdateDeleteConfirm(String message, String yesText, String noText, LoggerEx log) protected voidupdateDeleteText(String message) protected voidupdateDownText(String message) protected voidupdateEditText(String message) voidCall to update the enabled-ness of the button actions.voidRebuilds the columns and the model.protected voidupdateUpText(String message) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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:
setEnabledin 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:
setFontin classJComponent
-
setWindowBackground
Sets the background color of the window to the passedColor.- Parameters:
color- theColorthe window is to be set to. Must not be null.
-
setWindowForeground
Sets the text color of the window to the passedColor.- Parameters:
color- theColorthe 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
-