Class CommonUI
java.lang.Object
com.inductiveautomation.ignition.designer.gui.CommonUI
A collection of static methods and constants to make the UI uniform.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Colorstatic final intstatic final intstatic Dimensionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic Dimensionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic Dimensionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic Dimensionstatic final intstatic final intstatic Dimensionstatic final String<html><p style=\"width:300px;\">
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic PointadjustPopupLocationToFitScreen(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 voidcenterComponent(Component source) Centers the Component on the screen.static voidcenterComponent(Component source, Component parent) Centers a component (source) in it's parent component.static JButtoncreateAccessoryButton(Action action) Creates a small button for the given action with a 2px margin.static BorderCreates an blank border with the displayed textstatic BordercreateBorder(String text) Creates an etched border with the displayed textstatic JButtoncreateButton(String text, ActionListener listener) static JButtoncreateButton(String text, ActionListener listener, String mnemonic) Creates a JButtonstatic JButtoncreateButton(String text, ActionListener listener, String mnemonic, String actionCommand) static JCheckBoxcreateCheckBox(String text) static JCheckBoxcreateCheckBox(String text, int mnemonic) static JCheckBoxcreateCheckBox(String text, int mnemonic, boolean selected) static JCheckBoxcreateCheckBox(String text, int mnemonic, ActionListener listener) static JCheckBoxcreateCheckBox(String text, int mnemonic, ActionListener listener, boolean selected) Create a checkboxstatic JComboBoxcreateComboBox(Object[] items, boolean editable) static JComboBoxcreateComboBox(Object[] items, ActionListener listener, boolean editable) Creates a JComboBoxstatic JLabelcreateLabel(String text) static JLabelcreateLabel(String text, int mnemonic, Component comp) Creates a label which will be displayed.static JScrollPanecreateListPane(JList list, String text) Wraps a scrollpane with and etched border and a title around a JList.static JRadioButtoncreateRadioButton(String text) static JRadioButtoncreateRadioButton(String text, int mnemonic) static JRadioButtoncreateRadioButton(String text, int mnemonic, boolean selected) static JRadioButtoncreateRadioButton(String text, int mnemonic, ActionListener listener) static JRadioButtoncreateRadioButton(String text, int mnemonic, ActionListener listener, boolean selected) Creates a Radio Buttonstatic JButtoncreateSmallButton(String text, ActionListener listener) static JButtoncreateSmallButton(String text, ActionListener listener, String mnemonic) Creates a Smaller JButtonstatic JTextFieldcreateTextField(String text) static JTextFieldcreateTextField(String text, boolean numbers) static JTextFieldcreateTextField(String text, KeyListener listener) static JTextFieldcreateTextField(String text, KeyListener listener, boolean numbers) Creates a text fieldstatic AbstractButtoncreateToolbarButton(Action action, String componentTestName) Returns a minimalized toolbar button with no text.static StringeventModifiersToString(int event) static JFramegetParentFrame(Component source) Retrieves the parent JFrame for a component.static final StringgetTooltipPrefix(int width) static final StringgetTooltipPrefixInline(int width) static voidinitButtonGroup(JRadioButton... buttons) static IntegerConverts miliseconds to secondsstatic IntegerConverts seconds to milisecondsstatic voidsetDefaultCursor(Component comp) static voidsetDropCursor(Component comp) static voidsetupCancelButton(JButton btn) Sets up the ESC-key binding for a cancel buttonstatic voidsetWaitCursor(Component comp) static String[]stringArrayFromString(String string) static String[]stringArrayFromString(String string, String delim) Parses the string into an array of stringsstatic StringstringFromStringArray(String[] strings) static StringstringFromStringArray(String[] strings, String delim) Takes an array of strings and returns a concatenationstatic JPanelwrapInTitledPanel(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_WIDTHpublic static final int BUTTON_WIDTH- See Also:
 
- 
BUTTON_HEIGHTpublic static final int BUTTON_HEIGHT- See Also:
 
- 
BUTTCON_WIDTHpublic static final int BUTTCON_WIDTH- See Also:
 
- 
BUTTCON_HEIGHTpublic static final int BUTTCON_HEIGHT- See Also:
 
- 
SM_BUTTON_WIDTHpublic static final int SM_BUTTON_WIDTH- See Also:
 
- 
SM_BUTTON_HEIGHTpublic static final int SM_BUTTON_HEIGHT- See Also:
 
- 
LABEL_WIDTHpublic static final int LABEL_WIDTH- See Also:
 
- 
LABEL_HEIGHTpublic static final int LABEL_HEIGHT- See Also:
 
- 
TEXT_WIDTHpublic static final int TEXT_WIDTH- See Also:
 
- 
TEXT_HEIGHTpublic 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- 
CommonUIpublic CommonUI()
 
- 
- 
Method Details- 
getTooltipPrefix
- 
getTooltipPrefixInline
- 
wrapInTitledPanel
- 
createLabelCreates a label which will be displayed.- Parameters:
- text- Text for the label
- mnemonic- Hot key
- comp- Component that this label represents.
 
- 
createLabel
- 
createAccessoryButtonCreates a small button for the given action with a 2px margin.
- 
createToolbarButtonReturns 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.
- 
createTextFieldCreates a text field- Parameters:
- text- Text for the field
- listener- KeyListener
- numbers- Indicates that this field represents numbers only
 
- 
createTextField
- 
createTextField
- 
createTextField
- 
createRadioButtonpublic static JRadioButton createRadioButton(String text, int mnemonic, ActionListener listener, boolean selected) Creates a Radio Button- Parameters:
- text- Text to display
- mnemonic- Hot key
- listener- ActionListener
- selected- Flag to indicate if button should be selected
 
- 
createRadioButton
- 
createRadioButton
- 
createRadioButton
- 
createRadioButton
- 
initButtonGroup
- 
createCheckBoxpublic static JCheckBox createCheckBox(String text, int mnemonic, ActionListener listener, boolean selected) Create a checkbox- Parameters:
- text- to display
- mnemonic- Hot key
- listener- ActionListener
- selected- Flag to indicate if button should be selected
 
- 
createCheckBox
- 
createCheckBox
- 
createCheckBox
- 
createCheckBox
- 
createComboBoxCreates a JComboBox- Parameters:
- items- Object array
- listener- The action listener which handles events
- editable- Flag that indicates if this combo box is editable
 
- 
createComboBox
- 
createButtonCreates a JButton- Parameters:
- text- to display
- listener- The action listener which handles events
- mnemonic- Letter combination
 
- 
createButtonpublic static JButton createButton(String text, ActionListener listener, String mnemonic, String actionCommand) 
- 
createButton
- 
createSmallButtonCreates a Smaller JButton- Parameters:
- text- to display
- listener- The action listener which handles events
- mnemonic- Letter combination
 
- 
createSmallButton
- 
createBorderCreates an etched border with the displayed text
- 
createBorderCreates an blank border with the displayed text
- 
createListPaneWraps a scrollpane with and etched border and a title around a JList.- Parameters:
- list- JList to wrap.
- text- Text to display in the border.
 
- 
centerComponentCenters 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 
- 
centerComponentCenters the Component on the screen.
- 
setupCancelButtonSets up the ESC-key binding for a cancel button
- 
getParentFrameRetrieves 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.
 
- 
msToSecConverts miliseconds to seconds
- 
secToMsConverts seconds to miliseconds
- 
stringFromStringArrayTakes an array of strings and returns a concatenation- Parameters:
- strings- - Array to concatenate
- delim- - Delimiter to use. If this is null or empty then then a space will be used
 
- 
stringFromStringArray
- 
stringArrayFromStringParses the string into an array of strings- Parameters:
- string- - String to parse
- delim- - Delimiter to use. If this is null or empty then then the set [ ' ', '\t', '\n', '\r' ] is used.
 
- 
stringArrayFromString
- 
setWaitCursor
- 
setDefaultCursor
- 
setDropCursor
- 
adjustPopupLocationToFitScreenpublic 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
 
-