net.sourceforge.barbecue
Class CompositeModule

java.lang.Object
  extended bynet.sourceforge.barbecue.Module
      extended bynet.sourceforge.barbecue.CompositeModule

public class CompositeModule
extends Module

Specific implementation of Module that allows the grouping of multiple Modules into one parent module.

Note: You should not instantiate this class directly.

Author:
Ian Bourke

Field Summary
 
Fields inherited from class net.sourceforge.barbecue.Module
bars
 
Constructor Summary
CompositeModule()
          Constructs a new Composite module that is initially empty.
 
Method Summary
 void add(Module module)
          Adds the given module to this composite module.
protected  int draw(Output output, int x, int y, int barWidth, int barHeight)
          Draws the module to the given outputter at the specified origin.
 Module getModule(int index)
          Returns the child module at the specified index.
 java.lang.String getSymbol()
          Returns the symbol group encoded by this module.
 int size()
          Returns the number of modules currently contained within this composite module.
 int widthInBars()
          Returns the underlying total width of the bars from the bar specification (that is, the sum of original bar widths in base bar units).
 
Methods inherited from class net.sourceforge.barbecue.Module
equals, hashCode, setSymbol, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeModule

public CompositeModule()
Constructs a new Composite module that is initially empty.

Method Detail

add

public void add(Module module)
Adds the given module to this composite module.

Parameters:
module - The module to add

size

public int size()
Returns the number of modules currently contained within this composite module.

Returns:
The number of child modules

getModule

public Module getModule(int index)
Returns the child module at the specified index.

Parameters:
index - The module index
Returns:
The module at the given index

getSymbol

public java.lang.String getSymbol()
Returns the symbol group encoded by this module. This is actually a concatenation of the symbols encoded by each child module.

Overrides:
getSymbol in class Module
Returns:
The symbol encoded by this composite module

widthInBars

public int widthInBars()
Returns the underlying total width of the bars from the bar specification (that is, the sum of original bar widths in base bar units).

Overrides:
widthInBars in class Module
Returns:
The total width of bars in base (unscaled) units

draw

protected int draw(Output output,
                   int x,
                   int y,
                   int barWidth,
                   int barHeight)
            throws OutputException
Draws the module to the given outputter at the specified origin. This actually draws each child module in turn.

Overrides:
draw in class Module
Parameters:
output - The outputter to draw to
x - The X component of the origin
y - The Y component of the origin
barWidth -
barHeight -
Returns:
The total width drawn
Throws:
OutputException


Copyright © 2003-2007 barbecue.sourceforge.net. All Rights Reserved.