facets.core.superficial.app
Class SAreaTarget

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.core.superficial.TargetCore
          extended by facets.core.superficial.app.IndexingTarget
              extended by facets.core.superficial.app.SAreaTarget
All Implemented Interfaces:
Facetable, FacetedTarget, Notifiable, Notifying, STarget, TargeterCore.TargetType, Identified, Titled
Direct Known Subclasses:
AppSurface.ContentRoot, DialogSurface.ContentRoot

public class SAreaTarget
extends IndexingTarget
implements FacetedTarget

Represents viewers and other surface areas to the targeter tree.

SAreaTarget manages updating and focus for trees of viewers and other facets, being the target of a directly attached facet which it represents within an area target tree.

Much key functionality is defined in the IndexingTarget superclass.

Area target trees

The IndexingTarget.indexableTargets() of an SAreaTarget must comprise one of

A tree of SAreaTargets therefore terminates in SFrameTarget or ViewerTarget leaves.

The facets attached to and represented in the application by FacetedTarget (SAreaTarget and ViewerTarget) members of a tree generally form a containment hierarchy of tabs/windows and panes.


Nested Class Summary
 
Nested classes/interfaces inherited from interface facets.core.superficial.STarget
STarget.Targeted
 
Nested classes/interfaces inherited from interface facets.core.superficial.Notifying
Notifying.Impact
 
Field Summary
static int AREA_LOWEST
           
static STarget[] EMPTY_AREA_CHILDREN
           
 
Fields inherited from class facets.core.superficial.TargetCore
targets
 
Fields inherited from interface facets.core.superficial.STarget
NONE
 
Constructor Summary
SAreaTarget(java.lang.String title, SIndexing children)
          Core constructor which sets indexing.
SAreaTarget(java.lang.String title, STarget... indexableChildren)
          Convenience constructor setting indexable children.
 
Method Summary
 SFrameTarget activeContent()
          The SFrameTarget framing the content exposed by the active facet.
 FacetedTarget activeFacet()
          The FacetedTarget representing the contained viewer or area facet that should have the focus.
 SAreaTarget areaParent()
          The parent in the area target tree.
 SFacet attachedFacet()
          The SFacet attached with FacetedTarget.attachFacet(SFacet).
 void attachFacet(SFacet facet)
          Attach an immutable facet.
 void attachThenFacets(SAreaTarget rootThen)
          Attaches existing facet to a new area tree.
protected  boolean blockNotification()
          Enables notification to be restricted to this member of the tree.
 STarget[] descendants()
          Depth-first traversal of this area tree, including the root.
 void ensureActive(boolean notify)
          Ensure that the targeter tree treats the faceted as having the GUI focus.
 STarget[] facetTargets()
          Convenience method.
 java.lang.Object identity()
          Return an object that is as far as possible unique for the implementation.
 Notifying.Impact impact()
          Allows this Notifying to specify a default Notifying.Impact.
 boolean isActive()
          Should the targeter tree treat the facet as having the GUI focus?
 Notifiable monitor()
          The current Notifiable in the notification tree, as set with setMonitor.
protected  TypedNode[] newDebugChildren()
          Create a TypedNode[] representation of this Notifying for debug purposes.
protected static TypedNode newDebugContentNode(java.lang.String title, java.lang.Object source)
           
protected static TypedNode newDebugContentNode(java.lang.String title, java.lang.Object[] source)
           
protected static TypedNode newDebugMonitorNode(Notifiable monitor)
           
 TypedNode newGraphNode()
          Returns a descriptive node for use in debug object graph.
 STargeter newTargeter()
          Must return an AreaTargeter.
static SAreaTarget newViewerArea(ViewerTarget viewerTarget)
          Convenience method to a wrap single viewer in area.
 void notify(Notice notice)
          Respond to the Notice passed.
 void notifyMonitor(Notifying.Impact impact)
          Call notify on the parent monitor in the notification tree, typically with itself as parameter to the Notice passed.
 void retargetFacets(Notifying.Impact impact)
          Implements interface method.
 void setIndexing(SIndexing children)
          Overrides superclass method.
 void setMonitor(Notifiable monitor)
          Attach the Notifying to a Notifiable parent in the notification tree.
 
Methods inherited from class facets.core.superficial.app.IndexingTarget
indexableTargets, indexedTarget, indexing, notifiesTargeter, parent, setLive, toString
 
Methods inherited from class facets.core.superficial.TargetCore
elements, findMonitorOfType, isLive, join, lazyElements, setElements, title, wantsFocus
 
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, wait, wait, wait
 
Methods inherited from interface facets.core.superficial.STarget
elements, isLive, setLive, wantsFocus
 
Methods inherited from interface facets.util.Titled
title
 
Methods inherited from interface facets.core.superficial.Notifying
impact, monitor, notifyMonitor, setMonitor
 
Methods inherited from interface facets.core.superficial.Notifiable
notify
 

Field Detail

AREA_LOWEST

public static final int AREA_LOWEST
See Also:
Constant Field Values

EMPTY_AREA_CHILDREN

public static final STarget[] EMPTY_AREA_CHILDREN
Constructor Detail

SAreaTarget

public SAreaTarget(java.lang.String title,
                   SIndexing children)
Core constructor which sets indexing.

Parameters:
title - passed to superclass
children - passed to superclass

SAreaTarget

public SAreaTarget(java.lang.String title,
                   STarget... indexableChildren)
Convenience constructor setting indexable children.

Parameters:
title - passed to the core constructor
indexableChildren - passed to the core constructor in an SIndexing with a default coupler.
Method Detail

setIndexing

public final void setIndexing(SIndexing children)
Overrides superclass method.

Overrides:
setIndexing in class IndexingTarget
Parameters:
children - must return as its indexables a non-empty STarget[] which is either

newTargeter

public STargeter newTargeter()
Must return an AreaTargeter.

Specified by:
newTargeter in class IndexingTarget

attachFacet

public final void attachFacet(SFacet facet)
Description copied from interface: FacetedTarget
Attach an immutable facet.

As a STarget representing its FacetedTarget.attachedFacet(), FacetedTarget can only attach a single viewer or area facet; it should complain if any attempt is made to attach another.

Specified by:
attachFacet in interface Facetable
Specified by:
attachFacet in interface FacetedTarget
Parameters:
facet - will be applied during each retargeting sequence

attachedFacet

public final SFacet attachedFacet()
Description copied from interface: FacetedTarget
The SFacet attached with FacetedTarget.attachFacet(SFacet).

Return the facet attached to this FacetedTarget, complaining if none yet attached.

Specified by:
attachedFacet in interface FacetedTarget

retargetFacets

public final void retargetFacets(Notifying.Impact impact)
Implements interface method.

In addition to to retargeting any attachedFacet(), calls Facetable.retargetFacets(Notifying.Impact) in all IndexingTarget.indexableTargets(), starting with IndexingTarget.indexedTarget() to minimise apparent latency.

Specified by:
retargetFacets in interface Facetable

isActive

public final boolean isActive()
Description copied from interface: FacetedTarget
Should the targeter tree treat the facet as having the GUI focus?

Specified by:
isActive in interface FacetedTarget

ensureActive

public final void ensureActive(boolean notify)
Description copied from interface: FacetedTarget
Ensure that the targeter tree treats the faceted as having the GUI focus.

Specified by:
ensureActive in interface FacetedTarget
Parameters:
notify - if true, also trigger a retargeting
See Also:
Notifying

facetTargets

public final STarget[] facetTargets()
Convenience method.

Returns:
STarget.Targeted.targets() in attachedFacet()

activeFacet

public final FacetedTarget activeFacet()
The FacetedTarget representing the contained viewer or area facet that should have the focus.

Checks the IndexingTarget.indexedTarget() of this SAreaTarget and its descendents until it finds the last that is a FacetedTarget.


activeContent

public final SFrameTarget activeContent()
The SFrameTarget framing the content exposed by the active facet.

Checks the IndexingTarget.indexedTarget() of this SAreaTarget and its descendents until it finds one that is not an SAreaTarget; returns this if not a ViewerTarget, otherwise its ViewerTargetCore.viewable.


descendants

public final STarget[] descendants()
Depth-first traversal of this area tree, including the root.


attachThenFacets

public final void attachThenFacets(SAreaTarget rootThen)
Attaches existing facet to a new area tree.

Also applies the old area path to the new tree.

Parameters:
rootThen - heads the area tree to which the existing facet are attached

newViewerArea

public static final SAreaTarget newViewerArea(ViewerTarget viewerTarget)
Convenience method to a wrap single viewer in area.

Passes to core constructor the title of viewerFrame, which is wrapped in an SIndexing of the same title.


newDebugChildren

protected TypedNode[] newDebugChildren()
Create a TypedNode[] representation of this Notifying for debug purposes.

Overrides:
newDebugChildren in class IndexingTarget

areaParent

public final SAreaTarget areaParent()
Description copied from interface: FacetedTarget
The parent in the area target tree.

Specified by:
areaParent in interface FacetedTarget

newDebugContentNode

protected static final TypedNode newDebugContentNode(java.lang.String title,
                                                     java.lang.Object source)

newDebugContentNode

protected static final TypedNode newDebugContentNode(java.lang.String title,
                                                     java.lang.Object[] source)

newDebugMonitorNode

protected static final TypedNode newDebugMonitorNode(Notifiable monitor)

newGraphNode

public final TypedNode newGraphNode()
Returns a descriptive node for use in debug object graph.


impact

public Notifying.Impact impact()
Description copied from interface: Notifying
Allows this Notifying to specify a default Notifying.Impact.

Specified by:
impact in interface Notifying
Returns:
typically Notifying.Impact.DEFAULT

identity

public java.lang.Object identity()
Description copied from interface: Identified
Return an object that is as far as possible unique for the implementation.

This will usually be a class instance counter.

Specified by:
identity in interface Identified

monitor

public final Notifiable monitor()
The current Notifiable in the notification tree, as set with setMonitor.

Complains if no parent has been set.

Specified by:
monitor in interface Notifying

notify

public 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

notifyMonitor

public final void notifyMonitor(Notifying.Impact impact)
Description copied from interface: Notifying
Call notify on the parent monitor in the notification tree, typically with itself as parameter to the Notice passed.

Has no effect if no monitor has been set.

This is the usual means to trigger a surface retargeting, being called by an exposing SFacet on its target.

Specified by:
notifyMonitor in interface Notifying
Parameters:
impact - suggests the level of retargeting required

blockNotification

protected boolean blockNotification()
Enables notification to be restricted to this member of the tree.

Checked by notify(Notice); default returns false.


setMonitor

public final void setMonitor(Notifiable monitor)
Description copied from interface: Notifying
Attach the Notifying to a Notifiable parent in the notification tree.

Specified by:
setMonitor in interface Notifying