|
|||||||||
Home >> All >> jpicedt >> [ graphic overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
jpicedt.graphic
Class PECanvas

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jpicedt.graphic.PECanvas
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable
- public class PECanvas
- extends javax.swing.JPanel
- implements javax.swing.Scrollable
- extends javax.swing.JPanel
This is a JComponent on which graphic elements are drawn. It's has an underlying model (a Drawing) to represent the content, an EditorKit to manipulate the content, and a View responsible for rendering the content. EditorKit, Drawing, and View's are pluggable : the EditorKit is responsible for creating 1) a default Drawing and 2) a ViewFactory that will populate the View tree associated with the Drawing, by attaching a View to each element in the model.
Depending on the content type this Component is loaded with, it may plug a new EditorKit on-the-fly that's suited for the given content type (e.g. LaTeX, Postscript, SVG-XML, etc...).
Model to View/View to Model
Graphic objects are stored (e.g. in a Drawing) in natural coordinates, i.e. LaTeX/Postscript/... coordinates, using e.g. a "1 mm" unitlength : that's what we call "model coordinate". Obviously, we've to translate these coordinates to screen coordinates (e.g. JViewport-coordinate or JPanel-coordinate) before rendering, and this is done very simply by using an AffineTransform and adding it to the current Graphic2D context in the body of the "paintComponent" method. The following picture sums up the translation process that takes place b/w model- and view-coordinate.
The benefits of such an approach is to make it easy for someone willing to develop a parser/formater to handle objects coordinates with the fewest possible overhead, since objects coordinates are "natively" available in natural (i.e. from left to right and from bottom to top) coordinates, and this is perfectly suited for formatting language like LaTeX, Postscript or SVG-XML. Besides, this makes sense with the grid ticks marks.
Margins are encapsulated in a PageFormat (an inner class) object. Contrary to previous jpicedt releases, it's no longer necessary, as of jpicedt 1.3.2, to provide formater methods with the ptOrg parameter.
In addition to the standard behaviour inherited from JPanel, PropertyChangeEvent's are triggered when :
- changing the page format ;
- changing the zoom factor ;
- changing the editor kit ;
- Since:
- PicEdt 1.0
Nested Class Summary | |
private class |
PECanvas.PEStateEdit
overriden so as to display our own undo- and redo- presentation names |
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 | |
static java.lang.String |
CONTENT_TYPE_CHANGE
property name for content-type change |
protected ContentType |
contentType
the current content-type for this PECanvas (determines the EditorKit behaviour) |
protected jpicedt.graphic.model.Drawing |
drawing
the model for this canvas |
static java.lang.String |
DRAWING_CHANGE
property name for drawing change |
static java.lang.String |
EDITOR_KIT_CHANGE
property name for editor kit change |
protected jpicedt.graphic.grid.Grid |
grid
the grid attached to this canvas |
static java.lang.String |
KEY_CONTENT_TYPE
key for Properties's content-type value |
static java.lang.String |
KEY_UNDOABLE_STEPS
key for Properties's nb of undoable steps value |
static java.lang.String |
KEY_ZOOM
key for Properties's zoom value |
protected jpicedt.graphic.toolkit.EditorKit |
kit
the current editor kit for this component |
static int |
MAX_UNDOABLE_STEPS_DEFAULT
default undoable events to remember |
protected java.awt.geom.AffineTransform |
model2ViewTransform
the AffineTransform used to translate from model-coordinates to view-coordinates ; gets updated each time either the zoom factor or the page format changes |
private jpicedt.graphic.event.PEMouseInputListener |
mouseInputListener
chained list of PEMouseInputListener's for this component |
protected PageFormat |
pageFormat
pageFormat encapsulates board size and margin data |
private PicPoint |
peMousePoint
tmp. |
static java.lang.String[] |
PREDEFINED_ZOOM_STRINGS
|
static double[] |
PREDEFINED_ZOOMS
|
protected java.awt.RenderingHints |
renderingHints
a Map storing RenderingHints to be applied to the graphic context when rendering the drawing |
private java.awt.Rectangle |
repaintRectangle
|
private double |
scale
the total scale factor, including DPMM and zoom ; updated each time zoom changes |
protected javax.swing.undo.StateEdit |
stateEdit
the UndoableEdit in progress |
private double[] |
tmpCoords
tmp. |
protected javax.swing.undo.UndoableEditSupport |
undoableEditSupport
the UndoableEditSupport delegate for UndoableEditEvent firing |
protected javax.swing.undo.UndoManager |
undoManager
the UndoManager delegate for undo/redo operation |
protected java.awt.geom.AffineTransform |
view2ModelTransform
the AffineTransform used to translate from mouse-coordinates to model-coordinates ; gets updated each time model2ViewTransform changes |
private double |
zoom
the zoom factor ; this determines the zoom factor to be applied to Graphics2D through an AffineTransform |
static double |
ZOOM_DEFAULT
|
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.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 | |
PECanvas(double zoom,
PageFormat pageFormat,
jpicedt.graphic.grid.Grid grid,
ContentType contentType)
Construct a new PECanvas with the default editor-kit and drawing as content storage. |
Method Summary | |
void |
addPEMouseInputListener(jpicedt.graphic.event.PEMouseInputListener l)
Adds the specified mouse listener to receive mouse events from this component. |
void |
addSelectionListener(jpicedt.graphic.event.SelectionListener l)
adds a SelectionListener to the Canvas |
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener l)
Register an UndoableEditListener for the Drawing hosted by this canvas. |
void |
addZoomListener(jpicedt.graphic.event.ZoomListener l)
adds a ZoomListener to the Canvas |
void |
beginUndoableUpdate(java.lang.String presentationName)
Create a new UndoableEdit that holds the current state of the Drawing. |
boolean |
canRedo()
|
boolean |
canUndo()
|
void |
copy()
Copy the content of the current selection to the System's clipboard (after a formatting to text) |
void |
copy(java.awt.datatransfer.Clipboard clipbrd)
Copy the content of the current selection (through a GraphicTransferable) to the System's clipboard (after a formatting to text), AND to the given clipboard if non-null (the latter can be a local clipboard supporting more data-flavors than the system clipboard) |
protected jpicedt.graphic.toolkit.EditorKit |
createDefaultEditorKit()
Creates the default editor kit ( EditorKit ) for when
the component is first created. |
static jpicedt.graphic.toolkit.EditorKit |
createEditorKitForContentType(ContentType contentType)
|
void |
cut()
Cut the content of the current selection to the System clipboard, after formatting to text. |
void |
cut(java.awt.datatransfer.Clipboard clipbrd)
Cut the content of the current selection (through a GraphicTransferable) to the System clipboard, AND to the given ClipBoard if non-null. |
void |
deleteSelection()
remove all selected objects from the drawing |
void |
endUndoableUpdate()
Ends the current UndoableEdit and fire an event to registered listeners. |
protected void |
fireSelectionUpdate(jpicedt.graphic.model.Element[] elements,
jpicedt.graphic.event.SelectionEvent.EventType type)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireSelectionUpdate(jpicedt.graphic.model.Element element,
jpicedt.graphic.event.SelectionEvent.EventType type)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireZoomUpdate(double oldZoom,
double newZoom,
PicPoint ptClick)
Notify all listeners that have registered interest for notification on this event type. |
ContentType |
getContentType()
|
jpicedt.graphic.model.Drawing |
getDrawing()
|
jpicedt.graphic.toolkit.EditorKit |
getEditorKit()
Fetches the currently installed kit for handling content. |
jpicedt.graphic.grid.Grid |
getGrid()
|
java.awt.geom.AffineTransform |
getModelToViewTransform()
|
PageFormat |
getPageFormat()
|
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
java.lang.String |
getRedoPresentationName()
|
java.awt.RenderingHints |
getRenderingHints()
Return the RenderingHints applied to the graphic context when rendering this component |
double |
getScaleFactor()
|
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Return the preferred scrolling amount (in pixels) for the given scrolling direction and orientation when scrolling in large amounts (pages). |
boolean |
getScrollableTracksViewportHeight()
Return true if the height of the scrollable is always equal to the view, where it is displayed, height.In such case, the vertical scrolling should not be performed. |
boolean |
getScrollableTracksViewportWidth()
Return true if the width of the scrollable is always equal to the view, where it is displayed, width (for instance, the text area with the word wrap). |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Return the preferred scrolling amount (in pixels) for the given scrolling direction and orientation when scrolling in small amounts like table lines. |
int |
getSelectionSize()
|
PicPoint |
getSheetOrigin()
|
java.lang.String |
getUndoPresentationName()
|
java.awt.geom.AffineTransform |
getViewToModelTransform()
|
double |
getZoomFactor()
|
static int |
getZoomIndex(double zoom)
utilities to retrieve the index of the given zoom in PREDEFINED_ZOOMS ; this may be used by GUI widgets, e.g. |
void |
groupSelection()
group all selected objects into a new PicGroup and add it to the drawing. |
void |
insert(java.io.Reader reader,
jpicedt.graphic.io.parser.Parser parser)
insert content from a reader into the current drawing |
boolean |
isRequestFocusEnabled()
Overriden from JComponent Signals that this component can receive focus (useful for handling keyevents) |
boolean |
isSelected(jpicedt.graphic.model.Element e)
|
PicPoint |
modelToView(PicPoint src,
PicPoint dst)
Converts a point from the model-coordinate system to the pixel-coordinate system. |
java.awt.Shape |
modelToView(java.awt.Shape src)
Converts a Shape from the model-coordinate system to the pixel-coordinate system. |
void |
paintComponent(java.awt.Graphics g)
paintComponent(Graphics g) is called by AWTEventDispatchThread via "paint(g)" it's absolutely necessary to call super.paintComponent(g) so that the background gets properly painted (PECanvas is opaque) |
void |
paste(boolean translate)
Add the content of the System's ClipBoard to the current drawing, then select it. |
void |
paste(java.awt.datatransfer.Clipboard clipbrd,
boolean translate)
Add the content of the given ClipBoard to the current drawing, then select it. |
protected void |
processMouseEvent(java.awt.event.MouseEvent e)
Processes mouse events occurring on this component by dispatching them to any registered PEMouseListener objects. |
protected void |
processMouseMotionEvent(java.awt.event.MouseEvent e)
Processes mouse motion events occurring on this component by dispatching them to any registered PEMouseInputListener objects. |
void |
read(java.io.Reader reader,
jpicedt.graphic.io.parser.Parser parser)
read drawing content from a reader and erase old one. |
void |
redo()
Redo last change [underway] |
void |
removePEMouseInputListener(jpicedt.graphic.event.PEMouseInputListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this component. |
void |
removeSelectionListener(jpicedt.graphic.event.SelectionListener l)
removes a SelectionListener from the Canvas |
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
Register an UndoableEditListener for the Drawing hosted by this canvas. |
void |
removeZoomListener(jpicedt.graphic.event.ZoomListener l)
removes a ZoomListener from the Canvas |
void |
repaintFromModelRect(java.awt.geom.Rectangle2D rect)
add the given rectangle, given in model-coordinates, to the list of dirty regions. |
void |
select(java.util.Collection c,
boolean incremental)
select the elements in the given collection (if they belong to the drawing) |
void |
select(jpicedt.graphic.model.Element obj,
boolean incremental)
select the given object |
void |
selectAll(boolean state)
select or unselect every object in this drawing |
java.util.Iterator |
selection()
|
void |
setContentType(ContentType newContentType)
change the current content-type |
void |
setDrawing(jpicedt.graphic.model.Drawing dr)
set the Drawing model for this component. |
void |
setEditorKit(jpicedt.graphic.toolkit.EditorKit kit)
Sets the currently installed kit for handling content. |
void |
setPageFormat(PageFormat pageFormat)
Set the size of the drawing board. |
void |
setUndoLimit(int limit)
set the number of undoable events to remember |
void |
setZoomFactor(double zoom)
Convenience call to setZoomFactor(zoom,null) |
void |
setZoomFactor(double zoom,
PicPoint ptClick)
sets the current zoom factor to the given double, then updates various properties (model <-> view transforms, dimension, preferredSize...), finally, sources a ZoomEvent to give a chance to receiver to update their state accordingly (this may be used e.g. |
void |
undo()
Undo last change [underway] |
void |
unGroup(jpicedt.graphic.model.PicGroup g)
fetch all Element's belonging to the given PicGroup and add them to its parent, removing the given PicGroup from its parent afterward. |
void |
unSelect(jpicedt.graphic.model.Element obj)
unselect the given object |
PicPoint |
view2Model(PicPoint src,
PicPoint dst)
Converts a point from the pixel-coordinate system to the model-coordinate system. |
java.awt.Shape |
viewToModel(java.awt.Shape src)
Converts a Shape from the pixel-coordinate system to the model-coordinate system. |
void |
write(java.io.Writer writer,
boolean writeSelectionOnly)
Write drawing content to the given stream |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
PREDEFINED_ZOOM_STRINGS
public static final java.lang.String[] PREDEFINED_ZOOM_STRINGS
PREDEFINED_ZOOMS
public static final double[] PREDEFINED_ZOOMS
ZOOM_DEFAULT
public static final double ZOOM_DEFAULT
- See Also:
- Constant Field Values
KEY_ZOOM
public static final java.lang.String KEY_ZOOM
- key for Properties's zoom value
- See Also:
- Constant Field Values
KEY_CONTENT_TYPE
public static final java.lang.String KEY_CONTENT_TYPE
- key for Properties's content-type value
- See Also:
- Constant Field Values
KEY_UNDOABLE_STEPS
public static final java.lang.String KEY_UNDOABLE_STEPS
- key for Properties's nb of undoable steps value
- See Also:
- Constant Field Values
MAX_UNDOABLE_STEPS_DEFAULT
public static final int MAX_UNDOABLE_STEPS_DEFAULT
- default undoable events to remember
- See Also:
- Constant Field Values
DRAWING_CHANGE
public static final java.lang.String DRAWING_CHANGE
- property name for drawing change
- See Also:
- Constant Field Values
EDITOR_KIT_CHANGE
public static final java.lang.String EDITOR_KIT_CHANGE
- property name for editor kit change
- See Also:
- Constant Field Values
CONTENT_TYPE_CHANGE
public static final java.lang.String CONTENT_TYPE_CHANGE
- property name for content-type change
- See Also:
- Constant Field Values
drawing
protected jpicedt.graphic.model.Drawing drawing
- the model for this canvas
pageFormat
protected PageFormat pageFormat
- pageFormat encapsulates board size and margin data
contentType
protected ContentType contentType
- the current content-type for this PECanvas (determines the EditorKit behaviour)
model2ViewTransform
protected java.awt.geom.AffineTransform model2ViewTransform
- the AffineTransform used to translate from model-coordinates to view-coordinates ;
gets updated each time either the zoom factor or the page format changes
view2ModelTransform
protected java.awt.geom.AffineTransform view2ModelTransform
- the AffineTransform used to translate from mouse-coordinates to model-coordinates ;
gets updated each time model2ViewTransform changes
grid
protected jpicedt.graphic.grid.Grid grid
- the grid attached to this canvas
kit
protected jpicedt.graphic.toolkit.EditorKit kit
- the current editor kit for this component
undoableEditSupport
protected javax.swing.undo.UndoableEditSupport undoableEditSupport
- the UndoableEditSupport delegate for UndoableEditEvent firing
undoManager
protected javax.swing.undo.UndoManager undoManager
- the UndoManager delegate for undo/redo operation
stateEdit
protected javax.swing.undo.StateEdit stateEdit
- the UndoableEdit in progress
renderingHints
protected java.awt.RenderingHints renderingHints
- a Map storing RenderingHints to be applied to the graphic context when rendering the drawing
zoom
private double zoom
- the zoom factor ; this determines the zoom factor to be applied to Graphics2D through an AffineTransform
scale
private double scale
- the total scale factor, including DPMM and zoom ; updated each time zoom changes
mouseInputListener
private jpicedt.graphic.event.PEMouseInputListener mouseInputListener
- chained list of PEMouseInputListener's for this component
peMousePoint
private PicPoint peMousePoint
- tmp. buffer used by processMouseEvent
tmpCoords
private double[] tmpCoords
- tmp. buffer used by repaintFromModelRect
repaintRectangle
private java.awt.Rectangle repaintRectangle
Constructor Detail |
PECanvas
public PECanvas(double zoom, PageFormat pageFormat, jpicedt.graphic.grid.Grid grid, ContentType contentType)
- Construct a new PECanvas with the default editor-kit and drawing as content storage.
- Since:
- PicEdt 1.0
Method Detail |
paintComponent
public void paintComponent(java.awt.Graphics g)
- paintComponent(Graphics g) is called by AWTEventDispatchThread via "paint(g)"
it's absolutely necessary to call super.paintComponent(g) so that the background gets properly painted (PECanvas is opaque)
repaintFromModelRect
public void repaintFromModelRect(java.awt.geom.Rectangle2D rect)
- add the given rectangle, given in model-coordinates, to the list of dirty regions.
getRenderingHints
public java.awt.RenderingHints getRenderingHints()
- Return the RenderingHints applied to the graphic context when rendering this component
getDrawing
public jpicedt.graphic.model.Drawing getDrawing()
setDrawing
public void setDrawing(jpicedt.graphic.model.Drawing dr)
- set the Drawing model for this component. The currently registered EditorKit is
used to build a viewtree for the drawing. A PropertyChange event (DRAWING_CHANGE) is sent
to each listener.
getEditorKit
public jpicedt.graphic.toolkit.EditorKit getEditorKit()
- Fetches the currently installed kit for handling content.
createDefaultEditorKit
is called to set up a default, if no kit is currently installed.- Since:
- jPicEdt 1.3.2
createDefaultEditorKit
protected jpicedt.graphic.toolkit.EditorKit createDefaultEditorKit()
- Creates the default editor kit (
EditorKit
) for when the component is first created.
createEditorKitForContentType
public static jpicedt.graphic.toolkit.EditorKit createEditorKitForContentType(ContentType contentType)
setEditorKit
public void setEditorKit(jpicedt.graphic.toolkit.EditorKit kit)
- Sets the currently installed kit for handling content. This is the bound property that
establishes the content type of the editor. Any old kit is first deinstalled, then if kit is
non-
null
, the new kit is installed.A default drawing is created from it if there was no drawing set in this canvas before, otherwise the old drawing is reused : in both cases,
setDrawing
is called, but this allows the caller to change the ContentType w/o changing the Drawing if it deems it unnecessary (otherwise, it may call setDrawing() afterwards). APropertyChange
event (EDITOR_KIT_CHANGE) is always fired whensetEditorKit
is called.
getContentType
public ContentType getContentType()
setContentType
public void setContentType(ContentType newContentType)
- change the current content-type
setPageFormat
public void setPageFormat(PageFormat pageFormat)
- Set the size of the drawing board. Length are given in mm (this should approximately
represent true mm on the screen, however this might slightly depend on the underlying platform).
This in turn sets the preferred size of the component. .- Since:
- jPicEdt 1.3.2
getPageFormat
public PageFormat getPageFormat()
- Since:
- jPicEdt 1.3.2
getSheetOrigin
public PicPoint getSheetOrigin()
getGrid
public jpicedt.graphic.grid.Grid getGrid()
getModelToViewTransform
public java.awt.geom.AffineTransform getModelToViewTransform()
- Since:
- jPicEdt 1.3.2
getViewToModelTransform
public java.awt.geom.AffineTransform getViewToModelTransform()
- Since:
- jPicEdt 1.3.2
modelToView
public PicPoint modelToView(PicPoint src, PicPoint dst)
- Converts a point from the model-coordinate system to the pixel-coordinate system.
- Since:
- jPicEdt 1.3.2
view2Model
public PicPoint view2Model(PicPoint src, PicPoint dst)
- Converts a point from the pixel-coordinate system to the model-coordinate system.
- Since:
- jPicEdt 1.3.2
modelToView
public java.awt.Shape modelToView(java.awt.Shape src)
- Converts a Shape from the model-coordinate system to the pixel-coordinate system.
- Since:
- jPicEdt 1.3.2
viewToModel
public java.awt.Shape viewToModel(java.awt.Shape src)
- Converts a Shape from the pixel-coordinate system to the model-coordinate system.
- Since:
- jPicEdt 1.3.2
read
public void read(java.io.Reader reader, jpicedt.graphic.io.parser.Parser parser) throws jpicedt.graphic.io.parser.ParserException
- read drawing content from a reader and erase old one. Listener's interested in
DrawingEvent's should register their listener anew (this can be done systematically by
registering a PropertyCHangeListener to this canvas, and waiting for DRAWING_CHANGE events).
insert
public void insert(java.io.Reader reader, jpicedt.graphic.io.parser.Parser parser) throws jpicedt.graphic.io.parser.ParserException
- insert content from a reader into the current drawing
write
public void write(java.io.Writer writer, boolean writeSelectionOnly) throws java.io.IOException
- Write drawing content to the given stream
- Since:
- jPicEdt 1.3.2
setZoomFactor
public void setZoomFactor(double zoom)
- Convenience call to setZoomFactor(zoom,null)
setZoomFactor
public void setZoomFactor(double zoom, PicPoint ptClick)
- sets the current zoom factor to the given double,
then updates various properties (model <-> view transforms, dimension, preferredSize...), finally,
sources a ZoomEvent to give a chance to receiver to update their state accordingly (this may
be used e.g. by a parent scrollpane to update its view port location, or by a GUI widget
to reflect the new zoom value).
getZoomFactor
public double getZoomFactor()
getScaleFactor
public double getScaleFactor()
fireZoomUpdate
protected void fireZoomUpdate(double oldZoom, double newZoom, PicPoint ptClick)
- Notify all listeners that have registered interest for notification on this event type.
addZoomListener
public void addZoomListener(jpicedt.graphic.event.ZoomListener l)
- adds a ZoomListener to the Canvas
removeZoomListener
public void removeZoomListener(jpicedt.graphic.event.ZoomListener l)
- removes a ZoomListener from the Canvas
getZoomIndex
public static int getZoomIndex(double zoom)
- utilities to retrieve the index of the given zoom in PREDEFINED_ZOOMS ; this may be used by GUI widgets,
e.g. JComboBox,...
setUndoLimit
public void setUndoLimit(int limit)
- set the number of undoable events to remember
undo
public void undo() throws javax.swing.undo.CannotUndoException
- Undo last change [underway]
- Since:
- PicEdt 1.1.3
redo
public void redo() throws javax.swing.undo.CannotRedoException
- Redo last change [underway]
- Since:
- PicEdt 1.1.3
addUndoableEditListener
public void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
- Register an UndoableEditListener for the Drawing hosted by this canvas.
removeUndoableEditListener
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
- Register an UndoableEditListener for the Drawing hosted by this canvas.
beginUndoableUpdate
public void beginUndoableUpdate(java.lang.String presentationName)
- Create a new UndoableEdit that holds the current state of the Drawing.
endUndoableUpdate
public void endUndoableUpdate()
- Ends the current UndoableEdit and fire an event to registered listeners.
canRedo
public boolean canRedo()
canUndo
public boolean canUndo()
getRedoPresentationName
public java.lang.String getRedoPresentationName()
getUndoPresentationName
public java.lang.String getUndoPresentationName()
selection
public java.util.Iterator selection()
getSelectionSize
public int getSelectionSize()
isSelected
public boolean isSelected(jpicedt.graphic.model.Element e)
selectAll
public void selectAll(boolean state)
- select or unselect every object in this drawing
select
public void select(java.util.Collection c, boolean incremental)
- select the elements in the given collection (if they belong to the drawing)
select
public void select(jpicedt.graphic.model.Element obj, boolean incremental)
- select the given object
unSelect
public void unSelect(jpicedt.graphic.model.Element obj)
- unselect the given object
deleteSelection
public void deleteSelection()
- remove all selected objects from the drawing
paste
public void paste(java.awt.datatransfer.Clipboard clipbrd, boolean translate) throws jpicedt.graphic.io.parser.ParserException, java.io.IOException, java.awt.datatransfer.UnsupportedFlavorException
- Add the content of the given ClipBoard to the current drawing, then select it.
If only DataFlavor.stringFlavor is provided by the Transferable,
we try to parse the string and insert the parsed content. Otherwise, it's taken for granted
that the ClipBoard content support the jpicedt.graphic.toolkit.TransferableGraphic.JPICEDT_DATA_FLAVOR
data flavor.
paste
public void paste(boolean translate) throws jpicedt.graphic.io.parser.ParserException, java.io.IOException, java.awt.datatransfer.UnsupportedFlavorException
- Add the content of the System's ClipBoard to the current drawing, then select it.
More specifically, we try to parse the string and insert the parsed content.
copy
public void copy(java.awt.datatransfer.Clipboard clipbrd)
- Copy the content of the current selection (through a GraphicTransferable) to the
System's clipboard (after a formatting to text), AND to the given clipboard if non-null
(the latter can be a local clipboard supporting more data-flavors than the system clipboard)
copy
public void copy()
- Copy the content of the current selection to the
System's clipboard (after a formatting to text)
cut
public void cut(java.awt.datatransfer.Clipboard clipbrd)
- Cut the content of the current selection (through a GraphicTransferable) to the
System clipboard, AND to the given ClipBoard if non-null.
cut
public void cut()
- Cut the content of the current selection to the System clipboard, after formatting to text.
groupSelection
public void groupSelection()
- group all selected objects into a new PicGroup and add it to the drawing.
- Since:
- jPicEdt 1.2.a
unGroup
public void unGroup(jpicedt.graphic.model.PicGroup g)
- fetch all Element's belonging to the given PicGroup and add them to
its parent, removing the given PicGroup from its parent afterward.
fireSelectionUpdate
protected void fireSelectionUpdate(jpicedt.graphic.model.Element element, jpicedt.graphic.event.SelectionEvent.EventType type)
- Notify all listeners that have registered interest for notification on this event type.
fireSelectionUpdate
protected void fireSelectionUpdate(jpicedt.graphic.model.Element[] elements, jpicedt.graphic.event.SelectionEvent.EventType type)
- Notify all listeners that have registered interest for notification on this event type.
addSelectionListener
public void addSelectionListener(jpicedt.graphic.event.SelectionListener l)
- adds a SelectionListener to the Canvas
removeSelectionListener
public void removeSelectionListener(jpicedt.graphic.event.SelectionListener l)
- removes a SelectionListener from the Canvas
getPreferredScrollableViewportSize
public java.awt.Dimension getPreferredScrollableViewportSize()
- Specified by:
getPreferredScrollableViewportSize
in interfacejavax.swing.Scrollable
getScrollableUnitIncrement
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
- Description copied from interface:
javax.swing.Scrollable
- Return the preferred scrolling amount (in pixels) for the given
scrolling direction and orientation when scrolling in small amounts
like table lines.
- Specified by:
getScrollableUnitIncrement
in interfacejavax.swing.Scrollable
getScrollableBlockIncrement
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
- Description copied from interface:
javax.swing.Scrollable
- Return the preferred scrolling amount (in pixels) for the given
scrolling direction and orientation when scrolling in large amounts
(pages).
- Specified by:
getScrollableBlockIncrement
in interfacejavax.swing.Scrollable
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()
- Description copied from interface:
javax.swing.Scrollable
- Return true if the width of the scrollable is always equal to the
view, where it is displayed, width (for instance, the text area with
the word wrap). In such case, the horizontal scrolling should not be
performed.
- Specified by:
getScrollableTracksViewportWidth
in interfacejavax.swing.Scrollable
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()
- Description copied from interface:
javax.swing.Scrollable
- Return true if the height of the scrollable is always equal to the view,
where it is displayed, height.In such case, the vertical scrolling should
not be performed.
- Specified by:
getScrollableTracksViewportHeight
in interfacejavax.swing.Scrollable
isRequestFocusEnabled
public boolean isRequestFocusEnabled()
- Overriden from JComponent
Signals that this component can receive focus (useful for handling keyevents)
addPEMouseInputListener
public void addPEMouseInputListener(jpicedt.graphic.event.PEMouseInputListener l)
- Adds the specified mouse listener to receive mouse events from this component.
If l is null, no exception is thrown and no action is performed.
removePEMouseInputListener
public void removePEMouseInputListener(jpicedt.graphic.event.PEMouseInputListener l)
- Removes the specified mouse listener so that it no longer
receives mouse events from this component. This method performs
no function, nor does it throw an exception, if the listener
specified by the argument was not previously added to this component.
If l is null, no exception is thrown and no action is performed.
processMouseEvent
protected void processMouseEvent(java.awt.event.MouseEvent e)
- Processes mouse events occurring on this component by
dispatching them to any registered
PEMouseListener
objects.
processMouseMotionEvent
protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
- Processes mouse motion events occurring on this component by
dispatching them to any registered
PEMouseInputListener
objects.
|
|||||||||
Home >> All >> jpicedt >> [ graphic overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |