@Override public DockAction getDockAction( int index ){ if( index == 0 ){ return separator; } else{ return source.getDockAction( index-1 ); } }
/** * Gets the index of the child-source which contains <code>action</code>. * @param action the action for which is searched * @return the index of the source which contains the action or -1 */ protected int getSource( DockAction action ){ for( int i = 0, n = sources.size(); i<n; i++ ){ DockActionSource source = sources.get( i ); for( int j = 0, m = source.getDockActionCount(); j<m; j++ ){ if( source.getDockAction( j ) == action ) return i; } } return -1; }
public DockAction getDockAction( int index ) { if( listeners.isEmpty() ) updateSeparators(); int sum = 0; for( int i = 0, n = sources.size(); i<n; i++ ){ int length = sources.get( i ).getDockActionCount(); if( sum <= index && index < sum + length ) return sources.get( i ).getDockAction( index - sum ); sum += length; } throw new ArrayIndexOutOfBoundsException(); }
public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ){ for( int i = firstIndex; i <= lastIndex; i++ ) add( i, source.getDockAction( i )); }
public DockAction getDockAction( int index ){ if( index < 0 ) throw new IllegalArgumentException( "Index out of bounds: " + index ); int count = -1; if( actions == null ){ for( DockAction action : source ){ if( include( action )){ count++; if( index == count ) return action; } } } else{ for( int i = 0, n = source.getDockActionCount(); i<n; i++ ){ if( actions.get( i )){ count++; if( index == count ) return source.getDockAction( i ); } } } throw new IllegalArgumentException( "Index out of bounds: " + index ); }
public DockAction getDockAction( int index ){ return delegate.getDockAction( index ); }
public DockAction getDockAction( int index ){ if( index < 0 ) throw new IllegalArgumentException( "Index out of bounds: " + index ); int count = -1; if( actions == null ){ for( DockAction action : source ){ if( include( action )){ count++; if( index == count ) return action; } } } else{ for( int i = 0, n = source.getDockActionCount(); i<n; i++ ){ if( actions.get( i )){ count++; if( index == count ) return source.getDockAction( i ); } } } throw new IllegalArgumentException( "Index out of bounds: " + index ); }
public DockAction getDockAction( int index ){ return delegate.getDockAction( 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++; } } } }
public DockAction getDockAction( int index ){ if( source == null ) throw new IllegalArgumentException( "index out of bounds" ); else return source.getDockAction( index ); }
@Override public void bind() { super.bind(); source.addDockActionSourceListener( sourceListener ); for( int i = 0, n = source.getDockActionCount(); i<n; i++ ){ DockAction action = source.getDockAction( i ); ActionItem item = new ActionItem(); item.action = action; actions.add( item ); MenuViewItem<JComponent> handler = handlerFor( action ); if( handler != null ){ item.handler = handler; item.bind(); item.action.bind( dockable ); handler.bind(); if( handler.getItem() != null ){ menu.add( handler.getItem() ); } } } }
public DockAction getDockAction( int index ){ if( source == null ) throw new IllegalArgumentException( "index out of bounds" ); else return source.getDockAction( index ); }
public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = firstIndex; i <= lastIndex; i++ ){ DockAction action = source.getDockAction( i ); actions.add( i, action ); action.bind( dockable ); } }
public DockAction getDockAction( int index ){ DockActionSource source = source(); return source.getDockAction( index ); }
public DockAction getDockAction( int index ){ DockActionSource source = source(); return source.getDockAction( index ); }
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 ); } }
public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = firstIndex; i<=lastIndex; i++ ){ DockAction action = source.getDockAction( i ); ActionItem item = new ActionItem(); item.action = action; actions.add( i, item ); MenuViewItem<JComponent> handler = handlerFor( action ); if( handler != null ){ action.bind( dockable ); handler.bind(); item.handler = handler; item.bind(); } } reput(); }
public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = firstIndex; i <= lastIndex; i++ ){ DockAction action = source.getDockAction( i ); ActionItem entry = new ActionItem(); entry.action = action; if( dockable.getController() != null ){ BasicTitleViewItem<JComponent> item = createItemFor( action, dockable ); entry.item = item; if( item != null ){ action.bind( dockable ); item.bind(); item.setOrientation( orientation ); item.setForeground( getForeground() ); item.setBackground( getBackground() ); } } actions.add( i, entry ); } visibleActions = actions.size(); resetVisibleActions(); revalidate(); } public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ) {
public void actionsAdded( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = firstIndex; i <= lastIndex; i++ ){ DockAction action = source.getDockAction( i ); ActionItem entry = new ActionItem(); entry.action = action; if( dockable.getController() != null ){ BasicTitleViewItem<JComponent> item = createItemFor( action, dockable ); entry.item = item; if( item != null ){ action.bind( dockable ); item.bind(); item.setOrientation( orientation ); item.setForeground( getForeground() ); item.setBackground( getBackground() ); } } actions.add( i, entry ); } visibleActions = actions.size(); resetVisibleActions(); revalidate(); } public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ) {