Skip to content

Commit

Permalink
Converted boundsColor to the new rendering parameter API
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed May 20, 2012
1 parent 5daedad commit c895be0
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.openscience.cdk.renderer.generators;


import java.awt.Color;
import java.awt.geom.Rectangle2D;
import java.util.Arrays;
import java.util.List;
Expand All @@ -32,6 +33,7 @@
import org.openscience.cdk.renderer.elements.ElementGroup;
import org.openscience.cdk.renderer.elements.IRenderingElement;
import org.openscience.cdk.renderer.elements.RectangleElement;
import org.openscience.cdk.renderer.generators.parameter.AbstractGeneratorParameter;


/**
Expand All @@ -41,7 +43,19 @@
* @cdk.module renderextra
*/
public class BoundsGenerator implements IReactionGenerator {


/**
* The color of the box drawn at the bounds of a
* molecule, molecule set, or reaction.
*/
public static class BoundsColor extends
AbstractGeneratorParameter<Color> {
public Color getDefault() {
return Color.LIGHT_GRAY;
}
}
private IGeneratorParameter<Color> boundsColor = new BoundsColor();

public BoundsGenerator() {}

public IRenderingElement generate(IReaction reaction, RendererModel model) {
Expand All @@ -65,7 +79,7 @@ public IRenderingElement generate(IMolecule molecule, RendererModel model) {
bounds.getMinY(),
bounds.getMaxX(),
bounds.getMaxY(),
model.getBoundsColor());
boundsColor.getValue());
}

public IRenderingElement generate(
Expand All @@ -76,12 +90,13 @@ public IRenderingElement generate(
totalBounds.getMinY(),
totalBounds.getMaxX(),
totalBounds.getMaxY(),
model.getBoundsColor());
boundsColor.getValue());
}

public List<IGeneratorParameter<?>> getParameters() {
return Arrays.asList(
new IGeneratorParameter<?>[] {
boundsColor
}
);
}
Expand Down

0 comments on commit c895be0

Please sign in to comment.