de.randgestalten.toolbar
Class AbstractSegmentedToolbarBuilder<V extends AbstractSegmentedToolbarBuilder,T extends JComponent>

java.lang.Object
  extended by de.randgestalten.toolbar.AbstractToolbarBuilder<V,T>
      extended by de.randgestalten.toolbar.AbstractSegmentedToolbarBuilder<V,T>
All Implemented Interfaces:
SwingConstants
Direct Known Subclasses:
AbstractCustomizedToolbarBuilder, ToolbarBuilder, UnifiedToolbarBuilder

public abstract class AbstractSegmentedToolbarBuilder<V extends AbstractSegmentedToolbarBuilder,T extends JComponent>
extends AbstractToolbarBuilder<V,T>

Base class for ToolbarBuilders that support segmented Button groups. Use this to create extensions. ToolbarBuilder provides a default implementations where you do not have to specify generics.

Usage of this class is similar to AbstractToolbarBuilder, but groups support button positions. You can turn of segmentation support at any time, using withSegmentation(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
  AbstractSegmentedToolbarBuilder()
           
  AbstractSegmentedToolbarBuilder(JComponent toolbar)
           
  AbstractSegmentedToolbarBuilder(JComponent toolbar, int orientation)
           
  AbstractSegmentedToolbarBuilder(JComponent toolbar, int orientation, Class<? extends ButtonUI> uiclass)
           
  AbstractSegmentedToolbarBuilder(JToolBar toolbar)
           
protected AbstractSegmentedToolbarBuilder(V parent, JComponent container)
           
 
Method Summary
protected  void addImpl(JComponent component)
          Internal method that adds component to the toolbar container
protected  void applyPosition(JComponent component, String position)
          This applies the button position in groups.
protected  void initBuilder()
          Overrides the default implementations to initialize button segemntation positions based on the toolbars orientation.
 V withSegmentation(boolean segmentation)
          enable or disable segementation.
 
Methods inherited from class de.randgestalten.toolbar.AbstractToolbarBuilder
add, add, add, add, add, addSeperator, addSeperator, close, createGroup, createGroup, createGroupContainer, createGroupContainer, getBuilder, getToolbar, installUI, 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

AbstractSegmentedToolbarBuilder

public AbstractSegmentedToolbarBuilder()

AbstractSegmentedToolbarBuilder

public AbstractSegmentedToolbarBuilder(JToolBar toolbar)

AbstractSegmentedToolbarBuilder

public AbstractSegmentedToolbarBuilder(JComponent toolbar)

AbstractSegmentedToolbarBuilder

public AbstractSegmentedToolbarBuilder(JComponent toolbar,
                                       int orientation)

AbstractSegmentedToolbarBuilder

public AbstractSegmentedToolbarBuilder(JComponent toolbar,
                                       int orientation,
                                       Class<? extends ButtonUI> uiclass)

AbstractSegmentedToolbarBuilder

protected AbstractSegmentedToolbarBuilder(V parent,
                                          JComponent container)
Method Detail

initBuilder

protected void initBuilder()
Overrides the default implementations to initialize button segemntation positions based on the toolbars orientation.

Overrides:
initBuilder in class AbstractToolbarBuilder<V extends AbstractSegmentedToolbarBuilder,T extends JComponent>

withSegmentation

public V withSegmentation(boolean segmentation)
enable or disable segementation. Enabled by default.

Parameters:
segmentation -
Returns:
builder the builder

addImpl

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

Overrides:
addImpl in class AbstractToolbarBuilder<V extends AbstractSegmentedToolbarBuilder,T extends JComponent>

applyPosition

protected void applyPosition(JComponent component,
                             String position)
This applies the button position in groups. Default implementation uses button position properties from Jeremy Woods ButtonUI. Extends this class and overwrite this method if you want to customize the positioning.

Parameters:
component - the component
position - one of the position properties (MIDDLE, ONLY, FIRST, LAST)