|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.malai.widget.MPanel
net.sf.latexdraw.glib.ui.LCanvas
public class LCanvas
Defines a canvas that draw the drawing and manages the selected shapes.
This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
05/09/2010
Nested Class Summary | |
---|---|
protected class |
LCanvas.TooltipDisplayer
This kind of instrument manages the tooltips displayed on some views. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected java.lang.Object |
alphaInterpolValue
The value of the alpha-interpolation ( cf. |
protected java.lang.Object |
antiAliasingValue
The value of the antialiasing (cf. |
protected java.awt.geom.Rectangle2D |
border
The border of the drawing. |
protected Border |
borderIns
The instrument that manages selected views. |
protected java.lang.Object |
colorRenderingValue
The value of the colour rendering (cf. |
protected IDrawing |
drawing
The model of the view. |
protected LMagneticGrid |
magneticGrid
The magnetic grid of the canvas. |
protected boolean |
modified
Defined if the canvas has been modified. |
protected java.lang.Object |
renderingValue
The value of the rendering (cf. |
private static long |
serialVersionUID
|
static java.awt.BasicStroke |
STROKE_USER_SELECTION_BORDER
This stroke is used to show the rectangle made by the user to select some shapes. |
protected IUnary<IViewShape> |
tempView
The temporary view that the canvas may contain. |
protected java.util.List<ToolTipable> |
tooltipableView
This list contains a subset of the list 'view'. |
protected java.awt.geom.Rectangle2D |
userSelectionBorder
This rectangle is used as interim feedback to show the rectangle made by the user to select some shapes. |
protected IActiveList<IViewShape> |
views
The shapes of the canvas. |
protected IUnary<java.lang.Double> |
zoom
The zoom applied on the canvas. |
Fields inherited from class org.malai.widget.MPanel |
---|
eventManager, scrollpane |
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 org.malai.properties.Zoomable |
---|
MAX_ZOOM, MIN_ZOOM, ZOOM_INCREMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
LCanvas(IDrawing drawing)
Creates an initialises a canvas. |
Method Summary | |
---|---|
boolean |
contains(double x,
double y)
Tests if the given point is into the pickable object. |
Border |
getBorderInstrument()
|
IPoint |
getBottomLeftDrawingPoint()
|
IDrawing |
getDrawing()
|
LMagneticGrid |
getMagneticGrid()
|
IPoint |
getOriginDrawingPoint()
|
Pickable |
getPickableAt(double x,
double y)
|
Picker |
getPicker()
|
Picker |
getPickerAt(double x,
double y)
|
int |
getPPCDrawing()
|
IViewShape |
getTempView()
|
IPoint |
getTopRightDrawingPoint()
|
IUnary<IViewShape> |
getUnaryTempView()
|
IViewShape |
getViewAt(double x,
double y)
|
java.util.List<IViewShape> |
getViews()
|
double |
getZoom()
|
java.awt.geom.Point2D |
getZoomedPoint(double x,
double y)
Transforms the given point in a point which coordinates have been modified to take account of the zoom level. |
java.awt.geom.Point2D |
getZoomedPoint(java.awt.Point pt)
Transforms the given point in a point which coordinates have been modified to take account of the zoom level. |
IUnary<java.lang.Double> |
getZoomUnary()
|
boolean |
isModified()
|
void |
load(boolean generalPreferences,
java.lang.String nsURI,
org.w3c.dom.Element meta)
Loads data save in an XML document. |
void |
onActionAborted(Action action)
Notifies the handler when the given action is aborted. |
void |
onActionAdded(Action action)
Notifies the handler when the given action is added to the registry. |
void |
onActionCancelled(Action action)
Notifies the handler when the given action is cancelled. |
void |
onActionDone(Action action)
Notifies the handler when the given action is done. |
void |
onActionExecuted(Action action)
Notifies the handler when the given action is executed. |
void |
onUndoableAdded(Undoable undoable)
Actions to do when an undoable object is added to the undo register. |
void |
onUndoableRedo(Undoable undoable)
Actions to do when an undoable object is redone. |
void |
onUndoableUndo(Undoable undoable)
Actions to do when an undoable object is undone. |
void |
paint(java.awt.Graphics g)
Paints the shapes. |
void |
paintViews(java.awt.Graphics2D g,
boolean withZoom,
boolean withGrid)
Paints the shapes. |
void |
refresh()
Repaints the canvas. |
void |
reinit()
Reinitialises the object. |
void |
save(boolean generalPreferences,
java.lang.String nsURI,
org.w3c.dom.Document document,
org.w3c.dom.Element root)
Saves the parameters of the instrument into an XML tag. |
void |
setAlphaInterpolation(java.lang.Object alphaInterpolValue)
Sets the alpha interpolation value. |
void |
setAntiAliasing(java.lang.Object antiAliasingValue)
Sets the anti aliasing value. |
void |
setColorRendering(java.lang.Object colorRenderingValue)
Sets the colour rendering value. |
void |
setModified(boolean modified)
Sets the Modifiable object as modified. |
void |
setRendering(java.lang.Object renderingValue)
Sets the rendering value. |
void |
setTempUserSelectionBorder(java.awt.geom.Rectangle2D rect)
Sets the rectangle corresponding to the rectangle that performs users to select shapes. |
void |
setTempView(IViewShape view)
Sets the temporary view. |
void |
setZoom(double x,
double y,
double z)
Zooms in the zoomable object. |
void |
update()
Updates the canvas. |
void |
updateBorder()
Updates the border of the views. |
void |
updatePreferredSize()
Defines the dimensions of the canvas (needed for the scrollers). |
Methods inherited from class org.malai.widget.MPanel |
---|
add, add, add, add, add, contains, getEventManager, getRelativePoint, getScrollbar, getScrollpane, hasEventManager, hasScrollPane, isHorizontalScrollbarVisible, isVerticalScrollbarVisible, scroll, scrollHorizontally, scrollVertically |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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 |
Methods inherited from interface net.sf.latexdraw.glib.ui.ICanvas |
---|
requestFocus, setCursor |
Methods inherited from interface org.malai.widget.Scrollable |
---|
getScrollpane, hasScrollPane |
Methods inherited from interface org.malai.interaction.Eventable |
---|
getEventManager, hasEventManager |
Methods inherited from interface org.malai.picking.Picker |
---|
contains, getRelativePoint |
Field Detail |
---|
public static final java.awt.BasicStroke STROKE_USER_SELECTION_BORDER
private static final long serialVersionUID
protected IActiveList<IViewShape> views
protected IUnary<IViewShape> tempView
protected java.util.List<ToolTipable> tooltipableView
protected java.awt.geom.Rectangle2D border
protected IUnary<java.lang.Double> zoom
protected java.lang.Object antiAliasingValue
protected java.lang.Object renderingValue
protected java.lang.Object colorRenderingValue
protected java.lang.Object alphaInterpolValue
protected java.awt.geom.Rectangle2D userSelectionBorder
protected Border borderIns
protected LMagneticGrid magneticGrid
protected boolean modified
protected IDrawing drawing
Constructor Detail |
---|
public LCanvas(IDrawing drawing)
drawing
- The model of the canvas.Method Detail |
---|
public void reinit()
Reinitialisable
reinit
in interface Reinitialisable
public void paint(java.awt.Graphics g)
ICanvas
paint
in interface ICanvas
paint
in class javax.swing.JComponent
g
- The graphics used to paint the shapes.public void paintViews(java.awt.Graphics2D g, boolean withZoom, boolean withGrid)
ICanvas
paintViews
in interface ICanvas
g
- The graphics.withZoom
- True: the zoom will be considered.withGrid
- True: the grid will be considered.public void update()
ICanvas
update
in interface ICanvas
update
in interface ConcretePresentation
public void updateBorder()
ICanvas
updateBorder
in interface ICanvas
public void updatePreferredSize()
ICanvas
updatePreferredSize
in interface ICanvas
public IViewShape getViewAt(double x, double y)
getViewAt
in interface ICanvas
x
- The x-coordinate of the point to test.y
- The y-coordinate of the point to test.
public Pickable getPickableAt(double x, double y)
getPickableAt
in interface Picker
getPickableAt
in class MPanel
x
- The x-coordinate of the position used to get the pickable object.y
- The y-coordinate of the position used to get the pickable object.
public Picker getPickerAt(double x, double y)
getPickerAt
in interface Picker
getPickerAt
in class MPanel
x
- The x-coordinate of the position used to get the picker object.y
- The y-coordinate of the position used to get the picker object.
public double getZoom()
getZoom
in interface Zoomable
public void setZoom(double x, double y, double z)
Zoomable
setZoom
in interface Zoomable
x
- The X-coordinate of the location to zoom.y
- The Y-coordinate of the location to zoom.z
- The zooming level.public java.util.List<IViewShape> getViews()
getViews
in interface ICanvas
public IViewShape getTempView()
getTempView
in interface ICanvas
public void setTempView(IViewShape view)
ICanvas
setTempView
in interface ICanvas
view
- The new temporary view.public IUnary<IViewShape> getUnaryTempView()
public IPoint getTopRightDrawingPoint()
getTopRightDrawingPoint
in interface ViewsSynchroniserHandler
public IPoint getBottomLeftDrawingPoint()
getBottomLeftDrawingPoint
in interface ViewsSynchroniserHandler
public IPoint getOriginDrawingPoint()
getOriginDrawingPoint
in interface ViewsSynchroniserHandler
public int getPPCDrawing()
getPPCDrawing
in interface ViewsSynchroniserHandler
public void save(boolean generalPreferences, java.lang.String nsURI, org.w3c.dom.Document document, org.w3c.dom.Element root)
Preferenciable
save
in interface Preferenciable
generalPreferences
- True: this operation is called to save the general preferences of the interactive system.
Otherwise, it is called to save a presentation in a document. This parameter is useful when different information
must be saved during a presentation backup or a general preferences backup.nsURI
- The namespace that must be added to tags corresponding to the instrument's parameters.document
- The XML document.root
- The root element that will contains the instrument's parameters.public void load(boolean generalPreferences, java.lang.String nsURI, org.w3c.dom.Element meta)
Preferenciable
load
in interface Preferenciable
generalPreferences
- True: this operation is called to load the general preferences of the interactive system.
Otherwise, it is called to load a presentation in a document. This parameter is useful when different information
must be loaded during a presentation backup or a general preferences backup.nsURI
- The namespace that must be added to tags corresponding to the instrument's parameters.meta
- The meta data element.public boolean contains(double x, double y)
Pickable
contains
in interface Pickable
x
- The x-coordinate of the point to test.y
- The y-coordinate of the point to test.
public Picker getPicker()
getPicker
in interface Pickable
public void setTempUserSelectionBorder(java.awt.geom.Rectangle2D rect)
ICanvas
setTempUserSelectionBorder
in interface ICanvas
rect
- The rectangle to display.public void refresh()
ICanvas
refresh
in interface ICanvas
public Border getBorderInstrument()
getBorderInstrument
in interface ICanvas
public IUnary<java.lang.Double> getZoomUnary()
public LMagneticGrid getMagneticGrid()
getMagneticGrid
in interface ICanvas
public void setAntiAliasing(java.lang.Object antiAliasingValue)
ICanvas
setAntiAliasing
in interface ICanvas
antiAliasingValue
- The new anti-aliasing value.public void setRendering(java.lang.Object renderingValue)
ICanvas
setRendering
in interface ICanvas
renderingValue
- The new rendering value.public void setColorRendering(java.lang.Object colorRenderingValue)
ICanvas
setColorRendering
in interface ICanvas
colorRenderingValue
- The new colour rendering value.public void setAlphaInterpolation(java.lang.Object alphaInterpolValue)
ICanvas
setAlphaInterpolation
in interface ICanvas
alphaInterpolValue
- The new alpha interpolation value.public boolean isModified()
isModified
in interface Modifiable
public void setModified(boolean modified)
Modifiable
setModified
in interface Modifiable
modified
- True: the element is will tagged as modified.public IDrawing getDrawing()
getDrawing
in interface ICanvas
public java.awt.geom.Point2D getZoomedPoint(double x, double y)
Zoomable
getZoomedPoint
in interface Zoomable
x
- The X-coordinate of the point to modify.y
- The Y-coordinate of the point to modify.
public java.awt.geom.Point2D getZoomedPoint(java.awt.Point pt)
Zoomable
getZoomedPoint
in interface Zoomable
pt
- The point to transform.
public void onActionCancelled(Action action)
ActionHandler
onActionCancelled
in interface ActionHandler
action
- The cancelled action.public void onActionAdded(Action action)
ActionHandler
onActionAdded
in interface ActionHandler
action
- The added action.public void onActionAborted(Action action)
ActionHandler
onActionAborted
in interface ActionHandler
action
- The aborted action.public void onActionExecuted(Action action)
ActionHandler
onActionExecuted
in interface ActionHandler
action
- The executed action.public void onUndoableAdded(Undoable undoable)
UndoHandler
onUndoableAdded
in interface UndoHandler
undoable
- The undoable object added to the undo register.public void onUndoableUndo(Undoable undoable)
UndoHandler
onUndoableUndo
in interface UndoHandler
undoable
- The undone object.public void onUndoableRedo(Undoable undoable)
UndoHandler
onUndoableRedo
in interface UndoHandler
undoable
- The redone object.public void onActionDone(Action action)
ActionHandler
onActionDone
in interface ActionHandler
action
- The action that ends.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |