projectPrototype.view.graphicEditor
Class GraphicEditor

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byprojectPrototype.view.graphicEditor.GraphicEditor
All Implemented Interfaces:
javax.accessibility.Accessible, Editor, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GraphicEditor
extends javax.swing.JPanel
implements Editor

Author:
Dário Apolinário & Gustavo Reis This class is the Graphic Editor.
See Also:
Editor, Serialized Form

Nested Class Summary
private  class GraphicEditor.MouseClick
           
private  class GraphicEditor.MouseMotion
           
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  Operator activeOperator
          Selected Operator.
private  java.util.LinkedList currentGraphicElements
          Graphic elements wich are being created.
private  java.util.LinkedList graphicElementsList
          Graphic Elements contained by the Graphic Editor.
private  Operator[] operators
          Operators of the Graphic Editor.
private  State[] states
          States of the Graphic editor.
 
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 projectPrototype.view.graphicEditor.Editor
CFP, CSP, IDENTIFICATION, LINK_CFP, LINK_CSP, MODIFICATION, OVER_OBJECT, OVER_SELECTOR, TRANSLATION
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphicEditor()
          Creates a Graphic Editor
 
Method Summary
 void addGraphicElement()
          Adds the created Graphic Elements to the graphicElementsList.
 void bringForward(GraphicElement graphicElement)
          Bring forward a Graphic Element
 void bringToFront(GraphicElement graphicElement)
          Bring to front the Graphic Element.
 void changeCursor(java.awt.Cursor cursor)
          Sets the mouse Cursor.
private  void clbp(double x, double y)
          This method is called when left mouse button is pressed and CTRL key is down (clbp)
 Operator getActiveOpertator()
          Returns the active Operator.
 GraphicElement getGraphicElement(int i)
          Return a GraphicElement.
 GraphicElement getGraphicElementOver(Point point)
          Returns the Graphic Element over the Point.
 int getGraphicElementsListSize()
          Returns the number of Graphic Elements
 State getState(int i)
          Returns the active State.
private  void lbp(double x, double y)
          This method is called when the left mouse button is pressed (lbp)
private  void lbr(double x, double y)
          This method is called when the left mouse button is released (lbr)
 void paint()
          Paints the Graphic Elements
 void paint(java.awt.Graphics g)
          Paints the Graphic Elements
private  void rm(double x, double y)
          This method is called when the mouse is moved
 void selectNone()
          Unselect all Graphic Elements
 void sendBackward(GraphicElement graphicElement)
          Send backward a Graphic Element
 void sendToBack(GraphicElement graphicElement)
          Send to back a Graphic Element
 void setCurrentGraphicElement(GraphicElement graphicElement)
          Indicates to the Graphic Editor wich graphic element is being created.
 void setCurrentGraphicElements(java.util.LinkedList graphicElements)
          Sets Graphics Elements being created.
 void setOperator(int operator)
          Switch operator.
private  void showPopup(double x, double y)
          This method is called to show a PopupMenu
 
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, getPreferredSize, 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, paintBorder, paintChildren, paintComponent, 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

operators

private Operator[] operators
Operators of the Graphic Editor.


activeOperator

private Operator activeOperator
Selected Operator.


states

private State[] states
States of the Graphic editor.


currentGraphicElements

private java.util.LinkedList currentGraphicElements
Graphic elements wich are being created.


graphicElementsList

private java.util.LinkedList graphicElementsList
Graphic Elements contained by the Graphic Editor.

Constructor Detail

GraphicEditor

public GraphicEditor()
Creates a Graphic Editor

Method Detail

paint

public void paint(java.awt.Graphics g)
Paints the Graphic Elements


setOperator

public void setOperator(int operator)
Switch operator.

Specified by:
setOperator in interface Editor
Parameters:
operator - Operator to be set.

getActiveOpertator

public Operator getActiveOpertator()
Returns the active Operator.

Specified by:
getActiveOpertator in interface Editor
Returns:
Active operator

getState

public State getState(int i)
Returns the active State.

Specified by:
getState in interface Editor
Parameters:
i - State to be retrieved
Returns:
State i.

setCurrentGraphicElement

public void setCurrentGraphicElement(GraphicElement graphicElement)
Indicates to the Graphic Editor wich graphic element is being created.

Specified by:
setCurrentGraphicElement in interface Editor
Parameters:
graphicElement - Graphic element being created.

addGraphicElement

public void addGraphicElement()
Adds the created Graphic Elements to the graphicElementsList.

Specified by:
addGraphicElement in interface Editor

getGraphicElementsListSize

public int getGraphicElementsListSize()
Returns the number of Graphic Elements

Specified by:
getGraphicElementsListSize in interface Editor
Returns:
The number of Graphic Elements

getGraphicElement

public GraphicElement getGraphicElement(int i)
Return a GraphicElement.

Specified by:
getGraphicElement in interface Editor
Parameters:
i - Index of the Graphic Element
Returns:
The Graphic Element at index i.

lbp

private void lbp(double x,
                 double y)
This method is called when the left mouse button is pressed (lbp)

Parameters:
x - X mouse coordinate
y - Y mouse coordinate

lbr

private void lbr(double x,
                 double y)
This method is called when the left mouse button is released (lbr)

Parameters:
x - X mouse coordinate
y - Y mouse coordinate

clbp

private void clbp(double x,
                  double y)
This method is called when left mouse button is pressed and CTRL key is down (clbp)

Parameters:
x - X mouse coordinate
y - Y mouse coordinate

rm

private void rm(double x,
                double y)
This method is called when the mouse is moved

Parameters:
x - X mouse coordinate
y - Y mouse coordinate

showPopup

private void showPopup(double x,
                       double y)
This method is called to show a PopupMenu

Parameters:
x - X mouse coordinate
y - Y mouse coordinate

selectNone

public void selectNone()
Unselect all Graphic Elements

Specified by:
selectNone in interface Editor

bringToFront

public void bringToFront(GraphicElement graphicElement)
Bring to front the Graphic Element.

Specified by:
bringToFront in interface Editor
Parameters:
graphicElement - Graphic Element to bring to front.

sendToBack

public void sendToBack(GraphicElement graphicElement)
Description copied from interface: Editor
Send to back a Graphic Element

Specified by:
sendToBack in interface Editor
Parameters:
graphicElement - Graphic Element so send to back
See Also:
Editor.sendToBack(GraphicElement)

bringForward

public void bringForward(GraphicElement graphicElement)
Description copied from interface: Editor
Bring forward a Graphic Element

Specified by:
bringForward in interface Editor
Parameters:
graphicElement - Graphic Element to bring forward
See Also:
Editor.bringForward(GraphicElement)

sendBackward

public void sendBackward(GraphicElement graphicElement)
Description copied from interface: Editor
Send backward a Graphic Element

Specified by:
sendBackward in interface Editor
Parameters:
graphicElement - Graphic Element to send backward
See Also:
Editor.sendBackward(GraphicElement)

paint

public void paint()
Description copied from interface: Editor
Paints the Graphic Elements

Specified by:
paint in interface Editor
See Also:
Editor.paint()

changeCursor

public void changeCursor(java.awt.Cursor cursor)
Description copied from interface: Editor
Sets the mouse Cursor.

Specified by:
changeCursor in interface Editor
Parameters:
cursor - Cursor to be set.
See Also:
Editor.changeCursor(java.awt.Cursor)

getGraphicElementOver

public GraphicElement getGraphicElementOver(Point point)
Description copied from interface: Editor
Returns the Graphic Element over the Point.

Specified by:
getGraphicElementOver in interface Editor
Parameters:
point - Point over a Graphic Element
Returns:
Graphic Element at Point position.
See Also:
projectPrototype.view.graphicEditor.Editor#getGraphicElementOverPoint(Point)

setCurrentGraphicElements

public void setCurrentGraphicElements(java.util.LinkedList graphicElements)
Description copied from interface: Editor
Sets Graphics Elements being created.

Specified by:
setCurrentGraphicElements in interface Editor
Parameters:
graphicElements - Graphic Elements being created
See Also:
Editor.setCurrentGraphicElements(java.util.LinkedList)