unbbayes.draw
Class UCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLayeredPane
                  extended by unbbayes.draw.UCanvas
All Implemented Interfaces:
ComponentListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
GraphPane

public class UCanvas
extends JLayeredPane
implements MouseMotionListener, MouseListener, ComponentListener, KeyListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
JLayeredPane.AccessibleJLayeredPane
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  NetworkController controller
           
 Point dragPoint
           
 Rectangle dragRect
           
protected  int layerID
           
 String m_state
           
static String NODE_ALIGN_BOTTOM
           
static String NODE_ALIGN_LEFT
           
static String NODE_ALIGN_RIGHT
           
static String NODE_ALIGN_TOP
           
 Rectangle resizeRect
           
 List<UShape> selectedShapes
           
 Rectangle selectRect
           
 UShape shapeTest
           
static String STATE_CONNECT_COMP
           
static String STATE_CTRL
           
static String STATE_NONE
           
static String STATE_RESIZE_COMP
           
static String STATE_UPDATE
           
 String strTextOutputMode
           
static String TEXTOUTPUTMODEMODE_NONE
           
static String TEXTOUTPUTMODEMODE_USE_DESC
           
static String TEXTOUTPUTMODEMODE_USE_NAME
           
 
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
 
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.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
UCanvas()
           
 
Method Summary
 void addShape(UShape shape)
           
 void checkSelectArea()
           
 void componentHidden(ComponentEvent arg0)
           
 void componentMoved(ComponentEvent arg0)
           
 void componentResized(ComponentEvent arg0)
           
 void componentShown(ComponentEvent arg0)
           
 UShapeLine connectLinesForAllSelectedShape(UShape shapeParent, UShape shapeTarget)
           
 void DeleteSelectedShape()
           
 void delShape(UShape shape)
           
 void drawResizeRectEnter(Rectangle rc)
           
 void drawResizeRectReleased(Rectangle rc)
           
 void fitCanvasSizeToAllUShapes()
           
 NetworkController getController()
           
 UShape getNodeUShape(Node n)
          Does a linear search for a UShape instance containing a node n
 UShape getNodeUShape(UShape parent, Node n)
           
 UShape getSelectedShape()
           
 List<UShape> getSelectedShapes()
           
 Node getSelectedShapesNode()
           
 UShape GetShape(int x, int y)
           
 UShape GetShape(UShape parent, int x, int y)
           
 String getState()
           
 String getTextOutputMode()
           
 void keyPressed(KeyEvent arg0)
           
 void keyReleased(KeyEvent arg0)
           
 void keyTyped(KeyEvent arg0)
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(int x, int y)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(int x, int y)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(int x, int y)
           
 void mouseReleased(MouseEvent e)
           
 void onAlignNodes(String str)
           
 void onDrawConnectLineEnter(int x, int y)
           
 UShapeLine onDrawConnectLineReleased(UShape shapeParent, int x, int y)
           
 void onPositionChanged(UShape s)
           
 void onResized(UShape s)
           
 void onResizeToFitText()
           
 void onSelectionChanged()
           
 void onShapeChanged(UShape s)
           
 void onShapeColorChanged(Color c)
           
 void onShapeDeleted(UShape s)
           
 void onShapeMoved(UShape shapeMoved, int x, int y)
           
 void onShapeTypeChanged(String s)
           
 void paintComponent(Graphics g)
           
 void setController(NetworkController controller)
           
 UShape setDiamond(int x, int y, int width, int height)
           
 UShape setEllipse(int x, int y, int width, int height)
           
 UShape setFrame(int x, int y, int width, int height)
           
 UShape setPentagon(int x, int y, int width, int height)
           
 UShape setRect(int x, int y, int width, int height)
           
 UShape setRoundRect(int x, int y, int width, int height)
           
 void setShapeStateAll(String s, Object o)
           
 void setShapeStateAll(UShape parent, String s, Object o)
           
 void setState(String s)
           
 void setTextOutputMode(String str)
           
 UShape setTrapezoid(int x, int y, int width, int height)
           
 void update()
           
protected  void updateLines()
           
 
Methods inherited from class javax.swing.JLayeredPane
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

layerID

protected int layerID

controller

protected NetworkController controller

STATE_NONE

public static final String STATE_NONE
See Also:
Constant Field Values

STATE_RESIZE_COMP

public static final String STATE_RESIZE_COMP
See Also:
Constant Field Values

STATE_CONNECT_COMP

public static final String STATE_CONNECT_COMP
See Also:
Constant Field Values

STATE_UPDATE

public static final String STATE_UPDATE
See Also:
Constant Field Values

STATE_CTRL

public static final String STATE_CTRL
See Also:
Constant Field Values

NODE_ALIGN_BOTTOM

public static final String NODE_ALIGN_BOTTOM
See Also:
Constant Field Values

NODE_ALIGN_TOP

public static final String NODE_ALIGN_TOP
See Also:
Constant Field Values

NODE_ALIGN_LEFT

public static final String NODE_ALIGN_LEFT
See Also:
Constant Field Values

NODE_ALIGN_RIGHT

public static final String NODE_ALIGN_RIGHT
See Also:
Constant Field Values

m_state

public String m_state

resizeRect

public Rectangle resizeRect

dragRect

public Rectangle dragRect

selectRect

public Rectangle selectRect

dragPoint

public Point dragPoint

strTextOutputMode

public String strTextOutputMode

selectedShapes

public List<UShape> selectedShapes

TEXTOUTPUTMODEMODE_NONE

public static final String TEXTOUTPUTMODEMODE_NONE
See Also:
Constant Field Values

TEXTOUTPUTMODEMODE_USE_NAME

public static final String TEXTOUTPUTMODEMODE_USE_NAME
See Also:
Constant Field Values

TEXTOUTPUTMODEMODE_USE_DESC

public static final String TEXTOUTPUTMODEMODE_USE_DESC
See Also:
Constant Field Values

shapeTest

public UShape shapeTest
Constructor Detail

UCanvas

public UCanvas()
Method Detail

setTextOutputMode

public void setTextOutputMode(String str)

getTextOutputMode

public String getTextOutputMode()

setState

public void setState(String s)

getState

public String getState()

getNodeUShape

public UShape getNodeUShape(Node n)
Does a linear search for a UShape instance containing a node n

Parameters:
n - : node to look for
Returns:
an instance of UShape representing the parameter n.

getNodeUShape

public UShape getNodeUShape(UShape parent,
                            Node n)

fitCanvasSizeToAllUShapes

public void fitCanvasSizeToAllUShapes()

getSelectedShapes

public List<UShape> getSelectedShapes()

DeleteSelectedShape

public void DeleteSelectedShape()

update

public void update()

onResized

public void onResized(UShape s)

onPositionChanged

public void onPositionChanged(UShape s)

onResizeToFitText

public void onResizeToFitText()

onShapeColorChanged

public void onShapeColorChanged(Color c)

onShapeTypeChanged

public void onShapeTypeChanged(String s)

onShapeDeleted

public void onShapeDeleted(UShape s)

onShapeChanged

public void onShapeChanged(UShape s)

onSelectionChanged

public void onSelectionChanged()

onAlignNodes

public void onAlignNodes(String str)

getSelectedShapesNode

public Node getSelectedShapesNode()

getSelectedShape

public UShape getSelectedShape()

paintComponent

public void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

setShapeStateAll

public void setShapeStateAll(String s,
                             Object o)

setShapeStateAll

public void setShapeStateAll(UShape parent,
                             String s,
                             Object o)

drawResizeRectEnter

public void drawResizeRectEnter(Rectangle rc)

drawResizeRectReleased

public void drawResizeRectReleased(Rectangle rc)

onShapeMoved

public void onShapeMoved(UShape shapeMoved,
                         int x,
                         int y)

onDrawConnectLineEnter

public void onDrawConnectLineEnter(int x,
                                   int y)

onDrawConnectLineReleased

public UShapeLine onDrawConnectLineReleased(UShape shapeParent,
                                            int x,
                                            int y)

connectLinesForAllSelectedShape

public UShapeLine connectLinesForAllSelectedShape(UShape shapeParent,
                                                  UShape shapeTarget)

GetShape

public UShape GetShape(int x,
                       int y)

GetShape

public UShape GetShape(UShape parent,
                       int x,
                       int y)

checkSelectArea

public void checkSelectArea()

setRect

public UShape setRect(int x,
                      int y,
                      int width,
                      int height)

setEllipse

public UShape setEllipse(int x,
                         int y,
                         int width,
                         int height)

setFrame

public UShape setFrame(int x,
                       int y,
                       int width,
                       int height)

setRoundRect

public UShape setRoundRect(int x,
                           int y,
                           int width,
                           int height)

setTrapezoid

public UShape setTrapezoid(int x,
                           int y,
                           int width,
                           int height)

setPentagon

public UShape setPentagon(int x,
                          int y,
                          int width,
                          int height)

setDiamond

public UShape setDiamond(int x,
                         int y,
                         int width,
                         int height)

addShape

public void addShape(UShape shape)

delShape

public void delShape(UShape shape)

mouseDragged

public void mouseDragged(int x,
                         int y)

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(int x,
                         int y)

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(int x,
                          int y)

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

componentHidden

public void componentHidden(ComponentEvent arg0)
Specified by:
componentHidden in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent arg0)
Specified by:
componentMoved in interface ComponentListener

componentResized

public void componentResized(ComponentEvent arg0)
Specified by:
componentResized in interface ComponentListener

componentShown

public void componentShown(ComponentEvent arg0)
Specified by:
componentShown in interface ComponentListener

keyPressed

public void keyPressed(KeyEvent arg0)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent arg0)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent arg0)
Specified by:
keyTyped in interface KeyListener

getController

public NetworkController getController()
Returns:
the controller

setController

public void setController(NetworkController controller)
Parameters:
controller - the controller to set

updateLines

protected void updateLines()


Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.