Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jac.ide.diagrams
Class DiagramApplet  view DiagramApplet download DiagramApplet.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byjavax.swing.JApplet
                      extended byjac.ide.diagrams.DiagramApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, jac.aspects.gui.View
Direct Known Subclasses:
DiagramView

public class DiagramApplet
extends javax.swing.JApplet
implements jac.aspects.gui.View


Nested Class Summary
 
Nested classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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
(package private)  ToolButton aspectDefaultTool
           
(package private)  javax.swing.JPanel aspectPalette
           
(package private)  ToolButton classDefaultTool
           
(package private)  javax.swing.JPanel classPalette
           
(package private)  javax.swing.JPanel currentPalette
           
private  javax.swing.JComboBox fArrowChoice
           
private  ToolButton fDefaultToolButton
           
private  Drawing fDrawing
           
private  javax.swing.JComboBox fFillColor
           
private  javax.swing.JComboBox fFontChoice
           
private  javax.swing.JComboBox fFrameColor
           
private static java.lang.String fgDrawPath
           
(package private) static java.lang.String fgUntitled
           
private  Iconkit fIconkit
           
private  ToolButton fSelectedToolButton
           
private  boolean fSimpleUpdate
           
private  java.lang.Thread fSleeper
           
private  StorageFormatManager fStorageFormatManager
           
private  javax.swing.JComboBox fTextColor
           
private  Tool fTool
           
private  javax.swing.JButton fUpdateButton
           
private  DrawingView fView
           
(package private)  ToolButton groupDefaultTool
           
(package private)  javax.swing.JPanel groupPalette
           
static java.lang.String IMAGES
           
(package private)  ToolButton instanceDefaultTool
           
(package private)  javax.swing.JPanel instancePalette
           
private static java.lang.String JACIMAGES
           
private  UndoManager myUndoManager
           
(package private)  jac.ide.Diagram substance
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.applet.Applet
 
Fields inherited from class java.awt.Panel
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DiagramApplet(java.lang.Object substance)
           
 
Method Summary
 void addViewChangeListener(ViewChangeListener vsl)
           
(package private)  void buildAspectBar()
           
(package private)  void buildClassBar()
           
(package private)  void buildGroupBar()
           
(package private)  void buildInstanceBar()
           
 void close()
          This method is called by the system when the view is closed.
protected  void createAttributeChoices(javax.swing.JPanel panel)
          Creates the attribute choices.
protected  javax.swing.JPanel createAttributesPanel()
          Creates the attributes panel.
protected  javax.swing.JPanel createButtonPanel()
          Creates the buttons panel.
protected  void createButtons(javax.swing.JPanel panel)
          Creates the buttons shown in the buttons panel.
protected  javax.swing.JComboBox createColorChoice(java.lang.String attribute)
          Creates the color choice for the given attribute.
protected  Drawing createDrawing()
          Creates the drawing used in this application.
protected  DrawingView createDrawingView()
          Creates the drawing view used in this application.
protected  javax.swing.JComboBox createFontChoice()
          Creates the font choice.
protected  javax.swing.JFileChooser createOpenFileChooser()
           
protected  Tool createSelectionTool()
          Creates the selection tool used in this editor.
 StorageFormatManager createStorageFormatManager()
           
protected  ToolButton createToolButton(java.lang.String iconName, java.lang.String toolName, Tool tool)
          Creates a tool button with the given image, tool, and text
protected  javax.swing.JPanel createToolPalette()
          Creates the tools palette.
protected  void createTools(javax.swing.JPanel palette)
          Creates the tools.
 Drawing drawing()
          Gets the current drawing.
 void figureSelectionChanged(DrawingView view)
          Handles a change of the current selection.
 ClassFigure findClass(jac.ide.Class _class)
           
 Figure findElement(jac.ide.ModelElement element)
           
 Figure findElement(jac.ide.TypedElement te)
           
 jac.aspects.gui.View getParentView()
          Returns the parent view of this view.
 java.lang.String[] getRequiredVersions()
          Subclasses should override this method to specify to which versions of JHotDraw they are compatible.
 StorageFormatManager getStorageFormatManager()
          Return the StorageFormatManager for this application.The StorageFormatManager is used when storing and restoring Drawing from the file system.
 java.lang.Object getSubstance()
          Get the value of substance.
 UndoManager getUndoManager()
           
protected  VersionControlStrategy getVersionControlStrategy()
           
private  java.lang.String guessType(java.lang.String file)
           
 void init()
          Initializes the applet and creates its contents.
private  void initDrawing()
           
 void load()
           
protected  void loadDrawing(java.lang.String param)
           
 void paletteUserOver(PaletteButton button, boolean inside)
          Handles when the mouse enters or leaves a palette button.
 void paletteUserSelected(PaletteButton button)
          Handles a user selection in the palette.
 void promptOpen()
          Shows a file dialog and opens a drawing.
 void promptSave()
           
private  void readDrawing(java.lang.String filename)
           
private  void readFromObjectInput(java.lang.String filename)
           
private  void readFromStorableInput(java.lang.String filename)
           
 void refreshView()
          Refreshes the whole view.
 void refreshViewItem(jac.core.rtti.FieldItem field, jac.core.rtti.MethodItem method, java.lang.Object[] args)
          Refreshes an item of the current view.
 void removeViewChangeListener(ViewChangeListener vsl)
           
 void save()
           
protected  void saveDrawing(StorageFormat storeFormat, java.lang.String file)
           
protected  void setBufferedDisplayUpdate()
           
 void setFocus(jac.core.rtti.FieldItem field, java.lang.Object extraOption)
          Give the focus to a specified FieldItem.
private  void setSelected(ToolButton button)
           
protected  void setSimpleDisplayUpdate()
           
 void setSubstance(jac.ide.Diagram v)
          Set the value of substance.
private  void setTool(Tool t, java.lang.String name)
           
protected  void setUndoManager(UndoManager newUndoManager)
           
private  void setupAttributes()
           
protected  void showHelp()
          Shows a help page for the applet.
 void showStatus(java.lang.String msg)
          Displays the specified message in the status window if that window exists.
private  void startSleeper()
          *** netscape browser work around ***
private  void stopSleeper()
           
 Tool tool()
          Gets the current tool.
 void toolDone()
          Sets the default tool of the editor.
 DrawingView view()
          Gets the current drawing view.
 DrawingView[] views()
           
 void viewSelectionChanged(DrawingView oldView, DrawingView newView)
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getPreferredSize, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JACIMAGES

private static final java.lang.String JACIMAGES
See Also:
Constant Field Values

fDrawing

private transient Drawing fDrawing

fTool

private transient Tool fTool

fView

private transient DrawingView fView

fDefaultToolButton

private transient ToolButton fDefaultToolButton

fSelectedToolButton

private transient ToolButton fSelectedToolButton

fSimpleUpdate

private transient boolean fSimpleUpdate

fUpdateButton

private transient javax.swing.JButton fUpdateButton

fFrameColor

private transient javax.swing.JComboBox fFrameColor

fFillColor

private transient javax.swing.JComboBox fFillColor

fTextColor

private transient javax.swing.JComboBox fTextColor

fArrowChoice

private transient javax.swing.JComboBox fArrowChoice

fFontChoice

private transient javax.swing.JComboBox fFontChoice

fSleeper

private transient java.lang.Thread fSleeper

fIconkit

private Iconkit fIconkit

myUndoManager

private transient UndoManager myUndoManager

fgUntitled

static java.lang.String fgUntitled

fgDrawPath

private static final java.lang.String fgDrawPath
See Also:
Constant Field Values

IMAGES

public static final java.lang.String IMAGES
See Also:
Constant Field Values

fStorageFormatManager

private StorageFormatManager fStorageFormatManager

classPalette

javax.swing.JPanel classPalette

aspectPalette

javax.swing.JPanel aspectPalette

instancePalette

javax.swing.JPanel instancePalette

groupPalette

javax.swing.JPanel groupPalette

currentPalette

javax.swing.JPanel currentPalette

classDefaultTool

ToolButton classDefaultTool

aspectDefaultTool

ToolButton aspectDefaultTool

instanceDefaultTool

ToolButton instanceDefaultTool

groupDefaultTool

ToolButton groupDefaultTool

substance

jac.ide.Diagram substance
Constructor Detail

DiagramApplet

public DiagramApplet(java.lang.Object substance)
Method Detail

getParentView

public jac.aspects.gui.View getParentView()
Description copied from interface: jac.aspects.gui.View
Returns the parent view of this view.

The parent view is generally a view that aggregates (or contains) the current view. If the current view is not contained in any other view, then the parent view is null.

Specified by:
getParentView in interface jac.aspects.gui.View

refreshViewItem

public void refreshViewItem(jac.core.rtti.FieldItem field,
                            jac.core.rtti.MethodItem method,
                            java.lang.Object[] args)
Description copied from interface: jac.aspects.gui.View
Refreshes an item of the current view.

This method is automatically called by ViewControlWrapper when the substance state that corresponds to the given field item changes.

Specified by:
refreshViewItem in interface jac.aspects.gui.View

refreshView

public void refreshView()
Description copied from interface: jac.aspects.gui.View
Refreshes the whole view.

Specified by:
refreshView in interface jac.aspects.gui.View

close

public void close()
Description copied from interface: jac.aspects.gui.View
This method is called by the system when the view is closed.

Specified by:
close in interface jac.aspects.gui.View

setFocus

public void setFocus(jac.core.rtti.FieldItem field,
                     java.lang.Object extraOption)
Description copied from interface: jac.aspects.gui.View
Give the focus to a specified FieldItem.

Specified by:
setFocus in interface jac.aspects.gui.View

getSubstance

public java.lang.Object getSubstance()
Get the value of substance.

Specified by:
getSubstance in interface jac.aspects.gui.View

setSubstance

public void setSubstance(jac.ide.Diagram v)
Set the value of substance.


findClass

public ClassFigure findClass(jac.ide.Class _class)

findElement

public Figure findElement(jac.ide.TypedElement te)

findElement

public Figure findElement(jac.ide.ModelElement element)

init

public void init()
Initializes the applet and creates its contents.


addViewChangeListener

public void addViewChangeListener(ViewChangeListener vsl)

removeViewChangeListener

public void removeViewChangeListener(ViewChangeListener vsl)

getStorageFormatManager

public StorageFormatManager getStorageFormatManager()
Return the StorageFormatManager for this application.The StorageFormatManager is used when storing and restoring Drawing from the file system.


createStorageFormatManager

public StorageFormatManager createStorageFormatManager()

createAttributesPanel

protected javax.swing.JPanel createAttributesPanel()
Creates the attributes panel.


createAttributeChoices

protected void createAttributeChoices(javax.swing.JPanel panel)
Creates the attribute choices. Override to add additional choices.


createColorChoice

protected javax.swing.JComboBox createColorChoice(java.lang.String attribute)
Creates the color choice for the given attribute.


createFontChoice

protected javax.swing.JComboBox createFontChoice()
Creates the font choice. The choice is filled with all the fonts supported by the toolkit.


createButtonPanel

protected javax.swing.JPanel createButtonPanel()
Creates the buttons panel.


buildClassBar

void buildClassBar()

buildAspectBar

void buildAspectBar()

buildInstanceBar

void buildInstanceBar()

buildGroupBar

void buildGroupBar()

createButtons

protected void createButtons(javax.swing.JPanel panel)
Creates the buttons shown in the buttons panel. Override to add additional buttons.


createToolPalette

protected javax.swing.JPanel createToolPalette()
Creates the tools palette.


createTools

protected void createTools(javax.swing.JPanel palette)
Creates the tools. By default only the selection tool is added. Override this method to add additional tools. Call the inherited method to include the selection tool.


createSelectionTool

protected Tool createSelectionTool()
Creates the selection tool used in this editor. Override to use a custom selection tool.


createToolButton

protected ToolButton createToolButton(java.lang.String iconName,
                                      java.lang.String toolName,
                                      Tool tool)
Creates a tool button with the given image, tool, and text


createDrawing

protected Drawing createDrawing()
Creates the drawing used in this application. You need to override this method to use a Drawing subclass in your application. By default a standard Drawing is returned.


createDrawingView

protected DrawingView createDrawingView()
Creates the drawing view used in this application. You need to override this method to use a DrawingView subclass in your application. By default a standard DrawingView is returned.


paletteUserSelected

public void paletteUserSelected(PaletteButton button)
Handles a user selection in the palette.


paletteUserOver

public void paletteUserOver(PaletteButton button,
                            boolean inside)
Handles when the mouse enters or leaves a palette button.


drawing

public Drawing drawing()
Gets the current drawing.


tool

public Tool tool()
Gets the current tool.


view

public DrawingView view()
Gets the current drawing view.


views

public DrawingView[] views()

toolDone

public void toolDone()
Sets the default tool of the editor.


figureSelectionChanged

public void figureSelectionChanged(DrawingView view)
Handles a change of the current selection. Updates all menu items that are selection sensitive.


viewSelectionChanged

public void viewSelectionChanged(DrawingView oldView,
                                 DrawingView newView)

initDrawing

private void initDrawing()

setTool

private void setTool(Tool t,
                     java.lang.String name)

setSelected

private void setSelected(ToolButton button)

loadDrawing

protected void loadDrawing(java.lang.String param)

readDrawing

private void readDrawing(java.lang.String filename)

readFromStorableInput

private void readFromStorableInput(java.lang.String filename)

readFromObjectInput

private void readFromObjectInput(java.lang.String filename)

guessType

private java.lang.String guessType(java.lang.String file)

setupAttributes

private void setupAttributes()

setSimpleDisplayUpdate

protected void setSimpleDisplayUpdate()

setBufferedDisplayUpdate

protected void setBufferedDisplayUpdate()

showHelp

protected void showHelp()
Shows a help page for the applet. The URL of the help page is derived as follows: codeBase+appletClassname+Help.html"


setUndoManager

protected void setUndoManager(UndoManager newUndoManager)

getUndoManager

public UndoManager getUndoManager()

getVersionControlStrategy

protected VersionControlStrategy getVersionControlStrategy()

getRequiredVersions

public java.lang.String[] getRequiredVersions()
Subclasses should override this method to specify to which versions of JHotDraw they are compatible. A string array is returned so it is possible to specify several version numbers of JHotDraw to which the application is compatible with.


startSleeper

private void startSleeper()
*** netscape browser work around ***


stopSleeper

private void stopSleeper()

save

public void save()

load

public void load()

promptOpen

public void promptOpen()
Shows a file dialog and opens a drawing.


promptSave

public void promptSave()

saveDrawing

protected void saveDrawing(StorageFormat storeFormat,
                           java.lang.String file)

createOpenFileChooser

protected javax.swing.JFileChooser createOpenFileChooser()

showStatus

public void showStatus(java.lang.String msg)
Description copied from class: java.applet.Applet
Displays the specified message in the status window if that window exists.