/** * Sets a cursor position. * * @param aCursorIdx * the index of the cursor to set, should be >= 0 and < 10; * @param aCursorPosition * the actual cursor position to set. * @throws IllegalArgumentException * in case an invalid cursor index was given. */ public void setCursorPosition( final int aCursorIdx, final Long aCursorPosition ) throws IllegalArgumentException { if ( ( aCursorIdx < 0 ) || ( aCursorIdx > ( Ols.MAX_CURSORS - 1 ) ) ) { throw new IllegalArgumentException( "Invalid cursor index! Should be between 0 and " + Ols.MAX_CURSORS ); } final Cursor[] cursorPositions = getCursors(); if ( cursorPositions != null ) { if ( ( aCursorPosition == null ) || ( aCursorPosition.longValue() == Long.MIN_VALUE ) ) { cursorPositions[aCursorIdx].clear(); } else { cursorPositions[aCursorIdx].setTimestamp( aCursorPosition.longValue() ); } } }
/** * @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 ); } }