org.pietschy.command.interceptor
Class GlassPaneInterceptor
java.lang.Object
org.pietschy.command.interceptor.GlassPaneInterceptor
- ActionCommandInterceptor
public class GlassPaneInterceptor
extends java.lang.Object
GlassPaneInterceptor provides a simple interceptor that activates the glass pane before
a command executes and deactivates it afterward. This makes it easy block user
interaction while the command is executing making it easy to use libraries
like Foxtrot.
Generally this interceptor would be shared by all commands that need it. To this
end the static methods
install(ActionCommand)
and
uninstall(ActionCommand)
are provided for
your convenience.
public class FoxtrotCommand extends ActionCommand
{
public FoxtrotCommand(CommandManager cm, String id)
{
super(cm, id);
GlassPaneInterceptor.install(this);
}
public void handleExecute()
{
// the glass pane will be activated by the interceptor...
Worker.post(...);
// ..and removed when we're finished.
}
}
You can configure appearance of the glass pane by installing a custom instance of
GlassPaneHandler
.
GlassPaneInterceptor(Component glassPane) - Creates a new interceptor that uses the specified component as the glass pane.
|
COUNTER_STRATEGY
public static final org.pietschy.command.interceptor.GlassPaneInterceptorStrategy COUNTER_STRATEGY
STACK_STRATEGY
public static final org.pietschy.command.interceptor.GlassPaneInterceptorStrategy STACK_STRATEGY
GlassPaneInterceptor
public GlassPaneInterceptor(Component glassPane)
Creates a new interceptor that uses the specified component as the glass pane.
glassPane
- the glass pane to use.
install
public static void install(ActionCommand command)
A convenience method for adding the shared interceptor to the specified command.
command
- the command to which the interceptor is to be added.
setGlassPaneHandler
public void setGlassPaneHandler(GlassPaneHandler glassPaneHandler)
setStrategy
public void setStrategy(org.pietschy.command.interceptor.GlassPaneInterceptorStrategy modalstrategy)
Sets the GlassPaneInterceptorStrategy
this interceptor is to use.
modalstrategy
- the GlassPaneInterceptorStrategy
this interceptor is to use.
sharedInstance
public static GlassPaneInterceptor sharedInstance()
Gets the shared instance of this interceptor.
- the shared instance of this interceptor.
uninstall
public static void uninstall(ActionCommand command)
A convenience method for removing the shared interceptor from the specified command.
command
- the command from which the interceptor is to be removed.