|
|||||||||
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.rubato.composer.view2d.View2D
public class View2D
Nested Class Summary | |
---|---|
static class |
View2D.DragMode
|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
java.awt.Cursor |
addCursor
|
java.awt.Cursor |
infoCursor
|
java.awt.event.ActionEvent |
newSelectionEvent
|
java.awt.Cursor |
removeCursor
|
java.awt.event.ActionEvent |
updateEvent
|
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, 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 | |
---|---|
View2D(View2DModel model)
Creates a new view from the given model . |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener l)
|
void |
addPoint(double x,
double y,
Denotator d)
Adds a new data point. |
void |
addPoints(double[] x,
double[] y)
Adds an array of new data points, specified as two arrays of the same length. |
void |
addPointToSelection(double worldX,
double worldY)
Adds a new point to the current selection (world coordinates). |
void |
addPointToSelection(int screenX,
int screenY)
Adds a new point to the current selection (screen coordinates). |
void |
ancestorAdded(javax.swing.event.AncestorEvent event)
This is called when the component is added to its parent. |
void |
ancestorMoved(javax.swing.event.AncestorEvent event)
|
void |
ancestorRemoved(javax.swing.event.AncestorEvent event)
|
void |
componentHidden(java.awt.event.ComponentEvent e)
|
void |
componentMoved(java.awt.event.ComponentEvent e)
|
void |
componentResized(java.awt.event.ComponentEvent e)
|
void |
componentShown(java.awt.event.ComponentEvent e)
|
void |
drawZoomRectangle(int x0,
int y0,
int x1,
int y1)
Draws a rectangle indicated the region to be zoomed into. |
Selection |
getCurrentSelection()
|
View2DModel |
getModel()
|
double |
getPointerX()
Returns the world x-coordinate of the current pointer position. |
double |
getPointerY()
Returns the world y-coordinate of the current pointer position. |
java.util.ArrayList<Point> |
getPoints()
|
boolean |
isSelected(int i)
Returns true iff the point number i is in
the selection. |
static java.awt.Cursor |
loadCursor(java.lang.Class<?> cls,
java.lang.String name,
int x,
int y)
Loads the cursor from the given file name and the given hotpoint, and returns it. |
void |
mouseClicked(java.awt.event.MouseEvent e)
The most important event is mouse clicked. |
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
On mouse entering the window, the cursor must be changed to reflect the current action. |
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Whenever the mouse is moved, the state ( pointerX ,pointerY ) is
updated, and a updateEvent is sent. |
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
|
void |
newSelection()
Starts a new selection and makes it current. |
void |
recalcScreenCoords()
Recomputes the screen coordinates from the world coordinates of the data and transformed points and the selections. |
void |
removeActionListener(java.awt.event.ActionListener l)
|
void |
removeAllPoints()
Remove all points. |
void |
removePointFromSelection(int screenX,
int screenY)
Removes a point from the current selection (screen coordinates). |
void |
setAction(Action2D action)
Sets the current action. |
void |
setCurrentSelection(Selection selection)
|
void |
setWindow(double xmin,
double xmax,
double ymin,
double ymax)
Sets the viewport of the window. |
void |
updatePointer(double worldX,
double worldY)
|
void |
zoom(double fx,
double fy)
Zooms the viewport by the given factors. |
void |
zoomAll()
Sets the viewport so that everything, i.e., points and selections, is visible. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
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, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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 |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final java.awt.event.ActionEvent updateEvent
public final java.awt.event.ActionEvent newSelectionEvent
public java.awt.Cursor addCursor
public java.awt.Cursor removeCursor
public java.awt.Cursor infoCursor
Constructor Detail |
---|
public View2D(View2DModel model)
model
.
Method Detail |
---|
public View2DModel getModel()
public java.util.ArrayList<Point> getPoints()
public boolean isSelected(int i)
i
is in
the selection.
public double getPointerX()
public double getPointerY()
public void updatePointer(double worldX, double worldY)
public void setWindow(double xmin, double xmax, double ymin, double ymax)
public void zoom(double fx, double fy)
fx
- horizontal zoom factorfy
- vertical zoom factorpublic void zoomAll()
public void setAction(Action2D action)
public void addPoint(double x, double y, Denotator d)
x
- world x-coordinatey
- world y-coordinatepublic void addPoints(double[] x, double[] y)
x
- array of world x-coordinatesy
- array of world y-coordinatespublic void removeAllPoints()
public void recalcScreenCoords()
public void newSelection()
public Selection getCurrentSelection()
public void setCurrentSelection(Selection selection)
public void addPointToSelection(int screenX, int screenY)
screenX
- screen x-coordinate of the new pointscreenY
- screen y-coordinate of the new pointpublic void addPointToSelection(double worldX, double worldY)
worldX
- world x-coordinate of the new pointworldY
- world y-coordinate of the new pointpublic void removePointFromSelection(int screenX, int screenY)
screenX
- screen x-coordinate of the point to be selectedscreenY
- screen y-coordinate of the point to be selectedpublic void drawZoomRectangle(int x0, int y0, int x1, int y1)
x0
- screen x-coordinate of the first cornery0
- screen y-coordinate of the first cornerx1
- screen x-coordinate of the second cornery1
- screen y-coordinate of the second cornerpublic static java.awt.Cursor loadCursor(java.lang.Class<?> cls, java.lang.String name, int x, int y)
public void componentResized(java.awt.event.ComponentEvent e)
componentResized
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent e)
componentMoved
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent e)
componentShown
in interface java.awt.event.ComponentListener
public void componentHidden(java.awt.event.ComponentEvent e)
componentHidden
in interface java.awt.event.ComponentListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
pointerX
,pointerY
) is
updated, and a updateEvent
is sent.
mouseMoved
in interface java.awt.event.MouseMotionListener
public void ancestorAdded(javax.swing.event.AncestorEvent event)
ancestorAdded
in interface javax.swing.event.AncestorListener
public void ancestorMoved(javax.swing.event.AncestorEvent event)
ancestorMoved
in interface javax.swing.event.AncestorListener
public void ancestorRemoved(javax.swing.event.AncestorEvent event)
ancestorRemoved
in interface javax.swing.event.AncestorListener
public void addActionListener(java.awt.event.ActionListener l)
public void removeActionListener(java.awt.event.ActionListener l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |