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 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 Summary
Constructors -
Method Summary
Modifier 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_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
-