eTextReader
Class Diagram

java.lang.Object
  extended by eTextReader.Diagram
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener

public class Diagram
extends java.lang.Object
implements javax.swing.event.ChangeListener


Field Summary
private  java.lang.String addend
           
private  java.lang.String addstart
           
private  int b
           
private  javax.swing.JSlider bluefield
           
private  java.awt.Canvas canvas
           
private  DBClient client
           
private  ContentPane content
           
private  int currentmode
           
private  java.awt.event.ActionListener diagramlistener
           
private  javax.swing.JButton draw
           
private  boolean editableDiagram
           
static int ERASE
           
private  javax.swing.JButton eraser
           
private  javax.swing.JFrame f
           
private  int g
           
private  javax.swing.JSlider greenfield
           
private  java.awt.Image image
           
private  java.io.OutputStream imagestream
           
private  java.awt.event.ActionListener loglistener
           
private  int nid
           
static int NORMAL
           
private  Notation notationdiagram
           
private  java.util.Vector pdata
           
private  java.util.Vector plots
           
private  int r
           
private  javax.swing.JButton rainbow
           
static int RAINBOW
           
private  javax.swing.JSlider redfield
           
private  int size
           
private  javax.swing.JSlider sizeslider
           
private  javax.swing.JTextField titlefield
           
private  java.lang.String url
           
private  java.lang.String user
           
private  java.lang.String viewmode
           
private  int x1
           
private  int y1
           
 
Constructor Summary
Diagram(ContentPane content, java.awt.event.ActionListener loglistener, java.awt.event.ActionListener diagramlistener)
          Constructs a new JFrame object used to display Diagrams.
Diagram(ContentPane content, java.awt.event.ActionListener loglistener, boolean editableDiagram)
           
 
Method Summary
 void createDiagram(Notation info, java.lang.String userName)
          A method that brings up the GUI for diagram creation and stores the current canvas to the database.
 void dispose()
          Disposes of the current diagram
 java.lang.String getAddEnd()
          Returns the address end of the current Diagram Notation.
 java.lang.String getAddStart()
          Returns the address start of the current Diagram Notation.
 java.awt.Canvas getCanvas()
          Returns an Canvas of the current diagram display.
 int getID()
          Returns the ID of the last diagram created by this object
 java.awt.Dimension getSize()
          Returns the size of the current Diagram by getting the Dimension of its JFrame.
 java.lang.String getTitle()
          Returns the title of the current diagram display.
 java.lang.String getViewmode()
          return the viewing mode of this diagram
private  void loadDiagram(Notation n)
          loads the current diagram from the database, and returns an java.awt.Image object representing the current version of the digram
 void stateChanged(javax.swing.event.ChangeEvent e)
          Inherited from ChangeListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x1

private int x1

y1

private int y1

r

private int r

g

private int g

b

private int b

size

private int size

currentmode

private int currentmode

nid

private int nid

plots

private java.util.Vector plots

pdata

private java.util.Vector pdata

client

private DBClient client

canvas

private java.awt.Canvas canvas

imagestream

private java.io.OutputStream imagestream

user

private java.lang.String user

url

private java.lang.String url

addstart

private java.lang.String addstart

addend

private java.lang.String addend

viewmode

private java.lang.String viewmode

titlefield

private javax.swing.JTextField titlefield

sizeslider

private javax.swing.JSlider sizeslider

redfield

private javax.swing.JSlider redfield

greenfield

private javax.swing.JSlider greenfield

bluefield

private javax.swing.JSlider bluefield

draw

private javax.swing.JButton draw

eraser

private javax.swing.JButton eraser

rainbow

private javax.swing.JButton rainbow

f

private javax.swing.JFrame f

image

private java.awt.Image image

notationdiagram

private Notation notationdiagram

content

private ContentPane content

editableDiagram

private boolean editableDiagram

loglistener

private java.awt.event.ActionListener loglistener

diagramlistener

private java.awt.event.ActionListener diagramlistener

NORMAL

public static int NORMAL

RAINBOW

public static int RAINBOW

ERASE

public static int ERASE
Constructor Detail

Diagram

public Diagram(ContentPane content,
               java.awt.event.ActionListener loglistener,
               java.awt.event.ActionListener diagramlistener)
Constructs a new JFrame object used to display Diagrams.


Diagram

public Diagram(ContentPane content,
               java.awt.event.ActionListener loglistener,
               boolean editableDiagram)
Method Detail

createDiagram

public void createDiagram(Notation info,
                          java.lang.String userName)
A method that brings up the GUI for diagram creation and stores the current canvas to the database.

Parameters:
duser - The username of the Diagram author
durl - The url of the currently displayed page
daddstart - The start of the diagram notation in the eText page
daddend - The end of the diagram notation in the eText page

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Inherited from ChangeListener. Updates the color of the draw button to reflect the user's current color choice.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - The change event fired by the sliders

loadDiagram

private void loadDiagram(Notation n)
loads the current diagram from the database, and returns an java.awt.Image object representing the current version of the digram


getID

public int getID()
Returns the ID of the last diagram created by this object

Returns:
the ID of the last diagram created by this object

getCanvas

public java.awt.Canvas getCanvas()
Returns an Canvas of the current diagram display.

Returns:
a Canvas of the current diagram display

getAddStart

public java.lang.String getAddStart()
Returns the address start of the current Diagram Notation.

Returns:
the start of the current Diagram Notation.

getAddEnd

public java.lang.String getAddEnd()
Returns the address end of the current Diagram Notation.

Returns:
the end of the current Diagram Notation.

getTitle

public java.lang.String getTitle()
Returns the title of the current diagram display.

Returns:
the title of the current diagram.

getViewmode

public java.lang.String getViewmode()
return the viewing mode of this diagram

Returns:
a string representing the viewmode for this diagram

getSize

public java.awt.Dimension getSize()
Returns the size of the current Diagram by getting the Dimension of its JFrame.

Returns:
the dimensions of the current diagram.

dispose

public void dispose()
Disposes of the current diagram