UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.view
Class DefaultMultiViewImpl

java.lang.Object
  |
  +--edu.berkeley.guir.lib.satin.view.ViewImpl
        |
        +--edu.berkeley.guir.lib.satin.view.DefaultMultiViewImpl
All Implemented Interfaces:
Cloneable, MultiView, SatinConstants, Serializable, View
Direct Known Subclasses:
DebugMultiViewImpl, MultiplexedMultiViewImpl, SemanticZoomMultiViewImpl, TranslucentMultiViewImpl

public class DefaultMultiViewImpl
extends ViewImpl
implements MultiView

A sample implementation of a MultiView, which just displays the view with the greatest display value.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Aug 11 1999, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D
 
Fields inherited from class edu.berkeley.guir.lib.satin.view.ViewImpl
gob, poly
 
Fields inherited from interface edu.berkeley.guir.lib.satin.SatinConstants
ABOVE, ALL, BAR, BELOW, clipboard, clprops, cmdqueue, cmdsubsys, CONTAINEDBY, CONTAINS, COORD_ABS, COORD_LOCAL, COORD_REL, DAMAGE_LATER, DAMAGE_NOW, DEBUG_GRAPHICS_OFFSET, DEBUG_STYLE_FILE, DEBUG_STYLE_GPROPERTY, DEEP, DEFAULT_POINT2D_POOL_SIZE, DEFAULT_POLYGON2D_POOL_SIZE, DEFAULT_RECTANGLE_POOL_SIZE, DEFAULT_REPAINT_THRESHOLD, DEFAULT_SELECT_THRESHOLD, DEFAULT_STRINGBUFFER_POOL_SIZE, DEFAULT_TRANSFORM_POOL_SIZE, DIR_CENTER, DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT, DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT, FILTER_THRESHOLD, FIRST, FLOATING_PT_TOLERANCE, glprops, INTERSECTS, KEY_STYLE_DASHARRAY, KEY_STYLE_DASHPHASE, KEY_STYLE_DRAWCOLOR, KEY_STYLE_DRAWFONT, KEY_STYLE_DRAWTRANSPARENCY, KEY_STYLE_ENDCAP, KEY_STYLE_FILLCOLOR, KEY_STYLE_FILLTRANSPARENCY, KEY_STYLE_LINEJOIN, KEY_STYLE_LINEWIDTH, KEY_STYLE_MITERLIMIT, NEAR, NOTIFY_BOUNDS, NOTIFY_LAYER, NOTIFY_LOCATION, NOTIFY_STYLE, NOTIFY_TRANSFORM, poolPoints, poolPolys, poolRects, poolStrbuf, poolTx, rand, SATIN_DATA_DIRECTORY_DEFAULT, SATIN_DATA_DIRECTORY_GPROPERTY, SATIN_PROPERTIES_FILENAME, SHALLOW
 
Constructor Summary
DefaultMultiViewImpl()
          Does nothing.
 
Method Summary
 View add(View v)
          Add a view to the MultiView, setting the GraphicalObject the added View is attached to (via View.setAttachedGraphicalObject(GraphicalObject)) to be the same as the one this MultiView is attached to.
 void clear()
          Clear all of the views.
 Object clone()
          Implementation of the Sorceror's Apprentice algorithm.
protected  DefaultMultiViewImpl clone(DefaultMultiViewImpl vm)
          Clone chain.
 boolean contains(View v)
          Check if we contain the specified view.
 View get(int index)
          Get the view at the specified index.
 Polygon2D getBoundingPoints2DRef()
          Returns the bounding box of all of the contained AND visible views.
protected  Iterator getValidViews()
          Get an iterator over the valid views (views with display values greater than 0), sorted by their display values (high to low, descending order).
 float getViewDisplayValue()
          Check whether or not this view is valid, ie can and should be displayed.
 boolean isVisible()
          Checks if any contained views are visible.
 Iterator iterator()
          Get an iterator over the views, sorted by their display values (high to low, descending order).
 View remove(View v)
          Remove a view.
 void render(SatinGraphics g)
          Render this view.
 GraphicalObject setAttachedGraphicalObject(GraphicalObject gob)
          Also modify the attached GraphicalObject for every contained View.
 void setBoundingPoints2DRef(Polygon2D p)
          Recursively calls setBoundingPoints2DRef() on all of the contained views.
 int size()
          Get the number of views contained.
protected  void sortViewsByDisplayValue()
          Sort the views by their display values, from high to low values (descending order).
 String toString()
          Print out a list of all of the contained views.
 
Methods inherited from class edu.berkeley.guir.lib.satin.view.ViewImpl
clone, getAttachedGraphicalObject, getName, setName, setVisible
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.berkeley.guir.lib.satin.view.View
getAttachedGraphicalObject, getName, setName, setVisible
 

Constructor Detail

DefaultMultiViewImpl

public DefaultMultiViewImpl()
Does nothing.
Method Detail

setBoundingPoints2DRef

public void setBoundingPoints2DRef(Polygon2D p)
Recursively calls setBoundingPoints2DRef() on all of the contained views.

Chewbacca is a Wookie. Wookies are from Endor. Does this make sense? Or course it doesn't make sense! If it doesn't make sense, you must acquit!

Specified by:
setBoundingPoints2DRef in interface View
Overrides:
setBoundingPoints2DRef in class ViewImpl
Following copied from interface: edu.berkeley.guir.lib.satin.view.View
Parameters:
p - is the polygon bounds. Assumes the bounds are already in local coordinates.

setAttachedGraphicalObject

public GraphicalObject setAttachedGraphicalObject(GraphicalObject gob)
Also modify the attached GraphicalObject for every contained View.
Specified by:
setAttachedGraphicalObject in interface View
Overrides:
setAttachedGraphicalObject in class ViewImpl
Parameters:
gob - is the GraphicalObject to attach.

add

public View add(View v)
Description copied from interface: MultiView
Add a view to the MultiView, setting the GraphicalObject the added View is attached to (via View.setAttachedGraphicalObject(GraphicalObject)) to be the same as the one this MultiView is attached to.
Specified by:
add in interface MultiView
Following copied from interface: edu.berkeley.guir.lib.satin.view.MultiView
Parameters:
v - is the view to add.
Returns:
a reference to v.

remove

public View remove(View v)
Description copied from interface: MultiView
Remove a view.
Specified by:
remove in interface MultiView
Following copied from interface: edu.berkeley.guir.lib.satin.view.MultiView
Parameters:
v - is the view to remove.
Returns:
a reference to v.

clear

public void clear()
Description copied from interface: MultiView
Clear all of the views.
Specified by:
clear in interface MultiView

getBoundingPoints2DRef

public Polygon2D getBoundingPoints2DRef()
Returns the bounding box of all of the contained AND visible views.
Specified by:
getBoundingPoints2DRef in interface View
Overrides:
getBoundingPoints2DRef in class ViewImpl
Following copied from interface: edu.berkeley.guir.lib.satin.view.View
Returns:
the polygon bounds.

iterator

public Iterator iterator()
Get an iterator over the views, sorted by their display values (high to low, descending order).
Specified by:
iterator in interface MultiView
Following copied from interface: edu.berkeley.guir.lib.satin.view.MultiView
Returns:
an Iterator of View objects.

get

public View get(int index)
Description copied from interface: MultiView
Get the view at the specified index.
Specified by:
get in interface MultiView
Following copied from interface: edu.berkeley.guir.lib.satin.view.MultiView
Parameters:
index - is the index in the list to retrieve from.
Returns:
the View at the index, or null if it does not exist.

contains

public boolean contains(View v)
Description copied from interface: MultiView
Check if we contain the specified view.
Specified by:
contains in interface MultiView

size

public int size()
Description copied from interface: MultiView
Get the number of views contained.
Specified by:
size in interface MultiView

getValidViews

protected Iterator getValidViews()
Get an iterator over the valid views (views with display values greater than 0), sorted by their display values (high to low, descending order).

getViewDisplayValue

public float getViewDisplayValue()
Description copied from interface: View
Check whether or not this view is valid, ie can and should be displayed. This can be a combination of any range of parameters. For example, you could say that this view is valid when:
Specified by:
getViewDisplayValue in interface View
Returns:
Always returns 1.

isVisible

public boolean isVisible()
Checks if any contained views are visible.
Specified by:
isVisible in interface View
Overrides:
isVisible in class ViewImpl
Following copied from interface: edu.berkeley.guir.lib.satin.view.View
Returns:
true if the view is visible, false otherwise.

sortViewsByDisplayValue

protected void sortViewsByDisplayValue()
Sort the views by their display values, from high to low values (descending order).

render

public void render(SatinGraphics g)
Description copied from interface: View
Render this view. Use (0,0) as the top-left corner of this view. Any transformations that the attached GraphicalObject has will automatically be applied, so all you have to do is render the view normally.
Specified by:
render in interface View

toString

public String toString()
Print out a list of all of the contained views.
Overrides:
toString in class ViewImpl

clone

public Object clone()
Description copied from interface: View
Implementation of the Sorceror's Apprentice algorithm. Needs to be a DEEP clone.
Specified by:
clone in interface View
Overrides:
clone in class ViewImpl

clone

protected DefaultMultiViewImpl clone(DefaultMultiViewImpl vm)
Clone chain.

Copyright Information