Class 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
    • Constructor Detail

      • UITools

        public UITools()
    • Method Detail

      • 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)
      • 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​(String message)
      • informationMessage

        public static void informationMessage​(Component frame,
                                              String message)
      • informationMessage

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

        public static void informationMessage​(Component frame,
                                              String text,
                                              String string,
                                              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)
      • 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)
      • focusOn

        public static void focusOn​(JComponent component)
      • createStroke

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

        public static float[] toFloats​(int[] dash)
      • repaintAll

        public static void repaintAll​(Container root)
      • addTitledBorder

        public static void 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 float getUIFontSize​(double scalingFactor)
      • shouldScaleUIFonts

        public static boolean shouldScaleUIFonts()