Class PianoRollEditor
- All Implemented Interfaces:
- ImageObserver,- MenuContainer,- PropertyChangeListener,- Serializable,- EventListener,- Accessible
It can edit whole or part of a Phrase.
 Its Lookup must contain :
 - editor's ActionMap
 - editor's Zoomable instance
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ComponentComponent.BaselineResizeBehavior
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringoldValue=old tool, newValue=new toolstatic final StringnewValue=false.static final StringoldValue=old channel, newValue=new channel model.static final StringoldValue=old Phrase model, newValue=new Phrase model.static final StringnewValue=playback point position in beatsstatic final StringoldValue=old quantization value, newValue=new quantization valuestatic final StringoldValue=sorted list of NoteViews whose state has changeds, newValue=selected statestatic final StringnewValue=booleanFields inherited from class javax.swing.JComponentTOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructorsConstructorDescriptionPianoRollEditor(PianoRollEditorSettings settings) Create a piano roll editor for a dummy phrase model.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcleanup()Clean up everything so component can be garbaged.Get the actived EditTool.intGet the channel of the editor.The drum key map used by the edited phrase.The available EditTools.Get the optional view-only phrases shown faded in the background of the editor.org.openide.util.LookupGet the lookup of this editor.getModel()Get the Phrase edited by this editor.getNoteView(NoteEvent ne) Get the NoteView associated to the specified NoteEvent.Get all the NoteViews sorted by NoteEvent natural order.intGet the bar index corresponding to getPhraseBeatRange().from.intgetPitchFromPoint(Point notesPanelPoint) Return the pitch that correspond to a graphical point in the editor.floatGet the playback point position.floatgetPositionFromPoint(Point editorPoint) Return the phrase position in beats that corresponds to a graphical point in the editor.Get the display quantization.Get the ruler bar range.intGet the bar index displayed on the ruler corresponding to getBeatRange().from.Get the currently selected NoteViews sorted by NoteEvent natural order.Get the graphical settings of this editor.getSong()getTimeSignature(float posInBeats) The time signature at the specified beat position.Get all the time signatures with their position.Get the min/max bar indexes which are visible.Get the min/max beat positions which are visible.Get the min/max notes which are currently visible.intgetXFromPosition(float pos) Return the X editor position that corresponds to a beat position of the Phrase model.getZoom()Get the editor zoom value.booleanisDrums()Convenience method which returns true if getDrumKeyMap() is non null.booleanbooleanbooleanisReady()Check is editor is ready, ie painted and layouted at the correct size, so all editor methods can be called.booleanCheck if the snap to quantization feature is enabled.voidvoidscrollToCenter(float posInBeats) Scroll so that specified position is shown in the center of the editor, if possible.voidscrollToCenter(int pitch) Scroll so that specified pitch is shown in the center of the editor, if possible.voidselectNote(NoteEvent ne, boolean b) voidselectNotes(Collection<NoteEvent> notes, boolean b) Select or unselect NoteViews.voidsetActiveTool(EditTool tool) Set the active EditTool.voidsetGhostPhases(Map<Integer, Phrase> mapChannelPhrases) Optional view-only phrases shown faded in the background of the editor.voidsetModel(Phrase p, FloatRange beatRange, int phraseStartBar, int rulerStartBar, int channel, NavigableMap<Float, TimeSignature> mapPosTs, DrumKit.KeyMap kMap) Set the edited model.voidsetPlaybackAutoScrollEnabled(boolean playbackAutoScrollEnabled) voidSet the display quantization.voidsetSnapEnabled(boolean b) Enable or disable the snap to quantization feature.voidAssociate an optional song to the editor.final voidSet the UndoManager used by this editor.voidSet the editor zoom value.voidshowPlaybackPoint(float pos) Show (or hide) a playback point in the editor at specified phrase position.toPosition(float posInBeats) Convert a phrase position in beats into a Position.floatConvert a phrase Position into a phrase position in beats.toString()voidUnselect all notes.Methods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, setUI, updateUIMethods inherited from class javax.swing.JComponentaddAncestorListener, 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, hide, 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, updateMethods inherited from class java.awt.Containeradd, 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, transferFocusDownCycle, validateMethods inherited from class java.awt.Componentaction, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
- 
Field Details- 
PROP_EDITOR_ALIVEnewValue=false. This property change event is fired ONLY once, when the editor is destroyed (cleanup() is called).- See Also:
 
- 
PROP_MODEL_PHRASEoldValue=old Phrase model, newValue=new Phrase model.- See Also:
 
- 
PROP_MODEL_CHANNELoldValue=old channel, newValue=new channel model.- See Also:
 
- 
PROP_SELECTED_NOTE_VIEWSoldValue=sorted list of NoteViews whose state has changeds, newValue=selected state- See Also:
 
- 
PROP_ACTIVE_TOOLoldValue=old tool, newValue=new tool- See Also:
 
- 
PROP_SNAP_ENABLEDnewValue=boolean- See Also:
 
- 
PROP_QUANTIZATIONoldValue=old quantization value, newValue=new quantization value- See Also:
 
- 
PROP_PLAYBACK_POINT_POSITIONnewValue=playback point position in beats- See Also:
 
 
- 
- 
Constructor Details- 
PianoRollEditorCreate a piano roll editor for a dummy phrase model.- Parameters:
- settings- Can't be null
 
 
- 
- 
Method Details- 
setSongAssociate an optional song to the editor.Put the song in the editor's lookup. Song undo manager is used. The ruler can show the chord symbols and listen to chord symbols changes. This method can be called only once. - Parameters:
- song- Can't be null
 
- 
getSong
- 
getChannelpublic int getChannel()Get the channel of the editor.The channel is used e.g. when "hear preview" or "solo mode" is activated, or when notes are imported from a dragged Midi file. - Returns:
- See Also:
- 
- #setModel(int, org.jjazz.util.api.FloatRange, org.jjazz.phrase.api.Phrase, int, java.util.NavigableMap, org.jjazz.midi.api.DrumKit.KeyMap)
 
 
- 
getEditToolsThe available EditTools.- Returns:
 
- 
setGhostPhasesOptional view-only phrases shown faded in the background of the editor.The specified phrases are shown faded in the background in order to facilite the editing of the Phrase model. E.g. if the edited phrase is a bass line, you can use this method to make the corresponding drums phrase also visible. - Parameters:
- mapChannelPhrases- A name associated to a Phrase.
 
- 
getGhostPhrasesGet the optional view-only phrases shown faded in the background of the editor.- Returns:
- Can be empty
 
- 
getModelGet the Phrase edited by this editor.- Returns:
 
- 
getRulerStartBarpublic int getRulerStartBar()Get the bar index displayed on the ruler corresponding to getBeatRange().from.Usually identical to getPhraseStartBar(), but it can be different to make the edited range appear at a different bar in the ruler. - Returns:
 
- 
getRulerBarRangeGet the ruler bar range.An IntRange starting at getRulerStartbar() with size equals to getPhraseBarRange(). - Returns:
 
- 
getTimeSignatureThe time signature at the specified beat position.- Parameters:
- posInBeats- Must be in the beat range
- Returns:
- Can't be null
 
- 
getTimeSignaturesGet all the time signatures with their position.- Returns:
- Can't be empty.
 
- 
getPhraseBeatRange
- 
getPhraseStartBarpublic int getPhraseStartBar()Get the bar index corresponding to getPhraseBeatRange().from.- Returns:
 
- 
getPhraseBarRange
- 
getLookuppublic org.openide.util.Lookup getLookup()Get the lookup of this editor.Lookup contains - Returns:
 
- 
isDrumspublic boolean isDrums()Convenience method which returns true if getDrumKeyMap() is non null.- Returns:
 
- 
getDrumKeyMapThe drum key map used by the edited phrase.- Returns:
- Null if it's a melodic phrase.
 
- 
getSettingsGet the graphical settings of this editor.- Returns:
 
- 
cleanuppublic void cleanup()Clean up everything so component can be garbaged.Fire a PROP_EDITOR_ALIVE with value=false. 
- 
setZoomSet the editor zoom value.- Parameters:
- zoom-
 
- 
getZoomGet the editor zoom value.- Returns:
 
- 
setQuantizationSet the display quantization.Fire a PROP_QUANTIZATION change event. - Parameters:
- q- Accepted values are BEAT, HALF_BEAT, ONE_THIRD_BEAT, ONE_QUARTER_BEAT, ONE_SIXTH_BEAT.
 
- 
getQuantizationGet the display quantization.- Returns:
- Can't be null
 
- 
isNoteSelected
- 
selectNote
- 
selectNotesSelect or unselect NoteViews.Fire a PROP_SELECTED_NOTE_VIEWS change event. - Parameters:
- notes-
- b-
 
- 
setSnapEnabledpublic void setSnapEnabled(boolean b) Enable or disable the snap to quantization feature.Fire a PROP_SNAP_ENABLED change event. - Parameters:
- b-
 
- 
isSnapEnabledpublic boolean isSnapEnabled()Check if the snap to quantization feature is enabled.- Returns:
 
- 
getNoteViewGet the NoteView associated to the specified NoteEvent.- Parameters:
- ne-
- Returns:
- Can be null
 
- 
getNoteViewsGet all the NoteViews sorted by NoteEvent natural order.- Returns:
 
- 
unselectAllpublic void unselectAll()Unselect all notes.
- 
getSelectedNoteViewsGet the currently selected NoteViews sorted by NoteEvent natural order.- Returns:
 
- 
setActiveToolSet the active EditTool.Fire a PROP_ACTIVE_TOOL change event. - Parameters:
- tool-
 
- 
getActiveToolGet the actived EditTool.- Returns:
- Can't be null
 
- 
isPlaybackAutoScrollEnabledpublic boolean isPlaybackAutoScrollEnabled()
- 
setPlaybackAutoScrollEnabledpublic void setPlaybackAutoScrollEnabled(boolean playbackAutoScrollEnabled) 
- 
showPlaybackPointpublic void showPlaybackPoint(float pos) Show (or hide) a playback point in the editor at specified phrase position.If pos is < 0 or out of the editor bounds, nothing is shown. Fire a PROP_PLAYBACK_POINT_POSITION change event. - Parameters:
- pos- The phrase position in beats.
 
- 
getPlaybackPointPositionpublic float getPlaybackPointPosition()Get the playback point position.- Returns:
- If < 0 no playback point is shown.
 
- 
getPositionFromPointReturn the phrase position in beats that corresponds to a graphical point in the editor.- Parameters:
- editorPoint- A point in the editor's coordinates. -1 if point is not valid.
- Returns:
 
- 
getXFromPositionpublic int getXFromPosition(float pos) Return the X editor position that corresponds to a beat position of the Phrase model.- Parameters:
- pos-
- Returns:
- -1 If pos is outside the Phrase
 
- 
toPositionInBeatsConvert a phrase Position into a phrase position in beats.- Parameters:
- pos- Must be in the bar range.
- Returns:
 
- 
toPositionConvert a phrase position in beats into a Position.- Parameters:
- posInBeats- Must be in the beat range.
- Returns:
- See Also:
 
- 
getPitchFromPointReturn the pitch that correspond to a graphical point in the editor.- Parameters:
- notesPanelPoint- A point in the editor's coordinates. -1 if point is not valid.
- Returns:
 
- 
scrollToCenterpublic void scrollToCenter(int pitch) Scroll so that specified pitch is shown in the center of the editor, if possible.- Parameters:
- pitch-
 
- 
scrollToCenterpublic void scrollToCenter(float posInBeats) Scroll so that specified position is shown in the center of the editor, if possible.- Parameters:
- posInBeats-
 
- 
getVisiblePitchRangeGet the min/max notes which are currently visible.- Returns:
 
- 
getVisibleBeatRangeGet the min/max beat positions which are visible.- Returns:
- Can be EMPTY_FLOAT_RANGE
 
- 
isReadypublic boolean isReady()Check is editor is ready, ie painted and layouted at the correct size, so all editor methods can be called.- Returns:
 
- 
getVisibleBarRangeGet the min/max bar indexes which are visible.- Returns:
 
- 
getUndoManager- Returns:
- The UndoManager used by this editor.
 
- 
setUndoManagerSet the UndoManager used by this editor.- Parameters:
- um-
 
- 
toString
- 
propertyChange- Specified by:
- propertyChangein interface- PropertyChangeListener
 
 
-