com.jfimagine.jfdraw.gui
Class DrawPane

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

public class DrawPane
extends DrawAdapter

Draw pane class. A main drawing pane with rulers, scrollbars and drawing canvas inside.

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  Ruler m_columnView
          Horizontal and vertical rulers.
protected  DrawCanvas m_drawCanvas
          Drawing Canvas
protected  javax.swing.JScrollPane m_drawScrollPane
           
protected  boolean m_hideRulers
          if hide rulers
protected  boolean m_hideScrollbars
          if hide scrollbars Since rulers are part of this scroll panes, so hide scroll bars would also hide rulers.
protected  DrawFrame m_parentDrawFrame
          parent draw frame
protected  Ruler m_rowView
           
 
Fields inherited from class com.jfimagine.jfdraw.gui.DrawAdapter
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
DrawPane()
          Constructor
DrawPane(boolean initIt)
          Constructor
 
Method Summary
 CanvasFormat getCanvasFormat()
          Get canvas format.
 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.
 JFPageFormat getPageFormat()
          Get page format.
 javax.swing.JScrollPane getScrollPane()
          get current scroll pane.
 void initComponents()
          Init all gui components of this DrawPane.
 boolean isHideGrids()
          if hide grids now
 boolean isHidePopupMenus()
          if hide popupmenus now
 boolean isHideRulers()
          if hide rulers now
 boolean isHideScrollbars()
          if hide scrollbars now
 boolean isUsePageBounds()
          if use page bounds to restrict drawing
protected  DrawCanvas newDrawCanvas()
          to create a new instance of DrawCanvas class
 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
 boolean saveFile(java.lang.String fileName)
          Save current page to a specified file.
 void setCanvasFormat(CanvasFormat canvasFormat)
          Set canvas format.
 void setFileName(java.lang.String fileName)
          set the file name of current opened page.
 void setHideGrids(boolean hideGrids)
          set if hide grids
 void setHidePopupMenus(boolean hidePopupMenus)
          set if hide popupmenus
 void setHideRulers(boolean hideRulers)
          set if hide rulers
 void setHideScrollbars(boolean hideScrollbars)
          set if hide scrollbars
 void setIsMetric(boolean isMetric)
          set ruler as metric or english measurement.
 void setPageFormat(java.awt.print.PageFormat pageFormat)
          Set page format.
 void setUsePageBounds(boolean usePageBounds)
          set if use page bounds to restrict drawing
 void setZoomScale(double zoomScale)
          set zoom scale
 
Methods inherited from class com.jfimagine.jfdraw.gui.DrawAdapter
actionPerformed, addGraphEventListener, closeAllWindows, fireAction, fireGraphEvent, focusWindowByTitle, getDesktop, removeGraphEventListener, setDefaultFrameParameters, setLayerName
 
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

m_columnView

protected Ruler m_columnView
Horizontal and vertical rulers.


m_rowView

protected Ruler m_rowView

m_drawCanvas

protected DrawCanvas m_drawCanvas
Drawing Canvas


m_parentDrawFrame

protected DrawFrame m_parentDrawFrame
parent draw frame


m_drawScrollPane

protected javax.swing.JScrollPane m_drawScrollPane

m_hideRulers

protected boolean m_hideRulers
if hide rulers


m_hideScrollbars

protected boolean m_hideScrollbars
if hide scrollbars Since rulers are part of this scroll panes, so hide scroll bars would also hide rulers.

Constructor Detail

DrawPane

public DrawPane()
Constructor


DrawPane

public DrawPane(boolean initIt)
Constructor

Parameters:
initIt - True if initiate components, false otherwise. If you use false here to avoid initiating components when constructing, you need to call initComponents immediately.
Method Detail

isHideRulers

public boolean isHideRulers()
if hide rulers now


setHideRulers

public void setHideRulers(boolean hideRulers)
set if hide rulers


isHideScrollbars

public boolean isHideScrollbars()
if hide scrollbars now


setHideScrollbars

public void setHideScrollbars(boolean hideScrollbars)
set if hide scrollbars


isHideGrids

public boolean isHideGrids()
if hide grids now


setHideGrids

public void setHideGrids(boolean hideGrids)
set if hide grids


isHidePopupMenus

public boolean isHidePopupMenus()
if hide popupmenus now


setHidePopupMenus

public void setHidePopupMenus(boolean hidePopupMenus)
set if hide popupmenus


isUsePageBounds

public boolean isUsePageBounds()
if use page bounds to restrict drawing


setUsePageBounds

public void setUsePageBounds(boolean usePageBounds)
set if use page bounds to restrict drawing


initComponents

public void initComponents()
Init all gui components of this DrawPane.


newDrawCanvas

protected DrawCanvas newDrawCanvas()
to create a new instance of DrawCanvas class

Returns:
A new DrawCanvas object.

getDrawCanvas

public DrawCanvas getDrawCanvas()
get current Drawing Canvas

Overrides:
getDrawCanvas in class DrawAdapter
Returns:
Current drawing canvas.

getScrollPane

public javax.swing.JScrollPane getScrollPane()
get current scroll pane.


setZoomScale

public void setZoomScale(double zoomScale)
set zoom scale

Parameters:
zoomScale - A new zoom scale.

setIsMetric

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

Overrides:
setIsMetric in class DrawAdapter
Parameters:
isMetric - True if is metric, false english.

getIsMetric

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

Overrides:
getIsMetric in class DrawAdapter
Returns:
True if is metric, false english.

getPageFormat

public JFPageFormat getPageFormat()
Get page format.

Returns:
The page format.

setPageFormat

public void setPageFormat(java.awt.print.PageFormat pageFormat)
Set page format.

Parameters:
pageFormat - A new page format.

getCanvasFormat

public CanvasFormat getCanvasFormat()
Get canvas format.

Returns:
The canvas format.

setCanvasFormat

public void setCanvasFormat(CanvasFormat canvasFormat)
Set canvas format.

Parameters:
canvasFormat - A new canvas format.

newFile

public void newFile()
new file operation. This operation should generate a new drawing page.

Overrides:
newFile in class DrawAdapter

openFile

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

Overrides:
openFile in class DrawAdapter
Parameters:
fileName - A spcified file name

saveFile

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

Overrides:
saveFile in class DrawAdapter
Parameters:
fileName - A file to be saved into.

getFileName

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

Overrides:
getFileName in class DrawAdapter
Returns:
the file name

setFileName

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

Overrides:
setFileName in class DrawAdapter
Parameters:
fileName - A new file name

notifyObjectSelected

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

Overrides:
notifyObjectSelected in class DrawAdapter
Parameters:
objList - A new selected object list.


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