public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ){ // find location to remove old actions int remove = 0; for( int i = 0; i < firstIndex; i++ ){ if( actions.get( i )){ remove++; } } // remove old actions int count = 0; for( int i = lastIndex; i >= firstIndex; i-- ){ if( actions.remove( i )) count++; } // fire events if( count > 0 ){ fireRemoved( remove, remove+count-1 ); } } }
public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ){ // find location to remove old actions int remove = 0; for( int i = 0; i < firstIndex; i++ ){ if( actions.get( i )){ remove++; } } // remove old actions int count = 0; for( int i = lastIndex; i >= firstIndex; i-- ){ if( actions.remove( i )) count++; } // fire events if( count > 0 ){ fireRemoved( remove, remove+count-1 ); } } }
/** * Recalculates the visibility of all actions and fires events to the registered {@link DockActionSourceListener} * if the state of an action changed. */ public void refresh(){ if( actions != null ){ int index = 0; for( int i = 0, n = source.getDockActionCount(); i<n; i++ ){ boolean include = include( source.getDockAction( i ) ); if( include != actions.get( i ).booleanValue() ){ actions.set( i, include ); if( include ){ // action has been added fireAdded( index, index ); } else{ // action was removed fireRemoved( index, index ); } } if( include ){ index++; } } } }
/** * Recalculates the visibility of all actions and fires events to the registered {@link DockActionSourceListener} * if the state of an action changed. */ public void refresh(){ if( actions != null ){ int index = 0; for( int i = 0, n = source.getDockActionCount(); i<n; i++ ){ boolean include = include( source.getDockAction( i ) ); if( include != actions.get( i ).booleanValue() ){ actions.set( i, include ); if( include ){ // action has been added fireAdded( index, index ); } else{ // action was removed fireRemoved( index, index ); } } if( include ){ index++; } } } }