facets.core.app
Class SimpleContenter

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.core.app.SimpleContenter
All Implemented Interfaces:
DialogSurface.Contenter, SContenter, TargeterCore.TargetType, Titled
Direct Known Subclasses:
FacetDialogContenter

public abstract class SimpleContenter
extends Tracer
implements SContenter, DialogSurface.Contenter

SContenter that builds a content root with no viewers.

SimpleContenter is suitable for content that cannot (or need not) appear in viewers, being exposed by an arrangement of simple facets.

The content passed to the constructor is represented to the surface by targets returned by lazyContentRootElements().

Since SimpleContenter primarily creates content for DialogSurface, it provides a basic implementation of DialogSurface.Contenter.


Constructor Summary
SimpleContenter(java.lang.String title)
          Unique constructor.
 
Method Summary
 void applyChanges()
          Change content state to match surface state.
protected abstract  void attachRootMountFacet(SAreaTarget rootArea)
          Attach a facet to the tree headed by root.
 java.awt.Dimension contentAreaSize()
          Return the panel size needed for the content surface elements.
 SFrameTarget contentFrame()
          Implements abstract method.
 void dialogClosed()
          Called once the containing dialog has closed.
protected abstract  STarget[] lazyContentRootElements()
          Create simple targets representing the content.
 SAreaTarget newContentRoot(boolean faceted, boolean shareSelection)
          Implements abstract method.
 void reverseChanges()
          Restore content to its original state.
 void rootRetargeted(SContentRootTargeter t)
          Implements interface method.
 void setDialog(DialogSurface dialog)
          Empty implementation.
 java.lang.String title()
          Implements abstract method.
 
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
 
Methods inherited from interface facets.core.app.DialogSurface.Contenter
newContentPanel
 

Constructor Detail

SimpleContenter

public SimpleContenter(java.lang.String title)
Unique constructor.

Parameters:
title - returned by title() passed to lazyContentRootElements()
Method Detail

newContentRoot

public SAreaTarget newContentRoot(boolean faceted,
                                  boolean shareSelection)
Implements abstract method.

Creates a trivial subclass of DialogSurface.ContentRoot returning elements defined in lazyContentRootElements(), with (to meet the contract of SAreaTarget.activeContent()) a single SFrameTarget child created from the content.

Note If the SimpleContenter is to be used in an AppSurface this method must be re-implemented to return a comparable subclass of AppSurface.ContentRoot.

Specified by:
newContentRoot in interface SContenter
Parameters:
faceted - should the area tree have facets attached?
shareSelection - should the new tree frame the existing viewable
Returns:
the SAreaTarget root of an area tree containing either the content or viewers for the content; the root should in turn return with SAreaTarget.newTargeter() a SContentRootTargeter for the content wrapped by the SContenter.

lazyContentRootElements

protected abstract STarget[] lazyContentRootElements()
Create simple targets representing the content.


attachRootMountFacet

protected abstract void attachRootMountFacet(SAreaTarget rootArea)
Attach a facet to the tree headed by root.

Called by newContentRoot(boolean, boolean); the facet attached should be a suitable MountFacet for the facet returned by DialogSurface.Contenter.newContentPanel(SContentRootTargeter).

Parameters:
rootArea - was created in newContentRoot(boolean, boolean)

rootRetargeted

public void rootRetargeted(SContentRootTargeter t)
Implements interface method.

Empty impementation.

Specified by:
rootRetargeted in interface SContenter
Parameters:
t - will be retargeted on a content root created by this SContenter type (not generally by this instance).

contentFrame

public final SFrameTarget contentFrame()
Implements abstract method.

Returns the content passed to the constructor.

Specified by:
contentFrame in interface SContenter

title

public final java.lang.String title()
Implements abstract method.

Returns the title passed to the constructor.

Specified by:
title in interface DialogSurface.Contenter
Specified by:
title in interface SContenter
Specified by:
title in interface Titled
Returns:
non-null, non-empty string with no structural whitespace

setDialog

public void setDialog(DialogSurface dialog)
Empty implementation.

Specified by:
setDialog in interface DialogSurface.Contenter

reverseChanges

public void reverseChanges()
Description copied from interface: DialogSurface.Contenter
Restore content to its original state.

Specified by:
reverseChanges in interface DialogSurface.Contenter

contentAreaSize

public java.awt.Dimension contentAreaSize()
Description copied from interface: DialogSurface.Contenter
Return the panel size needed for the content surface elements.

Specified by:
contentAreaSize in interface DialogSurface.Contenter

applyChanges

public void applyChanges()
Description copied from interface: DialogSurface.Contenter
Change content state to match surface state.

This will generally mean setting content state to that of a buffer storing surface state.

Specified by:
applyChanges in interface DialogSurface.Contenter

dialogClosed

public void dialogClosed()
Description copied from interface: DialogSurface.Contenter
Called once the containing dialog has closed.

Specified by:
dialogClosed in interface DialogSurface.Contenter