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 ); } }
/** * Creates and sets up a new view. This method does nothing more than * calling the method {@link DockAction#createView(ViewTarget, ActionViewConverter, Dockable) createView} * of {@link DockAction}. * @param <A> the type of the view * @param action the action for which a view is created * @param target the target platform, where the view will be shown * @param dockable the Dockable for which the action is used * @return the new view or <code>null</code> if nothing should be shown * @throws IllegalArgumentException if an unknown argument is used */ public <A> A createView( DockAction action, ViewTarget<A> target, Dockable dockable ){ return action.createView( target, this, dockable ); }
public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = lastIndex; i >= firstIndex; i-- ){ DockAction action = actions.remove( i ); action.unbind( dockable ); } } }
private void createView(){ if( bound && controller != null ){ if( dockable == null ){ throw new IllegalStateException( "trying to bind the item without knowing its dockable" ); } action.bind( dockable ); view = action.createView( TOOLBAR, controller.getActionViewConverter(), dockable ); if( view != null ){ updateOrientation(); view.bind(); content.add( view.getItem() ); JComponent item = view.getItem(); for( MouseInputListener listener : mouseListeners ){ item.addMouseListener( listener ); item.addMouseMotionListener( listener ); } } } }
public boolean trigger( Dockable dockable ) { if( !isEnabled( dockable )) return false; if( selection != null ) return selection.trigger( dockable ); return false; } }
public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = lastIndex; i >= firstIndex; i-- ){ ActionItem entry = actions.remove( i ); if( entry.item != null ){ entry.item.unbind(); entry.action.unbind( dockable ); } } visibleActions = actions.size(); resetVisibleActions(); revalidate(); } }
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(); }
/** * Creates and sets up a new view. This method does nothing more than * calling the method {@link DockAction#createView(ViewTarget, ActionViewConverter, Dockable) createView} * of {@link DockAction}. * @param <A> the type of the view * @param action the action for which a view is created * @param target the target platform, where the view will be shown * @param dockable the Dockable for which the action is used * @return the new view or <code>null</code> if nothing should be shown * @throws IllegalArgumentException if an unknown argument is used */ public <A> A createView( DockAction action, ViewTarget<A> target, Dockable dockable ){ return action.createView( target, this, dockable ); }
public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = lastIndex; i >= firstIndex; i-- ){ ActionItem entry = actions.remove( i ); if( entry.item != null ){ entry.item.unbind(); entry.action.unbind( dockable ); } } visibleActions = actions.size(); resetVisibleActions(); revalidate(); } }
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 ) {
/** * Adds an action into the list of all known actions. * @param index the location of the action * @param action the new action */ private void add( int index, DockAction action ){ Dockable dockable = getDockable(); actions.add( index, action ); DropDownViewItem item = action.createView( ViewTarget.DROP_DOWN, dockable.getController().getActionViewConverter(), dockable ); if( item != null ){ DropDownItemHandle entry = new DropDownItemHandle( action, item, dockable, getAction() ); entry.bind(); items.put( action, entry ); if( item.getItem() != null ){ menu.add( item.getItem() ); } } }
public void actionsRemoved( DockActionSource source, int firstIndex, int lastIndex ) { for( int i = lastIndex; i >= firstIndex; i-- ){ ActionItem item = actions.remove( i ); item.unbind(); if( item.handler != null ){ item.handler.unbind(); item.action.unbind( dockable ); } } 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 ) {
private void destroyView(){ if( view != null ){ JComponent item = view.getItem(); for( MouseInputListener listener : mouseListeners ){ item.removeMouseListener( listener ); item.removeMouseMotionListener( listener ); } view.unbind(); view = null; } action.unbind( dockable ); content.removeAll(); }
@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() ); } } } }
@Override public void unbind() { super.unbind(); source.removeDockActionSourceListener( sourceListener ); menu.removeAll(); for( ActionItem item : actions ){ item.unbind(); if( item.handler != null ){ item.handler.unbind(); item.action.unbind( dockable ); } } actions.clear(); }