Package thing
Class ThinletWorkarounds
java.lang.Object
thing.ThinletWorkarounds
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorGets the property value of the given component by the property key.static FontGets the property value of the given component by the property key, in this case, a font.static FontGets the font of the given component, or the font of the thinlet, if the font of the component has not been set explicitely.static intgetIndexOfItem(thinlet.Thinlet thinlet, Object component, Object item) Returns the index of the specified item in the item list of the specified component.static Object[]Gets all the components in this container.static AWTKeyStrokegetKeystroke(Object component, String key) static EnumerationgetPropertyKeys(Object component) Returns an enumeration of all client property keys defined in the specified component.static intgetTotalCount(thinlet.Thinlet thinlet, Object component) Returns the total count of all sub-components of the specified components, including the children's children, recursively.static voidsetSelectedItem(thinlet.Thinlet thinlet, Object component, Object item) Sets the selected item of the specified component, deselects all others.static Colorstring2color(String value) Ripped offThinlet.addAttribute(): returns aColorobject for a color description such as "#A0A0A0" or "0xA0A0A0" or "240,240,240".static Fontstring2font(thinlet.Thinlet thinlet, String value) Ripped offThinlet.addAttribute(): returns aFontobject for a thinlet font description such as "Serif 10 bold italic".static StringReturns a short string representation of the specified component, for example "button:btnOk".
-
Constructor Details
-
ThinletWorkarounds
public ThinletWorkarounds()
-
-
Method Details
-
getColor
Gets the property value of the given component by the property key. This method should really be in Thinlet.java. -
getFont
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
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
-
string2color
Ripped offThinlet.addAttribute(): returns aColorobject for a color description such as "#A0A0A0" or "0xA0A0A0" or "240,240,240". -
string2font
Ripped offThinlet.addAttribute(): returns aFontobject for a thinlet font description such as "Serif 10 bold italic". -
getPropertyKeys
Returns an enumeration of all client property keys defined in the specified component. This method should really be in Thinlet.java. -
getItems
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
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 Thinletcomponent- 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
Sets the selected item of the specified component, deselects all others. This method should really be in Thinlet.java. -
getTotalCount
Returns the total count of all sub-components of the specified components, including the children's children, recursively. -
toString
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.
-