jdraw.jdraw_ui
Class JDrawUI

java.lang.Object
  |
  +--mvp.View
        |
        +--jdraw.jdraw_ui.JDrawUI
All Implemented Interfaces:
java.util.Observer

public class JDrawUI
extends mvp.View

Class JDrawUI is the view object for the system. It contains an instance of the three main parts of JDraw's view: The menubar, the toolbar, and a vector of drawing windows.


Field Summary
protected  java.util.Vector canvasWindow
          The Vector of Drawing Canvas objects.
protected  CommandMenu commandMenu
          The Menu Bar object
protected  JDraw jdraw
          The corresponding model object
protected  mvp.Screen screen
          A local reference to the screen
protected  ToolsPalette toolsPalette
          The Tool Bar
 
Fields inherited from class mvp.View
editable, model, shown, widget, window
 
Constructor Summary
JDrawUI(mvp.Screen screen, JDraw jdraw)
          Construct this with the given Screen and JDraw model.
 
Method Summary
 java.awt.Component compose()
          Compose this by (1) creating a new window, (2) setting the window's menubar to this' menubar, (3) populating the menubar with the menus, (4) calling compose in turn for each menu, and (5) setting the window title.
 void composeCanvas(int i)
          Compose the Canvas indicated by the parameter by calling it's compose() method.
 CanvasWindow getCanvasWindow(int index)
          Method getCanvasWindow(int) returns the CanvasWindow whose index is given.
 CommandMenu getCommandMenu()
           
 int getIndexOf(CanvasWindow c)
           
 void killCanvasWindow(int i)
          Method killCanvasWindow(int) makes the necessary calls to remove a CanvasWindow object (indicated by its ID) from the list of 'CanvasWindow's.
 void newCanvasWindow(int i)
          Create a new Canvas Window and add it to the vector of Canvas Windows (canvasWindow).
 void setTitle(java.lang.String title)
          Change the Window Title of the last Element in canvasWindow to the given String.
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setModel, show, show, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jdraw

protected JDraw jdraw
The corresponding model object

screen

protected mvp.Screen screen
A local reference to the screen

commandMenu

protected CommandMenu commandMenu
The Menu Bar object

toolsPalette

protected ToolsPalette toolsPalette
The Tool Bar

canvasWindow

protected java.util.Vector canvasWindow
The Vector of Drawing Canvas objects.
Constructor Detail

JDrawUI

public JDrawUI(mvp.Screen screen,
               JDraw jdraw)
Construct this with the given Screen and JDraw model. Call the constructors of each of the subviews (initial JDraw windows).
Method Detail

compose

public java.awt.Component compose()
Compose this by (1) creating a new window, (2) setting the window's menubar to this' menubar, (3) populating the menubar with the menus, (4) calling compose in turn for each menu, and (5) setting the window title.
Overrides:
compose in class mvp.View

getCommandMenu

public CommandMenu getCommandMenu()

newCanvasWindow

public void newCanvasWindow(int i)
Create a new Canvas Window and add it to the vector of Canvas Windows (canvasWindow).

killCanvasWindow

public void killCanvasWindow(int i)
Method killCanvasWindow(int) makes the necessary calls to remove a CanvasWindow object (indicated by its ID) from the list of 'CanvasWindow's.

composeCanvas

public void composeCanvas(int i)
Compose the Canvas indicated by the parameter by calling it's compose() method. Then call the window offset method (setWindow) giving it the windows index designation. Finally, show the window.

setTitle

public void setTitle(java.lang.String title)
Change the Window Title of the last Element in canvasWindow to the given String.

getCanvasWindow

public CanvasWindow getCanvasWindow(int index)
Method getCanvasWindow(int) returns the CanvasWindow whose index is given.

getIndexOf

public int getIndexOf(CanvasWindow c)