public void bind(){ action.bind( dockable ); DockActionSource source = action.getSubActions( dockable ); menuAction = new SimpleMenuAction( source ); handler = new MenuMenuHandler( menuAction, dockable, ViewTarget.DROP_DOWN ); menuAction.setText( action.getText( dockable ) ); menuAction.setTooltip( action.getTooltipText( dockable ) ); menuAction.setEnabled( action.isEnabled( dockable ) ); for( ActionContentModifier modifier : action.getIconContexts( dockable )){ menuAction.setIcon( modifier, action.getIcon( dockable, modifier ) ); } handler.bind(); handler.addChildrenActionListener( menuListener ); action.addDockActionListener( listener ); }
public DropDownViewItem create( ActionViewConverter converter, DropDownAction action, Dockable dockable ){ return new SubDropDownHandler( action.createView( ViewTarget.MENU, converter, dockable ) ); } });
public void unbind(){ handler.removeChildrenActionListener( menuListener ); handler.unbind(); action.removeDockActionListener( listener ); action.unbind( dockable ); menuAction = null; handler = null; }
action.bind( dockable ); filter = action.getFilter( dockable ).createView( action, dockable, buttonView ); filter.bind(); source = action.getSubActions( dockable ); selection = items.get( action.getSelection( dockable ) ); if( selection != null ) selection.getView().setView( selectionView ); action.addDropDownActionListener( listener ); action.addDockActionListener( listener ); source.addDockActionSourceListener( listener ); getModel().setEnabled( action.isEnabled( dockable ) ); buttonContentFilter.setProperties( dockable.getController() );
action.removeDockActionListener( listener ); action.removeDropDownActionListener( listener ); source.removeDockActionSourceListener( listener ); action.unbind( dockable );
/** * Updates the icon of the {@link #getView() view}. * @param selection the selected item, ignored by the default implementation */ protected void updateIcon( DropDownViewItem selection ){ Set<ActionContentModifier> modifiers = new HashSet<ActionContentModifier>(); modifiers.addAll( icons.keySet() ); for( ActionContentModifier modifier : getView().getIconContexts() ){ modifiers.add( modifier ); } for( ActionContentModifier modifier : getAction().getIconContexts( getDockable() )){ modifiers.add( modifier ); } for( ActionContentModifier modifier : modifiers ){ Icon icon = icons.get( modifier ); if( icon == null ){ getView().setIcon( modifier, getAction().getIcon( getDockable(), modifier ) ); } else{ getView().setIcon( modifier, icon ); } } }
/** * Updates the tooltip of the {@link #getView() view}. * @param selection the selected item, ignored by the default implementation */ protected void updateTooltip( DropDownViewItem selection ){ if( selection == null || !selection.isTriggerable( true ) ){ String tooltip = getAction().getTooltipText( getDockable() ); if( tooltip == null ) tooltip = super.tooltip; if( tooltip == null ) tooltip = getAction().getText( getDockable() ); if( tooltip == null ) tooltip = super.text; getView().setTooltip( tooltip ); } else{ String tooltip = super.tooltip; if( tooltip == null ) tooltip = getAction().getTooltipText( getDockable() ); if( tooltip == null ) tooltip = super.text; if( tooltip == null ) tooltip = getAction().getText( getDockable() ); getView().setTooltip( tooltip ); } } }
/** * Updates the text of the {@link #getView() view}. * @param selection the selected item, ignored by the default implementation */ protected void updateText( DropDownViewItem selection ){ if( text == null ) getView().setText( getAction().getText( getDockable() ) ); else getView().setText( text ); }
/** * Updates the icon of the {@link #getView() view}. * @param selection the selected item, ignored by the default implementation */ protected void updateIcon( DropDownViewItem selection ){ Set<ActionContentModifier> modifiers = new HashSet<ActionContentModifier>(); modifiers.addAll( icons.keySet() ); for( ActionContentModifier modifier : getView().getIconContexts() ){ modifiers.add( modifier ); } for( ActionContentModifier modifier : getAction().getIconContexts( getDockable() )){ modifiers.add( modifier ); } for( ActionContentModifier modifier : modifiers ){ Icon icon = icons.get( modifier ); if( icon == null ){ getView().setIcon( modifier, getAction().getIcon( getDockable(), modifier ) ); } else{ getView().setIcon( modifier, icon ); } } }
/** * Updates the tooltip of the {@link #getView() view}. * @param selection the selected item, ignored by the default implementation */ protected void updateTooltip( DropDownViewItem selection ){ if( selection == null || !selection.isTriggerable( true ) ){ String tooltip = getAction().getTooltipText( getDockable() ); if( tooltip == null ) tooltip = super.tooltip; if( tooltip == null ) tooltip = getAction().getText( getDockable() ); if( tooltip == null ) tooltip = super.text; getView().setTooltip( tooltip ); } else{ String tooltip = super.tooltip; if( tooltip == null ) tooltip = getAction().getTooltipText( getDockable() ); if( tooltip == null ) tooltip = super.text; if( tooltip == null ) tooltip = getAction().getText( getDockable() ); getView().setTooltip( tooltip ); } } }
/** * Updates the text of the {@link #getView() view}. * @param selection the selected item, ignored by the default implementation */ protected void updateText( DropDownViewItem selection ){ if( text == null ) getView().setText( getAction().getText( getDockable() ) ); else getView().setText( text ); }
public void bind(){ action.bind( dockable ); DockActionSource source = action.getSubActions( dockable ); menuAction = new SimpleMenuAction( source ); handler = new MenuMenuHandler( menuAction, dockable, ViewTarget.DROP_DOWN ); menuAction.setText( action.getText( dockable ) ); menuAction.setTooltip( action.getTooltipText( dockable ) ); menuAction.setEnabled( action.isEnabled( dockable ) ); for( ActionContentModifier modifier : action.getIconContexts( dockable )){ menuAction.setIcon( modifier, action.getIcon( dockable, modifier ) ); } handler.bind(); handler.addChildrenActionListener( menuListener ); action.addDockActionListener( listener ); }
public void unbind(){ handler.removeChildrenActionListener( menuListener ); handler.unbind(); action.removeDockActionListener( listener ); action.unbind( dockable ); menuAction = null; handler = null; }
public DropDownViewItem create( ActionViewConverter converter, DropDownAction action, Dockable dockable ){ return new SubDropDownHandler( action.createView( ViewTarget.MENU, converter, dockable ) ); } });