erkka
Class DrawingArea

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--erkka.DrawingArea
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DrawingArea
extends javax.swing.JPanel

Title: Erkka-Projekti

Description: This class defines drawing area of the application. Symbols and lines are over it.

Version:
1.2 Lisätty objektien lisäämisen yhteyteen event-listeriin PropertyChange-toiminnallisuus. Jukka Mäntylä
See Also:
Serialized Form

Nested Class Summary
 
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
 
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
DrawingArea()
          Default constuctor
 
Method Summary
 void AddObj(erkka.BaseObject obj, int x, int y)
          This fuction adds param object in to the object or line table.
 void clearAllVariables()
          this function clears all variables and removes all objects from line and focus vector
 int getFocusTableBottom()
          Function returns most bottom point of the focus table
 int getFocusTableLeft()
          Function returns most left point of the focus table
 int getFocusTableRight()
          Function returns most right point of the focus table
 int getFocusTableTop()
          Function returns most top point of the focus table
 java.util.Vector getFocusVector()
          returns focus vector
 int getFocusVectorSize()
          This function return the size of the FocusVector
 erkka.Line getLine()
          this function returns first line from line table
 java.util.Vector getLineTable()
          this function returns line table
 boolean getModified()
          returns a modified status
 erkka.Symbol getObjByID(int id)
          this function returns an object which have desired id.
 erkka.BaseObject getObject(int i)
          returns desired object from focus vector
 void hideLineHotSpots()
          If attribute status is false, this function hides all HotSpots of lines.
 boolean isModifiedAfterLastAsking()
           
 void moveSelectedObjects(int mx, int my)
          this function will moves all selected objects
 void paint(java.awt.Graphics g)
          paint method of the class.
 void removeFromContainer(erkka.BaseObject base)
           
 void removeObj(erkka.BaseObject obj)
          This function removes an object from drawing area
 void removeObjectFromVector(erkka.BaseObject rem)
          Function removes param rem from FocusVector.
 void removeSelectedObjects()
          This function removes all object which are selected.
 void selectAll()
          select all objects
 void setFocusVector(java.util.Vector newVector)
           
 void setFocusVectorNull()
          this function will clear focus vector.
 void setLine(int x1, int y1, int x2, int y2)
          Function sets start and end points of the line.
 void setModified(boolean newVal)
           
 void setSelectedObjectsPos(int dx, int dy)
          Moves objects which are in FocusVector to given coordinates.
 void Symb_changes(erkka.ErkkaEvent e)
           
 void Symb_selected(erkka.ErkkaEvent e)
          This function will be called when symbol is selected
 
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, getWidth, getVisibleRect, 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
 

Constructor Detail

DrawingArea

public DrawingArea()
Default constuctor

Method Detail

setLine

public void setLine(int x1,
                    int y1,
                    int x2,
                    int y2)
Function sets start and end points of the line.

Parameters:
x1 - start point of the x-coordinate
y1 - start point of the y-coordinate
x2 - end point of the x-coordinate
y2 - end point of the y-coordinate

paint

public void paint(java.awt.Graphics g)
paint method of the class. Function also draws all lines between objects. points of the lines are xx1,xx2,yy1,yy2

Overrides:
paint in class javax.swing.JComponent

AddObj

public void AddObj(erkka.BaseObject obj,
                   int x,
                   int y)
This fuction adds param object in to the object or line table.

Parameters:
obj - an object which you want to add in to area
x - object x-coordinate
y - object y-coordinate

Symb_changes

public void Symb_changes(erkka.ErkkaEvent e)

clearAllVariables

public void clearAllVariables()
this function clears all variables and removes all objects from line and focus vector


removeObj

public void removeObj(erkka.BaseObject obj)
This function removes an object from drawing area

Parameters:
obj - object which will be removed from drawing area

Symb_selected

public void Symb_selected(erkka.ErkkaEvent e)
This function will be called when symbol is selected


removeSelectedObjects

public void removeSelectedObjects()
This function removes all object which are selected.


removeFromContainer

public void removeFromContainer(erkka.BaseObject base)

getObject

public erkka.BaseObject getObject(int i)
returns desired object from focus vector

Parameters:
i - desired index

setFocusVectorNull

public void setFocusVectorNull()
this function will clear focus vector.


removeObjectFromVector

public void removeObjectFromVector(erkka.BaseObject rem)
Function removes param rem from FocusVector. It also sets rem focus status to false.

Parameters:
rem - object which will be removed from focus vector

getFocusVectorSize

public int getFocusVectorSize()
This function return the size of the FocusVector


hideLineHotSpots

public void hideLineHotSpots()
If attribute status is false, this function hides all HotSpots of lines.


getFocusTableLeft

public int getFocusTableLeft()
Function returns most left point of the focus table

Returns:
most left point

getFocusTableRight

public int getFocusTableRight()
Function returns most right point of the focus table

Returns:

getFocusTableTop

public int getFocusTableTop()
Function returns most top point of the focus table

Returns:

getFocusTableBottom

public int getFocusTableBottom()
Function returns most bottom point of the focus table

Returns:

getFocusVector

public java.util.Vector getFocusVector()
returns focus vector


setFocusVector

public void setFocusVector(java.util.Vector newVector)

getObjByID

public erkka.Symbol getObjByID(int id)
this function returns an object which have desired id. If object haven't be found this function return null

Parameters:
id -

getLine

public erkka.Line getLine()
this function returns first line from line table


getLineTable

public java.util.Vector getLineTable()
this function returns line table


getModified

public boolean getModified()
returns a modified status


isModifiedAfterLastAsking

public boolean isModifiedAfterLastAsking()

setModified

public void setModified(boolean newVal)

setSelectedObjectsPos

public void setSelectedObjectsPos(int dx,
                                  int dy)
Moves objects which are in FocusVector to given coordinates.

Parameters:
dx - New x coordinate for the selection
dy - New y coordinate for the selection

moveSelectedObjects

public void moveSelectedObjects(int mx,
                                int my)
this function will moves all selected objects


selectAll

public void selectAll()
select all objects