facets.facet.app
Class FacetAppSurface

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.core.app.AppSurface
          extended by facets.core.app.ActionAppSurface
              extended by facets.facet.app.FacetAppSurface
All Implemented Interfaces:
SurfaceServices, SSurface, Notifiable, Titled

public abstract class FacetAppSurface
extends ActionAppSurface
implements SurfaceServices

ActionAppSurface with a built-in FacetFactory.

FacetAppSurface extends its superclass primarily by passing the FacetAppSpecifier which is set as AppSurface.spec; this in turn supplies a FacetFactory which can either be used as-is or provide a core for content-specific subclasses.

Further general-purpose functionality is suppled by FacetAppSpecifier and FacetAppActions members of FacetAppSpecifier.


Nested Class Summary
 
Nested classes/interfaces inherited from class facets.core.app.ActionAppSurface
ActionAppSurface.CachingStyle
 
Nested classes/interfaces inherited from class facets.core.app.AppSurface
AppSurface.ContentCreationException, AppSurface.Contenter, AppSurface.ContentRoot, AppSurface.ContentStyle
 
Field Summary
 FacetFactory ff
          For use by subclasses and AppSurface.Contenters
 
Fields inherited from class facets.core.app.ActionAppSurface
actions, KEY_TIMED_OUT, KEY_TIMEOUTS, memory, watcher
 
Fields inherited from class facets.core.app.AppSurface
AREA_APP, AREA_CONTENT, AREA_PAGE, AREA_PANE, contentStyle, emptyContent, spec, TITLE_EMPTY
 
Constructor Summary
FacetAppSurface(FacetAppSpecifier spec, FacetFactory ff)
          Unique constructor.
 
Method Summary
protected  void appClosing()
          Called before a true return from closeAcceptable(WindowAppHost).
protected  void appOpened()
          Called from openApp().
 java.lang.String areaTitle(int depth)
           
protected  ActionAppSurface.CachingStyle cachingStyle()
           
protected  long calculateCacheMb(int maxSafeMb)
           
 boolean closeAcceptable(WindowAppHost host)
          Check to see if a non-applet app can be closed.
 void debugWatch(java.lang.String callName, boolean providing, boolean exception)
           
 Dialogs dialogs()
          The Dialogs created during openApp().
 MenuFacets getContextMenuFacets()
          Implements interface method.
 FileSpecifier[] getFileSpecifiers()
          What files can the application open?
protected  java.lang.Object getInternalContentSource()
          Implements abstract method.
 void handleInvalidInput(STarget target, java.lang.Object input)
          Implements interface method.
 SHost host()
          Re-implementation to create/return a suitable SHost.
protected  void hostWindowOpened()
          Called from openApp().
 SFacet newDebugSwitchLabel(SFacet client)
           
protected  java.lang.String newDebugText()
           
protected  SHost.FacetLayout newEmptyDesktopLayout(SHost host, SContentRootTargeter t, SFacet surfaceRootFacet)
          Provide a empty SHost.FacetLayout.
protected  MountFacet newMultiContentFacet(SAreaTarget surfaceRoot)
          May return a facet to be attached to the surface root.
 SurfaceServices newSimpleServices(MenuFacets contextFacets)
          Supplies a simple implementation of SurfaceServices.
protected  java.lang.String newTitleBarText()
          Implements abstract method.
protected  void notifiedFlash(Notice notice)
          Called from notify(Notice) when the Notice passed has Notifying.Impact.FLASH.
 void notify(Notice notice)
          Respond to the Notice passed.
 void openApp()
          Overrides superclass implementation.
 void runWatched(WatchableOperation r)
          Allows runtime exceptions in framework and client code to be handled gracefully, by AppWatcher.
 void runWatchedLater(WatchableOperation r)
           
 void setLayoutTargetsLive(boolean live)
           
protected  void traceOutput(java.lang.String msg)
          Outputs complete trace messages to console or elsewhere.
 
Methods inherited from class facets.core.app.ActionAppSurface
contentIsRemovable, getFixedOpeningContentSources, getOpeningContentSources, lazySurfaceRootElements, surfaceRetargeted
 
Methods inherited from class facets.core.app.AppSurface
activeContentRootTargeter, addContent, buildRetargeted, cloneActiveRoot, contentNotAdded, findActiveContent, firstContentRoot, getViewerContents, isBuilt, isHeadless, newContenter, newHeadlessHost, removeActiveContent, removeActiveRoot, removeAllContent, replaceSingleContent, revertActiveContent, surfaceRootTargeter, title
 
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

ff

public final FacetFactory ff
For use by subclasses and AppSurface.Contenters

Constructor Detail

FacetAppSurface

public FacetAppSurface(FacetAppSpecifier spec,
                       FacetFactory ff)
Unique constructor.

Parameters:
ff - set as ff after being passed to constructor as AppServices
Method Detail

traceOutput

protected final void traceOutput(java.lang.String msg)
Description copied from class: Tracer
Outputs complete trace messages to console or elsewhere.

Default prepends helpful classname to message.

Overrides:
traceOutput in class Tracer
Parameters:
msg - passed from one of the public methods

openApp

public final void openApp()
Overrides superclass implementation.
  1. Creates or gets the AppHost and obtains from it a suitable Dialogs.
  2. Issues any AppWatcher warnings.
  3. Possibly puts up a splash panel and calls the super-implementation.
  4. If applet-hosted, calls appOpened() and returns
  5. Otherwise opens app window, attempts to add content to an empty desktop, pulls down any splash panel, calls appOpened().

Overrides:
openApp in class AppSurface

debugWatch

public final void debugWatch(java.lang.String callName,
                             boolean providing,
                             boolean exception)

runWatched

public final void runWatched(WatchableOperation r)
Description copied from class: AppSurface
Allows runtime exceptions in framework and client code to be handled gracefully, by AppWatcher.

Default simply runs r

Overrides:
runWatched in class AppSurface

runWatchedLater

public final void runWatchedLater(WatchableOperation r)

cachingStyle

protected ActionAppSurface.CachingStyle cachingStyle()
Specified by:
cachingStyle in class ActionAppSurface

calculateCacheMb

protected long calculateCacheMb(int maxSafeMb)
Specified by:
calculateCacheMb in class ActionAppSurface

newMultiContentFacet

protected final MountFacet newMultiContentFacet(SAreaTarget surfaceRoot)
Description copied from class: AppSurface
May return a facet to be attached to the surface root.

Defines a tab folder or internal desktop for a multi-content surface - not called for single content as the content root facet is used instead.

Overrides:
newMultiContentFacet in class AppSurface
Parameters:
surfaceRoot - was (re)created in SSurface.buildRetargeted()

notify

public final void notify(Notice notice)
Description copied from interface: Notifiable
Respond to the Notice passed.

When this method is called, the Notifiable should respond based on

Specified by:
notify in interface Notifiable
Overrides:
notify in class ActionAppSurface

notifiedFlash

protected void notifiedFlash(Notice notice)
Called from notify(Notice) when the Notice passed has Notifying.Impact.FLASH.

No other response is made to such notifications.

Default...


newDebugSwitchLabel

public final SFacet newDebugSwitchLabel(SFacet client)

areaTitle

public final java.lang.String areaTitle(int depth)

closeAcceptable

public final boolean closeAcceptable(WindowAppHost host)
Check to see if a non-applet app can be closed.

Parameters:
host - should call if a request to close is made by the app or the toolkit window

newSimpleServices

public final SurfaceServices newSimpleServices(MenuFacets contextFacets)
Supplies a simple implementation of SurfaceServices.

This method is intended for use in implementations of AppSurface.Contenter.newContentLayout(SHost, SFacet, SContentRootTargeter), to meet the contract of layout creation methods such as AppHost.newDesktopLayout(SFacet, facets.core.app.AppHost.LayoutFeatures).

It provides a fine example of the closure-like use of anonymous classes, in that a hidden reference to the enclosing FacetAppSurface is passed to the SurfaceServices returned. When this is returned by AppHost.activeServices() in handleInvalidInput(STarget, Object), code can be executed using the reference even though the SurfaceServices was created from within a contenter and returned by the host.

Parameters:
contextFacets - will ultimately be returned by getContextMenuFacets()

getContextMenuFacets

public final MenuFacets getContextMenuFacets()
Implements interface method.

To ensure the request is met by the active SContenter, delegates to the SurfaceServices returned by AppHost.activeServices() in host().

Specified by:
getContextMenuFacets in interface SurfaceServices

handleInvalidInput

public final void handleInvalidInput(STarget target,
                                     java.lang.Object input)
Implements interface method.

To ensure the request is met by the active SContenter, delegates to the SurfaceServices returned by AppHost.activeServices() in host().

Specified by:
handleInvalidInput in interface SurfaceServices
Parameters:
target - exposed by the facet
input - is known to be invalid

dialogs

public final Dialogs dialogs()
The Dialogs created during openApp().

Specified by:
dialogs in class ActionAppSurface

host

public SHost host()
Re-implementation to create/return a suitable SHost.

Specified by:
host in interface SSurface
Returns:
unless AppSurface.isHeadless() returns true, the return of FacetFactory.newDesktopHost(FacetAppSurface)

setLayoutTargetsLive

public final void setLayoutTargetsLive(boolean live)

newEmptyDesktopLayout

protected SHost.FacetLayout newEmptyDesktopLayout(SHost host,
                                                  SContentRootTargeter t,
                                                  SFacet surfaceRootFacet)
Description copied from class: AppSurface
Provide a empty SHost.FacetLayout.

Implements AppSurface.Contenter.newContentLayout(SHost, SFacet, SContentRootTargeter) on behalf of AppSurface.emptyContent

Specified by:
newEmptyDesktopLayout in class AppSurface

getInternalContentSource

protected java.lang.Object getInternalContentSource()
Implements abstract method.

Default is invalid stub.

Specified by:
getInternalContentSource in class ActionAppSurface

getFileSpecifiers

public FileSpecifier[] getFileSpecifiers()
What files can the application open?

Called from AppFileValues.getOpenSpecifiers() in FileAppActions and typically from ViewerContenter.sinkFileSpecifiers(); default returns FileSpecifier.ALL.


newTitleBarText

protected java.lang.String newTitleBarText()
Implements abstract method.

Default adjusts title bar to shown save warning.


newDebugText

protected final java.lang.String newDebugText()

hostWindowOpened

protected void hostWindowOpened()
Called from openApp().

Default is empty stub.


appOpened

protected void appOpened()
Called from openApp().

Default is empty stub.


appClosing

protected void appClosing()
Called before a true return from closeAcceptable(WindowAppHost).

Default is empty stub.