|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel jpicedt.graphic.PECanvas
public class PECanvas
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
Drawing
andViewFactory
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…).
Graphic objects are stored (e.g. in a Drawing
)
in natural coordinates, ie 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 (ie 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 formatter methods with the
ptOrg
parameter.
In addition to the standard behaviour inherited from JPanel
,
PropertyChangeEvent
's are triggered when:
Nested Class Summary | |
---|---|
class |
PECanvas.IconizedTextTooltipDisplayListener
adds a MouseMotionListener to the canvas in order to show
a tooltip on PicText elements |
static class |
PECanvas.SelectionBehavior
|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
CONTENT_TYPE_CHANGE
property name for content-type's change events |
protected ContentType |
contentType
The current content-type for this PECanvas (determines the EditorKit
behaviour). |
static String |
CONVEX_ZONE_SET_CHANGE
nom de la propriété pour les évènement de changement d'ensemble de zones convexes. |
protected ConvexZoneSet |
convexZoneSet
Une liste de zones convexe que l'utilisateur a définies pour éditer le dessins pour cette toile à dessin PECanvas . |
protected Drawing |
drawing
the model for this canvas |
static String |
DRAWING_CHANGE
property name for drawing-change events |
static String |
EDITOR_KIT_CHANGE
property name for editorkit-change events |
protected Grid |
grid
the grid attached to this canvas |
static String |
KEY_CONTENT_TYPE
key for Properties 's content-type value |
static String |
KEY_UNDOABLE_STEPS
key for Properties 's nb of undoable steps value |
static String |
KEY_ZOOM
key for Properties 's zoom value |
protected EditorKit |
kit
the current editor kit for this component |
static int |
MAX_UNDOABLE_STEPS_DEFAULT
default undoable events to remember |
protected 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 |
protected PageFormat |
pageFormat
pageFormat encapsulates board size and margin data |
static double[] |
PREDEFINED_ZOOMS
|
protected RenderingHints |
renderingHints
A Map storing RenderingHints to be applied to the graphic context when rendering the
drawing. |
protected StateEdit |
stateEdit
the UndoableEdit in progress |
protected UndoableEditSupport |
undoableEditSupport
the UndoableEditSupport delegate for UndoableEditEvent firing |
protected UndoManager |
undoManager
the UndoManager delegate for undo/redo operation |
protected AffineTransform |
view2ModelTransform
the AffineTransform used to translate from mouse-coordinates to model-coordinates;
gets updated each time model2ViewTransform changes |
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.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()
Construct a new PECanvas initialized with default values. |
|
PECanvas(double zoom,
PageFormat pageFormat,
Grid grid,
ContentType contentType)
Construct a new PECanvas with the default editor-kit and drawing as content storage. |
Method Summary | |
---|---|
void |
addConvexZone(ConvexZone cz)
|
void |
addPEMouseInputListener(PEMouseInputListener l)
Adds the specified mouse listener to receive mouse events from this component. |
void |
addRotateListener(RotateListener l)
Adds a RotateListener to the Canvas. |
void |
addSelectionListener(SelectionListener l)
Adds a SelectionListener to the Canvas. |
void |
addUndoableEditListener(UndoableEditListener l)
Register an UndoableEditListener for the Drawing hosted by this canvas. |
void |
addZoomListener(ZoomListener l)
Adds a ZoomListener to the Canvas. |
void |
beginUndoableUpdate(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(Clipboard clipbrd)
Copy the content of the current selection (through a TransferableGraphic ) 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 EditorKit |
createDefaultEditorKit(ContentType contentType)
Creates a default editor kit ( EditorKit ) whose factory delegates are initialized from the
given content-type. |
void |
cut()
Cut the content of the current selection to the System clipboard, after formatting to text. |
void |
cut(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 |
deleteConvexZone(ConvexZone cz)
Détruit la zone convexe cz . |
void |
deleteConvexZoneSelection()
Détruit toutes les zones convexe de la selection de zones convexe. |
void |
deleteSelection()
Remove all selected objects from the drawing. |
void |
endUndoableUpdate()
Ends the current UndoableEdit and fire an event to registered listeners. |
protected void |
fireRotateUpdate(double angle)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireSelectionUpdate(ConvexZone cz,
ConvexZoneSelectionEvent.EventType type)
|
protected void |
fireSelectionUpdate(Element[] elements,
SelectionEvent.EventType type)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireSelectionUpdate(Element element,
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()
|
Iterator<ConvexZone> |
getConvexZoneSelection()
|
ConvexZoneSet |
getConvexZoneSet()
|
Drawing |
getDrawing()
|
EditorKit |
getEditorKit()
Fetches the currently installed kit for handling content. |
Grid |
getGrid()
|
AffineTransform |
getModelToViewTransform()
author: Sylvain Reynal |
PageFormat |
getPageFormat()
author: Sylvain Reynal |
Dimension |
getPreferredScrollableViewportSize()
|
String |
getRedoPresentationName()
|
RenderingHints |
getRenderingHints()
Return the RenderingHints applied to the graphic context when rendering this component. |
double |
getScaleFactor()
|
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
SelectionHandler |
getSelectionHandler()
Return a collection of selected elements. |
int |
getSelectionSize()
|
PicPoint |
getSheetOrigin()
|
String |
getUndoPresentationName()
|
AffineTransform |
getViewToModelTransform()
author: Sylvain Reynal |
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(Reader reader,
ExtractionParsing parser,
PicPoint insertionPoint)
Insère du contenu depuis un reader dans le dessin courant. |
boolean |
isRequestFocusEnabled()
Overriden from JComponent Signals that this component can receive focus (useful for handling keyevents) |
boolean |
isSelected(ConvexZone cz)
|
boolean |
isSelected(Element e)
|
void |
joinSelection()
Join all selected objects of type PicMultiCurveConvertable into a new
PicMulticurve and add it to the drawing. |
PicPoint |
modelToView(PicPoint src,
PicPoint dst)
Converts a point from the model-coordinate system to the pixel-coordinate system. |
Shape |
modelToView(Shape src)
Converts a Shape from the model-coordinate system to the pixel-coordinate system. |
void |
paintComponent(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)
This implementation first applies an AffineTransform to the graphic context : this transform maps in
effect model-coordinates to screen-coordinates. |
void |
paste(boolean translate)
Add the content of the System's ClipBoard to the current drawing, then select it. |
void |
paste(Clipboard clipbrd,
PicPoint translate)
Ajout le contenu du presse-papier ( ClipBoard ) passé en argument au dessin courant, et le
sélectionner ensuite. |
protected void |
processMouseEvent(MouseEvent e)
Processes mouse events occurring on this component by dispatching them to any registered PEMouseListener objects. |
protected void |
processMouseMotionEvent(MouseEvent e)
Processes mouse motion events occurring on this component by dispatching them to any registered PEMouseInputListener objects. |
ParsedDrawing |
read(Reader reader,
ExtractionParsing parser)
Read drawing content from a reader and erase old one. |
void |
redo()
Refait le dernier changement. |
void |
refreshPageFormatToBoundingBox()
Refraîchit le format de page de la toile à dessin en fonction de la boîte bornante du dessin sous-jascent. |
void |
removePEMouseInputListener(PEMouseInputListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this component. |
void |
removeSelectionListener(SelectionListener l)
Removes a SelectionListener from the Canvas. |
void |
removeUndoableEditListener(UndoableEditListener l)
Unregister an UndoableEditListener for the Drawing hosted by this canvas. |
void |
removeZoomListener(ZoomListener l)
Removes a ZoomListener from the Canvas. |
void |
repaintFromModelRect(Rectangle2D rect)
Add the given rectangle, given in model-coordinates, to the list of dirty regions. |
void |
select(ConvexZoneGroup czg,
PECanvas.SelectionBehavior beh)
|
void |
select(ConvexZone cz,
PECanvas.SelectionBehavior beh)
|
void |
select(Element obj,
PECanvas.SelectionBehavior beh)
Select the given element. |
void |
selectAll()
Select every object in this drawing. |
void |
selectCollection(Collection<Element> c,
PECanvas.SelectionBehavior beh)
Select the elements in the given collection (if they belong to the drawing). |
Iterator<Element> |
selection()
|
void |
setContentType(ContentType newContentType)
Change the current content-type: this implies plugging a new ViewFactory and a new
FormatterFactory to the currently installed EditorKit, as obtained from the given
newContentType argument. |
void |
setConvexZoneSet(ConvexZoneSet czs)
|
void |
setDrawing(Drawing dr)
Set the Drawing model for this component. |
void |
setEditorKit(EditorKit kit)
Sets the currently installed kit for handling content. |
void |
setMult(double mult)
Règle le pas horizontal et vertical par lequel les éléments sélectionnés sont déplacés par l'action des touches « flèche vers le haut », « flèche vers le bas », « flèche vers la gauche », ou « flèche vers la droite ». |
void |
setPageFormat(PageFormat pageFormat)
Set the size of the drawing board. |
void |
setRotateAngle(double angle)
Sets the angle of the selected element. |
void |
setRotateAngleLabelVisible(boolean b)
Toggle visibility of the angle-textfield. |
void |
setUndoLimit(int limit)
Règle le nombre d'événement défaisable à mémoriser. |
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. by a parent scrollpane to update its view port location, or by a GUI widget to reflect the new zoom value). |
void |
undo()
Défait le dernier changement. |
void |
unSelect(ConvexZone cz)
Unselect the given convex zone. |
void |
unSelect(Element obj)
Unselect the given graphic object. |
void |
unSelectAll()
Unselect every object in this drawing. |
PicPoint |
view2Model(PicPoint src,
PicPoint dst)
Converts a point from the pixel-coordinate system to the model-coordinate system. |
Shape |
viewToModel(Shape src)
Converts a Shape from the pixel-coordinate system to the model-coordinate system. |
void |
write(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 |
---|
public static final double[] PREDEFINED_ZOOMS
public static final double ZOOM_DEFAULT
public static final String KEY_ZOOM
Properties
's zoom value
public static final String KEY_CONTENT_TYPE
Properties
's content-type value
public static final String KEY_UNDOABLE_STEPS
Properties
's nb of undoable steps value
public static final int MAX_UNDOABLE_STEPS_DEFAULT
public static final String DRAWING_CHANGE
public static final String CONVEX_ZONE_SET_CHANGE
public static final String EDITOR_KIT_CHANGE
public static final String CONTENT_TYPE_CHANGE
protected Drawing drawing
protected ConvexZoneSet convexZoneSet
PECanvas
.
protected PageFormat pageFormat
protected ContentType contentType
PECanvas
(determines the EditorKit
behaviour).
protected AffineTransform model2ViewTransform
AffineTransform
used to translate from model-coordinates to view-coordinates; gets
updated each time either the zoom factor or the page format changes
protected AffineTransform view2ModelTransform
AffineTransform
used to translate from mouse-coordinates to model-coordinates;
gets updated each time model2ViewTransform changes
protected Grid grid
protected EditorKit kit
protected UndoableEditSupport undoableEditSupport
UndoableEditSupport
delegate for UndoableEditEvent
firing
protected UndoManager undoManager
UndoManager
delegate for undo/redo operation
protected StateEdit stateEdit
UndoableEdit
in progress
protected RenderingHints renderingHints
RenderingHints
to be applied to the graphic context when rendering the
drawing.
Constructor Detail |
---|
public PECanvas()
PECanvas
initialized with default values.
public PECanvas(double zoom, PageFormat pageFormat, Grid grid, ContentType contentType)
PECanvas
with the default editor-kit and drawing as content storage.
zoom
- initial zoom factorpageFormat
- page format (page size + page margins)grid
- grille d'aimantationcontentType
- (e.g. LaTeX, PsTricks,…) ; this will determine the EditorKit for
editing the Drawing, and indirectly the ViewFactory that produces View's for the drawing,
(since the ViewFactory is obtained through the currently installed EditorKit) and the
FormatterFactory used to write the drawing to a writer.
If null, the default editor-kit/content-type is used.Method Detail |
---|
public void paintComponent(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)
This implementation first applies an AffineTransform to the graphic context : this transform maps in effect model-coordinates to screen-coordinates. Then invokes the paint() method in that order :
Grid
object attached to this PECanvas
;Drawing.RootElement
.EditorKit
in which this PECanvas
is installed.
paintComponent
in class JComponent
public void repaintFromModelRect(Rectangle2D rect)
public RenderingHints getRenderingHints()
RenderingHints
applied to the graphic context when rendering this component.
public Drawing getDrawing()
Drawing
containing only non-selected objectspublic ConvexZoneSet getConvexZoneSet()
ConvexZoneSet
courant défini pour le dessin de
ce PECanvas
.public void addConvexZone(ConvexZone cz)
public void setDrawing(Drawing dr)
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.
public void setConvexZoneSet(ConvexZoneSet czs)
public EditorKit getEditorKit()
protected EditorKit createDefaultEditorKit(ContentType contentType)
EditorKit
) whose factory delegates are initialized from the
given content-type. If an EditorKit was already installed in this PECanvas
, we try to
reuse its properties in the new EditorKit
, if applicable.
contentType
- null if a default content-type should be used
public void setEditorKit(EditorKit kit)
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).
A PropertyChange
event (EDITOR_KIT_CHANGE
) is always fired when
setEditorKit
is called.
kit
- the desired editor behaviorgetEditorKit()
public ContentType getContentType()
public void setContentType(ContentType newContentType)
ViewFactory
and a new
FormatterFactory
to the currently installed EditorKit, as obtained from the given
newContentType
argument.
newContentType
- if null, the DefaultContentType
is installed.public void setPageFormat(PageFormat pageFormat)
public PageFormat getPageFormat()
public PicPoint getSheetOrigin()
public Grid getGrid()
public AffineTransform getModelToViewTransform()
AffineTransform
that represents the maping b/w the model-coordinate system
and the pixel coordinate system. Guaranteed not to change over time.public AffineTransform getViewToModelTransform()
AffineTransform
that represents the maping b/w the pixel-coordinate system
and the model-coordinate system. Guaranteed not to change over time.public PicPoint modelToView(PicPoint src, PicPoint dst)
src
- the source point in model-coordinatedst
- the destination point ; if null, a new point is allocated, and returned for convenience.
public PicPoint view2Model(PicPoint src, PicPoint dst)
src
- the source point in pixel-coordinatedst
- the destination point ; if null, a new point is allocated, and returned for convenience.
public Shape modelToView(Shape src)
src
- a Shape in the model-coordinate system
Shape
corresponding to the given Shape
once transformed to the
pixel-coordinate system.public Shape viewToModel(Shape src)
src
- a Shape in the pixel-coordinate system
public void refreshPageFormatToBoundingBox()
public ParsedDrawing read(Reader reader, ExtractionParsing parser) throws ParserException
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).
reader
- the reader to read content from
ParserException
public void insert(Reader reader, ExtractionParsing parser, PicPoint insertionPoint) throws ParserException
reader
dans le dessin courant.
reader
- le reader
à partir duquel insérer du contenu.insertionPoint
- la position où insérer la fragement. Si null
le fragment est inséré
en (0,0).
ParserException
public void write(Writer writer, boolean writeSelectionOnly) throws IOException
writer
- The writer to write towriteSelectionOnly
- if true, only write selection content
IOException
- on any I/O errorpublic void setZoomFactor(double zoom)
setZoomFactor(zoom,null)
.
public void setZoomFactor(double zoom, PicPoint ptClick)
zoom
- the new zoom factorptClick
- this only makes sense if the parent of this component is aka ScrollPane ;
public double getZoomFactor()
public double getScaleFactor()
model2ViewTransform
. This is usually the product of the current zoom factor, and
the DotPerMilliMeter screen factor.protected void fireZoomUpdate(double oldZoom, double newZoom, PicPoint ptClick)
oldZoom
- previous zoom valuenewZoom
- new zoom valueptClick
- the point (in model-coordinates) that is expected to be at the center of the view-port ;
can be nullpublic void addZoomListener(ZoomListener l)
ZoomListener
to the Canvas.
public void removeZoomListener(ZoomListener l)
ZoomListener
from the Canvas.
public static int getZoomIndex(double zoom)
PREDEFINED_ZOOMS
; this may be used
by GUI widgets, e.g. JComboBox
,…
PREDEFINED_ZOOMS
" ; returns -1 if not found.public void addRotateListener(RotateListener l)
RotateListener
to the Canvas.
protected void fireRotateUpdate(double angle)
angle
- the current anglepublic void setRotateAngle(double angle)
public void setRotateAngleLabelVisible(boolean b)
public void setMult(double mult)
public void setUndoLimit(int limit)
public void undo() throws CannotUndoException
CannotUndoException
public void redo() throws CannotRedoException
CannotRedoException
public void addUndoableEditListener(UndoableEditListener l)
UndoableEditListener
for the Drawing
hosted by this canvas.
public void removeUndoableEditListener(UndoableEditListener l)
UndoableEditListener
for the Drawing
hosted by this canvas.
public void beginUndoableUpdate(String presentationName)
UndoableEdit
that holds the current state of the Drawing
.
public void endUndoableUpdate()
UndoableEdit
and fire an event to registered listeners.
public boolean canRedo()
public boolean canUndo()
public String getRedoPresentationName()
public String getUndoPresentationName()
public Iterator<Element> selection()
Iterator
over selected graphic elements.public SelectionHandler getSelectionHandler()
public int getSelectionSize()
public boolean isSelected(Element e)
public void selectAll()
public void selectCollection(Collection<Element> c, PECanvas.SelectionBehavior beh)
public void select(Element obj, PECanvas.SelectionBehavior beh)
obj
- The Element
to be selected.beh
- Whether to add obj
to the selection, or to replace the selection by
obj
.public void unSelect(Element obj)
obj
is not in the selection.
obj
- the Element
to be removed from selection.public void unSelect(ConvexZone cz)
public void unSelectAll()
public void deleteSelection()
public void deleteConvexZone(ConvexZone cz)
cz
.
cz
- la ConvexZone
zone convexe à détruire.public void deleteConvexZoneSelection()
public void paste(Clipboard clipbrd, PicPoint translate) throws ParserException, IOException, UnsupportedFlavorException
ClipBoard
) passé en argument au dessin courant, et le
sélectionner ensuite. Si seulement DataFlavor.stringFlavor
est fournit par le
Transferable
, alors on analyse la chaîne de caractère et on insère le résultat de
l'analyse. Sinon, on considère comme garanti que le contenu du presse-papier (ClipBoard
)
prend en charge les données d'acception
jpicedt.graphic.toolkit.TransferableGraphic.JPICEDT_DATA_FLAVOR
.
translate
- si non null, et qu'on colle vers la même planche, translate le contenu collé d'un pas
de grille de sorte à ne pas cacher le contenu d'origine.
ParserException
IOException
UnsupportedFlavorException
public void paste(boolean translate) throws ParserException, IOException, UnsupportedFlavorException
ClipBoard
to the current drawing, then select it. More
specifically, we try to parse the string and insert the parsed content.
translate
- if true, translate the pasted content by a grid step so that it doesn't hide old one
ParserException
IOException
UnsupportedFlavorException
public void copy(Clipboard clipbrd)
TransferableGraphic
) 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)
clipbrd
- the target clipboard ; can be null, in which case only the System clipboard
is modified.public void copy()
public void cut(Clipboard clipbrd)
GraphicTransferable
) to the
System clipboard, AND to the given ClipBoard
if non-null.
clipbrd
- the target clipboard ; can be null, in which case only the System clipboard
is modified.public void cut()
public void groupSelection()
PicGroup
and add it to the drawing.
public void joinSelection()
PicMultiCurveConvertable
into a new
PicMulticurve
and add it to the drawing.
protected void fireSelectionUpdate(Element element, SelectionEvent.EventType type)
element
- the Element that was (un)selectedtype
- the event typeprotected void fireSelectionUpdate(Element[] elements, SelectionEvent.EventType type)
elements
- the Element
's that were (un)selectedtype
- the event typepublic void addSelectionListener(SelectionListener l)
SelectionListener
to the Canvas.
public void removeSelectionListener(SelectionListener l)
SelectionListener
from the Canvas.
public void select(ConvexZone cz, PECanvas.SelectionBehavior beh)
public void select(ConvexZoneGroup czg, PECanvas.SelectionBehavior beh)
public boolean isSelected(ConvexZone cz)
cz
- une valeur ConvexZone
dont on veut savoir si
elle fait partie de la sélection de zones convexes.
boolean
vrai si cz
fait
fait partie de la sélection de zones convexes, faux sinon.public Iterator<ConvexZone> getConvexZoneSelection()
protected void fireSelectionUpdate(ConvexZone cz, ConvexZoneSelectionEvent.EventType type)
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
ScrollPane
's View size, as opposed to
ViewPort's size)public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
public boolean isRequestFocusEnabled()
isRequestFocusEnabled
in class JComponent
public void addPEMouseInputListener(PEMouseInputListener l)
l
- the mouse listener.public void removePEMouseInputListener(PEMouseInputListener l)
l
- the mouse listener.protected void processMouseEvent(MouseEvent e)
PEMouseListener
objects.
processMouseEvent
in class JComponent
e
- the mouse event.protected void processMouseMotionEvent(MouseEvent e)
PEMouseInputListener
objects.
processMouseMotionEvent
in class JComponent
e
- the mouse motion event.
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |