org.nakedobjects.viewer.lightweight
Class Workspace

java.lang.Object
  extended byorg.nakedobjects.viewer.lightweight.AbstractView
      extended byorg.nakedobjects.viewer.lightweight.Workspace
All Implemented Interfaces:
Background, java.lang.Cloneable, DragTarget, PrintableView, View

public class Workspace
extends AbstractView
implements Background, DragTarget, PrintableView


Field Summary
 
Fields inherited from class org.nakedobjects.viewer.lightweight.AbstractView
DEBUG, DRAG_HANDLE_WIDTH, HPADDING, ICON_SIZE, VPADDING
 
Constructor Summary
Workspace(GraphicalViewingMechanism mechanism)
           
 
Method Summary
 void addIcon(DesktopView view)
          Adds a view to the list of iconized views for this workspace and re-layout all the views.
 void addNotificationView(ObjectView view)
           
 void addRootView(RootView view)
          Adds a view to the list of open view views for this workspace and re-layout all the views.
 void clearOverlayView()
           
 void dragObjectIn(ObjectDrag drag)
          Called as an object drag moves into this view
 void dragObjectOut(ObjectDrag drag)
          Called as an object drag moves out of this view
 void draw(Canvas canvas)
          Called by the frame, or the parent view, when this view must redraw itself.
 void dropObject(ObjectDrag drag)
          Called when a dragged object is dropped onto this view.
 Border getBorder()
           
 View getIdentifiedView()
           
 View getOverlayView()
           
 Padding getPadding()
           
 Size getRequiredSize()
           
 boolean hasFocus(AbstractValueView view)
           
 View identifyView(Location framePosition, View current)
          Returns the View that is currently under the pointer.
 boolean isIdentified(View view)
          Determines whether the specified view is the one that is currently identified.
 boolean isObjectIdentified(View view)
          Deprecated.  
 void layoutIcons()
           
 void limitBounds(View view)
          Limits the bounds of the given view (when being moved or dropped) so its never extends outside the bounds of the containing open view
protected  void lower(RootView view)
          Pushes the specified view to the back of all views
 void makeFocus(KeyboardAccessible view)
           
 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.
 void paintBackground(Canvas canvas, Size size)
           
protected  void raise(RootView view)
          Pulls the specified view to the top of all views
 void removeFromNotificationList(ObjectView view)
           
 void removeOtherRootViews(RootView view)
          Removes all the views - other than the specified one - from the workspace
 void removeView(View view)
          Removes the specified view from the workspace
 void removeViewsFor(NakedObject object)
          Removes and views (icons and open views) from the frame that are for the specified object.
protected  void removeViewsFor(NakedObject object, java.util.Vector toRemove)
           
 void repaint(int x, int y, int width, int height)
           
 void setBackground(Background background)
          Sets the background strategy.
 void setBorder(Border border)
           
 void setIdentifiedView(View view)
           
 void setOverlayView(View view)
           
 void setStatus(java.lang.String string)
           
 void showArrowCursor()
           
 void showColumnResizeCursor()
           
 void showMoveCursor()
           
 void showResizeCursor()
           
 void showTextCursor()
           
 
Methods inherited from class org.nakedobjects.viewer.lightweight.AbstractView
addControl, assignId, backgroundColor, calculateRepaintArea, contains, createCanvas, debugDetails, defaultFieldHeight, dispose, entered, enteredSubview, exited, exitedSubview, firstClick, getAbsoluteLocation, getBaseline, getBounds, getId, getLocation, getName, getParent, getSize, getWorkspace, indicatesForView, invalidateLayout, isLayoutInvalid, isOpen, isReplaceable, layout, limitBounds, mouseMoved, print, redraw, removeControl, repaintAll, secondClick, setBounds, setLayoutValid, setLocation, setParent, setSize, setWorkspace, thirdClick, transparentBackground, validateLayout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nakedobjects.viewer.lightweight.View
calculateRepaintArea, contains, debugDetails, dispose, entered, enteredSubview, exited, exitedSubview, firstClick, getAbsoluteLocation, getBaseline, getBounds, getId, getLocation, getName, getParent, getSize, getWorkspace, indicatesForView, invalidateLayout, isLayoutInvalid, isOpen, isReplaceable, layout, mouseMoved, print, redraw, secondClick, setBounds, setLocation, setSize, thirdClick, validateLayout
 
Methods inherited from interface org.nakedobjects.viewer.lightweight.PrintableView
createCanvas, print
 

Constructor Detail

Workspace

public Workspace(GraphicalViewingMechanism mechanism)
Method Detail

setBackground

public void setBackground(Background background)
Sets the background strategy.

Parameters:
background -

setBorder

public void setBorder(Border border)
Specified by:
setBorder in interface View
Overrides:
setBorder in class AbstractView

getBorder

public Border getBorder()
Specified by:
getBorder in interface View
Overrides:
getBorder in class AbstractView

isIdentified

public boolean isIdentified(View view)
Determines whether the specified view is the one that is currently identified.

Parameters:
view -
Returns:
boolean

setIdentifiedView

public void setIdentifiedView(View view)

getIdentifiedView

public View getIdentifiedView()

isObjectIdentified

public boolean isObjectIdentified(View view)
Deprecated.  

Determines whether the specified view is the one that is currently identified in a way that indicates that the object itself (vs the view) is of interest.

Parameters:
view -
Returns:
boolean

setOverlayView

public void setOverlayView(View view)

getOverlayView

public View getOverlayView()

getPadding

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

getRequiredSize

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

setStatus

public void setStatus(java.lang.String string)

addIcon

public void addIcon(DesktopView view)
Adds a view to the list of iconized views for this workspace and re-layout all the views. The icon's position is also limited so it is inside the bounds of this frame.

Parameters:
view - the view to add

addNotificationView

public void addNotificationView(ObjectView view)

addRootView

public void addRootView(RootView view)
Adds a view to the list of open view views for this workspace and re-layout all the views. The open view's position is also limited so it is inside the bounds of this frame.

Parameters:
view - the view to add

clearOverlayView

public void clearOverlayView()

dragObjectIn

public void dragObjectIn(ObjectDrag drag)
Description copied from interface: DragTarget
Called as an object drag moves into this view

Specified by:
dragObjectIn in interface DragTarget

dragObjectOut

public void dragObjectOut(ObjectDrag drag)
Description copied from interface: DragTarget
Called as an object drag moves out of this view

Specified by:
dragObjectOut in interface DragTarget

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

dropObject

public void dropObject(ObjectDrag drag)
Description copied from interface: DragTarget
Called when a dragged object is dropped onto this view.

Specified by:
dropObject in interface DragTarget

hasFocus

public boolean hasFocus(AbstractValueView view)

identifyView

public View identifyView(Location framePosition,
                         View current)
Returns the View that is currently under the pointer. Works through each top-level view and when the mouse is found in the that the same method is then called within that view, and so on. This ensures that views within views are identified. An optional parameter ensures that an already identified view is not returned. This is used when the dragged view needs to be ignored so a drop target can be identified.

Specified by:
identifyView in interface View
Overrides:
identifyView in class AbstractView
Parameters:
framePosition - the mouse position within the frame
current - the object that is being dragged, or null if none
Returns:
Component

layoutIcons

public void layoutIcons()

limitBounds

public void limitBounds(View view)
Limits the bounds of the given view (when being moved or dropped) so its never extends outside the bounds of the containing open view


makeFocus

public void makeFocus(KeyboardAccessible view)

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

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

paintBackground

public void paintBackground(Canvas canvas,
                            Size size)
Specified by:
paintBackground in interface Background

removeFromNotificationList

public void removeFromNotificationList(ObjectView view)

removeViewsFor

public final void removeViewsFor(NakedObject object)
Removes and views (icons and open views) from the frame that are for the specified object.

Parameters:
object -

removeOtherRootViews

public void removeOtherRootViews(RootView view)
Removes all the views - other than the specified one - from the workspace

Parameters:
view -

removeView

public void removeView(View view)
Removes the specified view from the workspace

Parameters:
view -

repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height)

lower

protected void lower(RootView view)
Pushes the specified view to the back of all views

Parameters:
view - to lower

raise

protected void raise(RootView view)
Pulls the specified view to the top of all views

Parameters:
view - to raise

removeViewsFor

protected void removeViewsFor(NakedObject object,
                              java.util.Vector toRemove)

showTextCursor

public void showTextCursor()

showArrowCursor

public void showArrowCursor()

showMoveCursor

public void showMoveCursor()

showResizeCursor

public void showResizeCursor()

showColumnResizeCursor

public void showColumnResizeCursor()