unbbayes.draw
Class UShape

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by unbbayes.draw.UShape
All Implemented Interfaces:
ActionListener, ComponentListener, FocusListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, Cloneable, EventListener
Direct Known Subclasses:
UShapeBox, UShapeDecisionNode, UShapeDiamond, UShapeEllipse, UShapeFrame, UShapeLine, UShapePentagon, UShapeProbabilisticNode, UShapeRoundRect, UShapeSizeBtn, UShapeState, UShapeText, UShapeTrapezoid, UShapeUtilityNode

public class UShape
extends JComponent
implements ActionListener, FocusListener, MouseMotionListener, MouseListener, Cloneable, ComponentListener

See Also:
Serialized Form

Nested Class Summary
 
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  Color backColor
           
protected  boolean bUseSelection
           
protected  Color drawColor
           
static int GAP
           
protected  String ID
           
static int iUpdate
           
protected  Color lineColor
           
protected static Font m_bFont
           
protected static Font m_biFont
           
 UCanvas m_canvas
           
protected  int m_cursor
           
 String m_label
           
protected static Font m_pFont
           
 String m_shapeType
           
 String m_state
           
protected static Color m_tBlue
           
protected static Color m_tBlue2
           
protected static Color m_tGreen
           
protected static Color m_tRed
           
protected static Color m_tYellow
           
protected static int nextId
           
protected  Node node
           
 JPopupMenu popup
           
 Point pressedPoint
           
protected  Rectangle rectText
           
protected  Rectangle rectTitle
           
static ResourceBundle resource
          Load resource file from this package
protected  UShapeSizeBtn shape1
           
protected  UShapeSizeBtn shape2
           
protected  UShapeSizeBtn shape3
           
protected  UShapeSizeBtn shape4
           
protected  UShapeSizeBtn shape5
           
protected  UShapeSizeBtn shape6
           
protected  UShapeSizeBtn shape7
           
protected  UShapeSizeBtn shape8
           
static String STATE_CHANGECURSOR
           
static String STATE_MOVE
           
static String STATE_NONE
           
static String STATE_RESIZED
           
static String STATE_SELECTED
           
static String STATE_UPDATE
           
static String STATE_WAIT_EDIT
           
protected  BasicStroke stroke
           
static String STYPE_NONE
           
protected  JTextField textInput
           
static String TTYPE_BOTTOM
           
static String TTYPE_CENTER
           
static String TTYPE_LEFT
           
static String TTYPE_NONE
           
static String TTYPE_RIGHT
           
static String TTYPE_TOP
           
 
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
UShape(UCanvas c, Node pNode, int x, int y, int w, int h)
           
 
Method Summary
 void actionPerformed(ActionEvent arg0)
           
protected  void addFriend(UShape friend)
           
 void changeToGlobalPosition(Point2D.Double p)
           
 void changeToLocalPosition(Point2D.Double p)
           
 UShape checkContainer()
           
 boolean checkExactEdge(Graphics g, UShape shapeDes, Point2D.Double pSrcResult, Point2D.Double pDesResult)
           
 String checkLimitedTextSize(Graphics g, Rectangle rect, String str)
           
 boolean checkLimitSize(Rectangle rc)
           
 Object clone()
           
 Object[] cloneChildren(Object[] children, boolean includeChildren)
           
 void componentHidden(ComponentEvent arg0)
           
 void componentMoved(ComponentEvent arg0)
           
 void componentResized(ComponentEvent arg0)
           
 void componentShown(ComponentEvent arg0)
           
 boolean contain(double x, double y)
           
 void createBasicPopupMenu()
          Resets the menu and fills it with the "resize" and "color change" menu.
 void createColorChooser()
           
protected  void createID()
           
 void createPopupMenu()
          Fills the popup menu with the "align" options and basic options
 boolean createResizeBtn()
           
 void createTextBox()
           
 void drawText(Graphics g)
           
 void drawText(Graphics g, Rectangle rect)
           
 void drawText(Graphics g, Rectangle rect, String strName, String strType)
           
 void finalize()
           
 void focusGained(FocusEvent arg0)
           
 void focusLost(FocusEvent arg0)
           
 Color getBackColor()
           
 UCanvas getCanvas()
           
 int getCenterX()
           
 int getCenterY()
           
 Object getChild(String id)
           
 int getCursorStyle()
           
 Color getDrawColor()
           
 List<UShape> getFriends()
           
 int getGlobalX()
           
 int getGlobalY()
           
 String getLabel()
           
 String getLimitedTextSize(Graphics g, Rectangle rect, String str)
           
 Color getLineColor()
           
 Node getNode()
           
 Rectangle getShapeRect()
           
 String getShapeType()
           
 String getState()
           
 BasicStroke getStroke()
           
 Rectangle getTextRect(String str)
           
 boolean getUseSelection()
           
 void hideResizeBtn()
           
 boolean isContained(Rectangle rc)
           
 void mouseClicked(MouseEvent arg0)
           
 void mouseDragged(MouseEvent arg0)
           
 void mouseEntered(MouseEvent arg0)
           
 void mouseExited(MouseEvent arg0)
           
 void mouseMoved(MouseEvent arg0)
           
 void mousePressed(MouseEvent arg0)
           
 void mouseReleased(MouseEvent arg0)
           
 void moveResizeBtn()
           
 void paint(Graphics2D graphics)
           
 void paintComponent(Graphics g)
           
 void receiveMessage(String Msg)
           
protected  void removeFriend(UShape friend)
           
 void removeResizeBtn()
           
 void removeTextBox()
           
 void resizeToFitText()
           
 void sendMessageToFriends(String Msg)
           
 void setBackColor(Color c)
           
 void setBackColorWithoutNode(Color c)
           
 void setBounds(int x, int y, int width, int height)
           
 void setCanvas(UCanvas s)
           
 void setCursor(int s)
           
 void setDrawColor(Color c)
           
 void setLabel(String str)
           
 void setLineColor(Color c)
           
 void setNewSize(int x, int y, int w, int h)
           
 void setNode(Node n)
           
 void setShapeType(String s)
           
 void setState(String s, Object o)
           
 void setStroke(BasicStroke c)
           
 void setUseSelection(boolean b)
           
 void shapeTypeChange(String s)
           
 void showResizeBtn()
           
 void update()
           
 void updateNodeInformation()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, addImpl, 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, remove, removeAll, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pressedPoint

public Point pressedPoint

m_state

public String m_state

m_shapeType

public String m_shapeType

m_label

public String m_label

m_canvas

public UCanvas m_canvas

backColor

protected Color backColor

lineColor

protected Color lineColor

drawColor

protected Color drawColor

m_cursor

protected int m_cursor

stroke

protected BasicStroke stroke

bUseSelection

protected boolean bUseSelection

node

protected Node node

GAP

public static final int GAP
See Also:
Constant Field Values

STATE_NONE

public static final String STATE_NONE
See Also:
Constant Field Values

STATE_SELECTED

public static final String STATE_SELECTED
See Also:
Constant Field Values

STATE_WAIT_EDIT

public static final String STATE_WAIT_EDIT
See Also:
Constant Field Values

STATE_RESIZED

public static final String STATE_RESIZED
See Also:
Constant Field Values

STATE_MOVE

public static final String STATE_MOVE
See Also:
Constant Field Values

STATE_UPDATE

public static final String STATE_UPDATE
See Also:
Constant Field Values

STATE_CHANGECURSOR

public static final String STATE_CHANGECURSOR
See Also:
Constant Field Values

STYPE_NONE

public static final String STYPE_NONE
See Also:
Constant Field Values

TTYPE_NONE

public static final String TTYPE_NONE
See Also:
Constant Field Values

TTYPE_CENTER

public static final String TTYPE_CENTER
See Also:
Constant Field Values

TTYPE_LEFT

public static final String TTYPE_LEFT
See Also:
Constant Field Values

TTYPE_RIGHT

public static final String TTYPE_RIGHT
See Also:
Constant Field Values

TTYPE_TOP

public static final String TTYPE_TOP
See Also:
Constant Field Values

TTYPE_BOTTOM

public static final String TTYPE_BOTTOM
See Also:
Constant Field Values

shape1

protected UShapeSizeBtn shape1

shape2

protected UShapeSizeBtn shape2

shape3

protected UShapeSizeBtn shape3

shape4

protected UShapeSizeBtn shape4

shape5

protected UShapeSizeBtn shape5

shape6

protected UShapeSizeBtn shape6

shape7

protected UShapeSizeBtn shape7

shape8

protected UShapeSizeBtn shape8

textInput

protected JTextField textInput

rectText

protected Rectangle rectText

rectTitle

protected Rectangle rectTitle

popup

public JPopupMenu popup

ID

protected String ID

nextId

protected static int nextId

m_tRed

protected static Color m_tRed

m_tGreen

protected static Color m_tGreen

m_tBlue

protected static Color m_tBlue

m_tBlue2

protected static Color m_tBlue2

m_tYellow

protected static Color m_tYellow

m_biFont

protected static Font m_biFont

m_pFont

protected static Font m_pFont

m_bFont

protected static Font m_bFont

resource

public static ResourceBundle resource
Load resource file from this package


iUpdate

public static int iUpdate
Constructor Detail

UShape

public UShape(UCanvas c,
              Node pNode,
              int x,
              int y,
              int w,
              int h)
Method Detail

finalize

public void finalize()
Overrides:
finalize in class Object

updateNodeInformation

public void updateNodeInformation()

update

public void update()

shapeTypeChange

public void shapeTypeChange(String s)

createBasicPopupMenu

public void createBasicPopupMenu()
Resets the menu and fills it with the "resize" and "color change" menu.


createPopupMenu

public void createPopupMenu()
Fills the popup menu with the "align" options and basic options


createColorChooser

public void createColorChooser()

setLabel

public void setLabel(String str)
Parameters:
str -

getLabel

public String getLabel()

setUseSelection

public void setUseSelection(boolean b)

getUseSelection

public boolean getUseSelection()

setState

public void setState(String s,
                     Object o)

getLineColor

public Color getLineColor()

setLineColor

public void setLineColor(Color c)

getBackColor

public Color getBackColor()

setBackColor

public void setBackColor(Color c)

setBackColorWithoutNode

public void setBackColorWithoutNode(Color c)

getDrawColor

public Color getDrawColor()

setDrawColor

public void setDrawColor(Color c)

getStroke

public BasicStroke getStroke()

setStroke

public void setStroke(BasicStroke c)

getState

public String getState()

setShapeType

public void setShapeType(String s)

getShapeType

public String getShapeType()

setNode

public void setNode(Node n)

getNode

public Node getNode()

setCanvas

public void setCanvas(UCanvas s)

getCanvas

public UCanvas getCanvas()

getCursorStyle

public int getCursorStyle()

setCursor

public void setCursor(int s)

paint

public void paint(Graphics2D graphics)

paintComponent

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

getTextRect

public Rectangle getTextRect(String str)

resizeToFitText

public void resizeToFitText()

checkLimitedTextSize

public String checkLimitedTextSize(Graphics g,
                                   Rectangle rect,
                                   String str)

getLimitedTextSize

public String getLimitedTextSize(Graphics g,
                                 Rectangle rect,
                                 String str)

drawText

public void drawText(Graphics g)

drawText

public void drawText(Graphics g,
                     Rectangle rect)

drawText

public void drawText(Graphics g,
                     Rectangle rect,
                     String strName,
                     String strType)

createTextBox

public void createTextBox()

removeTextBox

public void removeTextBox()

createResizeBtn

public boolean createResizeBtn()

moveResizeBtn

public void moveResizeBtn()

showResizeBtn

public void showResizeBtn()

hideResizeBtn

public void hideResizeBtn()

removeResizeBtn

public void removeResizeBtn()

getGlobalX

public int getGlobalX()

getGlobalY

public int getGlobalY()

getCenterX

public int getCenterX()

getCenterY

public int getCenterY()

getShapeRect

public Rectangle getShapeRect()

checkLimitSize

public boolean checkLimitSize(Rectangle rc)

contain

public boolean contain(double x,
                       double y)

isContained

public boolean isContained(Rectangle rc)

checkContainer

public UShape checkContainer()

checkExactEdge

public boolean checkExactEdge(Graphics g,
                              UShape shapeDes,
                              Point2D.Double pSrcResult,
                              Point2D.Double pDesResult)

clone

public Object clone()
Overrides:
clone in class Object

createID

protected void createID()

addFriend

protected void addFriend(UShape friend)

removeFriend

protected void removeFriend(UShape friend)

getFriends

public List<UShape> getFriends()

getChild

public Object getChild(String id)

sendMessageToFriends

public void sendMessageToFriends(String Msg)

receiveMessage

public void receiveMessage(String Msg)

setNewSize

public void setNewSize(int x,
                       int y,
                       int w,
                       int h)

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Overrides:
setBounds in class Component

cloneChildren

public Object[] cloneChildren(Object[] children,
                              boolean includeChildren)

mouseDragged

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

changeToLocalPosition

public void changeToLocalPosition(Point2D.Double p)

changeToGlobalPosition

public void changeToGlobalPosition(Point2D.Double p)

mouseMoved

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

mouseClicked

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

mouseEntered

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

mouseExited

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

mousePressed

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

mouseReleased

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

actionPerformed

public void actionPerformed(ActionEvent arg0)
Specified by:
actionPerformed in interface ActionListener

focusGained

public void focusGained(FocusEvent arg0)
Specified by:
focusGained in interface FocusListener

focusLost

public void focusLost(FocusEvent arg0)
Specified by:
focusLost in interface FocusListener

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


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