uk.ac.ic.doc.automed.p2p.gui.graph
Class TableComponent

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.gui.graph.GShape
      extended by uk.ac.ic.doc.automed.p2p.gui.graph.GraphComponent
          extended by uk.ac.ic.doc.automed.p2p.gui.graph.TableComponent
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, GVisualisable

public class TableComponent
extends GraphComponent

See Also:
Serialized Form

Field Summary
private  java.lang.String caption
           
private  java.util.Vector columns
           
private  GTable.Header header
           
private  java.util.Vector rows
           
 
Fields inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GraphComponent
atShape, grouped, prevPoint
 
Fields inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GShape
altDrawer, altDrawing, AUTO_COUNT, bound, brPoint, centrePoint, changed, color, cshape, data, defBound, displayScript, displayShape, enabled, handler, highlighted, hshape, icon, id, label, lblPoint, movable, name, onClick, PREFIX_CTRL, PREFIX_HIL, props, refresh, selectable, tlPoint, type, visible, visibleOnHighlighted, ZEROX
 
Constructor Summary
TableComponent(java.lang.String label, java.lang.String caption, java.awt.Point atPoint, java.awt.Dimension bound, java.util.Vector headers, java.util.Vector columnNodes, java.util.Properties props)
           
 
Method Summary
protected  void addRow(java.util.Vector row, java.awt.Graphics g)
          Add a new row to the table
 void clear()
           
protected  void doDraw(java.awt.Graphics g, boolean drawOrRedraw)
          Actually draw (redraw) table shapes and properly align them into their respective rows and columns
protected  void drawBefore(java.awt.Graphics g)
          Drawings that are performed before the main drawing
private  void drawBorder(java.awt.Graphics g)
          Draw the table border
protected  void drawMain(java.awt.Graphics g)
          The main body of the drawing method
 GShape get(int rowIndex, int colIndex)
           
 GTable.Column getColumn(int i)
           
 int getColumnCount()
           
 GShape getColumnHeader(int colIndex)
           
 java.util.Vector getColumnObjects(int i)
           
 double getHeight()
           
 GTable.Row getRow(int i)
           
 int getRowCount()
           
 java.util.Vector getRows()
           
 java.util.Collection getShapes()
           
protected  java.util.Collection getShapesForUpdate()
           
 double getWidth()
           
protected  boolean isEmpty()
           
 boolean isWrapped()
          Returns true if the table is to wrap its cells' texts
 void preDraw(java.awt.Graphics g)
          Prepare nodes and edges for drawing, no actual drawings are performd at this stage.
This method is to be invoked before this shape is drawn either for the first time or after it has been changed.
 void preDraw(java.awt.Graphics g, boolean updateOnly)
          When updateOnly is set to true, this method is only to make structural changes (e.g.
protected  void redrawBefore(java.awt.Graphics g)
           
protected  void redrawMain(java.awt.Graphics g)
          The main body of redraw
protected  void setData(java.util.Vector headers, java.util.Vector columns, java.awt.Graphics g)
          Remove existing headers and columns and redraw table content
this method is to be called only from within GraphViz package
private  double updateColumn(int ci, double nwidth, double dX, double dY)
          Update a column of the table when changes are applied to this column
private  double updateRow(GTable.Row row, double rheight, double dx, double dY)
          Update the height of a changed row and (optional) the delta-X, Y of the changes in the display coordinates of the shapes in that row
 
Methods inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GraphComponent
addEdge, addNode, addNodes, contains, drawAfter, drawAt, drawBound, drawOverlay, drawTo, equals, getBaseCenterPoint, getBasePoint, getBooleanProperty, getBound, getEdges, getEdges, getEdgesArray, getIsGrouped, getNodes, getNodesArray, getNumericProperty, getProperty, getShapesArray, init, redraw, removeShape, setEdges, setEdgesArray, setIsChanged, setIsGrouped, setIsVisible, setNodes, setNodesArray, setUp, update, updateBound, updateControl, updateHighlighted
 
Methods inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GShape
clear, contains, contains, contains, contains, copyProperties, cos, dcos, draw, drawAlternative, drawControl, drawHighlighted, dsin, dtan, getAutoID, getBounds, getBounds2D, getBrPoint, getCenter, getColor, getData, getDefaultBound, getDrawerInstance, getHandlerObject, getID, getIDShape, getIsVisible, getIsVisibleOnHighlighted, getLabel, getLabelBounds, getLabelPoint, getName, getPathIterator, getPathIterator, getPoint, getProperties, getProperty, getPropertyObject, getPropertyObjects, getStringBounds, getType, hashCode, highlightLabel, highlightLabel, intersects, intersects, isActive, isAltDrawing, isChanged, isEnabled, isHighlighted, isMovable, isMutableColor, isOnClick, isRefresh, isSelectable, newDrawerInstance, paintBlank, redrawAfter, refresh, setBound, setBound, setColorProperty, setColorProperty, setColorProperty, setEnabled, setHandlerObject, setIsAltDrawing, setIsHighlighted, setIsMovable, setIsOnClick, setIsRefresh, setIsSelectable, setLabel, setName, setProperties, setProperty, setPropertyObject, setStrokeStyle, setTLPoint, setTLPoint, setType, setUpHighlightedShape, setVisibleOnHighlighted, sin, tan, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

header

private GTable.Header header

columns

private java.util.Vector columns

rows

private java.util.Vector rows

caption

private java.lang.String caption
Constructor Detail

TableComponent

public TableComponent(java.lang.String label,
                      java.lang.String caption,
                      java.awt.Point atPoint,
                      java.awt.Dimension bound,
                      java.util.Vector headers,
                      java.util.Vector columnNodes,
                      java.util.Properties props)
Method Detail

getShapes

public java.util.Collection getShapes()
Overrides:
getShapes in class GraphComponent

getShapesForUpdate

protected java.util.Collection getShapesForUpdate()
Overrides:
getShapesForUpdate in class GraphComponent

isEmpty

protected boolean isEmpty()

drawMain

protected void drawMain(java.awt.Graphics g)
Description copied from class: GraphComponent
The main body of the drawing method

Overrides:
drawMain in class GraphComponent

redrawMain

protected void redrawMain(java.awt.Graphics g)
Description copied from class: GraphComponent
The main body of redraw

Overrides:
redrawMain in class GraphComponent

doDraw

protected void doDraw(java.awt.Graphics g,
                      boolean drawOrRedraw)
Actually draw (redraw) table shapes and properly align them into their respective rows and columns


isWrapped

public boolean isWrapped()
Returns true if the table is to wrap its cells' texts

Returns:

getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

getColumnHeader

public GShape getColumnHeader(int colIndex)

getColumnObjects

public java.util.Vector getColumnObjects(int i)

getRows

public java.util.Vector getRows()

getRow

public GTable.Row getRow(int i)

getColumn

public GTable.Column getColumn(int i)

get

public GShape get(int rowIndex,
                  int colIndex)

addRow

protected void addRow(java.util.Vector row,
                      java.awt.Graphics g)
Add a new row to the table

Parameters:
row -

updateColumn

private double updateColumn(int ci,
                            double nwidth,
                            double dX,
                            double dY)
Update a column of the table when changes are applied to this column

Parameters:
ci -

updateRow

private double updateRow(GTable.Row row,
                         double rheight,
                         double dx,
                         double dY)
Update the height of a changed row and (optional) the delta-X, Y of the changes in the display coordinates of the shapes in that row

Parameters:
ri -

getHeight

public double getHeight()

getWidth

public double getWidth()

setData

protected void setData(java.util.Vector headers,
                       java.util.Vector columns,
                       java.awt.Graphics g)
Remove existing headers and columns and redraw table content
this method is to be called only from within GraphViz package


preDraw

public void preDraw(java.awt.Graphics g)
Description copied from class: GShape
Prepare nodes and edges for drawing, no actual drawings are performd at this stage.
This method is to be invoked before this shape is drawn either for the first time or after it has been changed.

Overrides:
preDraw in class GShape

preDraw

public void preDraw(java.awt.Graphics g,
                    boolean updateOnly)
Description copied from class: GShape
When updateOnly is set to true, this method is only to make structural changes (e.g. updating coordinates or dimensions) to the existing shape and not to create any new shapes.

Overrides:
preDraw in class GShape

redrawBefore

protected void redrawBefore(java.awt.Graphics g)
Overrides:
redrawBefore in class GShape

drawBefore

protected void drawBefore(java.awt.Graphics g)
Description copied from class: GraphComponent
Drawings that are performed before the main drawing

Overrides:
drawBefore in class GraphComponent

drawBorder

private void drawBorder(java.awt.Graphics g)
Draw the table border

Parameters:
g -

clear

public void clear()
Overrides:
clear in class GShape