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
  • Field Details

    • MAIN_FREEPLANE_FRAME

      public static final String MAIN_FREEPLANE_FRAME
      See Also:
    • SCROLLBAR_INCREMENT

      public static final String SCROLLBAR_INCREMENT
      See Also:
    • 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)
    • getCurrentRootComponent

      public static Component getCurrentRootComponent()
    • getCurrentFrame

      public static Frame getCurrentFrame()
    • getFrame

      public static Frame getFrame()
    • getMenuComponent

      public static Component getMenuComponent()
    • 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 JFileChooser newFileChooser()
    • newFileChooser

      public static JFileChooser newFileChooser(File directory)
    • getFreeplaneTabbedPanel

      public static JTabbedPane getFreeplaneTabbedPanel()
    • isLightLookAndFeelInstalled

      public static boolean isLightLookAndFeelInstalled()
    • resetMenuBarOnMac

      public static void resetMenuBarOnMac()