facets.core.app
Class AppActions

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.core.app.AppActions
Direct Known Subclasses:
FacetAppActions

public abstract class AppActions
extends Tracer

Can launch dialogs and create root target elements on behalf of a ActionAppSurface.

AppActions defines a range of commonly required top-level application actions, together with STargets to represent them in the surface (typically as menu items).


Nested Class Summary
static interface AppActions.StatePreferences
          Supplier of DialogSurface.Contenters and matching DialogSurface for launchPreferences().
 
Field Summary
protected  ActionAppSurface app
           
static int BLOCKING_RUBRIC_1
           
static int BLOCKING_TITLE_0
           
static int CANCEL_RUBRIC_3
           
static int CANCEL_TITLE_2
           
static java.lang.String KEY_EXTRAS_SPLIT
           
static java.lang.String KEY_SHOW_EXTRAS
           
static java.lang.String KEY_SHOW_PREFERENCES
           
static int TARGETS_CORE
           
static int TARGETS_HELP
           
static int TARGETS_LAST
           
static int TARGETS_NEW
           
static int TARGETS_WINDOW
           
static java.lang.String TITLE_CLOSE_CONTENT
           
 
Constructor Summary
AppActions(ActionAppSurface app)
           
 
Method Summary
protected abstract  void attemptClose()
          Called by the STrigger with title AppConstants.TITLE_APP_CLOSE created by the default implementation of newSurfaceRootElements().
protected  Dialogs.Response contentIsRemovable(java.lang.String dialogTitle, AppSurface.Contenter content)
           
 java.io.File getOpeningContentSourceFile()
          May return source file on behalf of surface.
protected  boolean handleWatchCall(java.util.List<WatchableOperation> ops, java.lang.Exception e, boolean firstRetry, boolean inOpen)
          Called by the private AppWatcher.WatcherCoupler in FacetAppSurface.
 void launchAbout()
          Launch an 'about' pane.
 void launchPreferences()
          Launches a preferences dialog exposing session state values.
protected abstract  AppActions.StatePreferences lazyPreferences()
          Supply a AppActions.StatePreferences for used by launchPreferences().
protected  STarget[] newSurfaceRootElements()
          Create targets representing the actions defined by the instance type.
protected  STarget[] newWindowTargets()
          Called from default implementation of newSurfaceRootElements().
 void revertContent()
          Encapsulates reverting the current content.
protected  void setWindowCloseLiveState()
           
protected  boolean showPreferences()
          Show preferences in core menu?
protected  void surfaceRetargeted()
          Called from ActionAppSurface.surfaceRetargeted().
 void updateLayout()
          Convenience method calling SHost.updateLayout(SSurface).
 boolean windowTryClose()
          Cover for AppSurface.removeActiveRoot().
 
Methods inherited from class facets.util.Tracer
trace, trace, trace, trace, trace, traceDebug, traceDebug, traceObjectText, traceOutput, traceOutputWithClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE_CLOSE_CONTENT

public static final java.lang.String TITLE_CLOSE_CONTENT
See Also:
Constant Field Values

KEY_EXTRAS_SPLIT

public static final java.lang.String KEY_EXTRAS_SPLIT
See Also:
Constant Field Values

KEY_SHOW_EXTRAS

public static final java.lang.String KEY_SHOW_EXTRAS
See Also:
Constant Field Values

KEY_SHOW_PREFERENCES

public static final java.lang.String KEY_SHOW_PREFERENCES
See Also:
Constant Field Values

BLOCKING_TITLE_0

public static final int BLOCKING_TITLE_0
See Also:
Constant Field Values

BLOCKING_RUBRIC_1

public static final int BLOCKING_RUBRIC_1
See Also:
Constant Field Values

CANCEL_TITLE_2

public static final int CANCEL_TITLE_2
See Also:
Constant Field Values

CANCEL_RUBRIC_3

public static final int CANCEL_RUBRIC_3
See Also:
Constant Field Values

TARGETS_CORE

public static final int TARGETS_CORE
See Also:
Constant Field Values

TARGETS_WINDOW

public static final int TARGETS_WINDOW
See Also:
Constant Field Values

TARGETS_NEW

public static final int TARGETS_NEW
See Also:
Constant Field Values

TARGETS_HELP

public static final int TARGETS_HELP
See Also:
Constant Field Values

TARGETS_LAST

public static final int TARGETS_LAST
See Also:
Constant Field Values

app

protected final ActionAppSurface app
Constructor Detail

AppActions

public AppActions(ActionAppSurface app)
Method Detail

handleWatchCall

protected boolean handleWatchCall(java.util.List<WatchableOperation> ops,
                                  java.lang.Exception e,
                                  boolean firstRetry,
                                  boolean inOpen)
Called by the private AppWatcher.WatcherCoupler in FacetAppSurface.


windowTryClose

public final boolean windowTryClose()
Cover for AppSurface.removeActiveRoot().


setWindowCloseLiveState

protected final void setWindowCloseLiveState()

revertContent

public final void revertContent()
Encapsulates reverting the current content.


contentIsRemovable

protected Dialogs.Response contentIsRemovable(java.lang.String dialogTitle,
                                              AppSurface.Contenter content)

newSurfaceRootElements

protected STarget[] newSurfaceRootElements()
Create targets representing the actions defined by the instance type.

Called from ActionAppSurface.lazySurfaceRootElements() when creating the SAreaTarget which in turn creates AppSurface.surfaceRootTargeter(). Default returns triggers grouped as they are likely to be required for application menus; some expose member methods.

Targeter elements can be accessed using the following indexes into elements:


newWindowTargets

protected final STarget[] newWindowTargets()
Called from default implementation of newSurfaceRootElements().


updateLayout

public final void updateLayout()
Convenience method calling SHost.updateLayout(SSurface).

Called by the STrigger with title AppConstants.TITLE_APP_HELP created by the default implementation of newSurfaceRootElements() and other framework elements.


attemptClose

protected abstract void attemptClose()
Called by the STrigger with title AppConstants.TITLE_APP_CLOSE created by the default implementation of newSurfaceRootElements().


showPreferences

protected final boolean showPreferences()
Show preferences in core menu?

Returns:
by default false unless KEY_SHOW_PREFERENCES has been set in AppValues.nature(boolean)

launchPreferences

public final void launchPreferences()
Launches a preferences dialog exposing session state values.

Calls Dialogs.launchSurfaced(Surfacer, String, DialogSurface.DialogActions,DialogSurface.Contenter...) with parameters returned by the AppActions.StatePreferences created with lazyPreferences(). Typically called by one of newSurfaceRootElements(); declared public to enable calls from client code.


lazyPreferences

protected abstract AppActions.StatePreferences lazyPreferences()
Supply a AppActions.StatePreferences for used by launchPreferences().


launchAbout

public void launchAbout()
Launch an 'about' pane.

Called by one of newSurfaceRootElements(); declared public to enable calls from client code.


getOpeningContentSourceFile

public java.io.File getOpeningContentSourceFile()
May return source file on behalf of surface.

Called by ActionAppSurface.getOpeningContentSources(); default returns null.


surfaceRetargeted

protected void surfaceRetargeted()
Called from ActionAppSurface.surfaceRetargeted().

Default is empty stub.