public void showTextChanged( ButtonContentFilter filter, Dockable dockable, DockAction action ){ if( (action == null || action == getAction()) && (dockable == null || dockable == getDockable())){ updateText(); } } };
/** * Changes the tooltip of the model. */ private void updateTooltip(){ Dockable dockable = getDockable(); StandardDockAction action = getAction(); String tooltip = action.getTooltipText( dockable ); if( tooltip == null || tooltip.length() == 0 ) tooltip = action.getText( dockable ); getModel().setToolTipText( tooltip ); }
@Override protected void valueChanged( ButtonContentFilter oldValue, ButtonContentFilter newValue ){ if( isBound() ){ if( oldValue != null ){ oldValue.removeListener( filterListener ); oldValue.uninstall( getDockable(), getAction() ); } if( newValue != null ){ newValue.addListener( filterListener ); newValue.install( getDockable(), getAction() ); } } updateText(); } };
/** * Updates the text of the model. */ private void updateText(){ Dockable dockable = getDockable(); StandardDockAction action = getAction(); if( filter.getValue().showText( dockable, action )){ getModel().setText( action.getText( dockable ) ); } else{ getModel().setText( null ); } }
public void bind(){ if( listener == null ) listener = createListener(); filter.setProperties( getDockable().getController() ); updateTooltip(); BasicButtonModel model = getModel(); StandardDockAction action = getAction(); Dockable dockable = getDockable(); for( ActionContentModifier modifier : action.getIconContexts( dockable )){ model.setIcon( modifier, action.getIcon( dockable, modifier ) ); } updateText(); model.setEnabled( action.isEnabled( dockable ) ); model.setDockableRepresentative( action.getDockableRepresentation( dockable ) ); action.addDockActionListener( listener ); super.bind(); filter.getValue().addListener( filterListener ); filter.getValue().install( getDockable(), getAction() ); }
public void unbind(){ filter.getValue().removeListener( filterListener ); filter.getValue().uninstall( getDockable(), getAction() ); super.unbind(); filter.setProperties( (DockController)null ); getModel().setDockableRepresentative( null ); getAction().removeDockActionListener( listener ); }