org.nakedobjects.viewer.lightweight
Interface View

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
ClassView, CompositeView, DesktopView, DragSource, DragTarget, DragView, InternalView, ObjectView, RootView
All Known Implementing Classes:
AbstractCompositeView, AbstractObjectView, AbstractValueView, AbstractView, ClassIcon, DragOutline, EmptyField, FallbackView, InstanceList, InternalList, ObjectIcon, OpenClassView, StandardForm, StandardList, Workspace

public interface View
extends java.lang.Cloneable


Method Summary
 void calculateRepaintArea()
          Called to mark this view's on-screen state as invalid, i.e. it needs to be redrawn.
 boolean contains(Location point)
          Determines whether the specified point (from within the parent view) is within this view.
 java.lang.String debugDetails()
           
 void dispose()
          Called when a view is no longer needed and its resources can be disposed of.
 void draw(Canvas canvas)
          Called by the frame, or the parent view, when this view must redraw itself.
 void entered()
          Called as the mouse crosses the bounds, and ends up inside, of this view.
 void enteredSubview()
          Called as the mouse moves into one of this view's contained views.
 void exited()
          Called as the mouse crosses the bounds, and ends up outside, of this view.
 void exitedSubview()
          Called as the mouse moves back into view from one its contained views.
 void firstClick(Click click)
          Called when the user clicks the mouse buttone within this view.
 Location getAbsoluteLocation()
          the location of this view relative to the containing java.awt.Window object.
 int getBaseline()
           
 Border getBorder()
           
 Bounds getBounds()
          Returns the bounding rectangle that describes where (within it parent), and how big, this view is.
 int getId()
           
 Location getLocation()
          Determines the location relative to this object's containing view
 java.lang.String getName()
           
 Padding getPadding()
           
 CompositeView getParent()
           
 Size getRequiredSize()
           
 Size getSize()
          Determines the size of this view.
 Workspace getWorkspace()
           
 View identifyView(Location mouseLocationer, View current)
          Returns the view that mouse pointer is over.
 boolean indicatesForView(Location mouseLocation)
          Determines if the user is invoking an action relating to this view, rather than to whatever this view represents.
 void invalidateLayout()
          sets this view layout flag to show that the layout is no longer valid
 boolean isLayoutInvalid()
          Returns true when this views layout is not current, i.e. it needs to be laid out again.
 boolean isOpen()
          Indicates whether this view is expanded, or iconized.
 boolean isReplaceable()
          Indicates whether this view can be replaced with another view (for the same value or reference).
 void layout()
           
 View makeView(Naked object, Field field)
          Creates a new concrete view, using this view as a prototype, reassigning the naked object in the process.
 void menuOptions(MenuOptionSet menuOptions)
          Called when the popup menu is being populated for this view.
 void mouseMoved(Location at)
          Called as the mouse is moved around within this view.
 void print(Canvas canvas)
           
 void redraw()
           
 void secondClick(Click click)
          Called when the user double-clicked this view.
 void setBorder(Border border)
           
 void setBounds(Location point, Size size)
           
 void setLocation(Location point)
          Specifies the location of this view, relative to its enclosing view.
 void setSize(Size size)
           
 void thirdClick(Click click)
          Called when the user triple-clicks the mouse buttone within this view.
 void validateLayout()
          Reqests that this view tree needs to be laid out.
 

Method Detail

getAbsoluteLocation

public Location getAbsoluteLocation()
the location of this view relative to the containing java.awt.Window object.

Returns:
Location

getBaseline

public int getBaseline()

setBorder

public void setBorder(Border border)

getBorder

public Border getBorder()

setBounds

public void setBounds(Location point,
                      Size size)

getBounds

public Bounds getBounds()
Returns the bounding rectangle that describes where (within it parent), and how big, this view is.

Returns:
Bounds
See Also:
getSize(), getLocation()

getId

public int getId()

isLayoutInvalid

public boolean isLayoutInvalid()
Returns true when this views layout is not current, i.e. it needs to be laid out again.


setLocation

public void setLocation(Location point)
Specifies the location of this view, relative to its enclosing view.

Parameters:
point -

getLocation

public Location getLocation()
Determines the location relative to this object's containing view

See Also:
getBounds()

getName

public java.lang.String getName()

isOpen

public boolean isOpen()
Indicates whether this view is expanded, or iconized.

Returns:
true if it is showing the object's details; false if it is showing the object only.

getPadding

public Padding getPadding()

getParent

public CompositeView getParent()

isReplaceable

public boolean isReplaceable()
Indicates whether this view can be replaced with another view (for the same value or reference).

Returns:
true if it can be replaced by another view; false if it can't be replaces

getRequiredSize

public Size getRequiredSize()

setSize

public void setSize(Size size)

getSize

public Size getSize()
Determines the size of this view.

See Also:
getBounds()

getWorkspace

public Workspace getWorkspace()

calculateRepaintArea

public void calculateRepaintArea()
Called to mark this view's on-screen state as invalid, i.e. it needs to be redrawn.


contains

public boolean contains(Location point)
Determines whether the specified point (from within the parent view) is within this view. I.e., whether the mouse pointer is over this object.


debugDetails

public java.lang.String debugDetails()

dispose

public void dispose()
Called when a view is no longer needed and its resources can be disposed of.


draw

public void draw(Canvas canvas)
Called by the frame, or the parent view, when this view must redraw itself.


entered

public void entered()
Called as the mouse crosses the bounds, and ends up inside, of this view. Is also called as the mouse returns into this view from a contained view.


enteredSubview

public void enteredSubview()
Called as the mouse moves into one of this view's contained views.


exited

public void exited()
Called as the mouse crosses the bounds, and ends up outside, of this view.


exitedSubview

public void exitedSubview()
Called as the mouse moves back into view from one its contained views.


firstClick

public void firstClick(Click click)
Called when the user clicks the mouse buttone within this view.

Parameters:
click - the location within the current view where the mouse click took place

identifyView

public View identifyView(Location mouseLocationer,
                         View current)
Returns the view that mouse pointer is over. If it is over this view and not over any of it's components then this views reference is returned. Returns this view; should be overriden for container views.

Parameters:
mouseLocationer -
current -
Returns:
View this view

indicatesForView

public boolean indicatesForView(Location mouseLocation)
Determines if the user is invoking an action relating to this view, rather than to whatever this view represents.

Parameters:
mouseLocation -
Returns:
true if the user is targeting the view itself, false if the user is targeting what is being represented

invalidateLayout

public void invalidateLayout()
sets this view layout flag to show that the layout is no longer valid


layout

public void layout()

makeView

public View makeView(Naked object,
                     Field field)
              throws java.lang.CloneNotSupportedException
Creates a new concrete view, using this view as a prototype, reassigning the naked object in the process. The field is the field within the parent view's object that this field represents, and is null if the view is not part of another - i.e. it is not a field within an object.

Parameters:
object - the object the new view is for
Returns:
View
Throws:
java.lang.CloneNotSupportedException

menuOptions

public void menuOptions(MenuOptionSet menuOptions)
Called when the popup menu is being populated for this view. Any options that need to appear on the menu should be added to the menuOptions object.

Parameters:
menuOptions -

mouseMoved

public void mouseMoved(Location at)
Called as the mouse is moved around within this view. Does nothing; should be overriden when needed.

Parameters:
at - the position relative to the top-left of this view

print

public void print(Canvas canvas)

redraw

public void redraw()

secondClick

public void secondClick(Click click)
Called when the user double-clicked this view. This method will have been preceded by a call to click.


thirdClick

public void thirdClick(Click click)
Called when the user triple-clicks the mouse buttone within this view. This method will have been preceded by a call to doubleClick.


validateLayout

public void validateLayout()
Reqests that this view tree needs to be laid out. The root view will start calling layout on each of the invalid views in the tree.