Package adams.gui.goe
Class VariableSupport
- java.lang.Object
-
- adams.gui.goe.VariableSupport
-
public class VariableSupport extends Object
Helper class for managing variables in the GOE.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringBUTTON_HINT_PREFIXthe prefix for the buttons's tiptext when the option has a variable.static StringCAPTION_INDICATORthe indicator to be displayed in a JLabel when the option has a variable.static StringHINT_INDICATORthe indicator to be displayed in a JLabel's tiptext when the option has a variable.
-
Constructor Summary
Constructors Constructor Description VariableSupport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BasePopupMenucreatePopup(PropertySheetPanel parent, PropertyEditor editor)Creates a popup menu for variable management.static PropertySheetPanelfindParent(Container c)Returns the PropertySheetPanel parent of this container.protected static StringgetCallableActor(TreePath path)Returns the callable actor associated with the path.protected static StringselectCallableActorFromNames(Container parent, List<String> actors, String current)Pops up a dialog with the provided callable actors for the user to select one.protected static StringselectCallableActorFromNodes(Container parent, List<Node> nodes, String current)Pops up a dialog with the provided callable actors for the user to select one.static voidupdateButton(BaseFlatButton button, String variable)Updates the icon of the variables button.static voidupdateLabel(JLabel label, String variable)Updates the label's caption and hint depending on whether the option has a variable or not.static BasePopupMenuupdatePopup(PropertySheetPanel parent, PropertyEditor editor, BasePopupMenu menu)Updates a popup menu and adds menu items for variable management.
-
-
-
Field Detail
-
CAPTION_INDICATOR
public static final String CAPTION_INDICATOR
the indicator to be displayed in a JLabel when the option has a variable.- See Also:
- Constant Field Values
-
HINT_INDICATOR
public static final String HINT_INDICATOR
the indicator to be displayed in a JLabel's tiptext when the option has a variable.- See Also:
- Constant Field Values
-
BUTTON_HINT_PREFIX
public static final String BUTTON_HINT_PREFIX
the prefix for the buttons's tiptext when the option has a variable.- See Also:
- Constant Field Values
-
-
Method Detail
-
findParent
public static PropertySheetPanel findParent(Container c)
Returns the PropertySheetPanel parent of this container.- Parameters:
c- the container to get the enclosing PropertySheetPanel for- Returns:
- the parent sheet or null if none found
-
createPopup
public static BasePopupMenu createPopup(PropertySheetPanel parent, PropertyEditor editor)
Creates a popup menu for variable management.- Parameters:
parent- the parent sheet panel of the editoreditor- the property editor this menu is generated for- Returns:
- the popup menu
-
getCallableActor
protected static String getCallableActor(TreePath path)
Returns the callable actor associated with the path.- Parameters:
path- the path to get the callable actor for- Returns:
- the name of the callable actor, null if not a callable actor
-
selectCallableActorFromNodes
protected static String selectCallableActorFromNodes(Container parent, List<Node> nodes, String current)
Pops up a dialog with the provided callable actors for the user to select one.- Parameters:
parent- the swing parentnodes- the actors to choose fromcurrent- the current actor, null if not available- Returns:
- the selected actor, null if none chosen or none available
-
selectCallableActorFromNames
protected static String selectCallableActorFromNames(Container parent, List<String> actors, String current)
Pops up a dialog with the provided callable actors for the user to select one.- Parameters:
parent- the swing parentactors- the actors to choose fromcurrent- the current actor, null if not available- Returns:
- the selected actor, null if none chosen
-
updatePopup
public static BasePopupMenu updatePopup(PropertySheetPanel parent, PropertyEditor editor, BasePopupMenu menu)
Updates a popup menu and adds menu items for variable management.- Parameters:
parent- the parent sheet panel of the editoreditor- the property editor this menu is generated formenu- the menu to update- Returns:
- the updated popup menu
-
updateLabel
public static void updateLabel(JLabel label, String variable)
Updates the label's caption and hint depending on whether the option has a variable or not.- Parameters:
label- the label to processvariable- the variable name, null if none present
-
updateButton
public static void updateButton(BaseFlatButton button, String variable)
Updates the icon of the variables button.- Parameters:
button- the button to changevariable- the name of the attached variable, null if none attached
-
-