Package thing

Class ThinletWorkarounds

java.lang.Object
thing.ThinletWorkarounds

public class ThinletWorkarounds extends Object
This class encapsulates workarounds for missing functionality in Thinlet.java.

Some of Thinlet's private methods needed by ThinG are copied here and have at times been sligtly modified. This methods need to be adapted when their counterparts in Thinlet.java changes.

Some other helper methods are here, that should better be put into Thinlet.java.

Author:
Dirk Moebius
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Color
    getColor(Object component, String key)
    Gets the property value of the given component by the property key.
    static Font
    getFont(Object component, String key)
    Gets the property value of the given component by the property key, in this case, a font.
    static Font
    getFont(thinlet.Thinlet thinlet, Object component, String key)
    Gets the font of the given component, or the font of the thinlet, if the font of the component has not been set explicitely.
    static int
    getIndexOfItem(thinlet.Thinlet thinlet, Object component, Object item)
    Returns the index of the specified item in the item list of the specified component.
    static Object[]
    getItems(thinlet.Thinlet thinlet, Object component)
    Gets all the components in this container.
    getKeystroke(Object component, String key)
     
    Returns an enumeration of all client property keys defined in the specified component.
    static int
    getTotalCount(thinlet.Thinlet thinlet, Object component)
    Returns the total count of all sub-components of the specified components, including the children's children, recursively.
    static void
    setSelectedItem(thinlet.Thinlet thinlet, Object component, Object item)
    Sets the selected item of the specified component, deselects all others.
    static Color
    Ripped off Thinlet.addAttribute(): returns a Color object for a color description such as "#A0A0A0" or "0xA0A0A0" or "240,240,240".
    static Font
    string2font(thinlet.Thinlet thinlet, String value)
    Ripped off Thinlet.addAttribute(): returns a Font object for a thinlet font description such as "Serif 10 bold italic".
    static String
    toString(Object component)
    Returns a short string representation of the specified component, for example "button:btnOk".

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ThinletWorkarounds

      public ThinletWorkarounds()
  • Method Details

    • getColor

      public static Color getColor(Object component, String key)
      Gets the property value of the given component by the property key. This method should really be in Thinlet.java.
    • getFont

      public static Font getFont(thinlet.Thinlet thinlet, Object component, String key)
      Gets the font of the given component, or the font of the thinlet, if the font of the component has not been set explicitely. This method should really be in Thinlet.java.
    • getFont

      public static Font getFont(Object component, String key)
      Gets the property value of the given component by the property key, in this case, a font. In most cases, the property key is "font". This method should really be in Thinlet.java.
    • getKeystroke

      public static AWTKeyStroke getKeystroke(Object component, String key)
    • string2color

      public static Color string2color(String value)
      Ripped off Thinlet.addAttribute(): returns a Color object for a color description such as "#A0A0A0" or "0xA0A0A0" or "240,240,240".
    • string2font

      public static Font string2font(thinlet.Thinlet thinlet, String value)
      Ripped off Thinlet.addAttribute(): returns a Font object for a thinlet font description such as "Serif 10 bold italic".
    • getPropertyKeys

      public static Enumeration getPropertyKeys(Object component)
      Returns an enumeration of all client property keys defined in the specified component. This method should really be in Thinlet.java.
    • getItems

      public static Object[] getItems(thinlet.Thinlet thinlet, Object component)
      Gets all the components in this container.

      The difference between Thinlet.getItems(Object component) is the following: If the container is a tree, then recursively get all nodes of the tree. (The Thinlet method only returns the nodes of the top level).

    • getIndexOfItem

      public static int getIndexOfItem(thinlet.Thinlet thinlet, Object component, Object item)
      Returns the index of the specified item in the item list of the specified component. Note that trees are not searched recursively. This method should really be in Thinlet.java.
      Parameters:
      thinlet - the Thinlet
      component - the component; this should be a component that has sub-items such as tree, table, node etc.
      item - the item to search for.
      Returns:
      the index of the item, or -1 if the item cannot be found.
    • setSelectedItem

      public static void setSelectedItem(thinlet.Thinlet thinlet, Object component, Object item)
      Sets the selected item of the specified component, deselects all others. This method should really be in Thinlet.java.
    • getTotalCount

      public static int getTotalCount(thinlet.Thinlet thinlet, Object component)
      Returns the total count of all sub-components of the specified components, including the children's children, recursively.
    • toString

      public static String toString(Object component)
      Returns a short string representation of the specified component, for example "button:btnOk". Useful for debugging output.
      Parameters:
      component - the component. If it is null, the string "null" is returned.
      Returns:
      a string representation of the component.