/** * {@inheritDoc} */ @Override public Cursor clone() { try { final Cursor result = ( Cursor )super.clone(); if ( isDefined() ) { result.setTimestamp( this.timestamp.longValue() ); } if ( hasLabel() ) { result.setLabel( new String( this.label ) ); } result.setColor( this.color ); return result; } catch ( CloneNotSupportedException exception ) { throw new RuntimeException( "Internal error: Object#clone() not supported?!" ); } }
/** * 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 ); }