public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ){ // find location to insert new actions int insert = 0; for( int i = 0; i < firstIndex; i++ ){ if( actions.get( i )){ insert++; } } // filter new actions int count = 0; for( int i = firstIndex; i <= lastIndex; i++ ){ DockAction action = source.getDockAction( i ); boolean include = include( action ); actions.add( i, include ); if( include ){ count++; } } // fire events if( count > 0 ){ fireAdded( insert, insert+count-1 ); } }
public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ){ // find location to insert new actions int insert = 0; for( int i = 0; i < firstIndex; i++ ){ if( actions.get( i )){ insert++; } } // filter new actions int count = 0; for( int i = firstIndex; i <= lastIndex; i++ ){ DockAction action = source.getDockAction( i ); boolean include = include( action ); actions.add( i, include ); if( include ){ count++; } } // fire events if( count > 0 ){ fireAdded( insert, insert+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++; } } } }