org.nakedobjects.plugins.dnd.viewer.action
Class AbstractControlView

java.lang.Object
  extended by org.nakedobjects.plugins.dnd.viewer.action.AbstractControlView
All Implemented Interfaces:
java.lang.Cloneable, View
Direct Known Subclasses:
Button, WindowControl

public abstract class AbstractControlView
extends java.lang.Object
implements View


Field Summary
protected  UserAction action
           
 
Fields inherited from interface org.nakedobjects.plugins.dnd.View
HPADDING, VPADDING
 
Constructor Summary
AbstractControlView(UserAction action, View target)
           
 
Method Summary
 void addView(View view)
           
 Consent canChangeValue()
          Determines if the user is able to change the held value.
 boolean canFocus()
          Determines whether this view accepts keyboard focus.
 boolean contains(View view)
           
 boolean containsFocus()
           
 void contentMenuOptions(UserActionSet menuOptions)
          Called when the popup menu is being populated for this view.
 void debug(DebugString debug)
           
 void debugStructure(DebugString b)
           
 void dispose()
          Called when a view is no longer needed and its resources can be disposed of.
 void drag(ContentDrag contentDrag)
           
 void drag(InternalDrag drag)
          Called as mouse is dragged within and without this view.
 void dragCancel(InternalDrag drag)
           
 View dragFrom(Location location)
           
 void dragIn(ContentDrag drag)
          Called as the content being dragged is dragged into this view.
 void dragOut(ContentDrag drag)
          Called as the content being dragged is dragged out of this view.
 Drag dragStart(DragStart drag)
           
 void dragTo(InternalDrag drag)
          Called as the drag ends within and without this view.
 void draw(Canvas canvas)
          Called by the frame, or the parent view, when this view must redraw itself.
 void drop(ContentDrag drag)
          Called as another view's contents (the source) is dropped on this view's contents (the target).
 void drop(ViewDrag drag)
          Called as another view (the source) is dropped on this view (the target).
 void editComplete(boolean moveFocus, boolean toNextField)
          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 enteredSubview()
           
 void exited()
          Called as the mouse crosses the bounds, and ends up outside, of this view.
 void exitedSubview()
           
 void firstClick(Click click)
          Called when the user clicks the mouse buttone within this view.
 void focusLost()
           
 void focusReceived()
           
 Location getAbsoluteLocation()
           
 int getBaseline()
           
 Bounds getBounds()
          Returns the bounding rectangle that describes where (within it parent), and how big, this view is.
 Content getContent()
          get the object that this view represents
 Feedback getFeedbackManager()
           
 FocusManager getFocusManager()
           
 int getId()
           
 Location getLocation()
          Determines the location relative to this object's containing view
 Padding getPadding()
           
 View getParent()
           
 Size getRequiredSize(Size maximumSize)
           
 Size getSize()
          Determines the size of this view.
 ViewSpecification getSpecification()
           
 ViewState getState()
           
 View[] getSubviews()
           
 View getView()
          returns the topmost decorator in the chain, or the view itself if not decorated.
 ViewAxis getViewAxis()
           
 Viewer getViewManager()
           
 Workspace getWorkspace()
           
 boolean hasFocus()
           
 View identify(Location location)
           
 void invalidateContent()
          Flags that the views do not properly represent the content, and hence it needs rebuilding.
 void invalidateLayout()
          Flags that the views are possibly not displaying the content fully - too small, wrong place etc - although views exists for all the content.
 boolean isOver()
           
 boolean isPressed()
           
 void keyPressed(KeyboardAction key)
          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.
 void layout(Size maximumSize)
           
 void limitBoundsWithin(Bounds bounds)
           
 void limitBoundsWithin(Size size)
          Limits the bounds of this view (normally when being moved or dropped) so it never extends beyond the bounds of a view of the specified size.
 void markDamaged()
           
 void markDamaged(Bounds bounds)
           
 void mouseDown(Click click)
          Called as the mouse button is pressed down within this view.
 void mouseMoved(Location location)
          Called as the mouse is moved around within this view.
 void mouseUp(Click click)
          Called as the mouse button is released within this view (assuming that it was pressed in this view).
 void objectActionResult(NakedObject result, Location at)
          Called when an action generates a result, allowing this view to decide what to do with it.
 View pickupContent(Location location)
          Called as the drag of this view's content starts.
 View pickupView(Location location)
          Called as the drag of this view starts.
 void print(Canvas canvas)
           
 void refresh()
          Refreshes this view by reaccessing its content and redisplaying it.
 void removeView(View view)
          Removes the specifed view from the subviews contained by this view.
 void replaceView(View toReplace, View replacement)
           
 void secondClick(Click click)
          Called when the user double-clicked this view.
 void setBounds(Bounds bounds)
           
 void setFocusManager(FocusManager focusManager)
           
 void setLocation(Location point)
          Specifies the location of this view, relative to its enclosing view.
 void setMaximumSize(Size size)
           
 void setParent(View view)
           
 void setSize(Size size)
           
 void setView(View view)
           
 View subviewFor(Location location)
          Identifies the subview that contains the specified location within its bounds.
 void thirdClick(Click click)
          Called when the user triple-clicks the mouse buttone within this view.
 void update(NakedObject object)
          notification that the content of this view has changed
 void updateView()
           
 ViewAreaType viewAreaType(Location mouseLocation)
          Determines if the user is invoking an action relating to this view, rather than to whatever this view represents.
 void viewMenuOptions(UserActionSet menuOptions)
          Called when the popup menu is being populated for this view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nakedobjects.plugins.dnd.View
getMaximumSize
 

Field Detail

action

protected final UserAction action
Constructor Detail

AbstractControlView

public AbstractControlView(UserAction action,
                           View target)
Method Detail

addView

public void addView(View view)
Specified by:
addView in interface View

canChangeValue

public Consent canChangeValue()
Description copied from interface: View
Determines if the user is able to change the held value.

Specified by:
canChangeValue in interface View

canFocus

public boolean canFocus()
Description copied from interface: View
Determines whether this view accepts keyboard focus. If so focusLost and focusReceived will be called.

Specified by:
canFocus in interface View

contains

public boolean contains(View view)
Specified by:
contains in interface View

containsFocus

public boolean containsFocus()
Specified by:
containsFocus in interface View

contentMenuOptions

public void contentMenuOptions(UserActionSet menuOptions)
Description copied from interface: View
Called when the popup menu is being populated for this view. Any content options that need to appear on the menu should be added to the menuOptions object.

Specified by:
contentMenuOptions in interface View

debug

public void debug(DebugString debug)
Specified by:
debug in interface View

debugStructure

public void debugStructure(DebugString b)
Specified by:
debugStructure in interface View

dispose

public void dispose()
Description copied from interface: View
Called when a view is no longer needed and its resources can be disposed of. Dissociates this view from its parent, and removes itself from the list of views that need to be updated.

Specified by:
dispose in interface View
See Also:
View.removeView(View)

drag

public void drag(ContentDrag contentDrag)
Specified by:
drag in interface View

drag

public void drag(InternalDrag drag)
Description copied from interface: View
Called as mouse is dragged within and without this view. This only occurs when no content or view is being dragged.

Specified by:
drag in interface View

dragCancel

public void dragCancel(InternalDrag drag)
Specified by:
dragCancel in interface View

dragFrom

public View dragFrom(Location location)
Specified by:
dragFrom in interface View

dragIn

public void dragIn(ContentDrag drag)
Description copied from interface: View
Called as the content being dragged is dragged into this view. This only occurs when view contents are being dragged, and not when views themselves are being dragged.

Specified by:
dragIn in interface View

dragOut

public void dragOut(ContentDrag drag)
Description copied from interface: View
Called as the content being dragged is dragged out of this view. This only occurs when view contents are being dragged, and not when views themselves are being dragged.

Specified by:
dragOut in interface View

dragStart

public Drag dragStart(DragStart drag)
Specified by:
dragStart in interface View

dragTo

public void dragTo(InternalDrag drag)
Description copied from interface: View
Called as the drag ends within and without this view. This only occurs when no content or view is being dragged.

Specified by:
dragTo in interface View

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

drop

public void drop(ContentDrag drag)
Description copied from interface: View
Called as another view's contents (the source) is dropped on this view's contents (the target). The source view can be obtained from the ViewDrag object.

Specified by:
drop in interface View

drop

public void drop(ViewDrag drag)
Description copied from interface: View
Called as another view (the source) is dropped on this view (the target). The source view can be obtained from the ViewDrag object.

Specified by:
drop in interface View

editComplete

public void editComplete(boolean moveFocus,
                         boolean toNextField)
Description copied from interface: View
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 View
Parameters:
moveFocus - flags that focus should be moved from this field after the entry has been processed.
toNextField - flags that the focus should be moved to the next field (if true) or to the previous field (if false). This parameter is ignored if the moveFocus parameter is false.

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

enteredSubview

public void enteredSubview()

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

exitedSubview

public void exitedSubview()

firstClick

public void firstClick(Click click)
Description copied from interface: View
Called when the user clicks the mouse buttone within this view.

Specified by:
firstClick in interface View
Parameters:
click - the location within the current view where the mouse click took place

focusLost

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

focusReceived

public void focusReceived()
Specified by:
focusReceived in interface View

getAbsoluteLocation

public Location getAbsoluteLocation()
Specified by:
getAbsoluteLocation in interface View

isOver

public boolean isOver()

isPressed

public boolean isPressed()

getBaseline

public int getBaseline()
Specified by:
getBaseline in interface View

getBounds

public Bounds getBounds()
Description copied from interface: View
Returns the bounding rectangle that describes where (within it parent), and how big, this view is.

Specified by:
getBounds in interface View
Returns:
Bounds
See Also:
View.getSize(), View.getLocation()

getContent

public Content getContent()
Description copied from interface: View
get the object that this view represents

Specified by:
getContent in interface View

getId

public int getId()
Specified by:
getId in interface View

getFocusManager

public FocusManager getFocusManager()
Specified by:
getFocusManager in interface View

getLocation

public Location getLocation()
Description copied from interface: View
Determines the location relative to this object's containing view

Specified by:
getLocation in interface View
See Also:
View.getBounds()

getPadding

public Padding getPadding()
Specified by:
getPadding in interface View

getParent

public View getParent()
Specified by:
getParent in interface View

getRequiredSize

public Size getRequiredSize(Size maximumSize)
Specified by:
getRequiredSize in interface View

getSize

public Size getSize()
Description copied from interface: View
Determines the size of this view.

Specified by:
getSize in interface View
See Also:
View.getBounds()

getSpecification

public ViewSpecification getSpecification()
Specified by:
getSpecification in interface View

getState

public ViewState getState()
Specified by:
getState in interface View

getSubviews

public View[] getSubviews()
Specified by:
getSubviews in interface View

getView

public View getView()
Description copied from interface: View
returns the topmost decorator in the chain, or the view itself if not decorated.

Specified by:
getView in interface View

getViewAxis

public ViewAxis getViewAxis()
Specified by:
getViewAxis in interface View

getViewManager

public Viewer getViewManager()
Specified by:
getViewManager in interface View

getFeedbackManager

public Feedback getFeedbackManager()
Specified by:
getFeedbackManager in interface View

getWorkspace

public Workspace getWorkspace()
Specified by:
getWorkspace in interface View

hasFocus

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

identify

public View identify(Location location)
Specified by:
identify in interface View

invalidateContent

public void invalidateContent()
Description copied from interface: View
Flags that the views do not properly represent the content, and hence it needs rebuilding. Contrast this with invalidateLayout(), which deals with an a complete view, but one that is not showing properly.

Specified by:
invalidateContent in interface View
See Also:
View.invalidateLayout()

invalidateLayout

public void invalidateLayout()
Description copied from interface: View
Flags that the views are possibly not displaying the content fully - too small, wrong place etc - although views exists for all the content. Contrast this with invalidateContent(), which deals with an incomplete view.

Specified by:
invalidateLayout in interface View
See Also:
View.invalidateContent()

keyPressed

public void keyPressed(KeyboardAction key)
Description copied from interface: View
Called when the user presses any key on the keyboard while this view has the focus.

Specified by:
keyPressed in interface View
Parameters:
key - TODO

keyReleased

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

Specified by:
keyReleased in interface View

keyTyped

public void keyTyped(char keyCode)
Description copied from interface: View
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 View

layout

public void layout(Size maximumSize)
Specified by:
layout in interface View

limitBoundsWithin

public void limitBoundsWithin(Bounds bounds)

limitBoundsWithin

public void limitBoundsWithin(Size size)
Description copied from interface: View
Limits the bounds of this view (normally when being moved or dropped) so it never extends beyond the bounds of a view of the specified size.

Specified by:
limitBoundsWithin in interface View

markDamaged

public void markDamaged()
Specified by:
markDamaged in interface View

markDamaged

public void markDamaged(Bounds bounds)
Specified by:
markDamaged in interface View

mouseDown

public void mouseDown(Click click)
Description copied from interface: View
Called as the mouse button is pressed down within this view. Does nothing; should be overriden when needed. the position relative to the top-left of this view

Specified by:
mouseDown in interface View

mouseUp

public void mouseUp(Click click)
Description copied from interface: View
Called as the mouse button is released within this view (assuming that it was pressed in this view). Does nothing; should be overriden when needed.

Specified by:
mouseUp in interface View

mouseMoved

public void mouseMoved(Location location)
Description copied from interface: View
Called as the mouse is moved around within this view. Does nothing; should be overriden when needed.

Specified by:
mouseMoved in interface View
Parameters:
location - the position relative to the top-left of this view

objectActionResult

public void objectActionResult(NakedObject result,
                               Location at)
Description copied from interface: View
Called when an action generates a result, allowing this view to decide what to do with it.

Specified by:
objectActionResult in interface View
at - the location where the action took place

pickupContent

public View pickupContent(Location location)
Description copied from interface: View
Called as the drag of this view's content starts.

Specified by:
pickupContent in interface View

pickupView

public View pickupView(Location location)
Description copied from interface: View
Called as the drag of this view starts.

Specified by:
pickupView in interface View

print

public void print(Canvas canvas)
Specified by:
print in interface View

refresh

public void refresh()
Description copied from interface: View
Refreshes this view by reaccessing its content and redisplaying it.

Specified by:
refresh in interface View

removeView

public void removeView(View view)
Description copied from interface: View
Removes the specifed view from the subviews contained by this view.

Specified by:
removeView in interface View

replaceView

public void replaceView(View toReplace,
                        View replacement)
Specified by:
replaceView in interface View

secondClick

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

Specified by:
secondClick in interface View

setBounds

public void setBounds(Bounds bounds)
Specified by:
setBounds in interface View

setFocusManager

public void setFocusManager(FocusManager focusManager)
Specified by:
setFocusManager in interface View

setLocation

public void setLocation(Location point)
Description copied from interface: View
Specifies the location of this view, relative to its enclosing view.

Specified by:
setLocation in interface View

setParent

public void setParent(View view)
Specified by:
setParent in interface View

setMaximumSize

public void setMaximumSize(Size size)
Specified by:
setMaximumSize in interface View

setSize

public void setSize(Size size)
Specified by:
setSize in interface View

setView

public void setView(View view)
Specified by:
setView in interface View

subviewFor

public View subviewFor(Location location)
Description copied from interface: View
Identifies the subview that contains the specified location within its bounds. Returns null if no subview exists for that location.

Specified by:
subviewFor in interface View

thirdClick

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

Specified by:
thirdClick in interface View

update

public void update(NakedObject object)
Description copied from interface: View
notification that the content of this view has changed

Specified by:
update in interface View

updateView

public void updateView()
Specified by:
updateView in interface View

viewAreaType

public ViewAreaType viewAreaType(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:
viewAreaType in interface View
Returns:
true if the user is targeting the view itself, false if the user is targeting what is being represented

viewMenuOptions

public void viewMenuOptions(UserActionSet menuOptions)
Description copied from interface: View
Called when the popup menu is being populated for this view. Any view options that need to appear on the menu should be added to the menuOptions object.

Specified by:
viewMenuOptions in interface View


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.