org.nakedobjects.viewer.lightweight
Class AbstractValueView

java.lang.Object
  extended byorg.nakedobjects.viewer.lightweight.AbstractView
      extended byorg.nakedobjects.viewer.lightweight.AbstractValueView
All Implemented Interfaces:
java.lang.Cloneable, DragInternal, InternalView, KeyboardAccessible, View
Direct Known Subclasses:
CheckboxField, OptionField, TextField

public abstract class AbstractValueView
extends AbstractView
implements InternalView, KeyboardAccessible, DragInternal


Field Summary
protected  Value objectField
           
 
Fields inherited from class org.nakedobjects.viewer.lightweight.AbstractView
DEBUG, DRAG_HANDLE_WIDTH, HPADDING, ICON_SIZE, VPADDING
 
Fields inherited from interface org.nakedobjects.viewer.lightweight.InternalView
FIELD, NORMAL
 
Constructor Summary
AbstractValueView()
           
 
Method Summary
 boolean canChangeValue()
          Determines if the user is able to change the held value.
 boolean canFocus()
           
protected  java.lang.Object clone()
           
 void drag(InternalDrag drag)
          Indicates the drag started within this view's bounds is continuing.
 void dragCancel(InternalDrag drag)
          Default implementation - does nothing
 void dragFrom(InternalDrag drag)
          Indicates the start of a drag within this view's bounds.
 void dragTo(InternalDrag drag)
          Indicates the drag started within this view's bounds has been finished (although the location may now be outside of its bounds).
 void draw(Canvas canvas)
          Called by the frame, or the parent view, when this view must redraw itself.
 void editComplete()
          Indicates that editing has been completed and the entry should be saved.
 void entered()
          Called as the mouse crosses the bounds, and ends up inside, of this view.
 void exited()
          Called as the mouse crosses the bounds, and ends up outside, of this view.
 void focusLost()
           
 void focusRecieved()
           
 NakedObject getContainedBy()
           
 Field getFieldOf()
           
 boolean getIdentified()
           
 Padding getPadding()
           
 View getRoot()
           
abstract  NakedValue getValue()
           
 boolean hasFocus()
           
 boolean indicatesForView(Location mouseLocation)
          Determines if the user is invoking an action relating to this view, rather than to whatever this view represents.
protected  void init(NakedValue value)
           
 void keyPressed(int keyCode, int modifiers)
          Called when the user presses any key on the keyboard while this view has the focus.
 void keyReleased(int keyCode, int modifiers)
          Called when the user releases any key on the keyboard while this view has the focus.
 void keyTyped(char keyCode)
          Called when the user presses a non-control key (i.e. data entry keys and not shift, up-arrow etc).
 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 options)
          Called when the popup menu is being populated for this view.
 ObjectView parentObjectView()
          returns the parent view
abstract  void refresh()
          refresh this views state from the value objects state so that it accurately reflects the value objects value.
protected  void refreshDerivedValue()
           
protected  void refreshValue()
           
protected  void set(java.lang.String value)
           
 java.lang.String toString()
           
 
Methods inherited from class org.nakedobjects.viewer.lightweight.AbstractView
addControl, assignId, backgroundColor, calculateRepaintArea, contains, createCanvas, debugDetails, defaultFieldHeight, dispose, enteredSubview, exitedSubview, firstClick, getAbsoluteLocation, getBaseline, getBorder, getBounds, getId, getLocation, getName, getParent, getSize, getWorkspace, identifyView, invalidateLayout, isLayoutInvalid, isOpen, isReplaceable, layout, limitBounds, mouseMoved, print, redraw, removeControl, repaintAll, secondClick, setBorder, setBounds, setLayoutValid, setLocation, setParent, setSize, setWorkspace, thirdClick, transparentBackground, validateLayout
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nakedobjects.viewer.lightweight.InternalView
setParent
 
Methods inherited from interface org.nakedobjects.viewer.lightweight.View
calculateRepaintArea, contains, debugDetails, dispose, enteredSubview, exitedSubview, firstClick, getAbsoluteLocation, getBaseline, getBorder, getBounds, getId, getLocation, getName, getParent, getRequiredSize, getSize, getWorkspace, identifyView, invalidateLayout, isLayoutInvalid, isOpen, isReplaceable, layout, mouseMoved, print, redraw, secondClick, setBorder, setBounds, setLocation, setSize, thirdClick, validateLayout
 
Methods inherited from interface org.nakedobjects.viewer.lightweight.KeyboardAccessible
redraw
 

Field Detail

objectField

protected Value objectField
Constructor Detail

AbstractValueView

public AbstractValueView()
Method Detail

getContainedBy

public NakedObject getContainedBy()

getValue

public abstract NakedValue getValue()

getFieldOf

public Field getFieldOf()
Specified by:
getFieldOf in interface InternalView

getIdentified

public boolean getIdentified()

getPadding

public Padding getPadding()
Specified by:
getPadding in interface View
Overrides:
getPadding in class AbstractView

getRoot

public View getRoot()
Specified by:
getRoot in interface InternalView

canChangeValue

public boolean canChangeValue()
Determines if the user is able to change the held value.

Specified by:
canChangeValue in interface KeyboardAccessible

canFocus

public boolean canFocus()
Specified by:
canFocus in interface KeyboardAccessible

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

drag

public void drag(InternalDrag drag)
Indicates the drag started within this view's bounds is continuing. By default does nothing.

Specified by:
drag in interface DragInternal

dragCancel

public void dragCancel(InternalDrag drag)
Default implementation - does nothing

Specified by:
dragCancel in interface DragInternal

dragFrom

public void dragFrom(InternalDrag drag)
Indicates the start of a drag within this view's bounds. By default does nothing.

Specified by:
dragFrom in interface DragInternal

dragTo

public void dragTo(InternalDrag drag)
Indicates the drag started within this view's bounds has been finished (although the location may now be outside of its bounds). By default does nothing.

Specified by:
dragTo in interface DragInternal

draw

public void draw(Canvas canvas)
Description copied from interface: View
Called by the frame, or the parent view, when this view must redraw itself.

Specified by:
draw in interface View
Overrides:
draw in class AbstractView

editComplete

public void editComplete()
Indicates that editing has been completed and the entry should be saved. Will be called by the view manager when other action place within the parent.

Specified by:
editComplete in interface KeyboardAccessible

entered

public void entered()
Description copied from interface: View
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.

Specified by:
entered in interface View
Overrides:
entered in class AbstractView

exited

public void exited()
Description copied from interface: View
Called as the mouse crosses the bounds, and ends up outside, of this view.

Specified by:
exited in interface View
Overrides:
exited in class AbstractView

focusLost

public void focusLost()
Specified by:
focusLost in interface KeyboardAccessible

focusRecieved

public void focusRecieved()
Specified by:
focusRecieved in interface KeyboardAccessible

hasFocus

public boolean hasFocus()
Specified by:
hasFocus in interface KeyboardAccessible

indicatesForView

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

Specified by:
indicatesForView in interface View
Overrides:
indicatesForView in class AbstractView

keyPressed

public void keyPressed(int keyCode,
                       int modifiers)
Called when the user presses any key on the keyboard while this view has the focus.

Specified by:
keyPressed in interface KeyboardAccessible
Parameters:
keyCode -
modifiers -

keyReleased

public void keyReleased(int keyCode,
                        int modifiers)
Called when the user releases any key on the keyboard while this view has the focus.

Specified by:
keyReleased in interface KeyboardAccessible
Parameters:
keyCode -
modifiers -

keyTyped

public void keyTyped(char keyCode)
Called when the user presses a non-control key (i.e. data entry keys and not shift, up-arrow etc). Such a key press will result in a prior call to keyPressed and a subsequent call to keyReleased.

Specified by:
keyTyped in interface KeyboardAccessible
Parameters:
keyCode -

makeView

public View makeView(Naked object,
                     Field field)
              throws java.lang.CloneNotSupportedException
Description copied from interface: View
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.

Specified by:
makeView in interface View
Parameters:
object - the object the new view is for
Returns:
View
Throws:
java.lang.CloneNotSupportedException

init

protected void init(NakedValue value)

menuOptions

public void menuOptions(MenuOptionSet options)
Description copied from interface: View
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.

Specified by:
menuOptions in interface View
Overrides:
menuOptions in class AbstractView

parentObjectView

public ObjectView parentObjectView()
returns the parent view

Specified by:
parentObjectView in interface InternalView

refresh

public abstract void refresh()
refresh this views state from the value objects state so that it accurately reflects the value objects value.


toString

public java.lang.String toString()

refreshDerivedValue

protected void refreshDerivedValue()

refreshValue

protected void refreshValue()

set

protected void set(java.lang.String value)