private void updateOrientation(){ if( view != null ){ if( orientation == Orientation.HORIZONTAL ){ view.setOrientation( bibliothek.gui.dock.title.DockTitle.Orientation.FREE_HORIZONTAL ); } else{ view.setOrientation( bibliothek.gui.dock.title.DockTitle.Orientation.FREE_VERTICAL ); } } } }
@Override public void setBackground( Color bg ) { super.setBackground( bg ); if( menuItem != null ) menuItem.setBackground( bg ); if( actions != null ){ for( ActionItem item : actions ){ if( item.item != null ) item.item.setBackground( bg ); } } }
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 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 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(); } }
@Override public void setForeground( Color fg ) { super.setForeground( fg ); if( menuItem != null ) menuItem.setForeground( fg ); if( actions != null ){ for( ActionItem item : actions ){ if( item.item != null ) item.item.setForeground( fg ); } } }
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 ) {
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(); } }
@Override public void setForeground( Color fg ) { super.setForeground( fg ); if( menuItem != null ) menuItem.setForeground( fg ); if( actions != null ){ for( ActionItem item : actions ){ if( item.item != null ) item.item.setForeground( fg ); } } }
item.item.unbind(); item.action.unbind( this.dockable ); menuItem.unbind(); menuItem = null; menuItem = createItemFor( menuAction, dockable ); if( menuItem != null ){ menuItem.setOrientation( orientation ); menuItem.setForeground( getForeground() ); menuItem.setBackground( getBackground() ); menuItem.bind(); if( item != null ){ action.bind( dockable ); item.bind(); actionItem.item = item; item.setOrientation( orientation ); item.setForeground( getForeground() ); item.setBackground( getBackground() );
public void setOrientation( Orientation orientation ) { delegate.setOrientation( orientation ); } }
@Override public void setBackground( Color bg ) { super.setBackground( bg ); if( menuItem != null ) menuItem.setBackground( bg ); if( actions != null ){ for( ActionItem item : actions ){ if( item.item != null ) item.item.setBackground( bg ); } } }
item.item.unbind(); item.action.unbind( this.dockable ); menuItem.unbind(); menuItem = null; menuItem = createItemFor( menuAction, dockable ); if( menuItem != null ){ menuItem.setOrientation( orientation ); menuItem.setForeground( getForeground() ); menuItem.setBackground( getBackground() ); menuItem.bind(); if( item != null ){ action.bind( dockable ); item.bind(); actionItem.item = item; item.setOrientation( orientation ); item.setForeground( getForeground() ); item.setBackground( getBackground() );
@Override public Dimension getMinimumSize(){ if( actions.isEmpty() ) return new Dimension( 0, 0 ); if( menuItem == null ) return getPreferredSize(); return menuItem.getItem().getMinimumSize(); }
/** * Changes the orientation of this panel. * @param orientation the new orientation */ public void setOrientation( Orientation orientation ){ if( this.orientation != orientation ){ this.orientation = orientation; if( menuItem != null ) menuItem.setOrientation( orientation ); for( ActionItem item : actions ) if( item.item != null ) item.item.setOrientation( orientation ); revalidate(); } }
@Override public Dimension getMinimumSize(){ if( actions.isEmpty() ) return new Dimension( 0, 0 ); if( menuItem == null ) return getPreferredSize(); return menuItem.getItem().getMinimumSize(); }
/** * Changes the orientation of this panel. * @param orientation the new orientation */ public void setOrientation( Orientation orientation ){ if( this.orientation != orientation ){ this.orientation = orientation; if( menuItem != null ) menuItem.setOrientation( orientation ); for( ActionItem item : actions ) if( item.item != null ) item.item.setOrientation( orientation ); revalidate(); } }