slime.editor
Class Editor

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byslime.editor.Editor
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public final class Editor
extends javax.swing.JComponent
implements javax.swing.event.ChangeListener

For the Slime project of the Fortgeschrittenen-Praktikum.

Feel free to play around with this version of an SFC-editor.

Status: complete.
Known bugs: Some semantic problems. But who cares when there are no checks.

Version:
$Id: Editor.java,v 1.21 2002/07/18 11:37:09 swprakt Exp $
Author:
Andreas Niemann
See Also:
Serialized Form

Nested Class Summary
 
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
protected static java.awt.Color BACKGROUND_COLOR
           
protected static java.awt.Color HIGHLIGHT_COLOR
           
protected static java.awt.Color SELECTABLE_COLOR
           
 
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
Editor()
          Creates an editor with an 'empty' SFC.
Editor(SFC sfc)
          Creates an editor with the given SFC.
 
Method Summary
 void add(SFC sfc)
          Adds the given sfc to this editor in a seperate DrawBoard.
protected  void add(SFC sfc, java.lang.String name)
           
 void add(java.lang.String name)
          Adds a new sfc under the given name to this editor on a seperate DrawBoard.
 void closeSelectedSFC()
          Closes the actual selected sfc.
 void deHighlight(java.lang.Object object)
          Removes highlight effect from the given object.
protected  void evaluateKeyTyped(char c)
           
protected  void evaluateMouseDragged(int x0, int y0, int x1, int y1)
           
protected  boolean evaluateMouseMoved(int x, int y)
           
protected  void evaluateSingleMouseClickOn(int x, int y)
           
protected  java.lang.String getExceptionMessage(CheckException ce)
           
protected  ESFC getExtendedSelectedSFC()
          Return the current selected ESFC of this editor or null if no ESFC is selected.
 Absynt getItemFromList(java.util.LinkedList items, java.lang.String message)
           
 SFC getSelectedSFC()
          Returns the actual SFC used by the editor or null if no SFC is selected.
protected  boolean getSimulatorActive()
           
protected  javax.swing.border.TitledBorder getTitledBorder(java.lang.String title)
          Returns a titled border with the given name.
 void highlight(java.lang.Object object)
          Highlights the given object iff it is part of a SFC.
protected  void reactOnChangeOfAction()
           
protected  void reactOnChangeOfDeclaration()
           
protected  void setSimulatorActive(boolean active)
           
 void stateChanged(javax.swing.event.ChangeEvent e)
           
protected  int toggleMode()
           
protected  int toggleMode(int newMode)
           
 void updateWindow()
          Updates the editors components.
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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

BACKGROUND_COLOR

protected static final java.awt.Color BACKGROUND_COLOR

HIGHLIGHT_COLOR

protected static final java.awt.Color HIGHLIGHT_COLOR

SELECTABLE_COLOR

protected static final java.awt.Color SELECTABLE_COLOR
Constructor Detail

Editor

public Editor()
Creates an editor with an 'empty' SFC.


Editor

public Editor(SFC sfc)
Creates an editor with the given SFC.

Method Detail

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

closeSelectedSFC

public void closeSelectedSFC()
Closes the actual selected sfc.


add

public void add(SFC sfc)
Adds the given sfc to this editor in a seperate DrawBoard.


add

public void add(java.lang.String name)
Adds a new sfc under the given name to this editor on a seperate DrawBoard.


add

protected void add(SFC sfc,
                   java.lang.String name)

getExtendedSelectedSFC

protected ESFC getExtendedSelectedSFC()
Return the current selected ESFC of this editor or null if no ESFC is selected.


getSelectedSFC

public SFC getSelectedSFC()
Returns the actual SFC used by the editor or null if no SFC is selected.


setSimulatorActive

protected void setSimulatorActive(boolean active)

getSimulatorActive

protected boolean getSimulatorActive()

updateWindow

public void updateWindow()
Updates the editors components.


getTitledBorder

protected javax.swing.border.TitledBorder getTitledBorder(java.lang.String title)
Returns a titled border with the given name.


evaluateSingleMouseClickOn

protected void evaluateSingleMouseClickOn(int x,
                                          int y)

evaluateMouseDragged

protected void evaluateMouseDragged(int x0,
                                    int y0,
                                    int x1,
                                    int y1)

evaluateMouseMoved

protected boolean evaluateMouseMoved(int x,
                                     int y)

toggleMode

protected int toggleMode(int newMode)

toggleMode

protected int toggleMode()

evaluateKeyTyped

protected void evaluateKeyTyped(char c)

reactOnChangeOfAction

protected void reactOnChangeOfAction()

reactOnChangeOfDeclaration

protected void reactOnChangeOfDeclaration()

highlight

public void highlight(java.lang.Object object)
Highlights the given object iff it is part of a SFC. Actually the object may be a step or a transition.


deHighlight

public void deHighlight(java.lang.Object object)
Removes highlight effect from the given object.


getItemFromList

public Absynt getItemFromList(java.util.LinkedList items,
                              java.lang.String message)

getExceptionMessage

protected java.lang.String getExceptionMessage(CheckException ce)