org.montsuqi.monsia.builders
Class WidgetPropertySetter

java.lang.Object
  extended by org.montsuqi.monsia.builders.WidgetPropertySetter

abstract class WidgetPropertySetter
extends java.lang.Object

WidgetPropertySetter is a class to help assigning properties to widgets.

These setters exist one for a class(and subclass) and property name.

When building a widget, a widget builder will look up a suitable setter for each key in provided properties. When such a setter is found, its set method is called to set a certain property of the widget.


Field Summary
protected static Logger logger
           
 
Constructor Summary
WidgetPropertySetter()
           
 
Method Summary
(package private) static WidgetPropertySetter getSetter(java.lang.Class clazz, java.lang.String name)
          Looks up a property setter for given class or its ancestors and property name.
(package private) static java.lang.String normalize(java.lang.String value, java.lang.String prefixToRemove)
          Removes given prefix along with "GTK_" and "GTK_".
(package private) abstract  void set(Interface xml, java.awt.Container parent, java.awt.Component widget, java.lang.String value)
          This method does the actual work of setting a property.
protected  void warnUnsupportedProperty(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
Constructor Detail

WidgetPropertySetter

WidgetPropertySetter()
Method Detail

set

abstract void set(Interface xml,
                  java.awt.Container parent,
                  java.awt.Component widget,
                  java.lang.String value)

This method does the actual work of setting a property. Subclasses must implement this method.

Parameters:
xml - glade screen definition
parent - parent widget of the target widget.
widget - target widget.
value - the value to set in String.

warnUnsupportedProperty

protected void warnUnsupportedProperty(java.lang.String value)

getSetter

static WidgetPropertySetter getSetter(java.lang.Class clazz,
                                      java.lang.String name)

Looks up a property setter for given class or its ancestors and property name.

When no setter is found, nullWidgetPropertySetter, which does nothing, is returned.

Parameters:
clazz - class of the widget whose property is to be set.
name - the proeprty name to be set.
Returns:
a setter.

normalize

static java.lang.String normalize(java.lang.String value,
                                  java.lang.String prefixToRemove)

Removes given prefix along with "GTK_" and "GTK_".

Parameters:
value - target string to be normalized.
prefixToRemove - a prefix to remove. Ignored if it is null or its length is zero.
Returns:
normalized string.