Class wb.WBCanvas
All Packages Class Hierarchy This Package Previous Next Index
Class wb.WBCanvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----wb.WBCanvas
- public class WBCanvas
- extends Canvas
- implements GTypes
WBCanvas is derived from Canvas and is corresponds to View in the MVC
paradigm. Objects are not only rendered here but are also sent to all
the clients.
It has the Repositary of objects that are created and that came over the
network
-
WBCanvas(Frame)
- Creates a new Canvas.
-
WBCanvas(Frame, WriteClient)
- Creates a new Canvas that is ready for conference.
-
Add(GraphUnit, String)
- Add adds a graphunit to the canvas.
-
CancelDelete()
-
-
Clear()
- Clear As the name implies clears the screen and the storage
losing all the previously created object info.
-
LoadCanvas(DataInputStream)
- Method that reads GraphUnits from a file.
-
NewColor(Color)
- NewColor changes the state of current color
-
NewFont(int)
- NewFontSize changes the size of the Text size
-
Refresh()
- Refresh As the name implies it refreshes the screen.
-
SaveCanvas(DataOutputStream)
- Method that saves the GraphUnits to a file.
-
action(Event, Object)
- Handler for action events.
-
getDrawType()
- returns the current drawing mode of the canvas
-
inside(int, int)
- Needed to fix a bug in Java
-
keyDown(Event, int)
- Handler for keyDown events.
-
keyUp(Event, int)
- Handler for keyUp events.
-
mouseDown(Event, int, int)
- Handler for mouseDown events.
-
mouseDrag(Event, int, int)
- Handler for mouseDrag events.
-
mouseEnter(Event, int, int)
- Handler for mouseEnter events.
-
mouseExit(Event, int, int)
- Handler for mouseExit events.
-
mouseMove(Event, int, int)
- Handler for mouseMove events.
-
mouseUp(Event, int, int)
- Handler for mouseUp events.
-
paint(Graphics)
- Handler for paint requests.
-
setDrawType(int)
- setDrawType set the current mode of the canvas
-
setWriter(WriteClient)
- Set the Writer for this Canvas
-
update(Graphics)
- Handler for update requests.
WBCanvas
public WBCanvas(Frame arg)
- Creates a new Canvas.
- Parameters:
- arg - the frame that holds this canvas
WBCanvas
public WBCanvas(Frame arg,
WriteClient passed)
- Creates a new Canvas that is ready for conference.
- Parameters:
- arg - the frame that holds this canvas
- passed - the writer to whom the locally created objects/messages
are sent for transmission.
setWriter
public void setWriter(WriteClient arg)
- Set the Writer for this Canvas
- Parameters:
- arg - WriteClient
NewColor
public synchronized void NewColor(Color arg)
- NewColor changes the state of current color
- Parameters:
- arg - the Color of the objects that would be created in future.
NewFont
public synchronized void NewFont(int arg)
- NewFontSize changes the size of the Text size
- Parameters:
- arg - the size of the objects that would be created in future.
Refresh
public synchronized void Refresh()
- Refresh As the name implies it refreshes the screen.
Clear
public synchronized void Clear()
- Clear As the name implies clears the screen and the storage
losing all the previously created object info.
Add
public synchronized void Add(GraphUnit passed,
String userhost)
- Add adds a graphunit to the canvas. this specifically handles the
requests from other participants. It identifies if the added object
is a message and deciphers it accordingly
- Parameters:
- passed - the GraphUnit/Message received over the network
- userhost - the source of GraphUnit/Message
getDrawType
public int getDrawType()
- returns the current drawing mode of the canvas
- Returns:
- int the current mode
- See Also:
- setDrawType, GTypes
setDrawType
public synchronized void setDrawType(int t)
- setDrawType set the current mode of the canvas
- Parameters:
- t - the new mode
- See Also:
- getDrawType
mouseEnter
public boolean mouseEnter(Event e,
int x,
int y)
- Handler for mouseEnter events. Takes care of the cursor shape
and sets the inside flag true
- Parameters:
- e - Event to be handled
- x - the x co-ordinate of the event to be handled
- y - the y co-ordinate of the event to be handled
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- mouseEnter in class Component
mouseExit
public boolean mouseExit(Event e,
int x,
int y)
- Handler for mouseExit events.
sets the inside flag false
- Parameters:
- e - Event to be handled
- x - the x co-ordinate of the event to be handled
- y - the y co-ordinate of the event to be handled
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- mouseExit in class Component
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- Handler for mouseDown events. Used to initiate the creation of
graphunits.
- Parameters:
- e - Event to be handled
- x - the x co-ordinate of the event to be handled
- y - the y co-ordinate of the event to be handled
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- mouseDown in class Component
mouseDrag
public boolean mouseDrag(Event e,
int x,
int y)
- Handler for mouseDrag events. This whole stuff is required
to give the rubber banding effect
- Parameters:
- e - Event to be handled
- x - the x co-ordinate of the event to be handled
- y - the y co-ordinate of the event to be handled
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- mouseDrag in class Component
mouseMove
public boolean mouseMove(Event e,
int x,
int y)
- Handler for mouseMove events. This whole stuff is required
to give the rubber banding effect esp. for polylines and spokes
- Parameters:
- e - Event to be handled
- x - the x co-ordinate of the event to be handled
- y - the y co-ordinate of the event to be handled
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- mouseMove in class Component
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
- Handler for mouseUp events. Marks the end of object creation in most
cases.
- Parameters:
- e - Event to be handled
- x - the x co-ordinate of the event to be handled
- y - the y co-ordinate of the event to be handled
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- mouseUp in class Component
keyUp
public boolean keyUp(Event evt,
int key)
- Handler for keyUp events.
- Parameters:
- e - Event to be handled
- key - the key released
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- keyUp in class Component
action
public boolean action(Event evt,
Object what)
- Handler for action events.
- Parameters:
- evt - Event to be handled
- what - the object
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- action in class Component
keyDown
public boolean keyDown(Event evt,
int key)
- Handler for keyDown events. Used in Text
- Parameters:
- evt - Event to be handled
- key - the key pressed
- Returns:
- boolean indicating if the event is handled.
- Overrides:
- keyDown in class Component
update
public synchronized void update(Graphics g)
- Handler for update requests. Called either locally or by the screen
update thread of the runtime.
- Parameters:
- g - Graphics onto which the update needs to be performed
- Overrides:
- update in class Component
paint
public synchronized void paint(Graphics g)
- Handler for paint requests. Called either locally or by the screen
refresh thread of the runtime.
- Parameters:
- g - Graphics onto which the update needs to be performed
- Overrides:
- paint in class Canvas
inside
public boolean inside(int x,
int y)
- Needed to fix a bug in Java
- Parameters:
- x - x-coordinate of the point
- y - y-coordinate of the point
- Returns:
- true iff (x,y) is inside this
- Overrides:
- inside in class Component
SaveCanvas
public synchronized void SaveCanvas(DataOutputStream dos) throws IOException
- Method that saves the GraphUnits to a file.
- Parameters:
- dos - DataOutputStream to a file stream
- Throws: IOException
- if there is any I/O Error
LoadCanvas
public synchronized void LoadCanvas(DataInputStream din) throws IOException
- Method that reads GraphUnits from a file.
- Parameters:
- din - DataInputStream to a file stream
- Throws: IOException
- if there is any I/O Error
CancelDelete
public void CancelDelete()
All Packages Class Hierarchy This Package Previous Next Index