facets.facet.app
Class FacetAppSpecifier

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.util.app.AppValues
          extended by facets.core.app.AppSpecifier
              extended by facets.facet.app.FacetAppSpecifier
Direct Known Subclasses:
TreeAppSpecifier

public abstract class FacetAppSpecifier
extends AppSpecifier

AppSpecifier that builds and launches the FacetAppSurface that it specifies.

A FacetAppSpecifier simplifies definition of a simple desktop application defined by itself and by a FacetAppSurface, ViewerContenter and SHost.FacetLayout

These components are assembled into a complete GUI surface as follows:

  1. A FacetAppSpecifier is constructed in main, typically redefining some of its default values and buildAndLaunchApp(String[]) is called.
  2. The FacetAppSpecifier obtains from newApp(FacetFactory) a concrete FacetAppSurface which will typically configure itself from the FacetAppSpecifier.
  3. The FacetAppSurface is launched via AppHost.runHostedApp() in the return of FacetAppSurface.host().
  4. Either before or after launch, and as required based on user input, the FacetAppSurface creates ViewerContenters in AppSurface.newContenter(Object), which in turn create the application content and define the user interface.
  5. The SHost.FacetLayout defining content-specific surface features is returned by the first ViewerContenter for the content type from AppSurface.Contenter.newContentLayout(SHost, SFacet, SContentRootTargeter).


Field Summary
static java.lang.String ARG_NO_CREATE
          Debug flag.
static java.lang.String ARG_NO_FILES
          Debug flag.
static int DRAG_WAIT_MIN
           
static java.lang.String KEY_DEBUG_STATUS
          Key for debug value.
static java.lang.String KEY_DRAG_NOTIFY
          Key for debug value.
static java.lang.String KEY_DRAG_PAUSE
          Key for debug value.
static java.lang.String KEY_DRAG_WAIT
          Key for debug value.
static java.lang.String KEY_GRAPH_BUILD
          Key for debug value.
static java.lang.String KEY_GRAPH_FIND
          Key for debug value.
static java.lang.String KEY_GRAPH_OFFSETS
          Key for debug value.
static java.lang.String KEY_GRAPH_SPLIT
          Key for debug value.
static java.lang.String KEY_GRAPH_WHERE
          Key for debug value.
static java.lang.String KEY_SPLASH
          Key for debug value.
static java.lang.String KEY_TEXT_ALIASING
          Key for debug value.
 
Fields inherited from class facets.util.app.AppValues
appName, KEY_TIMEOUT, KEY_TIMEOUT_SYSTEM, NATURE_DEBUG, NATURE_NO_SYSTEM_ACCESS, NATURE_RECORD_RUNS, NATURE_WRITABLE, PATH_APP, PATH_CORE, PATH_CORE_APP, PATH_CORE_DEBUG, PATH_DEBUG, PATH_RUNS, stateDebug, TYPE_NATURE, TYPE_STATE
 
Constructor Summary
FacetAppSpecifier(java.lang.Class appClass)
           
 
Method Summary
protected  void addNatureDefaults(ValueNode root)
          Can set default configuration values.
protected  void addStateDefaults(ValueNode root)
          Overrides superclass method.
 void adjustClassValues()
          Overrides superclass method.
 void buildAndLaunchApp(java.lang.String[] args)
          Calls newApp(FacetFactory) and then AppHost.runHostedApp().
 boolean canCreateContent()
          Re-implementation setting positive default.
 boolean canSaveContent()
          Re-implementation making instance checks.
protected  AppSurface.ContentStyle contentStyle()
          Re-implementation looking at isFileApp().
 java.lang.Object[][] decorationValues()
          Return values keyed to application titles and keys.
 boolean isFileApp()
          Defines default returns of newActions(ActionAppSurface) and contentStyle().
static java.lang.Object[][] joinValues(java.lang.Object[][] head, java.lang.Object[][] tail)
           
protected  AppActions newActions(ActionAppSurface app)
          Implements abstract method.
protected abstract  FacetAppSurface newApp(FacetFactory ff)
          Called from buildAndLaunchApp(String...).
protected  FacetFactory newFacetFactory()
          Final implementation for desktop applications.
 AppActions.StatePreferences newPreferences(ActionAppSurface app)
          Delegate for FacetAppActions.lazyPreferences().
 FacetFactory.ToolkitType toolkitType()
          Defines the GUI widgets to be used for the application surface.
 
Methods inherited from class facets.core.app.AppSpecifier
app, canEditContent, canOverwriteContent, offersHelp
 
Methods inherited from class facets.util.app.AppValues
hasSystemAccess, nature, readValues, state, traceOutput, tryWriteValues
 
Methods inherited from class facets.util.Tracer
trace, trace, trace, trace, trace, traceDebug, traceDebug, traceObjectText, traceOutputWithClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARG_NO_FILES

public static final java.lang.String ARG_NO_FILES
Debug flag.

See Also:
Constant Field Values

ARG_NO_CREATE

public static final java.lang.String ARG_NO_CREATE
Debug flag.

See Also:
Constant Field Values

KEY_SPLASH

public static final java.lang.String KEY_SPLASH
Key for debug value.

See Also:
Constant Field Values

KEY_GRAPH_BUILD

public static final java.lang.String KEY_GRAPH_BUILD
Key for debug value.

See Also:
Constant Field Values

KEY_GRAPH_SPLIT

public static final java.lang.String KEY_GRAPH_SPLIT
Key for debug value.

See Also:
Constant Field Values

KEY_GRAPH_OFFSETS

public static final java.lang.String KEY_GRAPH_OFFSETS
Key for debug value.

See Also:
Constant Field Values

KEY_GRAPH_WHERE

public static final java.lang.String KEY_GRAPH_WHERE
Key for debug value.

See Also:
Constant Field Values

KEY_GRAPH_FIND

public static final java.lang.String KEY_GRAPH_FIND
Key for debug value.

See Also:
Constant Field Values

KEY_DEBUG_STATUS

public static final java.lang.String KEY_DEBUG_STATUS
Key for debug value.

See Also:
Constant Field Values

KEY_DRAG_WAIT

public static final java.lang.String KEY_DRAG_WAIT
Key for debug value.

See Also:
Constant Field Values

KEY_DRAG_PAUSE

public static final java.lang.String KEY_DRAG_PAUSE
Key for debug value.

See Also:
Constant Field Values

KEY_DRAG_NOTIFY

public static final java.lang.String KEY_DRAG_NOTIFY
Key for debug value.

See Also:
Constant Field Values

KEY_TEXT_ALIASING

public static final java.lang.String KEY_TEXT_ALIASING
Key for debug value.

See Also:
Constant Field Values

DRAG_WAIT_MIN

public static final int DRAG_WAIT_MIN
See Also:
Constant Field Values
Constructor Detail

FacetAppSpecifier

public FacetAppSpecifier(java.lang.Class appClass)
Method Detail

addNatureDefaults

protected void addNatureDefaults(ValueNode root)
Description copied from class: AppValues
Can set default configuration values.

Called from AppValues.readValues(String[]); values added are treated as defaults for AppValues.nature(boolean).

Default implementation is empty.

Overrides:
addNatureDefaults in class AppValues

addStateDefaults

protected void addStateDefaults(ValueNode root)
Overrides superclass method.

Fills AppValues.stateDebug with defaults for Events.

Overrides:
addStateDefaults in class AppValues
Parameters:
root - of the AppValues.state(String...) tree

decorationValues

public java.lang.Object[][] decorationValues()
Return values keyed to application titles and keys.

Returns:
by default FacetConstants.DECORATION_VALUES

joinValues

public static java.lang.Object[][] joinValues(java.lang.Object[][] head,
                                              java.lang.Object[][] tail)

adjustClassValues

public final void adjustClassValues()
Overrides superclass method.

Overrides:
adjustClassValues in class AppValues

newFacetFactory

protected final FacetFactory newFacetFactory()
Final implementation for desktop applications.

Returns:
FacetFactory.newDesktopCore(FacetAppSpecifier)

buildAndLaunchApp

public final void buildAndLaunchApp(java.lang.String[] args)
Calls newApp(FacetFactory) and then AppHost.runHostedApp().

Parameters:
args - passed to AppValues.readValues(String...) before creating app

newApp

protected abstract FacetAppSurface newApp(FacetFactory ff)
Called from buildAndLaunchApp(String...).

Parameters:
ff - created in newFacetFactory()
Returns:
a FacetAppSurface that will create content and the surface to expose it

newActions

protected AppActions newActions(ActionAppSurface app)
Implements abstract method.

Specified by:
newActions in class AppSpecifier
Parameters:
app - TODO
Returns:
by default either a FacetAppActions or a FileAppActions depending on isFileApp()

toolkitType

public FacetFactory.ToolkitType toolkitType()
Defines the GUI widgets to be used for the application surface.

Returns:
a FacetFactory.ToolkitType specifying the toolkit to be used by FacetFactory; by default FacetFactory.ToolkitType.SWING_SYSTEM

isFileApp

public boolean isFileApp()
Defines default returns of newActions(ActionAppSurface) and contentStyle().

Returns:
by default true unless contradicted using ARG_NO_FILES

canCreateContent

public boolean canCreateContent()
Re-implementation setting positive default.

Overrides:
canCreateContent in class AppSpecifier
Returns:
by default true unless contradicted using ARG_NO_CREATE

canSaveContent

public boolean canSaveContent()
Re-implementation making instance checks.

Overrides:
canSaveContent in class AppSpecifier
Returns:
by default true where AppSpecifier.canEditContent() and isFileApp() both return true

contentStyle

protected AppSurface.ContentStyle contentStyle()
Re-implementation looking at isFileApp().

Overrides:
contentStyle in class AppSpecifier
Returns:
by default AppSurface.ContentStyle.DESKTOP

newPreferences

public AppActions.StatePreferences newPreferences(ActionAppSurface app)
Delegate for FacetAppActions.lazyPreferences().

Returns:
by default a basic FacetPreferences; client code will usually return a trivial subclass.