Class SeqDiagramEditor

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended bySeqDiagramEditor
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants, java.awt.event.WindowListener

public class SeqDiagramEditor
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.awt.event.WindowListener

This class represents the editor for a sequence diagram. It creates the window to draw in and the drawingarea.

Author:
Matilda Östling
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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  javax.swing.JButton actor
           
private  bluej.extensions.BlueJ bluej
           
private  javax.swing.JButton classCancel
           
private  javax.swing.JDialog classdialog
           
private  bluej.extensions.BClass[] classes
           
private  javax.swing.JComboBox classList
           
private  javax.swing.JButton classOk
           
private  boolean connectedToBlueJ
           
private  org.w3c.dom.Document document
           
private  DrawingArea drawingArea
           
private  javax.swing.JMenuItem fileMenuItem1
           
private  javax.swing.JMenuItem fileMenuItem2
           
private  javax.swing.JMenuItem fileMenuItem3
           
private  javax.swing.JMenuItem fileMenuItem4
           
private  javax.swing.JMenuItem fileMenuItem5
           
private  javax.swing.JFileChooser fileSaver
           
private  javax.swing.JMenuItem helpMenuItem1
           
private  javax.swing.JMenuItem helpMenuItem2
           
private  javax.swing.JButton message
           
private  javax.swing.JButton noteOK
           
private  javax.swing.JButton notes
           
private  javax.swing.JTextArea noteText
           
private  javax.swing.JButton object
           
private  javax.swing.JCheckBoxMenuItem optionMenuItem1
           
private  javax.swing.JCheckBoxMenuItem optionMenuItem2
           
private  boolean showReturnMessages
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.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 javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SeqDiagramEditor()
          The constructor of the class.
SeqDiagramEditor(bluej.extensions.BlueJ b)
          The constructor of the class which takes an object of the BlueJ-class.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method is called when an event takes place.
private  java.io.File blueJFileSaveChooser()
          This method is called to let the user choose which file to save the current sequence diagram in.
private  java.io.File blueJOpenFileChooser(java.io.File currDir)
          This method is called to let the user choose what file to open when the editor is in BlueJ-mode.
private  void chooseClass(bluej.extensions.BPackage pack)
          This method is used when the user wants to add a new object to the sequence diagram and the editor is connected to a BlueJ-project.
private  boolean closeAndExit()
          This method is called when the user wants to close a sequence diagram or exit the program.
private  void createMenu()
          This method is called to create the menu.
private  void createToolBar()
          This method is called to create the toolbar where the user can choose to create actors, objects and messages.
private  java.io.File fileOpenChooser()
          This method is called to let the user choose what file to open the sequence diagram from.
private  java.io.File fileSaveChooser()
          This method is called to let the user choose what file to save the sequence diagram in.
 boolean getShowReturnMessages()
           
 boolean isConnectedToBlueJ()
           
private  void open()
          This method is called when the user want to open a sequence diagram.
private  void saveAs()
          This method is called when the user wants to save the current sequence diagram but there is still no file.
 void setIsConnectedToBlueJ(boolean b)
           
private  void takeNotes()
          This method is called when the user wants to write some notes about the sequence diagram.
 void windowActivated(java.awt.event.WindowEvent w)
           
 void windowClosed(java.awt.event.WindowEvent w)
          This method is called when the user closes the window.
 void windowClosing(java.awt.event.WindowEvent w)
          This method is called when the user closes the window.
 void windowDeactivated(java.awt.event.WindowEvent w)
           
 void windowDeiconified(java.awt.event.WindowEvent w)
           
 void windowIconified(java.awt.event.WindowEvent w)
           
 void windowOpened(java.awt.event.WindowEvent w)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

actor

private javax.swing.JButton actor

object

private javax.swing.JButton object

message

private javax.swing.JButton message

notes

private javax.swing.JButton notes

classOk

private javax.swing.JButton classOk

classCancel

private javax.swing.JButton classCancel

classdialog

private javax.swing.JDialog classdialog

classList

private javax.swing.JComboBox classList

classes

private bluej.extensions.BClass[] classes

fileMenuItem1

private javax.swing.JMenuItem fileMenuItem1

fileMenuItem2

private javax.swing.JMenuItem fileMenuItem2

fileMenuItem3

private javax.swing.JMenuItem fileMenuItem3

fileMenuItem4

private javax.swing.JMenuItem fileMenuItem4

fileMenuItem5

private javax.swing.JMenuItem fileMenuItem5

optionMenuItem1

private javax.swing.JCheckBoxMenuItem optionMenuItem1

optionMenuItem2

private javax.swing.JCheckBoxMenuItem optionMenuItem2

helpMenuItem1

private javax.swing.JMenuItem helpMenuItem1

helpMenuItem2

private javax.swing.JMenuItem helpMenuItem2

drawingArea

private DrawingArea drawingArea

document

private org.w3c.dom.Document document

bluej

private bluej.extensions.BlueJ bluej

connectedToBlueJ

private boolean connectedToBlueJ

showReturnMessages

private boolean showReturnMessages

fileSaver

private javax.swing.JFileChooser fileSaver

noteText

private javax.swing.JTextArea noteText

noteOK

private javax.swing.JButton noteOK
Constructor Detail

SeqDiagramEditor

public SeqDiagramEditor(bluej.extensions.BlueJ b)
The constructor of the class which takes an object of the BlueJ-class. This constructor is called when the editor i started from BlueJ. Creates the window, menues and the toolbar.

Parameters:
b - The BlueJ object.

SeqDiagramEditor

public SeqDiagramEditor()
The constructor of the class. Creates the window, menues and the toolbar.

Method Detail

createToolBar

private void createToolBar()
This method is called to create the toolbar where the user can choose to create actors, objects and messages. Is called by the constructor.


createMenu

private void createMenu()
This method is called to create the menu. Is called by the constructor.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This method is called when an event takes place. Depending on what the source is the event is handled.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The actionEvent.

takeNotes

private void takeNotes()
This method is called when the user wants to write some notes about the sequence diagram.


chooseClass

private void chooseClass(bluej.extensions.BPackage pack)
This method is used when the user wants to add a new object to the sequence diagram and the editor is connected to a BlueJ-project.

Parameters:
pack - The current open project in BlueJ

blueJFileSaveChooser

private java.io.File blueJFileSaveChooser()
This method is called to let the user choose which file to save the current sequence diagram in. This method is called when the editor is in BlueJ-mode.

Returns:
The file to save the sequence digram in, if the user did not choose a file null is returned.

fileSaveChooser

private java.io.File fileSaveChooser()
This method is called to let the user choose what file to save the sequence diagram in.

Returns:
The file, if the user did not choose a file the method returns null

blueJOpenFileChooser

private java.io.File blueJOpenFileChooser(java.io.File currDir)
This method is called to let the user choose what file to open when the editor is in BlueJ-mode.

Parameters:
currDir - The directory were the file is in
Returns:
The file to open, if the user did not choose a file null is returned

fileOpenChooser

private java.io.File fileOpenChooser()
This method is called to let the user choose what file to open the sequence diagram from.

Returns:
The file, if the user did not choose a file the method returns null

windowClosed

public void windowClosed(java.awt.event.WindowEvent w)
This method is called when the user closes the window.

Specified by:
windowClosed in interface java.awt.event.WindowListener
Parameters:
w - The windowEvent

windowClosing

public void windowClosing(java.awt.event.WindowEvent w)
This method is called when the user closes the window.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
w - The windowEvent

saveAs

private void saveAs()
This method is called when the user wants to save the current sequence diagram but there is still no file. The method asks the user for the file and saves the file.


open

private void open()
This method is called when the user want to open a sequence diagram.


closeAndExit

private boolean closeAndExit()
This method is called when the user wants to close a sequence diagram or exit the program.


isConnectedToBlueJ

public boolean isConnectedToBlueJ()

setIsConnectedToBlueJ

public void setIsConnectedToBlueJ(boolean b)

getShowReturnMessages

public boolean getShowReturnMessages()

windowActivated

public void windowActivated(java.awt.event.WindowEvent w)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent w)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent w)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent w)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent w)
Specified by:
windowOpened in interface java.awt.event.WindowListener