Package jmri.jmrit.beantable
Class AbstractTableAction<E extends NamedBean>
java.lang.Object
javax.swing.AbstractAction
jmri.jmrit.beantable.AbstractTableAction<E>
- Type Parameters:
E- type of NamedBean supported in this table
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
- Direct Known Subclasses:
AbstractLogixNGTableAction,AbstractTableTabAction,AudioTableAction,BlockTableAction,EcosLocoTableAction,IdTagTableAction,LightTableAction,LogixTableAction,LRouteTableAction,MemoryTableAction,OBlockTableAction,RailComTableAction,ReporterTableAction,RouteTableAction,SectionTableAction,SensorTableAction,SignalGroupTableAction,SignalHeadTableAction,SignalMastLogicTableAction,SignalMastTableAction,StringIOTableAction,TransitTableAction,TurnoutTableAction
Swing action to create and register a NamedBeanTable GUI.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAbstractTableAction.TableItem<E extends NamedBean> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BeanTableFrame<E>protected booleanprotected BeanTableDataModel<E>Fields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTableAction(String actionName) AbstractTableAction(String actionName, Object option) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddBottomButtons(BeanTableFrame<E> ata, JTable dataTable) protected abstract voidvoidAllow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.voidAllow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.voidIf the subClass is being included in a greater tabbed frame, then this method is used to add the details to the tabbed frame.protected voidcolumnsVisibleUpdated(boolean[] colsVisible) Notification that column visibility for the JTable has updated.protected voidconfigureManagerComboBox(ManagerComboBox<E> comboBox, Manager<E> manager, Class<? extends Manager<E>> managerClass) Configure the combo box listing managers.protected voidconfigureTable(JTable table) Perform configuration of the JTable as required by a specific TableAction.protected abstract voidCreate the JTable DataModel, along with the changes for the specific NamedBean type.protected voiddisplayHwError(String curAddress, Exception ex) Display a warning to user about invalid entry.voiddispose()Dispose of the BeanTableDataModel ( if present ), which removes the DataModel property change listeners from Beans.protected abstract StringGet the relevant data model for the current table.getFrame()Get the Bean Manager in use by the TableAction.getPanel()final BeanTableDataModel<E>protected StringSpecify the JavaHelp target for this specific panel.booleanTest if to include an Add New Button.protected StringIncrements trailing digits of a system/user name (string) I.E.voidprint(JTable.PrintMode mode, MessageFormat headerFormat, MessageFormat footerFormat) Used with the Tabbed instances of table action, so that the print option is handled via that on the appropriate tab.protected voidremovePrefixBoxListener(ManagerComboBox<E> prefixBox) Remove the Add panel prefixBox listener before disposal.voidsetFrame(BeanTableFrame<E> frame) protected voidsetManager(Manager<E> man) If the subClass is being included in a greater tabbed frame, then this is used to specify which manager the subclass should be using.voidAllow subclasses to alter the frame's Menubar without having to actually subclass the BeanTableDataFrame.voidprotected abstract voidsetTitle()Include the correct title.Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
m
-
f
-
includeAddButton
-
-
Constructor Details
-
AbstractTableAction
-
AbstractTableAction
-
-
Method Details
-
createModel
Create the JTable DataModel, along with the changes for the specific NamedBean type. -
setTitle
Include the correct title. -
actionPerformed
-
addBottomButtons
-
columnsVisibleUpdated
Notification that column visibility for the JTable has updated.This is overridden by classes which have column visibility Checkboxes on bottom bar.
Called on table startup and whenever a column goes hidden / visible.
- Parameters:
colsVisible- array of ALL table columns and their visibility status in order of main Table Model, NOT XTableColumnModel.
-
setFrame
-
getFrame
-
getDataModel
Get the relevant data model for the current table.This is overridden in the tabbed-table classes to return their own local data model.
Unlike
getTableDataModel(), this therefore doesn't attempt to (re)-create the model. -
getTableDataModel
-
addToFrame
Allow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.- Parameters:
f- the Frame to add to
-
addToFrame
Allow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.- Parameters:
tti- the TabbedTableItem to add to
-
addToPanel
If the subClass is being included in a greater tabbed frame, then this method is used to add the details to the tabbed frame.- Parameters:
f- AbstractTableTabAction for the containing frame containing these and other tabs
-
setManager
If the subClass is being included in a greater tabbed frame, then this is used to specify which manager the subclass should be using.- Parameters:
man- Manager for this table tab
-
getManager
Get the Bean Manager in use by the TableAction.- Returns:
- Bean Manager, could be Proxy or normal Manager, may be null.
-
setMenuBar
Allow subclasses to alter the frame's Menubar without having to actually subclass the BeanTableDataFrame.- Parameters:
f- the Frame to attach the menubar to
-
getPanel
-
configureTable
Perform configuration of the JTable as required by a specific TableAction.- Parameters:
table- The table to configure.
-
dispose
Dispose of the BeanTableDataModel ( if present ), which removes the DataModel property change listeners from Beans. -
nextName
Increments trailing digits of a system/user name (string) I.E. "Geo7" returns "Geo8" Note: preserves leading zeros: "Geo007" returns "Geo008" Also, if no trailing digits, appends "1": "Geo" returns "Geo1"- Parameters:
name- the system or user name string- Returns:
- the same name with trailing digits incremented by one
-
helpTarget
Specify the JavaHelp target for this specific panel.- Returns:
- a fixed default string "index" pointing to to highest level in JMRI Help
-
getClassDescription
-
setMessagePreferencesDetails
-
getClassName
-
includeAddButton
Test if to include an Add New Button.- Returns:
- true to include, else false.
-
print
Used with the Tabbed instances of table action, so that the print option is handled via that on the appropriate tab.- Parameters:
mode- table print modeheaderFormat- messageFormat for headerfooterFormat- messageFormat for footer
-
addPressed
-
configureManagerComboBox
protected void configureManagerComboBox(ManagerComboBox<E> comboBox, Manager<E> manager, Class<? extends Manager<E>> managerClass) Configure the combo box listing managers. Can be placed on Add New pane to select a connection for the new item.- Parameters:
comboBox- the combo box to configuremanager- the current managermanagerClass- the implemented manager class for the current manager; this is the class used byInstanceManager.getDefault(Class)to get the default manager, which may or may not be the current manager
-
removePrefixBoxListener
Remove the Add panel prefixBox listener before disposal. The listener is created when the Add panel is defined. It persists after the the Add panel has been disposed. When the next Add is created, AbstractTableAction sets the default connection as the current selection. This triggers validation before the new Add panel is created.The listener is removed by the controlling table action before disposing of the Add panel after Close or Create.
- Parameters:
prefixBox- The prefix combobox that might contain the listener.
-
displayHwError
Display a warning to user about invalid entry. Needed as entry validation does not disable the Create button when full system name eg "LT1" is entered.- Parameters:
curAddress- address as entered in Add new... pane address fieldex- the exception that occurred
-