|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.application.config.DefaultApplicationObjectConfigurer
public class DefaultApplicationObjectConfigurer
The default implementation of the ApplicationObjectConfigurer
interface.
This class makes use of several application services in order to determine
the property values to be applied to objects being configured. For example,
some string properties will be retrieved from the application's message
resource bundle using a MessageSource
. To configure an object with
images and icons, an ImageSource
and IconSource
respectively
will be used. Subclasses can modify this behaviour by overriding the
configure(Object, String)
method but it may be more convenient to
override some of the various methods that deal specificly with objects that
implement certain 'configurable' interfaces, such as
LabelConfigurable
or TitleConfigurable
. See the javadoc of
the configure(Object, String)
method for more details.
Field Summary | |
---|---|
static String |
CAPTION_KEY
The key fragment used to retrieve the caption for a given object. |
static String |
DESCRIPTION_KEY
The key fragment used to retrieve the description for a given object. |
static String |
DISABLED_ICON_KEY
The key fragment used to retrieve the disabled icon for a given object. |
static String |
ICON_KEY
The key fragment used to retrieve the icon for a given object. |
static String |
IMAGE_KEY
The key fragment used to retrieve the image for a given object. |
static String |
LABEL_KEY
The key fragment used to retrieve the label for a given object. |
protected org.apache.commons.logging.Log |
logger
Class logger, available to subclasses. |
static String |
PRESSED_ICON_KEY
The key fragment used to retrieve the pressed icon for a given object. |
static String |
ROLLOVER_ICON_KEY
The key fragment used to retrieve the rollover icon for a given object. |
static String |
SELECTED_ICON_KEY
The key fragment used to retrieve the selected icon for a given object. |
static String |
TITLE_KEY
The key fragment used to retrieve the title for a given object. |
Constructor Summary | |
---|---|
DefaultApplicationObjectConfigurer()
Creates a new DefaultApplicationObjectConfigurer that will obtain
required services from the application services locator. |
|
DefaultApplicationObjectConfigurer(MessageSource messageSource)
Creates a new DefaultApplicationObjectConfigurer that will use
the given message source. |
|
DefaultApplicationObjectConfigurer(MessageSource messageSource,
ImageSource imageSource)
Creates a new DefaultApplicationObjectConfigurer that will use
the given message and image sources. |
|
DefaultApplicationObjectConfigurer(MessageSource messageSource,
ImageSource imageSource,
IconSource iconSource,
SecurityControllerManager securityControllerManager)
Creates a new DefaultApplicationObjectConfigurer that will use
the given message, image and icon sources. |
Method Summary | |
---|---|
void |
configure(Object object,
String objectName)
Configures the given object according to the interfaces that it implements. |
protected void |
configureColor(ColorConfigurable configurable,
String objectName)
Sets the foreground and background colours of the given object. |
protected void |
configureCommandIcons(CommandIconConfigurable configurable,
String objectName)
Sets the icons of the given object. |
protected void |
configureCommandLabel(CommandLabelConfigurable configurable,
String objectName)
Sets the CommandButtonLabelInfo of the given object. |
protected void |
configureDescription(DescriptionConfigurable configurable,
String objectName)
Sets the description and caption of the given object. |
protected void |
configureIcon(IconConfigurable configurable,
String objectName)
Sets the icon of the given object. |
protected void |
configureImage(ImageConfigurable configurable,
String objectName)
Sets the image of the given object. |
protected void |
configureLabel(LabelConfigurable configurable,
String objectName)
Sets the LabelInfo of the given object. |
protected void |
configureSecurityController(SecurityControllable controllable,
String objectName)
Associates the given object with a security controller if it implements the SecurityControllable interface. |
protected void |
configureTitle(TitleConfigurable configurable,
String objectName)
Sets the title of the given object. |
protected IconSource |
getIconSource()
Returns this instance's icon source. |
protected ImageSource |
getImageSource()
Returns this instance's image source. |
protected Locale |
getLocale()
Returns the system default locale. |
protected MessageSource |
getMessageSource()
Returns this instance's message source. |
protected SecurityControllerManager |
getSecurityControllerManager()
Returns this instance's security controller manager. |
Object |
postProcessAfterInitialization(Object bean,
String beanName)
A default implemenation, performing no operation. |
Object |
postProcessBeforeInitialization(Object bean,
String beanName)
Configures the given object. |
protected void |
setIconInfo(CommandIconConfigurable object,
String objectName,
boolean large)
|
void |
setLoadOptionalIcons(boolean loadOptionalIcons)
Sets the flag that determines if optional icons will be loaded for any CommandIconConfigurable objects that are configured by this
instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PRESSED_ICON_KEY
public static final String DISABLED_ICON_KEY
public static final String ROLLOVER_ICON_KEY
public static final String SELECTED_ICON_KEY
public static final String ICON_KEY
public static final String IMAGE_KEY
public static final String DESCRIPTION_KEY
public static final String CAPTION_KEY
public static final String TITLE_KEY
public static final String LABEL_KEY
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public DefaultApplicationObjectConfigurer()
DefaultApplicationObjectConfigurer
that will obtain
required services from the application services locator.
public DefaultApplicationObjectConfigurer(MessageSource messageSource)
DefaultApplicationObjectConfigurer
that will use
the given message source. Other application services will be retrieved
using the application services locator.
messageSource
- The message source. May be null.public DefaultApplicationObjectConfigurer(MessageSource messageSource, ImageSource imageSource)
DefaultApplicationObjectConfigurer
that will use
the given message and image sources. Other application services will be
retrieved using the application services locator.
messageSource
- The message source. May be null.imageSource
- The image source. May be null.public DefaultApplicationObjectConfigurer(MessageSource messageSource, ImageSource imageSource, IconSource iconSource, SecurityControllerManager securityControllerManager)
DefaultApplicationObjectConfigurer
that will use
the given message, image and icon sources. If any of these services are
null, they will be retrieved using the application services locator.
messageSource
- The message source. May be null.imageSource
- The image source. May be null.iconSource
- The icon source. May be null.securityControllerManager
- The security controller manager. May be
null.Method Detail |
---|
public void setLoadOptionalIcons(boolean loadOptionalIcons)
CommandIconConfigurable
objects that are configured by this
instance. The default is true.
loadOptionalIcons
- The flag to load optional options.protected MessageSource getMessageSource()
ServiceNotFoundException
- if a source was not provided at
construction time and the application services locator cannot find an
instance of a message source.protected IconSource getIconSource()
ServiceNotFoundException
- if a source was not provided at
construction time and the application services locator cannot find an
instance of an icon source.protected ImageSource getImageSource()
ServiceNotFoundException
- if a source was not provided at
construction time and the application services locator cannot find an
instance of an image source.protected SecurityControllerManager getSecurityControllerManager()
ServiceNotFoundException
- if a security controller manager was not
provided at construction time and the application services locator cannot
find an instance of the service.public void configure(Object object, String objectName)
This implementation forwards the object to the following overridable methods in the order listed. Subclasses can use these methods as hooks to modify the default configuration behaviour without having to override this method entirely.
configureTitle(TitleConfigurable, String)
configureLabel(LabelConfigurable, String)
configureCommandLabel(CommandLabelConfigurable, String)
configureDescription(DescriptionConfigurable, String)
configureImage(ImageConfigurable, String)
configureIcon(IconConfigurable, String)
configureCommandIcons(CommandIconConfigurable, String)
configureSecurityController(SecurityControllable, String)
configure
in interface ApplicationObjectConfigurer
object
- The object to be configured. May be null.objectName
- The name for the object, expected to be unique within
the application. If object
is not null, then objectName
must also be non-null.
IllegalArgumentException
- if object
is not null, but
objectName
is null.protected void configureTitle(TitleConfigurable configurable, String objectName)
MessageSource
using a message code in the format
<objectName>.title
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureLabel(LabelConfigurable configurable, String objectName)
LabelInfo
of the given object. The label info is created
after loading the encoded label string from this instance's
MessageSource
using a message code in the format
<objectName>.label
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureColor(ColorConfigurable configurable, String objectName)
<objectName>.foreground <objectName>.background
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureCommandLabel(CommandLabelConfigurable configurable, String objectName)
CommandButtonLabelInfo
of the given object. The label
info is created after loading the encoded label string from this
instance's MessageSource
using a message code in the format
<objectName>.label
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureDescription(DescriptionConfigurable configurable, String objectName)
MessageSource
using message codes in
the format
<objectName>.descriptionand
<objectName>.captionrespectively.
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureImage(ImageConfigurable configurable, String objectName)
ImageSource
using a key in the format
<objectName>.imageIf the image source cannot find an image under that key, the object's image will be set to null.
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureIcon(IconConfigurable configurable, String objectName)
IconSource
using a key in the format
<objectName>.iconIf the icon source cannot find an icon under that key, the object's icon will be set to null.
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureCommandIcons(CommandIconConfigurable configurable, String objectName)
The icons are loaded from this instance's IconSource
. using a
key in the format
<objectName>.someIconType
The keys used to retrieve large icons from the icon source are created by
concatenating the given objectName
with a dot (.), the text
'large' and then an icon type like so:
<myObjectName>.large.someIconType
If the icon source cannot find an icon under that key, the object's icon will be set to null.
If the loadOptionalIcons
flag is set to true (it is by default)
all the following icon types will be used. If the flag is false, only the
first will be used:
configurable
- The object to be configured. Must not be null.objectName
- The name of the configurable object, unique within the
application. Must not be null.
IllegalArgumentException
- if either argument is null.protected void configureSecurityController(SecurityControllable controllable, String objectName)
SecurityControllable
interface.
object
- The object to be configured.objectName
- The name (id) of the object.
BeansException
- if a referenced security controller is not found
or is of the wrong typeprotected void setIconInfo(CommandIconConfigurable object, String objectName, boolean large)
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
postProcessBeforeInitialization
in interface BeanPostProcessor
BeansException
configure(Object, String)
protected Locale getLocale()
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
postProcessAfterInitialization
in interface BeanPostProcessor
BeansException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |