ch.hearc.I04_05s08.GUI.Graph
Class GraphPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bych.hearc.I04_05s08.GUI.Graph.GraphPanel
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
RdfGraph, RdfsGraph

public abstract class GraphPanel
extends JPanel

Graph

Author:
Blanc, Yoan
See Also:
Serialized Form
Licence:
MIT
Copyright:
2005 Yoan Blanc, HE-ARC Ing�nierie

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int ARROW_MODE
          Mode drawing an arrow
private  LinkedList arrows
          List of arrows
private  Element drawingElement
          The element that will be drawing
private  LinkedList[] elements
          List of lists
private  OntFile file
          Ontology file
private  Line2D line
          Temporary line before arrow
private  int mode
          Mode of drawing
static int NO_MODE
          Mode drawing an arrow
static int NODE_MODE
          Mode drawing a node
private  LinkedList nodes
          List of nodes
private  Point2D offset
          Offset of the point inside the Node
private  Element oldElement
          Last selected Element
private  Element selectedElement
          Current selected Element
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphPanel()
          Build the graph
 
Method Summary
 boolean add(Arrow a)
          Add an arrow
 boolean add(Arrow[] a)
          Add arrows
 boolean add(Element e)
          Add an Element to the graph
 boolean add(Node n)
          Add a node
 boolean add(Node[] n)
          Add nodes
 boolean del(Arrow a)
          Delete an arrow
 boolean del(Arrow[] a)
          Delete some arrows
 boolean del(Element e)
          Delete a element (node or arrow)
 boolean del(Node n)
          Delete a node (and connected arrows)
 boolean del(Node[] n)
          Delete some nodes (and connected arrows)
 OntFile getFile()
          Get the file
 int getMode()
          Get the drawing mode
 LinkedList getNodes()
          Get the nodes
 Element getOldSelectedElement()
          Get the last selected element
 Dimension getPreferredSize()
          Get the size of the graph (used by the scroll area)
 Element getSelectedElement()
          Get the selected element
 void modeAction(Point2D p)
          Do the actions for the modes (ARROW_MODE here)
 void moveTo(Point2D p)
          Move the selected element to the point
 void paintComponent(Graphics g)
          Paint the panel
 void redraw()
          Update the graph
 void select(Point2D p)
          Select the Element at the choosen point
 void setDrawingElement(Element e)
          Set the element that would be drawn
 void setFile(OntFile file)
          Set the file
 void setMode(int mode)
          Set the drawing mode
 void setMousePos(Point2D p)
          Set the mouse position
 void showDialog(Point2D p)
          Display a dialog box for the selected element
private  void showme()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodes

private LinkedList nodes
List of nodes


arrows

private LinkedList arrows
List of arrows


elements

private LinkedList[] elements
List of lists


selectedElement

private Element selectedElement
Current selected Element


oldElement

private Element oldElement
Last selected Element


offset

private Point2D offset
Offset of the point inside the Node


line

private Line2D line
Temporary line before arrow


mode

private int mode
Mode of drawing


drawingElement

private Element drawingElement
The element that will be drawing


file

private OntFile file
Ontology file


NO_MODE

public static final int NO_MODE
Mode drawing an arrow

See Also:
Constant Field Values

ARROW_MODE

public static final int ARROW_MODE
Mode drawing an arrow

See Also:
Constant Field Values

NODE_MODE

public static final int NODE_MODE
Mode drawing a node

See Also:
Constant Field Values
Constructor Detail

GraphPanel

public GraphPanel()
Build the graph

Method Detail

add

public boolean add(Node n)
Add a node

Parameters:
n - Node

add

public boolean add(Node[] n)
Add nodes

Parameters:
n - Nodes

add

public boolean add(Arrow a)
Add an arrow

Parameters:
a - Arrow

add

public boolean add(Arrow[] a)
Add arrows

Parameters:
a - Arrow

add

public boolean add(Element e)
Add an Element to the graph

Parameters:
e - the element

del

public boolean del(Arrow a)
Delete an arrow

Parameters:
a - arrow

del

public boolean del(Arrow[] a)
Delete some arrows

Parameters:
a - arrows

del

public boolean del(Node n)
Delete a node (and connected arrows)

Parameters:
n - node to delete

showme

private void showme()

del

public boolean del(Node[] n)
Delete some nodes (and connected arrows)

Parameters:
n - node to delete

del

public boolean del(Element e)
Delete a element (node or arrow)

Parameters:
e - element

getFile

public OntFile getFile()
Get the file

Returns:
a file

setFile

public void setFile(OntFile file)
Set the file

Parameters:
file - a file

paintComponent

public void paintComponent(Graphics g)
Paint the panel

Parameters:
g - Graphic context

select

public void select(Point2D p)
Select the Element at the choosen point

Parameters:
p - the point clicked on screen

showDialog

public void showDialog(Point2D p)
Display a dialog box for the selected element

Parameters:
p - the point clicked on screen

setDrawingElement

public void setDrawingElement(Element e)
Set the element that would be drawn

Parameters:
e - define the element that will be drawn

modeAction

public void modeAction(Point2D p)
Do the actions for the modes (ARROW_MODE here)

Parameters:
p - the point clicked on screen

moveTo

public void moveTo(Point2D p)
Move the selected element to the point

Parameters:
p - the point

setMousePos

public void setMousePos(Point2D p)
Set the mouse position


getPreferredSize

public Dimension getPreferredSize()
Get the size of the graph (used by the scroll area)

Returns:
dimension of the graph

getSelectedElement

public Element getSelectedElement()
Get the selected element

Returns:
the element selected

getOldSelectedElement

public Element getOldSelectedElement()
Get the last selected element

Returns:
the last element selected

setMode

public void setMode(int mode)
Set the drawing mode

Parameters:
mode - the mode

getMode

public int getMode()
Get the drawing mode

Returns:
the mode

redraw

public void redraw()
Update the graph


getNodes

public LinkedList getNodes()
Get the nodes



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