Class ConditionalEditBase
- Direct Known Subclasses:
ConditionalList,ConditionalTreeEdit
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCreate a custom listener event.(package private) static classListen for name combo box selection events.(package private) classListen for Pick Single table click events.static enumInput selection names. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) ConditionalManager(package private) Logix(package private) JmriJFrame(package private) boolean(package private) LogixManager(package private) ConditionalEditBase.PickSingleListener(package private) JFrame(package private) JTable(package private) PickFrame(package private) JTabbedPane(package private) ConditionalEditBase.SelectionMode(package private) boolean(package private) boolean(package private) boolean(package private) List<ConditionalEditBase.LogixEventListener>Maintain a list of listeners -- normally only one.This contains a list of commands to be processed by the listener recipient. -
Constructor Summary
ConstructorsConstructorDescriptionConditionalEditBase(String sName) Set the Logix and Conditional managers and set the selection mode. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener.(package private) StringappendToAntecedent(Conditional.AntecedentOperator logicType, int varListSize, String antecedent) Add a variable R# entry to the antecedent string.void(package private) booleancheckConditionalReferences(String logixName) Check for conditional references.(package private) booleancheckConditionalUserName(String uName, Logix logix) Verify that the user name is not a duplicate for the selected Logix.(package private) voidClose a single panel picklist JFrame and related items.(package private) booleanconfirmActionAsVariable(String actionName, String variableName) Check if user OK's the use of an item as both an action and a state variable.(package private) booleanconfirmIndirectMemory(String memName) Check if user will provide a valid item name in a Memory variable.(package private) NamedBeanComboBox<?>createNameBox(Conditional.ItemType itemType) Create a combo name box for Variable and Action name selection.(package private) voidcreateSinglePanelPickList(Conditional.ItemType itemType, ConditionalEditBase.PickSingleListener listener, boolean actionType) Create a single panel picklist JFrame for choosing action and variable names.(package private) voiddisplayBadNumberReference(Conditional.Action actionType) Display an error message to user when an invalid number is provided in Conditional setup.(package private) voidfindPickListTabPane(Component[] compList, int level) Recursive search for the tab panel.(package private) voidNotify the listeners to check for new data.static StringformatTime(int hour, int minute) Format time to hh:mm given integer hour and minute.protected String(package private) LightGet Light instance.(package private) voidHide the drag-n-drop Pick List if the last detail edit is closing.(package private) voidloadReferenceNames(List<ConditionalVariable> varList, TreeSet<String> treeSet) Build a tree set from conditional references.(package private) voidGet the saved mode selection, default to the tranditional tabbed pick list.void(package private) StringmakeAntecedent(List<ConditionalVariable> variableList) Create an antecedent string based on the current variables(package private) voidSend a duplicate Conditional user name message for Edit Logix pane.(package private) voidmessageInvalidActionItemName(String name, String itemType) Send an Invalid Conditional Action name message for Edit Logix pane.(package private) voidOpen a new drag-n-drop Pick List to drag Variable and Action names from to form Logix Conditionals.(package private) intvoidRemove a listener -- not used.(package private) voidsetPickListTab(Conditional.ItemType curType, boolean actionType) Set the pick list tab based on the variable or action type.(package private) voidDisplay reminder to save.static StringtranslateAntecedent(String antecedent, boolean isLocal) Translate an antecedent string between English and the current language as determined by the Bundle classes.(package private) voidUpdate the conditional reference where used.(package private) booleanvalidateAntecedent(Conditional.AntecedentOperator logicType, String antecedentText, List<ConditionalVariable> variableList, Conditional curConditional) Check the antecedent and logic type.(package private) StringvalidateAudioReference(String name) Check an Audio reference of text.(package private) StringCheck Conditional reference of text.(package private) StringCheck an EntryExit reference of text.(package private) booleanvalidateIntensity(int time) Check if text represents an integer is suitable for percentage w/o NumberFormatException.(package private) booleanvalidateIntensityReference(Conditional.Action actionType, String intReference) Check if String is an integer or references an integer.(package private) StringvalidateLightReference(String name) Check Light reference of text.(package private) StringvalidateLogixReference(String name) Check Logix reference of text.(package private) StringCheck Memory reference of text.(package private) StringCheck OBlock reference of text.(package private) StringvalidateRouteReference(String name) Check Route reference of text.(package private) StringCheck Sensor reference of text.(package private) StringCheck SignalHead reference of text.(package private) StringCheck SignalMast reference of text.(package private) booleanvalidateTime(Conditional.Action actionType, float time) Range check time entry (assumes seconds).(package private) booleanvalidateTimeReference(Conditional.Action actionType, String ref) Check if a string is decimal or references a decimal.(package private) StringCheck Turnout reference of text.(package private) StringCheck Warrant reference of text.
-
Field Details
-
_conditionalManager
-
_logixManager
-
_curLogix
-
_editLogixFrame
-
_inEditMode
boolean _inEditMode -
_showReminder
boolean _showReminder -
_suppressReminder
boolean _suppressReminder -
_suppressIndirectRef
boolean _suppressIndirectRef -
_selectionMode
-
_pickTable
-
_pickTabPane
-
_pickTables
-
_pickSingleFrame
-
_pickListener
-
listenerList
Maintain a list of listeners -- normally only one. -
logixData
This contains a list of commands to be processed by the listener recipient.
-
-
Constructor Details
-
ConditionalEditBase
Set the Logix and Conditional managers and set the selection mode.- Parameters:
sName- the Logix system name being edited
-
ConditionalEditBase
public ConditionalEditBase()
-
-
Method Details
-
loadSelectionMode
void loadSelectionMode()Get the saved mode selection, default to the tranditional tabbed pick list.During the menu build process, the corresponding menu item is set to selected.
- Since:
- 4.7.3
-
addLogixEventListener
Add a listener.- Parameters:
listener- The recipient
-
removeLogixEventListener
Remove a listener -- not used.- Parameters:
listener- The recipient
-
fireLogixEvent
void fireLogixEvent()Notify the listeners to check for new data. -
makeAntecedent
Create an antecedent string based on the current variablesThe antecedent consists of all of the variables "in order" combined with the current operator.
- Parameters:
variableList- The current variable list- Returns:
- the resulting antecedent string
- Since:
- 4.11.5
-
appendToAntecedent
String appendToAntecedent(Conditional.AntecedentOperator logicType, int varListSize, String antecedent) Add a variable R# entry to the antecedent string. If not the first one, include and or or depending on the logic type- Parameters:
logicType- The current logic type.varListSize- The current size of the variable list.antecedent- The current antecedent- Returns:
- an extended antecedent
- Since:
- 4.11.5
-
validateAntecedent
boolean validateAntecedent(Conditional.AntecedentOperator logicType, String antecedentText, List<ConditionalVariable> variableList, Conditional curConditional) Check the antecedent and logic type.The antecedent text is translated and verified. A new one is created if necessary.
- Parameters:
logicType- The current logic type. Types other than Mixed are ignored.antecedentText- The proposed antecedent string using the local language.variableList- The current variable list.curConditional- The current conditional.- Returns:
- false if antecedent can't be validated
- Since:
- 4.11.5
-
translateAntecedent
Translate an antecedent string between English and the current language as determined by the Bundle classes.The property files have Logic??? keys for translating to the target language.
- Parameters:
antecedent- The antecedent string which can either local or EnglishisLocal- True if the antecedent string has local words.- Returns:
- the translated antecedent string.
- Since:
- 4.11.5
-
checkConditionalUserName
Verify that the user name is not a duplicate for the selected Logix.- Parameters:
uName- is the user name to be checkedlogix- is the Logix that is being updated- Returns:
- true if the name is unique
-
createNameBox
Create a combo name box for Variable and Action name selection.- Parameters:
itemType- The selected variable or action type- Returns:
- nameBox A combo box based on the item type
-
createSinglePanelPickList
void createSinglePanelPickList(Conditional.ItemType itemType, ConditionalEditBase.PickSingleListener listener, boolean actionType) Create a single panel picklist JFrame for choosing action and variable names.- Parameters:
itemType- The selected variable or action typelistener- The listener to be assigned to the picklistactionType- True if Action, false if Variable.- Since:
- 4.7.3
-
closeSinglePanelPickList
void closeSinglePanelPickList()Close a single panel picklist JFrame and related items.- Since:
- 4.7.3
-
openPickListTable
void openPickListTable()Open a new drag-n-drop Pick List to drag Variable and Action names from to form Logix Conditionals. -
hidePickListTable
void hidePickListTable()Hide the drag-n-drop Pick List if the last detail edit is closing. -
setPickListTab
Set the pick list tab based on the variable or action type. If there is not a corresponding tab, hide the picklist.- Parameters:
curType- is the current typeactionType- True if Action, false if Variable.
-
findPickListTabPane
Recursive search for the tab panel.- Parameters:
compList- The components for the current Levellevel- The current level in the structure
-
loadReferenceNames
Build a tree set from conditional references.- Parameters:
varList- The ConditionalVariable list that might contain conditional referencestreeSet- A tree set to be built from the varList data- Since:
- 4.7.4
-
checkConditionalReferences
Check for conditional references.- Parameters:
logixName- The Logix under consideration- Returns:
- true if no references
- Since:
- 4.7.4
-
updateWhereUsed
void updateWhereUsed(TreeSet<String> oldTargetNames, TreeSet<String> newTargetNames, String refName) Update the conditional reference where used.The difference between the saved target names and new target names is used to add/remove where used references.
- Parameters:
oldTargetNames- The conditional target names before updatingnewTargetNames- The conditional target names after updatingrefName- The system name for the referencing conditional- Since:
- 4.7.4
-
showSaveReminder
void showSaveReminder()Display reminder to save. The class is set to LogixTableAction. -
validateIntensityReference
boolean validateIntensityReference(Conditional.Action actionType, @CheckForNull String intReference) Check if String is an integer or references an integer.- Parameters:
actionType- Conditional action to check for, i.e. ACTION_SET_LIGHT_INTENSITYintReference- string referencing a decimal for light intensity or the name of a memory- Returns:
- true if either correct decimal format or a memory with the given name is present
-
validateIntensity
Check if text represents an integer is suitable for percentage w/o NumberFormatException.- Parameters:
time- value to use as light intensity percentage- Returns:
- true if time is an integer in range 0 - 100
-
validateTimeReference
Check if a string is decimal or references a decimal.- Parameters:
actionType- enum representing the Conditional action type being checked, i.e. ACTION_DELAYED_TURNOUTref- entry to check- Returns:
- true if ref is itself a decimal or user will provide one from a Memory at run time
-
validateTime
Range check time entry (assumes seconds).- Parameters:
actionType- integer representing the Conditional action type being checked, i.e. ACTION_DELAYED_TURNOUTtime- value to be checked- Returns:
- false if time > 3600 (seconds) or too small
-
displayBadNumberReference
Display an error message to user when an invalid number is provided in Conditional setup.- Parameters:
actionType- integer representing the Conditional action type being checked, i.e. ACTION_DELAYED_TURNOUT
-
validateMemoryReference
Check Memory reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Memory, null if not found
-
confirmIndirectMemory
Check if user will provide a valid item name in a Memory variable.- Parameters:
memName- Memory location to provide item name at run time- Returns:
- false if user replies No
-
confirmActionAsVariable
Check if user OK's the use of an item as both an action and a state variable.- Parameters:
actionName- name of ConditionalActionvariableName- name of ConditionalVariable- Returns:
- false if user replies No
-
validateTurnoutReference
Check Turnout reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Turnout, null if not found
-
validateSignalHeadReference
Check SignalHead reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding SignalHead, null if not found
-
validateSignalMastReference
Check SignalMast reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Signal Mast, null if not found
-
validateWarrantReference
Check Warrant reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Warrant, null if not found
-
validateOBlockReference
Check OBlock reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding OBlock, null if not found
-
validateSensorReference
Check Sensor reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Sensor, null if not found
-
validateLightReference
Check Light reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Light, null if not found
-
validateConditionalReference
Check Conditional reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Conditional, null if not found
-
validateLogixReference
Check Logix reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Logix, null if not found
-
validateRouteReference
Check Route reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding Route, null if not found
-
validateAudioReference
Check an Audio reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system or user name of the corresponding AudioManager, null if not found
-
validateEntryExitReference
Check an EntryExit reference of text.Show a message if not found.
- Parameters:
name- the name to look for- Returns:
- the system name of the corresponding EntryExit pair, null if not found
-
getLight
Get Light instance.Show a message if not found.
- Parameters:
name- user or system name of an existing light- Returns:
- the Light object
-
parseTime
-
formatTime
Format time to hh:mm given integer hour and minute.- Parameters:
hour- value for time hoursminute- value for time minutes- Returns:
- Formatted time string
-
messageInvalidActionItemName
Send an Invalid Conditional Action name message for Edit Logix pane.- Parameters:
name- user or system name to look upitemType- type of Bean to look for
-
messageDuplicateConditionalUserName
Send a duplicate Conditional user name message for Edit Logix pane.- Parameters:
svName- proposed name that duplicates an existing name
-
bringToFront
-
locateAt
-
getClassName
-