Package com.illumon.iris.gui.util
Class IrisGuiUtil
java.lang.Object
com.illumon.iris.gui.util.IrisGuiUtil
public class IrisGuiUtil extends Object
Contains some static helper methods to create and manipulate GUI objects.
-
Field Summary
Fields Modifier and Type Field Description static String
IRIS_ICON_PROPERTY
-
Constructor Summary
Constructors Constructor Description IrisGuiUtil()
-
Method Summary
Modifier and Type Method Description static void
addCopyPasteMenu(JPopupMenu menu, JTextArea textArea)
Given a textarea, add a Copy/Cut/Paste menu to the passed in menu.static void
addDocumentChangeCallback(Document document, Runnable runnable)
static void
addDocumentChangeCallback(JTextComponent textComponent, Runnable runnable)
static void
addMutualExclusionRadioButton(JRadioButton radioButton, List<JComponent> enableComponents, List<JComponent> disableComponents)
static Color
adjustAlpha(int a, Color c)
static void
bindCheckboxToTextComponent(JTextComponent textComponent, JCheckBox checkBox)
static void
centerOnScreen(Window win)
static JPanel
centerWrap(JComponent com)
static void
clearAlertTabColor(Component com)
Clears the alert color with colored child checkingstatic int
countViews(com.illumon.infonode.docking.DockingWindow window)
static com.fishlib.base.Pair<JFrame,JPanel>
createEmptyDialog(Component parent, String title)
Create an empty dialog, with a JPanel that we can put stuff in.static void
editableTextAreaDialog(Component parent, String title, String value, Consumer<String> onOk)
Create an editable text area within dialog, returning the text on OK.static void
editableTextAreaDialog(Component parent, String title, String value, Consumer<String> onOk, Dialog.ModalityType modalityType)
Create an editable text area within dialog, returning the text on OK.static com.illumon.infonode.docking.DockingWindow
findView(com.illumon.infonode.docking.DockingWindow window, String name)
static Image
getDefaultDialogIcon()
static com.illumon.infonode.docking.DockingWindow
getDockingWindow(Component startComponent)
static ErrorReporter
getErrorReporter()
Get the globalErrorReporter
for reporting unexpected errors to the user.static JScrollPane
getScrollableTextArea(String value)
static com.fishlib.base.Pair<JScrollPane,JTextArea>
getScrollableTextArea(String value, boolean editable)
static com.illumon.infonode.docking.TabWindow
getTabWindow(com.illumon.infonode.docking.DockingWindow window)
static com.illumon.infonode.docking.View
getView(Component com)
static String
getViewTitle(Component com)
static void
initPropsAndLogs(String appName)
static boolean
isNumber(Class type)
static Color
lookupColorString(String colorString)
static Color
lookupColorString(String colorString, UIDefaults uiDefaults)
static JScrollPane
makeScrollableTextArea(String message, Dimension dim)
Create a scrollable, non-editable text area with the given message.static <V extends com.fishlib.base.stats.Value>
com.fishlib.base.stats.Item<V>makeUniqueItem(String groupName, String itemName, com.fishlib.base.Function.Unary<V,Long> valueFactory, String description)
static void
refreshAllWindows()
static void
restore(com.illumon.infonode.docking.RootWindow rootWindow, com.illumon.infonode.docking.util.StringViewMap viewMap, String viewName)
static void
restore(com.illumon.infonode.docking.RootWindow rootWindow, com.illumon.infonode.docking.View view)
static void
restoreAllViews(com.illumon.infonode.docking.RootWindow rootWindow, com.illumon.infonode.docking.util.StringViewMap viewMap, List excludeList)
static Color
scale(float v, Color c)
static void
setErrorReporter(ErrorReporter reporter)
Set the globalErrorReporter
for reporting unexpected errors to the user.static void
setSplitLocation(JSplitPane pane, double percentPosition)
Set the location of aJSplitPane
divider.static void
setTabColor(com.illumon.infonode.docking.DockingWindow dw, Color normalColor, Color highlightColor)
Sets the raw value of the color without checking for any previous colorstatic void
setViewTabAlertColor(Component com, Color color, boolean alertColorPropagates)
Sets the alert color of this view.static void
setViewTabTempColor(Component com, Color color, boolean tempColorPropagates)
Sets the temp color of this view.static String
showInputAreaDialog(Component parentComponent, String message, String initialSelectionValue)
static void
showTextAreaDialog(Component parent, String title, String value)
Create a scrollable, non-editable text area within dialog.static void
textAreaDialog(boolean editable, Component parent, String title, String value, Consumer<String> onOk, Dialog.ModalityType modalityType)
Create an editable text area within dialog, returning the text on OK.static JPanel
wrap(Object obj)
static JPanel
wrap(Object... obj)
static JPanel
wrapBorder(Object north, Object south, Object west, Object east, Object center)
static JPanel
wrapBox(int axis, Object... obj)
-
Field Details
-
IRIS_ICON_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Details
-
IrisGuiUtil
public IrisGuiUtil()
-
-
Method Details
-
getDefaultDialogIcon
-
refreshAllWindows
public static void refreshAllWindows() -
showInputAreaDialog
-
setViewTabTempColor
Sets the temp color of this view. colors "trickle up" so all ancestor windows will also get this color- Parameters:
com
- the component that is the child of a colorable tabcolor
- the color to set
-
setViewTabAlertColor
Sets the alert color of this view. Alerts will "trickle up" so any ancestor will also get the alert color applied- Parameters:
com
- the component causing the alertcolor
- the color of the alert
-
clearAlertTabColor
Clears the alert color with colored child checking- Parameters:
com
- the component whose ancestor will be colored
-
setTabColor
public static void setTabColor(com.illumon.infonode.docking.DockingWindow dw, Color normalColor, Color highlightColor)Sets the raw value of the color without checking for any previous color- Parameters:
dw
- the docking window to be colorednormalColor
- the normal color to be sethighlightColor
- the highlight color to be set
-
getViewTitle
-
makeUniqueItem
-
isNumber
-
centerOnScreen
-
getView
-
wrap
-
wrap
-
wrapBorder
-
wrapBox
-
centerWrap
-
getTabWindow
public static com.illumon.infonode.docking.TabWindow getTabWindow(com.illumon.infonode.docking.DockingWindow window) -
restoreAllViews
public static void restoreAllViews(com.illumon.infonode.docking.RootWindow rootWindow, com.illumon.infonode.docking.util.StringViewMap viewMap, List excludeList) -
restore
public static void restore(com.illumon.infonode.docking.RootWindow rootWindow, com.illumon.infonode.docking.View view) -
restore
public static void restore(com.illumon.infonode.docking.RootWindow rootWindow, com.illumon.infonode.docking.util.StringViewMap viewMap, String viewName) -
findView
public static com.illumon.infonode.docking.DockingWindow findView(com.illumon.infonode.docking.DockingWindow window, String name) -
countViews
public static int countViews(com.illumon.infonode.docking.DockingWindow window) -
initPropsAndLogs
-
makeScrollableTextArea
Create a scrollable, non-editable text area with the given message.- Parameters:
message
- message to display in the text boxdim
- optional preferred size for the text area- Returns:
- JScrollPane containing a text area
-
showTextAreaDialog
Create a scrollable, non-editable text area within dialog.- Parameters:
parent
- parent component for the dialogtitle
- title of the dialogvalue
- message to display in the text box
-
editableTextAreaDialog
public static void editableTextAreaDialog(Component parent, String title, String value, Consumer<String> onOk)Create an editable text area within dialog, returning the text on OK.- Parameters:
parent
- parent component for the dialogtitle
- title of the dialogvalue
- message to display in the text box
-
editableTextAreaDialog
public static void editableTextAreaDialog(Component parent, String title, String value, Consumer<String> onOk, Dialog.ModalityType modalityType)Create an editable text area within dialog, returning the text on OK.- Parameters:
parent
- parent component for the dialogtitle
- title of the dialogvalue
- message to display in the text box
-
textAreaDialog
public static void textAreaDialog(boolean editable, Component parent, String title, String value, @NotNull Consumer<String> onOk, Dialog.ModalityType modalityType)Create an editable text area within dialog, returning the text on OK.- Parameters:
parent
- parent component for the dialogtitle
- title of the dialogvalue
- message to display in the text boxmodalityType
- the modality type for the dialog
-
getScrollableTextArea
-
getScrollableTextArea
@NotNull public static com.fishlib.base.Pair<JScrollPane,JTextArea> getScrollableTextArea(String value, boolean editable) -
addCopyPasteMenu
Given a textarea, add a Copy/Cut/Paste menu to the passed in menu.- Parameters:
menu
- the popup menu that we'll add our components totextArea
- the textArea that we'll be modifying
-
createEmptyDialog
public static com.fishlib.base.Pair<JFrame,JPanel> createEmptyDialog(Component parent, String title)Create an empty dialog, with a JPanel that we can put stuff in.- Parameters:
parent
- parent component for the dialogtitle
- title of the dialog
-
addDocumentChangeCallback
-
addDocumentChangeCallback
-
lookupColorString
-
lookupColorString
-
scale
-
adjustAlpha
-
bindCheckboxToTextComponent
-
setSplitLocation
Set the location of a
JSplitPane
divider.This method handles the fact that
JSplitPane.setDividerLocation(double)
is a lie if the view has not been completely drawn yet. We need to wait for the window to be resized to _both_ it's internal sizes before we call setDividerLocation, otherwise the divider will not move to where it's supposed to.- Parameters:
pane
- The pane to set the divider forpercentPosition
- The position of the divider
-
getDockingWindow
public static com.illumon.infonode.docking.DockingWindow getDockingWindow(Component startComponent) -
addMutualExclusionRadioButton
public static void addMutualExclusionRadioButton(JRadioButton radioButton, List<JComponent> enableComponents, List<JComponent> disableComponents) -
getErrorReporter
Get the globalErrorReporter
for reporting unexpected errors to the user.- Returns:
- the error reporter.
-
setErrorReporter
Set the globalErrorReporter
for reporting unexpected errors to the user.- Parameters:
reporter
- the reporter to use
-