/** * 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 ); }
/** * 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 ); }
/** * 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() ); } } }
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 ); } } } }