/** * {@inheritDoc} */ public Cursor getCursor( final int aCursorIdx ) { final Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } return cursors[aCursorIdx]; }
/** * @return the cursorPositions */ private Cursor[] getCursors() { return getCurrentDataSet().getCursors(); } }
/** * {@inheritDoc} */ public boolean isCursorDefined( final int aCursorIdx ) { Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } return cursors[aCursorIdx].isDefined(); }
/** * Returns all defined cursors. * * @return an array of defined cursors, never <code>null</code>. */ public Cursor[] getDefinedCursors() { List<Cursor> result = new ArrayList<Cursor>(); if ( hasData() ) { for ( Cursor c : this.dataSet.getCursors() ) { if ( c.isDefined() ) { result.add( c ); } } } return result.toArray( new Cursor[result.size()] ); }
/** * {@inheritDoc} */ @Override protected String[] getMenuItemNames() { final Cursor[] cursors = this.controller.getCurrentDataSet().getCursors(); final List<String> result = new ArrayList<String>(); for ( Cursor cursor : cursors ) { if ( cursor.isDefined() ) { result.add( Integer.toString( cursor.getIndex() ) ); } } return result.toArray( new String[result.size()] ); }
/** * {@inheritDoc} */ public void setCursor( final int aCursorIdx, final long aTimestamp ) { Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } final Cursor cursor = cursors[aCursorIdx]; final Cursor oldCursor = cursor.clone(); // Update the time stamp of the cursor... cursor.setTimestamp( aTimestamp ); fireCursorChangeEvent( ICursorChangeListener.PROPERTY_TIMESTAMP, oldCursor, cursor ); }
/** * Returns the color for a cursor with the given index. * * @param aCursorIdx * the index of the cursor to retrieve the color for; * @param aLabel * the label to set, cannot be <code>null</code>. * @return a cursor color, never <code>null</code>. */ public void setCursorLabel( final int aCursorIdx, final String aLabel ) { Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } final Cursor cursor = cursors[aCursorIdx]; final Cursor oldCursor = cursor.clone(); // Update the label of the cursor... cursor.setLabel( aLabel ); fireCursorChangeEvent( ICursorChangeListener.PROPERTY_LABEL, oldCursor, cursor ); }
final Cursor[] cursors = aDataSet.getCursors(); final boolean cursorsEnabled = aDataSet.isCursorsEnabled();
/** * Returns the color for a cursor with the given index. * * @param aCursorIdx * the index of the cursor to retrieve the color for; * @param aColor * the color to set, cannot be <code>null</code>. * @return a cursor color, never <code>null</code>. */ public void setCursorColor( final int aCursorIdx, final Color aColor ) { Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } final Cursor cursor = cursors[aCursorIdx]; final Cursor oldCursor = cursor.clone(); // Update the color of the cursor... cursor.setColor( aColor ); fireCursorChangeEvent( ICursorChangeListener.PROPERTY_COLOR, oldCursor, cursor ); }
/** * @param aCursorIdx */ public void removeCursor( final int aCursorIdx ) { Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } final Cursor cursor = cursors[aCursorIdx]; if ( !cursor.isDefined() ) { // Nothing to do; the cursor is not defined... return; } final Cursor oldCursor = cursor.clone(); cursor.clear(); ICursorChangeListener[] listeners = this.eventListeners.getListeners( ICursorChangeListener.class ); for ( ICursorChangeListener listener : listeners ) { listener.cursorRemoved( oldCursor ); } }
/** * Creates a new DataSetImpl instance. * * @param aCapturedData * the captured data of this data set; * @param aOld * the old data set to template. */ public DataSetImpl( final AcquisitionResult aCapturedData, final DataSet aOld, final boolean aRetainAnnotations ) { this.propertyChangeSupport = new PropertyChangeSupport( this ); this.capturedData = aCapturedData; this.cursorsEnabled = aOld.isCursorsEnabled(); this.channels = createChannels( aCapturedData.getChannels(), aCapturedData.getEnabledChannels(), aRetainAnnotations, aOld.getChannels() ); this.cursors = createCursors( Ols.MAX_CURSORS, aOld.getCursors() ); }