|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pietschy.command.interceptor.GlassPaneInterceptor
public class GlassPaneInterceptor
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(org.pietschy.command.ActionCommand)
and
uninstall(org.pietschy.command.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
.
Field Summary | |
---|---|
static org.pietschy.command.interceptor.GlassPaneInterceptorStrategy |
COUNTER_STRATEGY
|
static GlassPaneInterceptor |
SHARED_INSTANCE
|
static org.pietschy.command.interceptor.GlassPaneInterceptorStrategy |
STACK_STRATEGY
|
Constructor Summary | |
---|---|
GlassPaneInterceptor(java.awt.Component glassPane)
Creates a new interceptor that uses the specified component as the glass pane. |
Method Summary | |
---|---|
void |
afterExecute(ActionCommand command)
Get the commands invoking window and deactivates its glass pane. |
boolean |
beforeExecute(ActionCommand command)
Get the commands invoking window and activates its glass pane. |
static void |
install(ActionCommand command)
A convenience method for adding the shared interceptor to the specified command. |
void |
setGlassPaneHandler(GlassPaneHandler glassPaneHandler)
|
void |
setStrategy(org.pietschy.command.interceptor.GlassPaneInterceptorStrategy modalstrategy)
Sets the GlassPaneInterceptorStrategy this interceptor is to use. |
static GlassPaneInterceptor |
sharedInstance()
Gets the shared instance of this interceptor. |
static void |
uninstall(ActionCommand command)
A convenience method for removing the shared interceptor from the specified command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.pietschy.command.interceptor.GlassPaneInterceptorStrategy STACK_STRATEGY
public static final org.pietschy.command.interceptor.GlassPaneInterceptorStrategy COUNTER_STRATEGY
public static GlassPaneInterceptor SHARED_INSTANCE
Constructor Detail |
---|
public GlassPaneInterceptor(java.awt.Component glassPane)
glassPane
- the glass pane to use.Method Detail |
---|
public static void install(ActionCommand command)
command
- the command to which the interceptor is to be added.public static void uninstall(ActionCommand command)
command
- the command from which the interceptor is to be removed.public static GlassPaneInterceptor sharedInstance()
public boolean beforeExecute(ActionCommand command)
beforeExecute
in interface ActionCommandInterceptor
command
- the command whose window is to be blocked.
true
.public void afterExecute(ActionCommand command)
afterExecute
in interface ActionCommandInterceptor
command
- the command whose window is to be unblocked.public void setStrategy(org.pietschy.command.interceptor.GlassPaneInterceptorStrategy modalstrategy)
GlassPaneInterceptorStrategy
this interceptor is to use.
modalstrategy
- the GlassPaneInterceptorStrategy
this interceptor is to use.public void setGlassPaneHandler(GlassPaneHandler glassPaneHandler)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |