Package jmri.jmrit.beantable.beanedit
Class BeanEditAction<B extends NamedBean>
- java.lang.Object
-
- javax.swing.AbstractAction
-
- jmri.jmrit.beantable.beanedit.BeanEditAction<B>
-
- Type Parameters:
B
- the type of supported NamedBean
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
- Direct Known Subclasses:
BlockEditAction
,LightEditAction
,OBlockEditAction
,SensorDebounceEditAction
,SensorEditAction
,SensorPullUpEditAction
,TurnoutEditAction
public abstract class BeanEditAction<B extends NamedBean> extends javax.swing.AbstractAction
Provides the basic information and structure for for a editing the details of a bean object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.JButton
applyBut
Apply Button.(package private) B
bean
protected java.util.ArrayList<BeanItemPanel>
bei
(package private) javax.swing.JTextArea
commentField
(package private) javax.swing.JScrollPane
commentFieldScroller
(package private) JmriJFrame
f
(package private) NamedBeanHandleManager
nbMan
protected java.awt.Component
selectedTab
(package private) javax.swing.JTextField
userNameField
-
Constructor Summary
Constructors Constructor Description BeanEditAction()
BeanEditAction(java.lang.String s)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
protected void
addToPanel(javax.swing.JPanel panel, java.util.List<BeanEditItem> items)
Set out the panel based upon the items passed in via the ArrayList.(package private) boolean
allowBlockNameChange(java.lang.String changeType, java.lang.String newName)
Determine whether it is safe to rename/remove a Block user name.protected void
applyButtonAction(java.awt.event.ActionEvent e)
(package private) BeanItemPanel
basicDetails()
Create a generic panel that holds the basic bean information System Name, User Name, and Comment.protected void
cancelButtonAction(java.awt.event.ActionEvent e)
(package private) void
formatTextAreaAsLabel(javax.swing.JTextPane pane)
protected abstract B
getByUserName(java.lang.String name)
protected abstract java.lang.String
helpTarget()
protected void
initPanels()
Call to create all the different tabs that will be added to the frame.protected void
initPanelsFirst()
Initialise panels to be at start of Tabbed Panel menu.protected void
initPanelsLast()
Initialise panels to be at end of Tabbed Panel menu.(package private) BeanItemPanel
propertiesDetails()
Create a generic panel that holds Bean Property details.void
removeName()
Generic method to remove the user name from a bean.void
renameBean(java.lang.String _newName)
Generic method to change the user name of a Bean.protected void
resetBasicItems(java.awt.event.ActionEvent e)
void
save()
protected void
saveBasicItems(java.awt.event.ActionEvent e)
void
setBean(B bean)
void
setSelectedComponent(java.awt.Component c)
(package private) BeanItemPanel
usageDetails()
Create a generic panel that holds Bean usage details.(package private) static boolean
validateNumericalInput(java.lang.String text)
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
userNameField
javax.swing.JTextField userNameField
-
commentField
javax.swing.JTextArea commentField
-
commentFieldScroller
javax.swing.JScrollPane commentFieldScroller
-
bei
protected java.util.ArrayList<BeanItemPanel> bei
-
f
JmriJFrame f
-
selectedTab
protected java.awt.Component selectedTab
-
applyBut
protected javax.swing.JButton applyBut
Apply Button. Accessible so Edit Actions can set custom tool tip.
-
nbMan
NamedBeanHandleManager nbMan
-
-
Constructor Detail
-
BeanEditAction
public BeanEditAction(java.lang.String s)
-
BeanEditAction
public BeanEditAction()
-
-
Method Detail
-
initPanels
protected void initPanels()
Call to create all the different tabs that will be added to the frame.
-
initPanelsFirst
protected void initPanelsFirst()
Initialise panels to be at start of Tabbed Panel menu. Default empty.
-
initPanelsLast
protected void initPanelsLast()
Initialise panels to be at end of Tabbed Panel menu. Startup usage details and Properties.
-
basicDetails
BeanItemPanel basicDetails()
Create a generic panel that holds the basic bean information System Name, User Name, and Comment.- Returns:
- a new panel
-
usageDetails
BeanItemPanel usageDetails()
Create a generic panel that holds Bean usage details.- Returns:
- a new panel
-
propertiesDetails
BeanItemPanel propertiesDetails()
Create a generic panel that holds Bean Property details.- Returns:
- a new panel
-
saveBasicItems
@OverridingMethodsMustInvokeSuper protected void saveBasicItems(java.awt.event.ActionEvent e)
-
resetBasicItems
@OverridingMethodsMustInvokeSuper protected void resetBasicItems(java.awt.event.ActionEvent e)
-
helpTarget
protected abstract java.lang.String helpTarget()
-
setSelectedComponent
public void setSelectedComponent(java.awt.Component c)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
-
applyButtonAction
protected void applyButtonAction(java.awt.event.ActionEvent e)
-
cancelButtonAction
protected void cancelButtonAction(java.awt.event.ActionEvent e)
-
addToPanel
protected void addToPanel(javax.swing.JPanel panel, java.util.List<BeanEditItem> items)
Set out the panel based upon the items passed in via the ArrayList.- Parameters:
panel
- JPanel to add stuff toitems
- aBeanEditItem
list of key-value pairs for the items to add
-
formatTextAreaAsLabel
void formatTextAreaAsLabel(javax.swing.JTextPane pane)
-
save
public void save()
-
validateNumericalInput
static boolean validateNumericalInput(java.lang.String text)
-
getByUserName
protected abstract B getByUserName(java.lang.String name)
-
renameBean
public void renameBean(java.lang.String _newName)
Generic method to change the user name of a Bean.- Parameters:
_newName
- string to use as the new user name
-
removeName
public void removeName()
Generic method to remove the user name from a bean.
-
allowBlockNameChange
boolean allowBlockNameChange(java.lang.String changeType, java.lang.String newName)
Determine whether it is safe to rename/remove a Block user name.The user name is used by the LayoutBlock to link to the block and by Layout Editor track components to link to the layout block.
- Parameters:
changeType
- This will be Remove or Rename.newName
- For Remove this will be empty, for Rename it will be the new user name.- Returns:
- true to continue with the user name change.
-
-