facets.facet.app.tree
Class TreeAppContenter

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.core.app.ViewerContenter
          extended by facets.facet.app.tree.TreeAppContenter
All Implemented Interfaces:
AppSurface.Contenter, SContenter, TargeterCore.TargetType, Titled

public final class TreeAppContenter
extends ViewerContenter

ViewerContenter that manages content for TreeAppSpecifier.

Effectively a package-private class; declared public for documentation purposes only.

The code exemplifies 'filling out' the abstract ViewerContenter to provide real-world functionality.


Nested Class Summary
 
Nested classes/interfaces inherited from class facets.core.app.ViewerContenter
ViewerContenter.ContentSource
 
Field Summary
static int TARGETS_CONTENT
          Index into return of lazyContentRootElements(SAreaTarget).
static int TARGETS_PANE
          Index into return of lazyContentRootElements(SAreaTarget).
 
Fields inherited from class facets.core.app.ViewerContenter
VIEWABLE_NONE
 
Method Summary
protected  void attachContentRootFacets(SAreaTarget rootArea)
          Attach viewer and area facets to the tree headed by rootArea using a suitable facet builder.
 boolean hasChanged()
          Implements interface method.
protected  STarget[] lazyContentRootElements(SAreaTarget root)
          Re-implementation returning pane and extra tree menu targets.
 SHost.FacetLayout newContentLayout(SHost host, SFacet appRoot, SContentRootTargeter t)
          Return a layout of facets that expose a content type.
protected  ViewableFrame newContentViewable(java.lang.Object source)
          Create a ViewableFrame framing content.
protected  FacetedTarget[] newContentViewers(ViewableFrame viewable)
          Delegates to TreeAppSpecifier
 void saveToSink(java.lang.Object sink)
          Attempt to save to a sink.
 boolean setSink(java.lang.Object sink)
          Attempts to set a data sink for the content.
 FileSpecifier[] sinkFileSpecifiers()
          Specify file passed to ViewerContenter.saveToSink(Object).
 void wasAdded()
          Called when the content has been added to the surface.
 
Methods inherited from class facets.core.app.ViewerContenter
alignAddedRoot, contentFrame, newAppContentRoot, newContentRoot, newContentRootTitle, newViewableContentRoot, rootRetargeted, sink, title, wasRemoved
 
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

TARGETS_PANE

public static final int TARGETS_PANE
Index into return of lazyContentRootElements(SAreaTarget).

See Also:
Constant Field Values

TARGETS_CONTENT

public static final int TARGETS_CONTENT
Index into return of lazyContentRootElements(SAreaTarget).

See Also:
Constant Field Values
Method Detail

newContentViewable

protected ViewableFrame newContentViewable(java.lang.Object source)
Description copied from class: ViewerContenter
Create a ViewableFrame framing content.

Called by the first invocation of ViewerContenter.newContentRoot(boolean, boolean), with the content or source passed to the constructor.

A valid implementation of this method should create default content and/or content from a file or database connection, possibly using an implementation of ViewerContenter.ContentSource passed to the constructor.

The ViewableFrame returned will be passed to ViewerContenter.newContentViewers(ViewableFrame).

Default implementation is an invalid stub.

Overrides:
newContentViewable in class ViewerContenter
Parameters:
source - must be capable either of defining or of creating content; it should not generally be the content itself

newContentViewers

protected FacetedTarget[] newContentViewers(ViewableFrame viewable)
Delegates to TreeAppSpecifier

Overrides:
newContentViewers in class ViewerContenter
Parameters:
viewable - was returned by ViewerContenter.newContentViewable(Object) and should be returned as the viewable of all ViewerTargets constructed in this method.

attachContentRootFacets

protected void attachContentRootFacets(SAreaTarget rootArea)
Description copied from class: ViewerContenter
Attach viewer and area facets to the tree headed by rootArea using a suitable facet builder.

Called by the first invocation of ViewerContenter.newContentRoot(boolean, boolean), with the SAreaTarget returned by ViewerContenter.newAppContentRoot(String, FacetedTarget[])

Default implementation is an invalid stub.

Overrides:
attachContentRootFacets in class ViewerContenter
Parameters:
rootArea - was returned by ViewerContenter.newContentRoot(boolean, boolean)

newContentLayout

public SHost.FacetLayout newContentLayout(SHost host,
                                          SFacet appRoot,
                                          SContentRootTargeter t)
Description copied from interface: AppSurface.Contenter
Return a layout of facets that expose a content type.

Parameters:
host - will generally create the layout, to ensure that it is of a type known to SHost.setLayout(FacetLayout)
appRoot - is attached to the SAreaTarget heading the application surface area tree
t - was created by a content root returned by SContenter.newContentRoot(boolean, boolean)

lazyContentRootElements

protected STarget[] lazyContentRootElements(SAreaTarget root)
Re-implementation returning pane and extra tree menu targets.

Overrides:
lazyContentRootElements in class ViewerContenter
Parameters:
root - contains the viewers returned by ViewerContenter.newContentViewers(ViewableFrame).
Returns:
STarget[] indexable by TARGETS_PANE and TARGETS_CONTENT; the latter created in TreeAppSpecifier.newContentRootTargets()

hasChanged

public boolean hasChanged()
Description copied from class: ViewerContenter
Implements interface method.

Default returns true.

Specified by:
hasChanged in interface AppSurface.Contenter
Overrides:
hasChanged in class ViewerContenter

sinkFileSpecifiers

public FileSpecifier[] sinkFileSpecifiers()
Description copied from class: ViewerContenter
Specify file passed to ViewerContenter.saveToSink(Object).

Overrides:
sinkFileSpecifiers in class ViewerContenter
Returns:
one or more FileSpecifiers; default is invalid stub

setSink

public boolean setSink(java.lang.Object sink)
Description copied from class: ViewerContenter
Attempts to set a data sink for the content.

Overrides:
setSink in class ViewerContenter
Parameters:
sink - becomes the new ViewerContenter.sink()
Returns:
true by default; return false to signal unacceptable sink

saveToSink

public void saveToSink(java.lang.Object sink)
                throws java.io.IOException
Description copied from class: ViewerContenter
Attempt to save to a sink.

Default is invalid stub.

Overrides:
saveToSink in class ViewerContenter
Parameters:
sink - typically a file
Throws:
java.io.IOException

wasAdded

public void wasAdded()
Description copied from interface: AppSurface.Contenter
Called when the content has been added to the surface.

Specified by:
wasAdded in interface AppSurface.Contenter
Overrides:
wasAdded in class ViewerContenter