/** * Creates a new DeleteCursorAction instance. */ public DeleteCursorAction( final SignalDiagramController aController, final Cursor aCursor ) { super( "Delete cursor " + ( aCursor.getIndex() + 1 ) ); this.controller = aController; this.cursorIdx = aCursor.getIndex(); putValue( ACCELERATOR_KEY, SwingComponentUtils.createKeyMask( KeyEvent.VK_DELETE ) ); }
/** * {@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()] ); }
/** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed( final ActionEvent aEvent ) { final Cursor[] definedCursors = this.controller.getDefinedCursors(); for ( Cursor cursor : definedCursors ) { if ( ( this.index == cursor.getIndex() ) && cursor.isDefined() ) { this.controller.scrollToTimestamp( cursor.getTimestamp() ); } } }
/** * Creates a new Cursor instance a copy of a given cursor. * * @param aCursor * the cursor to copy, cannot be <code>null</code>. * @param aAbsLen * the absolute length of the data, >= 0L. * @throws IllegalArgumentException * in case the given index was invalid. */ public CursorImpl( final Cursor aCursor, final long aAbsLen ) { this( aCursor.getIndex() ); this.color = aCursor.getColor(); this.label = aCursor.getLabel(); this.timestamp = aCursor.isDefined() && ( aCursor.getTimestamp() <= aAbsLen ) // ? Long.valueOf( aCursor.getTimestamp() ) : null; }
/** * {@inheritDoc} */ @Override public void actionPerformed( final ActionEvent aEvent ) { final EditCursorDialog dialog = new EditCursorDialog( SwingComponentUtils.getOwningWindow( aEvent ), this.cursor ); if ( dialog.showDialog() ) { final SignalDiagramModel model = this.controller.getViewModel(); // XXX shouldn't this be set directly on the cursor?!!! model.setCursorLabel( this.cursor.getIndex(), dialog.getLabel() ); model.setCursorColor( this.cursor.getIndex(), dialog.getColor() ); } } }
Integer index = Integer.valueOf( aCursor.getIndex() + 1 );
String label = "" + ( cursor.getIndex() + 1 ); if ( cursor.hasLabel() )
/** * {@inheritDoc} */ @Override public void mousePressed( final MouseEvent aEvent ) { final MouseEvent event = convertEvent( aEvent ); final Point point = event.getPoint(); if ( !handlePopupTrigger( point, aEvent ) ) { if ( getModel().isCursorMode() ) { Cursor hoveredCursor = findCursor( point ); if ( hoveredCursor != null ) { this.movingCursor = hoveredCursor.getIndex(); setMouseCursor( aEvent, SignalView.CURSOR_MOVE_CURSOR ); } else { this.movingCursor = -1; } } if ( ( aEvent.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK ) != 0 ) { this.lastClickPosition = point; } } }