Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt.ui
Class PEDrawingBoard

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      jpicedt.ui.PEDrawingBoard

All Implemented Interfaces:
  Accessible, ImageObserver, MenuContainer, Serializable

public class PEDrawingBoard
extends JPanel

A drawing board based on jpicedt.graphic.PECanvas, with an embeded scrollpane, and some I/O facilities (saving and loading) which PECanvas doesn't have.
There are two accessors two retrieve the embedded canvas and scrollpane.

Since:
  jPicEdt
Author:
  Sylvain Reynal
See Also:
  Serialized Form

Nested Class Summary
`class` | `PEDrawingBoard.GridZoomToolBar` A toolbar that allows the user to change the grid and zoom properties
`class` | `PEDrawingBoard.StatusBar` jpicedt's Status Bar

Nested classes inherited from class javax.swing.JPanel
`JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy`

Field Summary

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
`PEDrawingBoard(int untitledIndex, double zoom, PageFormat pageFormat, Grid grid, ContentType contentType)` create a new empty drawing board with a (localized) "untitled" title
`PEDrawingBoard(int untitledIndex, Properties preferences)` create a new empty drawing board with a (localized) "untitled" title Init zoom, pageFormat, contentType and undoableLimit from the given Properties, using : - key = PECanvas.KEY_ZOOM, value = a double - key = PageFormat.KEY_PAGE_FORMAT (see jpicedt.graphic.PageFormat for details) - key = PECanvas.KEY_CONTENT_TYPE, value = path of ContentType class (e.g.
`PEDrawingBoard(String path, double zoom, PageFormat pageFormat, Grid grid, ContentType contentType, Parser parser)` create a new drawing board pre-loaded from the given path ; set title from this path.
`PEDrawingBoard(String path, Properties preferences, Parser parser)` create a new drawing board pre-loaded from the given path ; set title from this path.

Method Summary
`PECanvas` | `getCanvas()`
`PopupMenuFactory` | `getPopupMenuFactory()`
`PEScrollPane` | `getScrollPane()`
`PEDrawingBoard.StatusBar` | `getStatusBar()` Return the status bar
`String` | `getTitle()`
`void` | `insert(String path, Parser parser)` Insert new content from the given path into this board's drawing
`boolean` | `isDirty()`
`boolean` | `isSaved()`
`void` | `load(String path, Parser parser)` Load this board's content from the given path
`void` | `reload(Parser parser)` Reload the content of this board from its current file name if applicable ; do nothing otherwise.
`boolean` | `save(boolean alwaysPrompt)` Save drawing content to disk.
`void` | `save(String fileName, boolean selectionOnly)` Save drawing or selection content the given file.
`boolean` | `saveFragment()` save the selection content to the "fragment directory" on disk, prompting user for a file name
`void` | `setDirty(boolean dirty)` mark this board as being dirty
`void` | `setPopupMenuFactory(PopupMenuFactory factory)` Set the PopupMenuFactory that produces JPopupMenu when a popup-trigger mouse event occurs on the board.

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`

Constructor Detail

### PEDrawingBoard

    public PEDrawingBoard(int untitledIndex,
                          double zoom,
                          PageFormat pageFormat,
                          Grid grid,
                          ContentType contentType)

  create a new empty drawing board with a (localized) "untitled" title

Parameters:
  `untitledIndex` - index appended to "untitled", e.g. "Untitled 2"
Since:
  jPicEdt

### PEDrawingBoard

    public PEDrawingBoard(String path,
                          double zoom,
                          PageFormat pageFormat,
                          Grid grid,
                          ContentType contentType,
                          Parser parser)

  create a new drawing board pre-loaded from the given path ; set title from this path.

Since:
  jPicEdt

### PEDrawingBoard

    public PEDrawingBoard(int untitledIndex,
                          Properties preferences)

  create a new empty drawing board with a (localized) "untitled" title Init zoom, pageFormat, contentType and undoableLimit from the given Properties, using : - key = PECanvas.KEY_ZOOM, value = a double - key = PageFormat.KEY_PAGE_FORMAT (see jpicedt.graphic.PageFormat for details) - key = PECanvas.KEY_CONTENT_TYPE, value = path of ContentType class (e.g. "jpicedt.format.latex.ContentType") - key = PECanvas.KEY_UNDOABLE_STEPS, value = nb of undoable events to remember suitable for instanciation by Class.forName("xxx").newInstance(). "preferences" is also used to init the ContentType, if non-null.

Parameters:
  `untitledIndex` - index appended to "untitled", e.g. "Untitled 2"
Since:
  jPicEdt

### PEDrawingBoard

    public PEDrawingBoard(String path,
                          Properties preferences,
                          Parser parser)

  create a new drawing board pre-loaded from the given path ; set title from this path. Init zoom, pageFormat and contentType from the given Properties, using : - key = PECanvas.KEY_ZOOM, value = a double - key = PageFormat.KEY_PAGE_FORMAT (see jpicedt.graphic.PageFormat for details) - key = PECanvas.KEY_CONTENT_TYPE, value = path of ContentType class (e.g. "jpicedt.format.latex.ContentType") suitable for instanciation by Class.forName("xxx").newInstance(). "preferences" is also used to init the ContentType, if non-null.

Since:
  jPicEdt

Method Detail

### setPopupMenuFactory

    public void setPopupMenuFactory(PopupMenuFactory factory)

  Set the PopupMenuFactory that produces JPopupMenu when a popup-trigger mouse event occurs on the board.

### getPopupMenuFactory

    public PopupMenuFactory getPopupMenuFactory()

  Returns:
    the PopupMenuFactory that produces JPopupMenu when a popup-trigger mouse event occurs on the board.

### getCanvas

    public PECanvas getCanvas()

### getScrollPane

    public PEScrollPane getScrollPane()

### isSaved

    public boolean isSaved()

  Returns:
    whether this board has been already saved to disk (even if it's been modified since then) This is just a convenience to know if a file path is attached to this board or not.

### isDirty

    public boolean isDirty()

  Returns:
    whether this board has been modified since the last time it was saved or created

    This signal that this board need to be saved during "save", "save all",... actions.

### setDirty

    public void setDirty(boolean dirty)

  mark this board as being dirty

### getTitle

    public String getTitle()

  Returns:
    this board's title, e.g. used as the title of the hosting frame
  Since:
    jPicEdt

### save

    public boolean save(boolean alwaysPrompt)

  Save drawing content to disk.

  if alwaysPrompt is false, save to disk using the current title ; prompt user if it's null, ie this board has never been saved.
  if alwaysPrompt is true, prompt user for a file name (aka "save as...") in any case.

  Returns:
    false if operation was cancelled by user or an I/O error occured

### saveFragment

    public boolean saveFragment()

  save the selection content to the "fragment directory" on disk, prompting user for a file name

  Returns:
    false if operation was cancelled by user or I/O error occured

### save

    public void save(String fileName,
                     boolean selectionOnly)
              throws IOException

  Save drawing or selection content the given file.

  Parameters:
    `fileName` - name of file to save content to
    `selectionOnly` - whether to save the content of the selection or that of the whole the drawing
  Throws:
    `IOException`

### load

    public void load(String path,
                     Parser parser)

  Load this board's content from the given path

  Since:
    jPicEdt

### insert

    public void insert(String path,
                       Parser parser)

  Insert new content from the given path into this board's drawing

  Since:
    jPicEdt

### reload

    public void reload(Parser parser)

  Reload the content of this board from its current file name if applicable ; do nothing otherwise. [pending] should raise an exception in the latter case

  Since:
    jPicEdt

### getStatusBar

    public PEDrawingBoard.StatusBar getStatusBar()

  Return the status bar

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org