Belongs to following categories: Extension, ULC6.0, ULC6.1, ULC6.2, UltraLightClient '08,
Project Home
Downloads
Purpose
This extension provides developers with the concept of
Iconizers
that allows the simple, fast and consistent creation of fancy (tool bar)
button icon effects.
Using iconizers for the creation of a set of consistent icons based on
simple source icons has the following advantages:
- less time-consuming pixel-work in a paint application: global
background images are added dynamically, shadows are painted on demand,
offsets can be configured, ...
- more flexibility for global changes: when using a factory
approach for creating iconizers, global changes (e.g. new background
image for all icons) can be applied in the blink of an eye
- better consistency: no "one-pixel-shift-errors", configured
effects are always applied consistently to the whole set of icons
- lower bandwidth usage: as the iconizers create the
effect-enabled icons directly on the client side, only the source
icon(s) for each button has/have to be sent to the client
- highly customizable and extensible: existing iconizers can be
configured in different ways and combined using the provided chaining
iconizer. writing custom iconizers is also easy ...
What's new?
- Iconizer can be used with RadioButton and CheckBox.
Resources
How to use
The following shows some features of the
iconizers
concept. For more information, please consult the
Javadoc.
Creation of a button having effect-enabled icons is straight-forward:
ULCAbstractIconizer iconizer = IconizerFactory.createPressInStyleIconizer();
ULCIcon icon = new ULCIcon(getClass().getResource("/iconA.png"));
ULCIconizedButton iconizedButton = new ULCIconizedButton(icon, iconizer);
When changing an icon during runtime, the iconizer configured for the
affected button re-applies its effects to the new source icon. Thus, the
following code results to a change in the base icon, but the iconizer
effects remain the same:
iconizedButton.setIcon(new ULCIcon(getClass().getResource("/iconB.png"));
In order to disable the iconizer and consequently removing the
corresponding effects from the source icon (only displaying the source
icon as per default without iconizers), the following is appropriate:
iconizedButton.setIconizer(null);
ULCIconizedButtoninstances do support actions.
Using the custom action key
ULCIconizedButton.ICONIZER,
an inconizer instance can get configured with the action and thus, is
set to the button when an action gets set. Also, whenever the value of
the action key
ULCIconizedButton.ICONIZER changes,
the iconizer property of the button gets updated:
private static class IconizerAction extends AbstractAction { public IconizerAction(ULCIcon icon, ULCAbstractIconizer iconizer) {
super(null, icon); putValue(ULCIconizedButton.ICONIZER, iconizer);
} public void actionPerformed(ActionEvent actionEvent) { }
}...ULCAbstractIconizer iconizer = …
ULCIcon icon = …
AbstractAction action = new IconizerAction(icon, iconizer);
ULCIconizedButton iconizedButton = new ULCIconizedButton(action);
Iconizer instances can be shared on the server-side. E.g. when creating
a set of tool bar buttons that all should have the same iconizer effects
applied, a factory method may be useful:
public static ULCButton createToolBarButton(String text, ULCIcon icon) { ULCIconizedButton iconizedButton = new ULCIconizedButton(text, icon, getToolBarIconizer());
…
return iconizedButton;
}private static ULCAbstractIconizer getToolBarIconizer() {
ULCAbstractIconizer toolBarIconizer = (ULCAbstractIconizer)ApplicationContext.getAttribute("toolBarIconizer");
if (toolBarIconizer == null) { toolBarIconizer = IconizerFactory.createPressInStyleIconizer();
ApplicationContext.setAttribute("toolBarIconizer", toolBarIconizer);
}
return toolBarIconizer;
}
The
IconizerFactory provides creators for
well-known effects. For a description of the iconizers created by the
IconizerFactory, please see the
Javadoc.
Using the
ULCIconizerChain class, multiple
iconizers can get chained and thus, their functionality is combined.
public static ULCAbstractIconizer createStickOutStyleIconizer() { return new ULCIconizerChain(new ULCAbstractIconizer[]{
new ULCShadowIconizer(0, 2, 0),
new ULCOffsetIconizer(new Point(0, 0), new Point(-1, -1), new Point(0, 0))
});}
How it is implemented
The
ULCIconizedButton extends the standard
ULCButton and provides the possibility for setting
an iconizer. Implementations of
ULCAbstractIconizer
on the server side also extend the abstract
UIAbstractIconizer
class on the client side. The corresponding
UIAbstractIconizer
implementation is responsible for creating an basic
IIconizer
instance which in fact applies the effects to the server-side configured
icons. Icons configured using the corresponding methods
setIcon(),
setRolloverIcon()
and
setPressedIcon() on
ULCAbstractButtonare used as the source icons to which the iconizers apply their effects.
Compatibility
- UltraLightClient 6.0: JDK 1.4.2
- UltraLightClient 6.1: JDK 1.4.2, JDK 1.5
- UltraLightClient 6.2: JDK 1.4.2, JDK 1.5, JDK 1.6, Windows XP, Windows
Vista, Mac OSX
- UltraLightClient 2008: JDK 1.4.2, JDK 1.5, JDK 1.6, Windows XP, Windows
Vista, Mac OSX
Project setup with Eclipse
The project contains all necessary Eclipse project files and can be directly imported from the repository.
The classpath in this project contains a entry named
ULC Library, which locates the needed
UltraLightClient libraries. For to use the
ULC
Library entry you have to install the Eclipse Java IDE Integration
Plug-in that can be found at :
http://update.canoo.com/eclipse.
A
installation guide how to install plug-ins in Eclipse can be found
at the Eclipse help pages: Workbench User Guide > Tasks > Updating and
installing software.
Author
christian
Project Links
Project Home
Downloads
Author
christian