com.jfimagine.jfdraw.gui
Class DrawAdapter

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.jfimagine.jfdraw.gui.DrawAdapter
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
CADPane, DrawPane

public abstract class DrawAdapter
extends javax.swing.JPanel
implements java.awt.event.ActionListener

Draw adapter class. A drawing base class.

Version:
$Revision: 1.1 $
Author:
CookieMaker
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
protected  javax.swing.event.EventListenerList listenerList
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
DrawAdapter()
          Creates a new DrawAdapter with a double buffer and a flow layout.
DrawAdapter(boolean isDoubleBuffered)
          Creates a new DrawAdapter with FlowLayout and the specified buffering strategy.
DrawAdapter(java.awt.LayoutManager layout)
          Create a new buffered DrawAdapter with the specified layout manager
DrawAdapter(java.awt.LayoutManager layout, boolean isDoubleBuffered)
          Creates a new DrawAdapter with the specified layout manager and buffering strategy.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Process actions from menus/buttons.
 void addGraphEventListener(GraphEventListener listener)
           
 void closeAllWindows()
          close all sub windows if this adapter contains internal frames.
 void fireAction(java.lang.String cmd)
          process actions from menus/buttons
 void fireGraphEvent(GraphEvent evt)
           
 void focusWindowByTitle(java.lang.String title)
          Focus window by title
 javax.swing.JDesktopPane getDesktop()
          getter for desktop
 DrawCanvas getDrawCanvas()
          get current Drawing Canvas
 java.lang.String getFileName()
          get the file name of current opened page.
 boolean getIsMetric()
          get if ruler is a metric one.
 void newFile()
          new file operation.
 void notifyObjectSelected(ObjectList objList)
          Notify object selected, tell to do some changes in the drawing framework.
 boolean openFile(java.lang.String fileName)
          open a specified file
 void removeGraphEventListener(GraphEventListener listener)
           
 boolean saveFile(java.lang.String fileName)
          Save current page to a specified file.
 void setDefaultFrameParameters()
          set default frame parameters, e.g.
 void setFileName(java.lang.String fileName)
          set the file name of current opened page.
 void setIsMetric(boolean isMetric)
          set ruler as metric or english measurement.
 void setLayerName(java.lang.String layerName)
          set current layer name of current drawing page.
 
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, paint, 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

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

DrawAdapter

public DrawAdapter(java.awt.LayoutManager layout,
                   boolean isDoubleBuffered)
Creates a new DrawAdapter with the specified layout manager and buffering strategy.

Parameters:
layout - the LayoutManager to use
isDoubleBuffered - a boolean, true for double-buffering, which uses additional memory space to achieve fast, flicker-free updates

DrawAdapter

public DrawAdapter(java.awt.LayoutManager layout)
Create a new buffered DrawAdapter with the specified layout manager

Parameters:
layout - the LayoutManager to use

DrawAdapter

public DrawAdapter(boolean isDoubleBuffered)
Creates a new DrawAdapter with FlowLayout and the specified buffering strategy. If isDoubleBuffered is true, the DrawAdapter will use a double buffer.

Parameters:
isDoubleBuffered - a boolean, true for double-buffering, which uses additional memory space to achieve fast, flicker-free updates

DrawAdapter

public DrawAdapter()
Creates a new DrawAdapter with a double buffer and a flow layout.

Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Process actions from menus/buttons.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - An action event sent by menus/buttons.

notifyObjectSelected

public void notifyObjectSelected(ObjectList objList)
Notify object selected, tell to do some changes in the drawing framework.

Parameters:
objList - A new selected object list.

fireAction

public void fireAction(java.lang.String cmd)
process actions from menus/buttons

Parameters:
cmd - A string command

getDrawCanvas

public DrawCanvas getDrawCanvas()
get current Drawing Canvas

Returns:
Current drawing canvas.

closeAllWindows

public void closeAllWindows()
close all sub windows if this adapter contains internal frames.


focusWindowByTitle

public void focusWindowByTitle(java.lang.String title)
Focus window by title

Parameters:
title - A specified window title.

setDefaultFrameParameters

public void setDefaultFrameParameters()
set default frame parameters, e.g. LayerName, isMetricRuler, etc. If this Draw Adapter pane includes internal frames, here we'll call this default parameters setter as soon as the frame is created.


setLayerName

public void setLayerName(java.lang.String layerName)
set current layer name of current drawing page.

Parameters:
layerName - Current layername

getDesktop

public javax.swing.JDesktopPane getDesktop()
getter for desktop

Returns:
Current desktop pane.

setIsMetric

public void setIsMetric(boolean isMetric)
set ruler as metric or english measurement.

Parameters:
isMetric - True if is metric, false english.

getIsMetric

public boolean getIsMetric()
get if ruler is a metric one.

Returns:
True if is metric, false english.

newFile

public void newFile()
new file operation.


openFile

public boolean openFile(java.lang.String fileName)
open a specified file

Parameters:
fileName - A spcified file name

saveFile

public boolean saveFile(java.lang.String fileName)
Save current page to a specified file.

Parameters:
fileName - A file to be saved into.

getFileName

public java.lang.String getFileName()
get the file name of current opened page.

Returns:
the file name

setFileName

public void setFileName(java.lang.String fileName)
set the file name of current opened page.

Parameters:
fileName - A new file name

addGraphEventListener

public void addGraphEventListener(GraphEventListener listener)

removeGraphEventListener

public void removeGraphEventListener(GraphEventListener listener)

fireGraphEvent

public void fireGraphEvent(GraphEvent evt)


Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All Rights Reserved.