/** * Gets the "special" children actions for <code>dockable</code> * @param dockable some item for which actions are required * @return the children actions, may be a new {@link DockActionSource}, not <code>null</code> */ protected DockActionSource getChildrenActionSourceFor( Dockable dockable ){ return new StationChildrenActionSource( dockable, null ); }
public int getDockActionCount(){ updateActionList( false ); return actions.size(); }
fill( dockable, list ); sort( list ); actions.remove( j ); m--; fireRemoved( j, j ); actions.add( j, new Tuple<Dockable, DockAction>( dockable, createActionFor( dockable ))); m++; fireAdded( j, j ); i++; j++; actions.remove( --m ); fireRemoved( j, length-1 ); while( i < n ){ Dockable dockable = list.get( i++ ); actions.add( new Tuple<Dockable, DockAction>( dockable, createActionFor( dockable ))); fireAdded( index, actions.size()-1 );
private void fill( Dockable dockable, List<Dockable> list ){ if( shouldShow( dockable )){ list.add( dockable ); } DockStation station = dockable.asDockStation(); if( station != null ){ for( int i = 0, n = station.getDockableCount(); i<n; i++ ){ fill( station.getDockable( i ), list ); } } }
/** * Tells which children to show and which not. This method is called with all children (direct * and indirect) of the station. The default behavior is to return <code>true</code> for * any direct child or <code>true</code> if the monitored dockable is no station at all. * @param dockable the child to check * @return <code>true</code> if there should be a button, <code>false</code> otherwise */ protected boolean shouldShow( Dockable dockable ){ if( dockable.getDockParent() == getDockable().asDockStation() ){ return true; } if( dockable == getDockable() && dockable.asDockStation() == null ){ return true; } return false; }
/** * Gets the "special" children actions for <code>dockable</code> * @param dockable some item for which actions are required * @return the children actions, may be a new {@link DockActionSource}, not <code>null</code> */ protected DockActionSource getChildrenActionSourceFor( Dockable dockable ){ return new StationChildrenActionSource( dockable, null ); }
public Iterator<DockAction> iterator(){ updateActionList( false ); return new Iterator<DockAction>() { private Iterator<Tuple<Dockable, DockAction>> iterator = actions.iterator(); public boolean hasNext(){ return iterator.hasNext(); } public DockAction next(){ return iterator.next().getB(); } public void remove(){ throw new UnsupportedOperationException(); } }; }
/** * Gets the "special" children actions for <code>dockable</code> * @param dockable some item for which actions are required * @return the children actions, may be a new {@link DockActionSource}, not <code>null</code> */ protected DockActionSource getChildrenActionSourceFor( Dockable dockable ){ return new StationChildrenActionSource( dockable, null ); }
public DockAction getDockAction( int index ){ updateActionList( false ); return actions.get( index ).getB(); }
@Override public void addDockActionSourceListener( DockActionSourceListener listener ){ if( this.listener == null ){ updateActionList( false ); } super.addDockActionSourceListener( listener ); if( this.listener == null ){ this.listener = new Listener(); this.listener.add( dockable ); } }