Package org.freeplane.core.ui.components

# Class UITools

java.lang.Object
org.freeplane.core.ui.components.UITools

public class UITools extends Object
Utilities for accessing the GUI, creating dialogs etc.: In scripts available as "global variable" `ui`.

In scripts this would be a simple way of opening a info popup:

     ui.informationMessage("Hello World!")
     ui.informationMessage(ui.frame, "Hello World!") // longer version, equivalent

Since:
  29.12.2008

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `UITools.Defaults`
  `static final class`
  `UITools.InsertEolAction`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final float`
  `FONT_SCALE_FACTOR`
  `static final String`
  `MAIN_FREEPLANE_FRAME`
  `static final Dimension`
  `MAX_BUTTON_DIMENSION`
  `static final String`
  `SCROLLBAR_INCREMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UITools()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addEscapeActionToDialog(JDialog dialog)`
  `static void`
  `addEscapeActionToDialog(JDialog dialog, Action action)`
  `static void`
  `addKeyActionToDialog(JDialog dialog, Action action, String keyStroke, String actionId)`
  `static void`
  `addScrollbarIncrementPropertyListener(JScrollPane scrollPane)`
  `static TitledBorder`
  `addTitledBorder(JComponent c, String title, float size)`
  `static void`
  `backOtherWindows()`
  `static void`
  `convertPointFromAncestor(Component ancestor, Point p, Component c)`
  `static void`
  `convertPointToAncestor(Component from, Point p, Component destination)`
  `static void`
  `convertPointToAncestor(Component source, Point point, Class<?> ancestorClass)`
  `static void`
  `convertRectangleToAncestor(Component from, Rectangle r, Component destination)`
  `static JDialog`
  `createCancelDialog(Component component, String title, String text)`
  `static JDialog`
  `createCancelDialog(Component component, String title, String text, String buttonText)`
  `static JButton`
  `createHtmlLinkStyleButton(URI uri, String title)`
  `static BasicStroke`
  `createStroke(float width, int[] dash, int join)`
  `static void`
  `errorMessage(Object message)`
  `static void`
  `executeWhenNodeHasFocus(Runnable runnable)`
  `static Point`
  `findBestLocation(Component placedComponent, Component displayedComponent)`
  `static void`
  `focusOn(JComponent component)`
  `static Rectangle`
  `getAvailableScreenBounds(Component frame)`
  `static final int`
  `getComponentIndex(Component component)`
  `static Frame`
  `getCurrentFrame()`
  `static Component`
  `getCurrentRootComponent()`
  `static Font`
  `getDefaultLabelFont()`
  `static Color`
  `getDisabledTextColorForBackground(Color color)`
  `static Frame`
  `getFrame()`
  `static JTabbedPane`
  `getFreeplaneTabbedPanel()`
  `static KeyStroke`
  `getKeyStroke(String keyStrokeDescription)`
  returns a KeyStroke if possible and null otherwise.
  `static Component`
  `getMenuComponent()`
  `static Rectangle`
  `getScreenBounds(GraphicsConfiguration graphicsConfiguration)`
  `static Color`
  `getTextColorForBackground(Color color)`
  `static Font`
  `getUIFont()`
  `static Font`
  `getUIFont(float scalingFactor)`
  `static int`
  `getUIFontSize(double scalingFactor)`
  `static int`
  `getUIFontSize(float scalingFactor)`
  `static Rectangle`
  `getValidFrameBounds(Component frame, int win_x, int win_y, int win_width, int win_height)`
  `static void`
  `informationMessage(Component frame, Object message)`
  `static void`
  `informationMessage(Component frame, Object message, String title)`
  `static void`
  `informationMessage(Component frame, Object text, String title, int type)`
  `static void`
  `informationMessage(Object message)`
  `static Font`
  `invertScale(Font font)`
  `static boolean`
  `isEditingText()`
  `static boolean`
  `isLight(Color color)`
  `static boolean`
  `isLighter(Color color, int minimum)`
  `static boolean`
  `isLightLookAndFeelInstalled()`
  `static String`
  `keyStrokeToString(KeyStroke keyStroke)`
  formats a KeyStroke in a ledgible way, e.g.
  `static org.freeplane.api.swing.JFileChooser`
  `newFileChooser()`
  `static org.freeplane.api.swing.JFileChooser`
  `newFileChooser(File directory)`
  `static void`
  `repaintAll(Container root)`
  `static void`
  `resetMenuBarOnMac()`
  `static Font`
  `scale(Font font)`
  `static Font`
  `scaleFontInt(Font font, double additionalFactor)`
  `static Font`
  `scaleUI(Font font)`
  `static void`
  `setBounds(Component frame, int win_x, int win_y, int win_width, int win_height)`
  `static void`
  `setDialogLocationRelativeTo(JDialog dialog, Component c)`
  `static void`
  `setDialogLocationRelativeTo(JDialog dialog, org.freeplane.features.map.NodeModel node)`
  `static void`
  `setDialogLocationUnder(JDialog dialog, org.freeplane.features.map.NodeModel node)`
  `static void`
  `setScrollbarIncrement(JScrollPane scrollPane)`
  `static void`
  `showAttributeEmptyStringErrorMessage()`
  Shows the error message "attributes_adding_empty_attribute_error"
  `static int`
  `showConfirmDialog(org.freeplane.features.map.NodeModel node, Object message, String title, int optionType)`
  `static int`
  `showConfirmDialog(org.freeplane.features.map.NodeModel node, Object message, String title, int optionType, int messageType)`
  `static void`
  `showFrame()`
  `static String`
  `showInputDialog(org.freeplane.features.map.NodeModel node, String message, String initialValue)`
  `static String`
  `showInputDialog(org.freeplane.features.map.NodeModel node, String text, String title, int type)`
  `static void`
  `showMessage(String message, int messageType)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MAIN_FREEPLANE_FRAME

    public static final String MAIN_FREEPLANE_FRAME
    See Also:
      - Constant Field Values

  - ### SCROLLBAR_INCREMENT

    public static final String SCROLLBAR_INCREMENT
    See Also:
      - Constant Field Values

  - ### MAX_BUTTON_DIMENSION

    public static final Dimension MAX_BUTTON_DIMENSION

  - ### FONT_SCALE_FACTOR

    public static final float FONT_SCALE_FACTOR

- ## Constructor Details

  - ### UITools

    public UITools()

- ## Method Details

  - ### addEscapeActionToDialog

    public static void addEscapeActionToDialog(JDialog dialog)

  - ### addEscapeActionToDialog

    public static void addEscapeActionToDialog(JDialog dialog, Action action)

  - ### addKeyActionToDialog

    public static void addKeyActionToDialog(JDialog dialog, Action action, String keyStroke, String actionId)

  - ### convertPointFromAncestor

    public static void convertPointFromAncestor(Component ancestor, Point p, Component c)

  - ### convertPointToAncestor

    public static void convertPointToAncestor(Component source, Point point, Class<?> ancestorClass)

  - ### convertRectangleToAncestor

    public static void convertRectangleToAncestor(Component from, Rectangle r, Component destination)

  - ### convertPointToAncestor

    public static void convertPointToAncestor(Component from, Point p, Component destination)

  - ### errorMessage

    public static void errorMessage(Object message)

  - ### getCurrentFrame

    public static Frame getCurrentFrame()

  - ### getFrame

    public static Frame getFrame()

  - ### getMenuComponent

    public static Component getMenuComponent()

  - ### getCurrentRootComponent

    public static Component getCurrentRootComponent()

  - ### getKeyStroke

    public static KeyStroke getKeyStroke(String keyStrokeDescription)
    returns a KeyStroke if possible and null otherwise.

  - ### keyStrokeToString

    public static String keyStrokeToString(KeyStroke keyStroke)
    formats a KeyStroke in a ledgible way, e.g. Control+V. Null is converted to "". Taken from MotifGraphicsUtils.paintMenuItem().

  - ### informationMessage

    public static void informationMessage(Object message)

  - ### informationMessage

    public static void informationMessage(Component frame, Object message)

  - ### informationMessage

    public static void informationMessage(Component frame, Object message, String title)

  - ### informationMessage

    public static void informationMessage(Component frame, Object text, String title, int type)

  - ### setBounds

    public static void setBounds(Component frame, int win_x, int win_y, int win_width, int win_height)

  - ### getValidFrameBounds

    public static Rectangle getValidFrameBounds(Component frame, int win_x, int win_y, int win_width, int win_height)

  - ### getAvailableScreenBounds

    public static Rectangle getAvailableScreenBounds(Component frame)

  - ### getScreenBounds

    public static Rectangle getScreenBounds(GraphicsConfiguration graphicsConfiguration)

  - ### setDialogLocationRelativeTo

    public static void setDialogLocationRelativeTo(JDialog dialog, Component c)

  - ### findBestLocation

    public static Point findBestLocation(Component placedComponent, Component displayedComponent)

  - ### setDialogLocationRelativeTo

    public static void setDialogLocationRelativeTo(JDialog dialog, org.freeplane.features.map.NodeModel node)

  - ### setDialogLocationUnder

    public static void setDialogLocationUnder(JDialog dialog, org.freeplane.features.map.NodeModel node)

  - ### showAttributeEmptyStringErrorMessage

    public static void showAttributeEmptyStringErrorMessage()
    Shows the error message "attributes_adding_empty_attribute_error"

  - ### showMessage

    public static void showMessage(String message, int messageType)

  - ### showConfirmDialog

    public static int showConfirmDialog(org.freeplane.features.map.NodeModel node, Object message, String title, int optionType, int messageType)

  - ### showConfirmDialog

    public static int showConfirmDialog(org.freeplane.features.map.NodeModel node, Object message, String title, int optionType)

  - ### showInputDialog

    public static String showInputDialog(org.freeplane.features.map.NodeModel node, String message, String initialValue)

  - ### showInputDialog

    public static String showInputDialog(org.freeplane.features.map.NodeModel node, String text, String title, int type)

  - ### setScrollbarIncrement

    public static void setScrollbarIncrement(JScrollPane scrollPane)

  - ### addScrollbarIncrementPropertyListener

    public static void addScrollbarIncrementPropertyListener(JScrollPane scrollPane)

  - ### getTextColorForBackground

    public static Color getTextColorForBackground(Color color)

  - ### getDisabledTextColorForBackground

    public static Color getDisabledTextColorForBackground(Color color)

  - ### isLight

    public static boolean isLight(Color color)

  - ### isLighter

    public static boolean isLighter(Color color, int minimum)

  - ### focusOn

    public static void focusOn(JComponent component)

  - ### createStroke

    public static BasicStroke createStroke(float width, int[] dash, int join)

  - ### repaintAll

    public static void repaintAll(Container root)

  - ### createCancelDialog

    public static JDialog createCancelDialog(Component component, String title, String text)

  - ### createCancelDialog

    public static JDialog createCancelDialog(Component component, String title, String text, String buttonText)

  - ### addTitledBorder

    public static TitledBorder addTitledBorder(JComponent c, String title, float size)

  - ### backOtherWindows

    public static void backOtherWindows()

  - ### createHtmlLinkStyleButton

    public static JButton createHtmlLinkStyleButton(URI uri, String title)

  - ### getComponentIndex

    public static final int getComponentIndex(Component component)

  - ### scale

    public static Font scale(Font font)

  - ### scaleUI

    public static Font scaleUI(Font font)

  - ### scaleFontInt

    public static Font scaleFontInt(Font font, double additionalFactor)

  - ### invertScale

    public static Font invertScale(Font font)

  - ### showFrame

    public static void showFrame()

  - ### isEditingText

    public static boolean isEditingText()

  - ### executeWhenNodeHasFocus

    public static void executeWhenNodeHasFocus(Runnable runnable)

  - ### getUIFontSize

    public static int getUIFontSize(double scalingFactor)

  - ### getUIFontSize

    public static int getUIFontSize(float scalingFactor)

  - ### getUIFont

    public static Font getUIFont(float scalingFactor)

  - ### getUIFont

    public static Font getUIFont()

  - ### getDefaultLabelFont

    public static Font getDefaultLabelFont()

  - ### newFileChooser

    public static org.freeplane.api.swing.JFileChooser newFileChooser()

  - ### newFileChooser

    public static org.freeplane.api.swing.JFileChooser newFileChooser(File directory)

  - ### getFreeplaneTabbedPanel

    public static JTabbedPane getFreeplaneTabbedPanel()

  - ### isLightLookAndFeelInstalled

    public static boolean isLightLookAndFeelInstalled()

  - ### resetMenuBarOnMac

    public static void resetMenuBarOnMac()