ch.hearc.I04_05s08.GUI.Graph
Class Element

java.lang.Object
  extended bych.hearc.I04_05s08.GUI.Graph.Element
Direct Known Subclasses:
Arrow, Node

public abstract class Element
extends Object

Graphic element

Author:
Blanc, Yoan
Licence:
MIT
Copyright:
2005 Yoan Blanc, HE-ARC Ing�nierie

Field Summary
private  Color[] colors
          Colors
private  GraphPanel graph
          The graph
private  Dimension2D padding
          Padding
private  boolean selected
          State of the Element
private  String title
          Title of the Element (text displayed)
 
Constructor Summary
Element(Element e)
          A copy builder
Element(String title)
          Init the Element
 
Method Summary
abstract  Object clone()
          Clone the element
abstract  boolean contains(Point2D p)
          Test if the Element contains the point
abstract  void draw(Graphics2D g2d)
          Draw the element
 Color getBackgroundColor()
          Get the background color
 Color getForegroundColor()
          Get the foreground color
 GraphPanel getGraph()
          Get the graph
 Dimension2D getPadding()
          Get the padding
 String getTitle()
          Get the title
 boolean isSelected()
          Get the state of the Element
 void select(boolean value)
          Set the state of the Element
 void setBackgroundColor(Color c)
          Set the background color
 void setForegroundColor(Color c)
          Set the foreground color
 void setPadding(Dimension2D padding)
          Set padding (internal margin)
 void setSelectedBackgroundColor(Color c)
          Set the background color when selected
 void setSelectedForegroundColor(Color c)
          Set the foreground color when selected
 void setTitle(String title)
          Set the title
 void showDialog(GraphPanel graph)
          Display a dialog box for this node
 void update()
          Update the values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selected

private boolean selected
State of the Element


title

private String title
Title of the Element (text displayed)


colors

private Color[] colors
Colors


padding

private Dimension2D padding
Padding


graph

private GraphPanel graph
The graph

Constructor Detail

Element

public Element(String title)
Init the Element

Parameters:
title - the title of the element (the text displayed)

Element

public Element(Element e)
A copy builder

Parameters:
e - the element to copy
Method Detail

clone

public abstract Object clone()
Clone the element

Returns:
dolly the clone

getTitle

public String getTitle()
Get the title

Returns:
the title

setTitle

public void setTitle(String title)
Set the title

Parameters:
title - the new title

select

public void select(boolean value)
Set the state of the Element

Parameters:
value - the state

isSelected

public boolean isSelected()
Get the state of the Element

Returns:
if the Element is selected

setForegroundColor

public void setForegroundColor(Color c)
Set the foreground color

Parameters:
c - color

setBackgroundColor

public void setBackgroundColor(Color c)
Set the background color

Parameters:
c - color

setSelectedForegroundColor

public void setSelectedForegroundColor(Color c)
Set the foreground color when selected

Parameters:
c - color

setSelectedBackgroundColor

public void setSelectedBackgroundColor(Color c)
Set the background color when selected

Parameters:
c - color

getForegroundColor

public Color getForegroundColor()
Get the foreground color

Returns:
color

getBackgroundColor

public Color getBackgroundColor()
Get the background color

Returns:
color

setPadding

public void setPadding(Dimension2D padding)
Set padding (internal margin)

Parameters:
padding - the padding

getPadding

public Dimension2D getPadding()
Get the padding

Returns:
padding

draw

public abstract void draw(Graphics2D g2d)
Draw the element

Parameters:
g2d - Graphic context

contains

public abstract boolean contains(Point2D p)
Test if the Element contains the point

Parameters:
p - the point
Returns:
if the Element contains this point

showDialog

public void showDialog(GraphPanel graph)
Display a dialog box for this node

Parameters:
graph - the graph

getGraph

public GraphPanel getGraph()
Get the graph


update

public void update()
Update the values



A project by Blanc, Yoan – supervised by Dr. Ghorbel, Hatem.
2004 © Blanc, Yoan - HE-ARC