Class CommonUI
java.lang.Object
com.inductiveautomation.ignition.designer.gui.CommonUI
A collection of static methods and constants to make the UI uniform.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Color
static final int
static final int
static Dimension
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static Dimension
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static Dimension
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static Dimension
static final int
static final int
static Dimension
static final String
<html><p style=\"width:300px;\"> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Point
adjustPopupLocationToFitScreen
(int xposition, int yposition, JComponent component, Component invoker) Adjusts a desired popup location to fit within the screen, given the component's preferred size.static void
centerComponent
(Component source) Centers the Component on the screen.static void
centerComponent
(Component source, Component parent) Centers a component (source) in it's parent component.static JButton
createAccessoryButton
(Action action) Creates a small button for the given action with a 2px margin.static Border
Creates an blank border with the displayed textstatic Border
createBorder
(String text) Creates an etched border with the displayed textstatic JButton
createButton
(String text, ActionListener listener) static JButton
createButton
(String text, ActionListener listener, String mnemonic) Creates a JButtonstatic JButton
createButton
(String text, ActionListener listener, String mnemonic, String actionCommand) static JCheckBox
createCheckBox
(String text) static JCheckBox
createCheckBox
(String text, int mnemonic) static JCheckBox
createCheckBox
(String text, int mnemonic, boolean selected) static JCheckBox
createCheckBox
(String text, int mnemonic, ActionListener listener) static JCheckBox
createCheckBox
(String text, int mnemonic, ActionListener listener, boolean selected) Create a checkboxstatic JComboBox
createComboBox
(Object[] items, boolean editable) static JComboBox
createComboBox
(Object[] items, ActionListener listener, boolean editable) Creates a JComboBoxstatic JLabel
createLabel
(String text) static JLabel
createLabel
(String text, int mnemonic, Component comp) Creates a label which will be displayed.static JScrollPane
createListPane
(JList list, String text) Wraps a scrollpane with and etched border and a title around a JList.static JRadioButton
createRadioButton
(String text) static JRadioButton
createRadioButton
(String text, int mnemonic) static JRadioButton
createRadioButton
(String text, int mnemonic, boolean selected) static JRadioButton
createRadioButton
(String text, int mnemonic, ActionListener listener) static JRadioButton
createRadioButton
(String text, int mnemonic, ActionListener listener, boolean selected) Creates a Radio Buttonstatic JButton
createSmallButton
(String text, ActionListener listener) static JButton
createSmallButton
(String text, ActionListener listener, String mnemonic) Creates a Smaller JButtonstatic JTextField
createTextField
(String text) static JTextField
createTextField
(String text, boolean numbers) static JTextField
createTextField
(String text, KeyListener listener) static JTextField
createTextField
(String text, KeyListener listener, boolean numbers) Creates a text fieldstatic AbstractButton
createToolbarButton
(Action action, String componentTestName) Returns a minimalized toolbar button with no text.static String
eventModifiersToString
(int event) static JFrame
getParentFrame
(Component source) Retrieves the parent JFrame for a component.static final String
getTooltipPrefix
(int width) static final String
getTooltipPrefixInline
(int width) static void
initButtonGroup
(JRadioButton... buttons) static Integer
Converts miliseconds to secondsstatic Integer
Converts seconds to milisecondsstatic void
setDefaultCursor
(Component comp) static void
setDropCursor
(Component comp) static void
setupCancelButton
(JButton btn) Sets up the ESC-key binding for a cancel buttonstatic void
setWaitCursor
(Component comp) static String[]
stringArrayFromString
(String string) static String[]
stringArrayFromString
(String string, String delim) Parses the string into an array of stringsstatic String
stringFromStringArray
(String[] strings) static String
stringFromStringArray
(String[] strings, String delim) Takes an array of strings and returns a concatenationstatic JPanel
wrapInTitledPanel
(JComponent component, String bundleKey)
-
Field Details
-
TOOLTIP_PREFIX
<html><p style=\"width:300px;\">- See Also:
-
BUTTONTEXT_APPLY
-
BUTTONTEXT_OK
-
BUTTONTEXT_CANCEL
-
BUTTONTEXT_REMOVE
-
BUTTONTEXT_ADD
-
MNEMONIC_APPLY
-
MNEMONIC_OK
-
MNEMONIC_CANCEL
-
MNEMONIC_REMOVE
-
MNEMONIC_ADD
-
BUTTON_WIDTH
public static final int BUTTON_WIDTH- See Also:
-
BUTTON_HEIGHT
public static final int BUTTON_HEIGHT- See Also:
-
BUTTCON_WIDTH
public static final int BUTTCON_WIDTH- See Also:
-
BUTTCON_HEIGHT
public static final int BUTTCON_HEIGHT- See Also:
-
SM_BUTTON_WIDTH
public static final int SM_BUTTON_WIDTH- See Also:
-
SM_BUTTON_HEIGHT
public static final int SM_BUTTON_HEIGHT- See Also:
-
LABEL_WIDTH
public static final int LABEL_WIDTH- See Also:
-
LABEL_HEIGHT
public static final int LABEL_HEIGHT- See Also:
-
TEXT_WIDTH
public static final int TEXT_WIDTH- See Also:
-
TEXT_HEIGHT
public static final int TEXT_HEIGHT- See Also:
-
BACKGROUND_COLOR
-
BUTTON_CMD_OK
- See Also:
-
BUTTON_CMD_CANCEL
- See Also:
-
BUTTON_CMD_NEXT
- See Also:
-
BUTTON_CMD_BACK
- See Also:
-
BUTTON_CMD_FINISH
- See Also:
-
BUTTON_CMD_ADD
- See Also:
-
BUTTON_CMD_REMOVE
- See Also:
-
BUTTON_CMD_MOVEUP
- See Also:
-
BUTTON_CMD_MOVEDOWN
- See Also:
-
buttonPrefSize
-
buttconPrefSize
-
smbuttonPrefSize
-
labelPrefSize
-
textPrefSize
-
-
Constructor Details
-
CommonUI
public CommonUI()
-
-
Method Details
-
getTooltipPrefix
-
getTooltipPrefixInline
-
wrapInTitledPanel
-
createLabel
Creates a label which will be displayed.- Parameters:
text
- Text for the labelmnemonic
- Hot keycomp
- Component that this label represents.
-
createLabel
-
createAccessoryButton
Creates a small button for the given action with a 2px margin. -
createToolbarButton
Returns a minimalized toolbar button with no text. The componentTestName parameter is used to set the component name for automated testing. It can be anything unique. -
createTextField
Creates a text field- Parameters:
text
- Text for the fieldlistener
- KeyListenernumbers
- Indicates that this field represents numbers only
-
createTextField
-
createTextField
-
createTextField
-
createRadioButton
public static JRadioButton createRadioButton(String text, int mnemonic, ActionListener listener, boolean selected) Creates a Radio Button- Parameters:
text
- Text to displaymnemonic
- Hot keylistener
- ActionListenerselected
- Flag to indicate if button should be selected
-
createRadioButton
-
createRadioButton
-
createRadioButton
-
createRadioButton
-
initButtonGroup
-
createCheckBox
public static JCheckBox createCheckBox(String text, int mnemonic, ActionListener listener, boolean selected) Create a checkbox- Parameters:
text
- to displaymnemonic
- Hot keylistener
- ActionListenerselected
- Flag to indicate if button should be selected
-
createCheckBox
-
createCheckBox
-
createCheckBox
-
createCheckBox
-
createComboBox
Creates a JComboBox- Parameters:
items
- Object arraylistener
- The action listener which handles eventseditable
- Flag that indicates if this combo box is editable
-
createComboBox
-
createButton
Creates a JButton- Parameters:
text
- to displaylistener
- The action listener which handles eventsmnemonic
- Letter combination
-
createButton
public static JButton createButton(String text, ActionListener listener, String mnemonic, String actionCommand) -
createButton
-
createSmallButton
Creates a Smaller JButton- Parameters:
text
- to displaylistener
- The action listener which handles eventsmnemonic
- Letter combination
-
createSmallButton
-
createBorder
Creates an etched border with the displayed text -
createBorder
Creates an blank border with the displayed text -
createListPane
Wraps a scrollpane with and etched border and a title around a JList.- Parameters:
list
- JList to wrap.text
- Text to display in the border.
-
centerComponent
Centers a component (source) in it's parent component. If parent is null then the window is centered in screen.The source and parent components should be correctly sized
-
centerComponent
Centers the Component on the screen. -
setupCancelButton
Sets up the ESC-key binding for a cancel button -
getParentFrame
Retrieves the parent JFrame for a component. This is handy when you want the frame as an owner for modal dialogs.- Parameters:
source
- - Source component.- Returns:
- The JFrame which contains the component or null if not found.
-
msToSec
Converts miliseconds to seconds -
secToMs
Converts seconds to miliseconds -
stringFromStringArray
Takes an array of strings and returns a concatenation- Parameters:
strings
- - Array to concatenatedelim
- - Delimiter to use. If this is null or empty then then a space will be used
-
stringFromStringArray
-
stringArrayFromString
Parses the string into an array of strings- Parameters:
string
- - String to parsedelim
- - Delimiter to use. If this is null or empty then then the set [ ' ', '\t', '\n', '\r' ] is used.
-
stringArrayFromString
-
setWaitCursor
-
setDefaultCursor
-
setDropCursor
-
adjustPopupLocationToFitScreen
public static Point adjustPopupLocationToFitScreen(int xposition, int yposition, JComponent component, Component invoker) Adjusts a desired popup location to fit within the screen, given the component's preferred size. Implementation copied from JPopupMenu. -
eventModifiersToString
-