|
||||||||||
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
net.sf.jaxodraw.gui.AbstractJaxoCanvas
public abstract class AbstractJaxoCanvas
Abstract base class for the canvas.
Nested Class Summary |
---|
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 | |
---|---|
protected static int |
HANDLE_PAINT_OFF
Do not paint handles. |
protected static int |
HANDLE_PAINT_ON
Paint handles. |
protected static int |
HANDLE_PAINT_SELECTION
Only paint handles of selected objects. |
protected static boolean |
HOVERING_EDITED_OBJECTS
|
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 net.sf.jaxodraw.gui.JaxoDrawingArea |
---|
DEFAULT_HELP_COLOR, DEFAULT_HELP_STROKE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
protected |
AbstractJaxoCanvas()
Constructor. |
Method Summary | |
---|---|
Component |
asComponent()
Return this CanvasComponent as a Component. |
protected boolean |
canPasteGraphFromSystemClipboard()
Check if the system clipboard contains a JaxoGraph. |
void |
copyMarkedObjects()
Puts the current clipboard to the system clipboard. |
void |
cutMarkedObjects()
Copies the current clipboard to the system clipboard and removes the corresponding objects from the drawing area. |
protected abstract void |
deleteMarkedObjects()
Deletes all 'marked' objects from the drawing area and the current canvas graph. |
Color |
getCanvasBackground()
Background color in the region that is actually covered by the canvas getCanvasSize() , which is the whole canvas, unless
the effective maximum size is smaller than the component size. |
Rectangle |
getCanvasBounds()
Part of the component that is covered by the actual canvas. |
protected JaxoGraph |
getCanvasGraph()
Returns the current graph. |
Point |
getCanvasOrigin()
Origin of the actual canvas within the component. |
Dimension |
getCanvasSize()
Canvas size. |
JaxoGraph |
getClipboard()
Gets the current clipboard. |
protected Dimension |
getEffectiveMaximumCanvasSize()
The effective maximum canvas size. |
protected JaxoFBoxPopupMenu |
getFboxPopup()
The JaxoFBoxPopupMenu for this canvas. |
protected JaxoPaintableGrid |
getGrid()
Grid to be used. |
protected JaxoHandle |
getHandle()
The currently set handle. |
protected int |
getHandlePaintMode()
How to paint handles. |
Dimension |
getMaximumCanvasSize()
Maximum size of the canvas (even if there are objects with a larger bounding box). |
Dimension |
getMinimumCanvasSize()
Minimum size of the canvas (even if there are no objects or they have a smaller bounding box). |
Dimension |
getPreferredScrollableViewportSize()
Return the preferred size of the viewport. |
protected Rectangle |
getScreenBounds(JaxoObject o)
Determines the bounds of the given object on the screen. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
Return the unit increment for block scrolling. |
boolean |
getScrollableTracksViewportHeight()
Return true if a viewport should force the height of the scrollable. |
boolean |
getScrollableTracksViewportWidth()
Return true if a viewport should force the width of the scrollable. |
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Return the unit increment for scrolling. |
protected JaxoGraph |
getSystemClipboardGraph()
Graph on the system clipboard. |
JaxoZoom |
getZoom()
Return a zoom on this drawing area. |
protected boolean |
isAntialiasEnabled()
Determines if objects are painted with antialiasing turned on. |
protected void |
markBackgroundInvalid()
Mark background or grid invalid (but not the graph/objects). |
void |
markImageInvalid()
Mark the whole image as invalid. |
void |
moveGraph(int dx,
int dy)
Displace the whole graph by a given offset. |
protected void |
paintBackgroundAndGrid(Graphics2D g,
Rectangle rect)
Paint background (unless covered by grid), and grid (if on). |
void |
propertyChange(PropertyChangeEvent evt)
|
protected void |
putToSystemClipboard(JaxoGraph g)
Make 'g' the contents of the system clipboard. |
protected abstract void |
rebuildImage()
Build a new off-screen image. |
protected void |
repaintBoundingBox(Rectangle2D r)
Repaint the given Rectangle in graph coordinates. |
protected abstract void |
revalidateCanvas()
Resets the preferred size of the canvas. |
void |
setAntialiasEnabled(boolean value)
Sets the antialias property. |
void |
setCanvasBackground(Color color)
Sets the color of the background. |
void |
setCanvasGraph(JaxoGraph value)
Sets the graph to be painted. |
void |
setCanvasGraphAndGrid(JaxoGraph newGraph,
JaxoPaintableGrid newGrid)
Set both graph and grid. |
void |
setGrid(JaxoPaintableGrid value)
Sets the grid to be painted on this drawing area. |
void |
setHandle(JaxoHandle newHandle)
Sets a new handle. |
protected void |
setHandlePaintMode(int value)
Sets how to paint handles. |
void |
setMaximumCanvasSize(Dimension value)
Sets the maximum canvas size. |
void |
setMinimumCanvasSize(Dimension value)
Sets the minimum canvas size. |
protected boolean |
showColorPanel(JaxoObject ob)
Brings up a ColorChooser panel for the given object. |
protected boolean |
showEditPanel(JaxoObject o)
Bring up an EditPanel to edit properties of the given JaxoObject. |
protected boolean |
showSelectionPanel(Point location)
Brings up the faint-box popup panel for the current selection. |
protected void |
snapObject(JaxoObject o)
Moves the given JaxoObject so that its first point is snapped to the current grid. |
protected void |
snapPoint(Point p)
Snap the given point to the current grid. |
protected Point |
toComponentCoordinates(Point p)
Point 'p' in graph coordinates converted to component coordinates. |
protected Rectangle |
toComponentCoordinates(Rectangle r)
A Rectangle in graph coordinates converted to component coordinates. |
protected Point |
toGraphCoordinates(Point p)
Point 'p' in component coordinates converted to graph coordinates. |
boolean |
unMarkGraph()
Sets all objects in the current graph as not marked. |
void |
updateLanguage()
Updates the language on any localized sub-components. |
protected abstract void |
updateMode(int mode)
Resets canvas parameters for the given mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.jaxodraw.gui.JaxoDrawingArea |
---|
clear, continueEdit, continueSelect, editNearestObject, finalizeEdit, finalizeSelect, groupMarkedObjects, initiateEdit, initiateSelect, markImageInvalid, moveSelection, pasteFromClipboard, refresh, ungroupMarkedObjects, updatePointsAid |
Methods inherited from interface net.sf.jaxodraw.gui.JaxoCanvasComponent |
---|
addMouseListener, addMouseMotionListener, addPropertyChangeListener, getGraphics, print, removeMouseListener, removeMouseMotionListener, repaint |
Field Detail |
---|
protected static final int HANDLE_PAINT_OFF
protected static final int HANDLE_PAINT_ON
protected static final int HANDLE_PAINT_SELECTION
protected static final boolean HOVERING_EDITED_OBJECTS
Constructor Detail |
---|
protected AbstractJaxoCanvas()
Method Detail |
---|
protected final JaxoFBoxPopupMenu getFboxPopup()
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public Component asComponent()
asComponent
in interface JaxoCanvasComponent
protected JaxoHandle getHandle()
public void setHandle(JaxoHandle newHandle)
newHandle
- The handle to set.protected int getHandlePaintMode()
protected void setHandlePaintMode(int value)
value
- One of the HANDLE_PAINT constants.protected JaxoGraph getCanvasGraph()
public void setCanvasGraph(JaxoGraph value)
setCanvasGraph
in interface JaxoDrawingArea
value
- The graph to be set.public void moveGraph(int dx, int dy)
moveGraph
in interface JaxoDrawingArea
dx
- the offset in x direction.dy
- the offset in y direction.public void copyMarkedObjects()
copyMarkedObjects
in interface JaxoDrawingArea
public void cutMarkedObjects()
cutMarkedObjects
in interface JaxoDrawingArea
public boolean unMarkGraph()
unMarkGraph
in interface JaxoDrawingArea
public Color getCanvasBackground()
getCanvasSize()
, which is the whole canvas, unless
the effective maximum size is smaller than the component size.
Note that this color may be overwritten by the grid.
getCanvasBackground
in interface JaxoCanvasComponent
public void setCanvasBackground(Color color)
setCanvasBackground
in interface JaxoCanvasComponent
color
- The background color.public Point getCanvasOrigin()
getCanvasOrigin
in interface JaxoCanvasComponent
public Rectangle getCanvasBounds()
getCanvasBounds
in interface JaxoCanvasComponent
JaxoCanvasComponent.getCanvasSize()
,
JaxoCanvasComponent.getCanvasOrigin()
public Dimension getCanvasSize()
getCanvasSize
in interface JaxoCanvasComponent
public Dimension getMinimumCanvasSize()
getMinimumCanvasSize
in interface JaxoCanvasComponent
public void setMinimumCanvasSize(Dimension value)
setMinimumCanvasSize
in interface JaxoCanvasComponent
value
- The minimum canvas size.public Dimension getMaximumCanvasSize()
getMaximumCanvasSize
in interface JaxoCanvasComponent
public void setMaximumCanvasSize(Dimension value)
setMaximumCanvasSize
in interface JaxoCanvasComponent
value
- The maximum canvas size.protected Dimension getEffectiveMaximumCanvasSize()
protected Point toGraphCoordinates(Point p)
p
- Point in component coordinates.
protected Point toComponentCoordinates(Point p)
p
- Point in graph coordinates.
protected Rectangle toComponentCoordinates(Rectangle r)
r
- Rectangle in graph coordinates.
protected Rectangle getScreenBounds(JaxoObject o)
o
- the JaxoObject.
public JaxoZoom getZoom()
getZoom
in interface JaxoDrawingArea
protected JaxoPaintableGrid getGrid()
public void setGrid(JaxoPaintableGrid value)
setGrid
in interface JaxoDrawingArea
value
- The new grid. May be null.public void setCanvasGraphAndGrid(JaxoGraph newGraph, JaxoPaintableGrid newGrid)
newGraph
- The new graph.newGrid
- The new grid.protected boolean isAntialiasEnabled()
public void setAntialiasEnabled(boolean value)
value
- True if antialising should be enabled.public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
visibleRect
- the visible view area.orientation
- Either SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL.direction
- less than zero to scroll up/left,
greater than zero for down/right.
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
visibleRect
- the visible view area.orientation
- Either SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL.direction
- less than zero to scroll up/left,
greater than zero for down/right.
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
protected boolean canPasteGraphFromSystemClipboard()
protected JaxoGraph getSystemClipboardGraph()
protected void putToSystemClipboard(JaxoGraph g)
g
- the graph to put on the clipboard.public JaxoGraph getClipboard()
getClipboard
in interface JaxoDrawingArea
protected void markBackgroundInvalid()
public void markImageInvalid()
protected void paintBackgroundAndGrid(Graphics2D g, Rectangle rect)
g
- the graphics context to paint to.rect
- the rectangle to paint.protected void snapPoint(Point p)
p
- the point to snap.protected void snapObject(JaxoObject o)
o
- the JaxoObject to snap.public void updateLanguage()
updateLanguage
in interface JaxoLocalized
protected void repaintBoundingBox(Rectangle2D r)
r
- the Rectangle to repaint.protected boolean showColorPanel(JaxoObject ob)
ob
- the object to edit.
protected boolean showSelectionPanel(Point location)
location
- the location of the popup panel.
protected boolean showEditPanel(JaxoObject o)
o
- the object to edit.
protected abstract void revalidateCanvas()
protected abstract void rebuildImage()
protected abstract void deleteMarkedObjects()
protected abstract void updateMode(int mode)
mode
- The mode to adjust to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |