|
||||||||||
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.JLayeredPane
org.das2.graph.DasCanvas
public class DasCanvas
Canvas for das2 graphics. The DasCanvas contains any number of DasCanvasComponents such as axes, plots, colorbars, etc.
Nested Class Summary | |
---|---|
protected static class |
DasCanvas.CanvasAction
|
static class |
DasCanvas.Cell
TODO |
static class |
DasCanvas.GlassPane
JPanel that lives above all other components, and is capable of blocking keyboard and mouse input from all components underneath. |
static class |
DasCanvas.HotLine
TODO |
protected static class |
DasCanvas.RowColumnLayout
Layout manager for managing the Row, Column layout implemented by swing. |
Nested classes/interfaces inherited from class javax.swing.JLayeredPane |
---|
javax.swing.JLayeredPane.AccessibleJLayeredPane |
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 | |
---|---|
static javax.swing.Action |
ABOUT_ACTION
|
static java.lang.Integer |
ANNOTATION_LAYER
Z-Layer |
static java.lang.Integer |
AXIS_LAYER
Z-Layer |
static java.lang.Integer |
DEFAULT_LAYER
Default drawing layer of the JLayeredPane |
static javax.swing.Action |
EDIT_DAS_PROPERTIES_ACTION
|
static java.lang.Integer |
GLASS_PANE_LAYER
Z-Layer |
static java.lang.Integer |
HORIZONTAL_AXIS_LAYER
Z-Layer |
static java.lang.Integer |
PLOT_LAYER
Z-Layer for drawing the plot. |
static javax.swing.Action |
PRINT_ACTION
|
javax.swing.Action |
PROPERTIES_ACTION
|
static javax.swing.Action |
REFRESH_ACTION
|
static javax.swing.Action |
SAVE_AS_PDF_ACTION
|
static javax.swing.Action |
SAVE_AS_PNG_ACTION
|
static javax.swing.Action |
SAVE_AS_SVG_ACTION
|
static java.lang.Integer |
VERTICAL_AXIS_LAYER
Z-Layer for vertical axis. |
Fields inherited from class javax.swing.JLayeredPane |
---|
DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
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.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DasCanvas()
Creates a new instance of DasCanvas TODO |
|
DasCanvas(int width,
int height)
Creates a new instance of DasCanvas with the specified width and height TODO |
Method Summary | |
---|---|
void |
add(DasCanvasComponent c,
DasRow row,
DasColumn column)
This methods adds the specified DasCanvasComponent to this canvas. |
protected void |
addImpl(java.awt.Component comp,
java.lang.Object constraints,
int index)
TODO |
void |
changePerformed(java.lang.Object client,
java.lang.Object lockObject)
|
static DasCanvas |
createFormCanvas(java.lang.String name,
int width,
int height)
|
void |
deregisterComponent()
|
static javax.swing.Action[] |
getActions()
|
DasApplication |
getApplication()
|
java.awt.Font |
getBaseFont()
TODO |
DasCanvasComponent |
getCanvasComponentAt(int x,
int y)
Returns the DasCanvasComponent that contains the (x, y) location. |
DasCanvasComponent[] |
getCanvasComponents()
|
DasCanvasComponent |
getCanvasComponents(int index)
|
DasCanvas.Cell |
getCellAt(int x,
int y)
TODO |
DasApplication |
getDasApplication()
|
java.lang.String |
getDasName()
TODO |
java.util.List |
getDevicePositionList()
TODO |
DnDSupport |
getDnDSupport()
TODO |
org.w3c.dom.Element |
getDOMElement(org.w3c.dom.Document document)
TODO |
boolean |
getEditingMode()
TODO |
FormBase |
getForm()
TODO |
java.awt.Component |
getGlassPane()
returns the GlassPane above all other components. |
java.awt.Image |
getImage(int width,
int height)
Creates a BufferedImage by blocking until the image is ready. |
DasCanvas.HotLine |
getLineAt(int x,
int y)
TODO |
java.awt.Dimension |
getMaximumSize()
simply returns getPreferredSize(). |
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
java.awt.print.Printable |
getPrintable()
Returns an instance of java.awt.print.Printable that can
be used to render this canvas to a printer. |
java.lang.String |
getPrintingTag()
printingTag is the DateFormat string to use to tag printed images. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
|
void |
invalidate()
|
boolean |
isAntiAlias()
Getter for property antiAlias. |
boolean |
isDirty()
returns true if work needs to be done to make the canvas clean. |
boolean |
isFitted()
If true, and the canvas was added to a scrollpane, the canvas will size itself to fit within the scrollpane. |
boolean |
isPendingChanges()
|
protected boolean |
isPrintingThread()
|
boolean |
isTextAntiAlias()
Getter for property textAntiAlias. |
protected void |
paintComponent(java.awt.Graphics g1)
paints the canvas itself. |
void |
performingChange(java.lang.Object client,
java.lang.Object lockObject)
|
void |
prepareForOutput(int width,
int height)
resets the width and height, then waits for all update messages to be processed. |
void |
print(java.awt.Graphics g)
|
int |
print(java.awt.Graphics printGraphics,
java.awt.print.PageFormat format,
int pageIndex)
Prints the canvas, scaling and possibly rotating it to improve fit. |
static DasCanvas |
processCanvasElement(org.w3c.dom.Element element,
FormBase form)
Process a <canvas> element. |
void |
registerComponent()
|
void |
registerPendingChange(java.lang.Object client,
java.lang.Object lockObject)
|
void |
remove(int index)
Removes the component, specified by index ,
from this container. |
void |
removepwDevicePosition(DasDevicePosition position)
TODO |
void |
resizeAllComponents()
introduced as a kludgy way for clients to force the canvas to resize all of its components. |
void |
setAntiAlias(boolean antiAlias)
Setter for property antiAlias. |
void |
setApplication(DasApplication application)
|
void |
setBaseFont(java.awt.Font font)
The base font is the font from which all other fonts should be derived. |
void |
setBounds(int x,
int y,
int width,
int height)
|
void |
setDasName(java.lang.String name)
TODO |
void |
setEditingMode(boolean b)
TODO |
void |
setFitted(boolean fitted)
|
void |
setPreferredHeight(int height)
Sets the preferred height of the canvas to the specified height. |
void |
setPreferredWidth(int width)
Sets the preferred width of the canvas to the specified width. |
void |
setPrintingTag(java.lang.String printingTag)
printingTag is the DateFormat string to use to tag printed images. |
void |
setTextAntiAlias(boolean textAntiAlias)
Setter for property textAntiAlias. |
boolean |
startDrag(int x,
int y,
int action,
java.awt.event.MouseEvent evt)
TODO |
java.lang.String |
toString()
|
void |
waitUntilIdle()
Blocks the caller's thread until all events have been dispatched from the awt event thread, and then waits for the RequestProcessor to finish all tasks with this canvas as the lock object. |
void |
writeToGraphicsOutput(java.io.OutputStream out,
GraphicsOutput go)
write to various graphics devices such as png, pdf and svg. |
void |
writeToGraphicsOutput(java.lang.String filename,
java.lang.String graphicsOutput)
|
protected void |
writeToImageImmediately(java.awt.Image image)
TODO |
void |
writeToPDF(java.lang.String filename)
|
void |
writeToPng(java.lang.String filename)
uses getImage to get an image of the canvas and encodes it as a png. |
void |
writeToSVG(java.lang.String filename)
|
Methods inherited from class javax.swing.JLayeredPane |
---|
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, removeAll, setLayer, setLayer, setPosition |
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, 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, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Integer DEFAULT_LAYER
public static final java.lang.Integer PLOT_LAYER
public static final java.lang.Integer VERTICAL_AXIS_LAYER
public static final java.lang.Integer HORIZONTAL_AXIS_LAYER
public static final java.lang.Integer AXIS_LAYER
public static final java.lang.Integer ANNOTATION_LAYER
public static final java.lang.Integer GLASS_PANE_LAYER
public static final javax.swing.Action SAVE_AS_PNG_ACTION
public static final javax.swing.Action SAVE_AS_SVG_ACTION
public static final javax.swing.Action SAVE_AS_PDF_ACTION
public static final javax.swing.Action EDIT_DAS_PROPERTIES_ACTION
public static final javax.swing.Action PRINT_ACTION
public static final javax.swing.Action REFRESH_ACTION
public static final javax.swing.Action ABOUT_ACTION
public final javax.swing.Action PROPERTIES_ACTION
Constructor Detail |
---|
public DasCanvas()
public DasCanvas(int width, int height)
width
- The width of the DasCanvasheight
- The height of the DasCanvasMethod Detail |
---|
public void setBounds(int x, int y, int width, int height)
setBounds
in class java.awt.Component
public void invalidate()
invalidate
in class java.awt.Container
public static javax.swing.Action[] getActions()
public java.awt.Component getGlassPane()
public java.util.List getDevicePositionList()
public DasApplication getApplication()
public void setApplication(DasApplication application)
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class javax.swing.JComponent
protected void paintComponent(java.awt.Graphics g1)
paintComponent
in class javax.swing.JComponent
gl
- the Graphics objectpublic int print(java.awt.Graphics printGraphics, java.awt.print.PageFormat format, int pageIndex)
print
in interface java.awt.print.Printable
printGraphics
- the Graphics object.format
- the PageFormat object.pageIndex
- should be 0, since the image will be on one page.
protected final boolean isPrintingThread()
public void print(java.awt.Graphics g)
print
in class javax.swing.JComponent
public java.awt.print.Printable getPrintable()
java.awt.print.Printable
that can
be used to render this canvas to a printer. The current implementation
returns a reference to this canvas. This method is provided so that in
the future, the canvas can delegate it's printing to another object.
Printable
instance for rendering this component.public void writeToPng(java.lang.String filename) throws java.io.IOException
filename
- the specified filename
java.io.IOException
- if there is an error opening the file for writingpublic void writeToPDF(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void writeToGraphicsOutput(java.io.OutputStream out, GraphicsOutput go) throws java.io.IOException, java.lang.IllegalAccessException
out
- OutputStream to receive the datago
- GraphicsOutput object.
java.io.IOException
java.lang.IllegalAccessException
public void writeToGraphicsOutput(java.lang.String filename, java.lang.String graphicsOutput) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public void writeToSVG(java.lang.String filename) throws java.io.IOException
filename
- the specified filename
java.io.IOException
- if there is an error opening the file for writingpublic boolean isDirty()
public void waitUntilIdle() throws java.lang.InterruptedException
java.lang.InterruptedException
public void resizeAllComponents()
public void prepareForOutput(int width, int height)
width
- the width of the output in pixels.height
- the width of the output in pixels.
java.lang.IllegalStateException
- if called from the event queue.public java.awt.Image getImage(int width, int height)
writeToImageImmediately(Image)
.
width
- height
-
protected void writeToImageImmediately(java.awt.Image image)
image
- public void add(DasCanvasComponent c, DasRow row, DasColumn column)
DasCanvasComponent
to this canvas.
c
- the component to be added to this canvas
Note that the canvas will need to be revalidated after the component
is added.row
- DasRow specifying the layout of the component.column
- DasColumn specifying the layout of the component.protected void addImpl(java.awt.Component comp, java.lang.Object constraints, int index)
addImpl
in class javax.swing.JLayeredPane
comp
- constraints
- index
- public void setPreferredWidth(int width)
width
- the specified width.public void setPreferredHeight(int height)
height
- the specified heightpublic java.awt.Font getBaseFont()
public void setBaseFont(java.awt.Font font)
font
- the font used to derive all other fonts.public org.w3c.dom.Element getDOMElement(org.w3c.dom.Document document)
getDOMElement
in interface FormComponent
document
-
public static DasCanvas processCanvasElement(org.w3c.dom.Element element, FormBase form) throws DasPropertyException, DasNameException, DasException, ParsedExpressionException, java.text.ParseException
<canvas>
element.
form
- element
- The DOM tree node that represents the element
DasPropertyException
DasNameException
ParsedExpressionException
DasException
java.text.ParseException
public static DasCanvas createFormCanvas(java.lang.String name, int width, int height)
name
- width
- height
-
public DasCanvasComponent getCanvasComponentAt(int x, int y)
null
x
- the x coordinatey
- the y coordinate
public void remove(int index)
index
,
from this container.
remove
in class javax.swing.JLayeredPane
index
- the index of the component to be removed.public DasCanvas.HotLine getLineAt(int x, int y)
x
- y
-
public DasCanvas.Cell getCellAt(int x, int y)
x
- y
-
public void removepwDevicePosition(DasDevicePosition position)
position
- public FormBase getForm()
getForm
in interface FormComponent
public boolean getEditingMode()
getEditingMode
in interface FormComponent
public void setEditingMode(boolean b)
setEditingMode
in interface FormComponent
b
- public DnDSupport getDnDSupport()
getDnDSupport
in interface FormComponent
public boolean startDrag(int x, int y, int action, java.awt.event.MouseEvent evt)
startDrag
in interface FormComponent
x
- y
- action
- evt
-
public java.lang.String getDasName()
getDasName
in interface FormComponent
public void setDasName(java.lang.String name) throws DasNameException
setDasName
in interface FormComponent
name
-
DasNameException
public void deregisterComponent()
deregisterComponent
in interface FormComponent
public DasApplication getDasApplication()
getDasApplication
in interface FormComponent
public void registerComponent() throws DasException
registerComponent
in interface FormComponent
DasException
public DasCanvasComponent getCanvasComponents(int index)
public DasCanvasComponent[] getCanvasComponents()
public java.lang.String toString()
toString
in class java.awt.Component
public java.lang.String getPrintingTag()
public void setPrintingTag(java.lang.String printingTag)
printingTag
- New value of property printingTag.public boolean isTextAntiAlias()
public void setTextAntiAlias(boolean textAntiAlias)
textAntiAlias
- New value of property textAntiAlias.public boolean isAntiAlias()
public void setAntiAlias(boolean antiAlias)
antiAlias
- New value of property antiAlias.public boolean isFitted()
public void setFitted(boolean fitted)
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface javax.swing.Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface javax.swing.Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface javax.swing.Scrollable
public void registerPendingChange(java.lang.Object client, java.lang.Object lockObject)
public void performingChange(java.lang.Object client, java.lang.Object lockObject)
public void changePerformed(java.lang.Object client, java.lang.Object lockObject)
public boolean isPendingChanges()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |