de.randgestalten.toolbar
Class UnifiedToolbarBuilder

java.lang.Object
  extended by de.randgestalten.toolbar.AbstractToolbarBuilder<V,T>
      extended by de.randgestalten.toolbar.AbstractSegmentedToolbarBuilder<UnifiedToolbarBuilder,JComponent>
          extended by de.randgestalten.toolbar.UnifiedToolbarBuilder
All Implemented Interfaces:
SwingConstants

public class UnifiedToolbarBuilder
extends AbstractSegmentedToolbarBuilder<UnifiedToolbarBuilder,JComponent>

A ToolbartBuilder that creates a UnifiedToolbar from MacWidgets (you need that in your classpath !). By default, all components are added to the left group of the unified toolbar. Use left(), center() and right() to switch groups.

You can use createGroup(String) to create labeled views.

To follow the mac style, focus painting for buttons is disabled by default. Enable it using enableButtonFocus(boolean).

Author:
Thasso Griebel (thasso.griebel@gmail.com)

Nested Class Summary
 
Nested classes/interfaces inherited from class de.randgestalten.toolbar.AbstractToolbarBuilder
AbstractToolbarBuilder.ComponentFactory, AbstractToolbarBuilder.DefaultComponentFactory
 
Field Summary
 
Fields inherited from class de.randgestalten.toolbar.AbstractToolbarBuilder
builder, componentFactory, componentProperties, focusPainting, orientation, parent, toolbar, uiclass
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
  UnifiedToolbarBuilder()
          Craete a new builder
  UnifiedToolbarBuilder(JComponent toolbar)
           
  UnifiedToolbarBuilder(JComponent toolbar, int orientation)
           
  UnifiedToolbarBuilder(JToolBar toolbar)
           
protected UnifiedToolbarBuilder(UnifiedToolbarBuilder parent, JComponent container)
           
 
Method Summary
protected  void addImpl(JComponent component)
          Internal method that adds component to the toolbar container
 UnifiedToolbarBuilder center()
          Switch to the center group
protected  UnifiedToolbarBuilder createGroup(JComponent container)
          Create a new buidler group
 UnifiedToolbarBuilder createGroup(String label)
          Create a labeled group using mac widgets LabeledComponentGroup as the gorups container.
 UnifiedToolbarBuilder createGroup(String label, JComponent... components)
          Creats a labeld group from the given components and adds it to the toolbar.
 UnifiedToolbarBuilder enableButtonFocus(boolean enabled)
          Enable/Disable painting of the button focus.
 JComponent getToolbar()
           
 com.explodingpixels.macwidgets.UnifiedToolBar getUnifiedToolbar()
          Access the unified toolbar
protected  JComponent installUI(AbstractButton button, Class<? extends ButtonUI> ui)
          To go with the mac style, we disable focus painting for buttons.
 UnifiedToolbarBuilder left()
          Switch to the left group
 UnifiedToolbarBuilder right()
          Switch to the right group
 
Methods inherited from class de.randgestalten.toolbar.AbstractSegmentedToolbarBuilder
applyPosition, initBuilder, withSegmentation
 
Methods inherited from class de.randgestalten.toolbar.AbstractToolbarBuilder
add, add, add, add, add, addSeperator, addSeperator, close, createGroup, createGroupContainer, createGroupContainer, getBuilder, prepareComponent, withComponentFactory, withFocusPainting, withProperty, withUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnifiedToolbarBuilder

public UnifiedToolbarBuilder()
Craete a new builder


UnifiedToolbarBuilder

public UnifiedToolbarBuilder(JToolBar toolbar)

UnifiedToolbarBuilder

public UnifiedToolbarBuilder(JComponent toolbar)

UnifiedToolbarBuilder

public UnifiedToolbarBuilder(JComponent toolbar,
                             int orientation)

UnifiedToolbarBuilder

protected UnifiedToolbarBuilder(UnifiedToolbarBuilder parent,
                                JComponent container)
Method Detail

installUI

protected JComponent installUI(AbstractButton button,
                               Class<? extends ButtonUI> ui)
To go with the mac style, we disable focus painting for buttons.

Overrides:
installUI in class AbstractToolbarBuilder<UnifiedToolbarBuilder,JComponent>
Parameters:
button - the button
ui - the ui class
Returns:

enableButtonFocus

public UnifiedToolbarBuilder enableButtonFocus(boolean enabled)
Enable/Disable painting of the button focus.

Parameters:
enabled -
Returns:
builder the builder

center

public UnifiedToolbarBuilder center()
Switch to the center group

Returns:
builder the center group builder

right

public UnifiedToolbarBuilder right()
Switch to the right group

Returns:
builder the right group builder

left

public UnifiedToolbarBuilder left()
Switch to the left group

Returns:
builder the left group builder

createGroup

public UnifiedToolbarBuilder createGroup(String label)
Create a labeled group using mac widgets LabeledComponentGroup as the gorups container.

Parameters:
label - the label
Returns:
group the group builder

createGroup

public UnifiedToolbarBuilder createGroup(String label,
                                         JComponent... components)
Creats a labeld group from the given components and adds it to the toolbar.

Parameters:
label - the label
components - the components
Returns:
builder the builder

createGroup

protected UnifiedToolbarBuilder createGroup(JComponent container)
Description copied from class: AbstractToolbarBuilder
Create a new buidler group

Specified by:
createGroup in class AbstractToolbarBuilder<UnifiedToolbarBuilder,JComponent>
Parameters:
container - the container
Returns:
group the group

getToolbar

public JComponent getToolbar()
Overrides:
getToolbar in class AbstractToolbarBuilder<UnifiedToolbarBuilder,JComponent>
Returns:
toolbar the final toolbar component

getUnifiedToolbar

public com.explodingpixels.macwidgets.UnifiedToolBar getUnifiedToolbar()
Access the unified toolbar

Returns:
unified toolbar

addImpl

protected void addImpl(JComponent component)
Description copied from class: AbstractToolbarBuilder
Internal method that adds component to the toolbar container

Overrides:
addImpl in class AbstractSegmentedToolbarBuilder<UnifiedToolbarBuilder,JComponent>