Java 类org.jfree.ui.HorizontalAlignment 实例源码

项目:parabuild-ci    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image (<code>null</code> not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the 
 *                 title.
 */
public ImageTitle(Image image, int height, int width, 
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment, 
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:rapidminer    文件:ROCChartPlotter.java   
public void paintDeviationChart(Graphics graphics, int width, int height) {
    prepareData();

    JFreeChart chart = createChart(this.dataset);

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // legend settings
    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setPosition(RectangleEdge.TOP);
        legend.setFrame(BlockBorder.NONE);
        legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
    }

    Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height);
    chart.draw((Graphics2D) graphics, drawRect);
}
项目:parabuild-ci    文件:TextTitle.java   
/**
 * Creates a new title.
 *
 * @param text  the text for the title (<code>null</code> not permitted).
 * @param font  the title font (<code>null</code> not permitted).
 * @param paint  the title paint (<code>null</code> not permitted).
 * @param position  the title position (<code>null</code> not permitted).
 * @param horizontalAlignment  the horizontal alignment (<code>null</code> not permitted).
 * @param verticalAlignment  the vertical alignment (<code>null</code> not permitted).
 * @param spacer  the space to leave around the outside of the title.
 */
public TextTitle(String text, 
                 Font font, 
                 Paint paint, 
                 RectangleEdge position,
                 HorizontalAlignment horizontalAlignment, 
                 VerticalAlignment verticalAlignment,
                 Spacer spacer) {

    super(position, horizontalAlignment, verticalAlignment, spacer);

    if (text == null) {
        throw new NullPointerException("Null 'text' argument.");
    }
    if (font == null) {
        throw new NullPointerException("Null 'font' argument.");
    }
    if (paint == null) {
        throw new NullPointerException("Null 'paint' argument.");
    }
    this.text = text;
    this.font = font;
    this.paint = paint;
    this.backgroundPaint = null;

}
项目:parabuild-ci    文件:TitleTests.java   
/**
 * Some checks for the equals() method.
 */
public void testEquals() {

    // use the TextTitle class because it is a concrete subclass
    Title t1 = new TextTitle();
    Title t2 = new TextTitle();
    assertEquals(t1, t2);

    t1.setPosition(RectangleEdge.LEFT);
    assertFalse(t1.equals(t2));
    t2.setPosition(RectangleEdge.LEFT);
    assertTrue(t1.equals(t2));

    t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));

    t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertTrue(t1.equals(t2));

}
项目:ccu-historian    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image ({@code null} not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the
 *                 title.
 */
public ImageTitle(Image image, int height, int width,
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment,
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:ccu-historian    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not
 *                  permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT,
 *                             CENTER or RIGHT, <code>null</code> not
 *                             permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP,
 *                           MIDDLE or BOTTOM, <code>null</code> not
 *                           permitted).
 * @param padding  the amount of space to leave around the outside of the
 *                 title (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position, 
        HorizontalAlignment horizontalAlignment, 
        VerticalAlignment verticalAlignment, RectangleInsets padding) {

    ParamChecks.nullNotPermitted(position, "position");
    ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
    ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
    ParamChecks.nullNotPermitted(padding, "padding");

    this.visible = true;
    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    setPadding(padding);
    this.listenerList = new EventListenerList();
    this.notify = true;
}
项目:aya-lang    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image ({@code null} not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the
 *                 title.
 */
public ImageTitle(Image image, int height, int width,
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment,
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:aya-lang    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not
 *                  permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT,
 *                             CENTER or RIGHT, <code>null</code> not
 *                             permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP,
 *                           MIDDLE or BOTTOM, <code>null</code> not
 *                           permitted).
 * @param padding  the amount of space to leave around the outside of the
 *                 title (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position, 
        HorizontalAlignment horizontalAlignment, 
        VerticalAlignment verticalAlignment, RectangleInsets padding) {

    ParamChecks.nullNotPermitted(position, "position");
    ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
    ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
    ParamChecks.nullNotPermitted(padding, "padding");

    this.visible = true;
    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    setPadding(padding);
    this.listenerList = new EventListenerList();
    this.notify = true;
}
项目:rapidminer-studio    文件:ROCChartPlotter.java   
public void paintDeviationChart(Graphics graphics, int width, int height) {
    prepareData();

    JFreeChart chart = createChart(this.dataset);

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // legend settings
    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setPosition(RectangleEdge.TOP);
        legend.setFrame(BlockBorder.NONE);
        legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
    }

    Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height);
    chart.draw((Graphics2D) graphics, drawRect);
}
项目:HTML5_WebSite    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image (<code>null</code> not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the
 *                 title.
 */
public ImageTitle(Image image, int height, int width,
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment,
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:populus    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image ({@code null} not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the
 *                 title.
 */
public ImageTitle(Image image, int height, int width,
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment,
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:populus    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not
 *                  permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT,
 *                             CENTER or RIGHT, <code>null</code> not
 *                             permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP,
 *                           MIDDLE or BOTTOM, <code>null</code> not
 *                           permitted).
 * @param padding  the amount of space to leave around the outside of the
 *                 title (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position, 
        HorizontalAlignment horizontalAlignment, 
        VerticalAlignment verticalAlignment, RectangleInsets padding) {

    ParamChecks.nullNotPermitted(position, "position");
    ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
    ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
    ParamChecks.nullNotPermitted(padding, "padding");

    this.visible = true;
    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    setPadding(padding);
    this.listenerList = new EventListenerList();
    this.notify = true;
}
项目:PI    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image (<code>null</code> not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the
 *                 title.
 */
public ImageTitle(Image image, int height, int width,
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment,
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:nabs    文件:TitleTests.java   
/**
 * Some checks for the equals() method.
 */
public void testEquals() {

    // use the TextTitle class because it is a concrete subclass
    Title t1 = new TextTitle();
    Title t2 = new TextTitle();
    assertEquals(t1, t2);

    t1.setPosition(RectangleEdge.LEFT);
    assertFalse(t1.equals(t2));
    t2.setPosition(RectangleEdge.LEFT);
    assertTrue(t1.equals(t2));

    t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));

    t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertTrue(t1.equals(t2));

}
项目:ECG-Viewer    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image ({@code null} not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the
 *                 title.
 */
public ImageTitle(Image image, int height, int width,
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment,
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:ECG-Viewer    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not
 *                  permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT,
 *                             CENTER or RIGHT, <code>null</code> not
 *                             permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP,
 *                           MIDDLE or BOTTOM, <code>null</code> not
 *                           permitted).
 * @param padding  the amount of space to leave around the outside of the
 *                 title (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position, 
        HorizontalAlignment horizontalAlignment, 
        VerticalAlignment verticalAlignment, RectangleInsets padding) {

    ParamChecks.nullNotPermitted(position, "position");
    ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
    ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
    ParamChecks.nullNotPermitted(padding, "padding");

    this.visible = true;
    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    setPadding(padding);
    this.listenerList = new EventListenerList();
    this.notify = true;
}
项目:opensim-gui    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image (<code>null</code> not permitted).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param padding  the amount of space to leave around the outside of the 
 *                 title.
 */
public ImageTitle(Image image, int height, int width, 
                  RectangleEdge position,
                  HorizontalAlignment horizontalAlignment, 
                  VerticalAlignment verticalAlignment,
                  RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);
    if (image == null) {
        throw new NullPointerException("Null 'image' argument.");
    }
    this.image = image;
    setHeight(height);
    setWidth(width);

}
项目:manydesigns.cn    文件:JFreeChart.java   
/**
 * Creates a rectangle that is aligned to the frame.
 * 
 * @param dimensions the dimensions for the rectangle.
 * @param frame the frame to align to.
 * @param hAlign the horizontal alignment.
 * @param vAlign the vertical alignment.
 * @return A rectangle.
 */
private Rectangle2D createAlignedRectangle2D(Size2D dimensions, Rectangle2D frame, HorizontalAlignment hAlign,
        VerticalAlignment vAlign) {
    double x = Double.NaN;
    double y = Double.NaN;
    if (hAlign == HorizontalAlignment.LEFT) {
        x = frame.getX();
    } else if (hAlign == HorizontalAlignment.CENTER) {
        x = frame.getCenterX() - (dimensions.width / 2.0);
    } else if (hAlign == HorizontalAlignment.RIGHT) {
        x = frame.getMaxX() - dimensions.width;
    }
    if (vAlign == VerticalAlignment.TOP) {
        y = frame.getY();
    } else if (vAlign == VerticalAlignment.CENTER) {
        y = frame.getCenterY() - (dimensions.height / 2.0);
    } else if (vAlign == VerticalAlignment.BOTTOM) {
        y = frame.getMaxY() - dimensions.height;
    }

    return new Rectangle2D.Double(x, y, dimensions.width, dimensions.height);
}
项目:group-five    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not
 *                  permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT,
 *                             CENTER or RIGHT, <code>null</code> not
 *                             permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP,
 *                           MIDDLE or BOTTOM, <code>null</code> not
 *                           permitted).
 * @param padding  the amount of space to leave around the outside of the
 *                 title (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position, 
        HorizontalAlignment horizontalAlignment, 
        VerticalAlignment verticalAlignment, RectangleInsets padding) {

    ParamChecks.nullNotPermitted(position, "position");
    ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
    ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
    ParamChecks.nullNotPermitted(padding, "padding");

    this.visible = true;
    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    setPadding(padding);
    this.listenerList = new EventListenerList();
    this.notify = true;
}
项目:rapidminer    文件:JFreeChartPlotEngine.java   
/**
 * Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
 * Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
 * {@link DimensionConfig} s.
 */
private List<LegendTitle> createLegendTitles() {
    List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
    LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();

    LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER,
            VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER,
            0, 2));
    legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());

    RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
    if (position == null) {
        return legendTitles;
    }
    legendTitle.setPosition(position);

    if (legendConfiguration.isShowLegendFrame()) {
        legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
    }
    ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
    wrapper.add(legendTitle.getItemContainer());
    wrapper.setPadding(3, 3, 3, 3);
    legendTitle.setWrapper(wrapper);

    legendTitles.add(legendTitle);
    return legendTitles;
}
项目:parabuild-ci    文件:ImageTitle.java   
/**
 * Creates a new image title.
 *
 * @param image  the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 */
public ImageTitle(Image image, RectangleEdge position, 
                  HorizontalAlignment horizontalAlignment, 
                  VerticalAlignment verticalAlignment) {

    this(image,
         image.getHeight(null),
         image.getWidth(null),
         position,
         horizontalAlignment,
         verticalAlignment,
         Title.DEFAULT_SPACER);

}
项目:parabuild-ci    文件:ImageTitle.java   
/**
 * Creates a new image title with the given image scaled to the given
 * width and height in the given location.
 *
 * @param image  the image (not null).
 * @param height  the height used to draw the image.
 * @param width  the width used to draw the image.
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 * @param spacer  the amount of space to leave around the outside of the title.
 */
public ImageTitle(Image image, int height, int width, RectangleEdge position,
                  HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment,
                  Spacer spacer) {

    super(position, horizontalAlignment, verticalAlignment, spacer);
    if (image == null) {
        throw new NullPointerException("ImageTitle(..): Image argument is null.");
    }
    this.image = image;
    this.height = height;
    this.width = width;

}
项目:parabuild-ci    文件:Title.java   
/**
 * Creates a new title, using default attributes where necessary.
 *
 * @param position  the position of the title (<code>null</code> not permitted).
 * @param horizontalAlignment  the horizontal alignment of the title 
 *                             (<code>null</code> not permitted).
 * @param verticalAlignment  the vertical alignment of the title 
 *                           (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position, 
                HorizontalAlignment horizontalAlignment, 
                VerticalAlignment verticalAlignment) {

    this(position,
         horizontalAlignment, verticalAlignment,
         Title.DEFAULT_SPACER);

}
项目:parabuild-ci    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT, CENTER or RIGHT, 
 *                             <code>null</code> not permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP, MIDDLE or BOTTOM, 
 *                           <code>null</code> not permitted).
 * @param spacer  the amount of space to leave around the outside of the title 
 *                (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position,
                HorizontalAlignment horizontalAlignment, 
                VerticalAlignment verticalAlignment,
                Spacer spacer) {

    // check arguments...
    if (position == null) {
        throw new IllegalArgumentException("Argument 'position' cannot be null.");
    }
    if (horizontalAlignment == null) {
        throw new IllegalArgumentException("Null 'horizontalAlignment' argument.");
    }

    if (verticalAlignment == null) {
        throw new IllegalArgumentException("Null 'verticalAlignment' argument.");
    }
    if (spacer == null) {
        throw new IllegalArgumentException("Argument 'spacer' cannot be null.");
    }

    // initialise...
    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    this.spacer = spacer;
    this.listenerList = new EventListenerList();
    this.notify = true;

}
项目:parabuild-ci    文件:Title.java   
/**
 * Sets the horizontal alignment for the title and sends a {@link TitleChangeEvent} to
 * all registered listeners.
 *
 * @param alignment  the horizontal alignment (<code>null</code> not permitted).
 */
public void setHorizontalAlignment(HorizontalAlignment alignment) {
    if (alignment == null) {
        throw new IllegalArgumentException("Null 'alignment' argument.");
    }
    if (this.horizontalAlignment != alignment) {
        this.horizontalAlignment = alignment;
        notifyListeners(new TitleChangeEvent(this));
    }
}
项目:parabuild-ci    文件:TitleTests.java   
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {

    // use the TextTitle class because it is a concrete subclass
    Title t1 = new TextTitle();
    Title t2 = new TextTitle();
    assertEquals(t1, t2);

    t1.setPosition(RectangleEdge.LEFT);
    assertFalse(t1.equals(t2));
    t2.setPosition(RectangleEdge.LEFT);
    assertTrue(t1.equals(t2));

    t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));

    t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertTrue(t1.equals(t2));

    t1.setSpacer(new Spacer(Spacer.ABSOLUTE, 5.0, 10.0, 15.0, 20.0));
    assertFalse(t1.equals(t2));
    t2.setSpacer(new Spacer(Spacer.ABSOLUTE, 5.0, 10.0, 15.0, 20.0));
    assertTrue(t1.equals(t2));

}
项目:parabuild-ci    文件:TextTitle.java   
/**
 * Creates a new title, using default attributes where necessary.   For the horizontal 
 * alignment, use one of the following tokens:  <code>HorizontalAlignment.LEFT</code>, 
 * <code>HorizontalAlignment.RIGHT </code> and <code>HorizontalAlignment.CENTER</code>.
 *
 * @param text  the title text (<code>null</code> not permitted).
 * @param font  the title font (<code>null</code> not permitted).
 * @param horizontalAlignment  the horizontal alignment (<code>null</code> not permitted).
 */
public TextTitle(String text, Font font, HorizontalAlignment horizontalAlignment) {

    this(text, font,
         TextTitle.DEFAULT_TEXT_PAINT,
         Title.DEFAULT_POSITION,
         horizontalAlignment,
         Title.DEFAULT_VERTICAL_ALIGNMENT,
         Title.DEFAULT_SPACER);

}
项目:parabuild-ci    文件:TextTitleTests.java   
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    TextTitle t1 = new TextTitle();
    TextTitle t2 = new TextTitle();
    assertEquals(t1, t2);

    t1.setText("Test 1");
    assertFalse(t1.equals(t2));
    t2.setText("Test 1");
    assertTrue(t1.equals(t2));

    Font f = new Font("SansSerif", Font.PLAIN, 15);
    t1.setFont(f);
    assertFalse(t1.equals(t2));
    t2.setFont(f);
    assertTrue(t1.equals(t2));

    t1.setTextAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setTextAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));

    // paint
    t1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 
            3.0f, 4.0f, Color.blue));
    assertFalse(t1.equals(t2));
    t2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 
            3.0f, 4.0f, Color.blue));
    assertTrue(t1.equals(t2));

    // backgroundPaint
    t1.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red, 
            2.0f, 1.0f, Color.blue));
    assertFalse(t1.equals(t2));
    t2.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red, 
            2.0f, 1.0f, Color.blue));
    assertTrue(t1.equals(t2));

}
项目:parabuild-ci    文件:ImageTitle.java   
/**
 * Creates a new image title.
 *
 * @param image  the image (<code>null</code> not permitted).
 * @param position  the title position.
 * @param horizontalAlignment  the horizontal alignment.
 * @param verticalAlignment  the vertical alignment.
 */
public ImageTitle(Image image, RectangleEdge position, 
                  HorizontalAlignment horizontalAlignment, 
                  VerticalAlignment verticalAlignment) {

    this(image, image.getHeight(null), image.getWidth(null),
            position, horizontalAlignment, verticalAlignment, 
            Title.DEFAULT_PADDING);
}
项目:parabuild-ci    文件:Title.java   
/**
 * Creates a new title.
 *
 * @param position  the position of the title (<code>null</code> not 
 *                  permitted).
 * @param horizontalAlignment  the horizontal alignment of the title (LEFT,
 *                             CENTER or RIGHT, <code>null</code> not 
 *                             permitted).
 * @param verticalAlignment  the vertical alignment of the title (TOP, 
 *                           MIDDLE or BOTTOM, <code>null</code> not 
 *                           permitted).
 * @param padding  the amount of space to leave around the outside of the 
 *                 title (<code>null</code> not permitted).
 */
protected Title(RectangleEdge position,
                HorizontalAlignment horizontalAlignment, 
                VerticalAlignment verticalAlignment,
                RectangleInsets padding) {

    // check arguments...
    if (position == null) {
        throw new IllegalArgumentException("Null 'position' argument.");
    }
    if (horizontalAlignment == null) {
        throw new IllegalArgumentException(
                "Null 'horizontalAlignment' argument.");
    }

    if (verticalAlignment == null) {
        throw new IllegalArgumentException(
                "Null 'verticalAlignment' argument.");
    }
    if (padding == null) {
        throw new IllegalArgumentException("Null 'spacer' argument.");
    }

    this.position = position;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    setPadding(padding);
    this.listenerList = new EventListenerList();
    this.notify = true;

}
项目:parabuild-ci    文件:Title.java   
/**
 * Sets the horizontal alignment for the title and sends a 
 * {@link TitleChangeEvent} to all registered listeners.
 *
 * @param alignment  the horizontal alignment (<code>null</code> not 
 *                   permitted).
 */
public void setHorizontalAlignment(HorizontalAlignment alignment) {
    if (alignment == null) {
        throw new IllegalArgumentException("Null 'alignment' argument.");
    }
    if (this.horizontalAlignment != alignment) {
        this.horizontalAlignment = alignment;
        notifyListeners(new TitleChangeEvent(this));
    }
}
项目:parabuild-ci    文件:TextTitle.java   
/**
 * Creates a new title.
 *
 * @param text  the text for the title (<code>null</code> not permitted).
 * @param font  the title font (<code>null</code> not permitted).
 * @param paint  the title paint (<code>null</code> not permitted).
 * @param position  the title position (<code>null</code> not permitted).
 * @param horizontalAlignment  the horizontal alignment (<code>null</code> 
 *                             not permitted).
 * @param verticalAlignment  the vertical alignment (<code>null</code> not 
 *                           permitted).
 * @param padding  the space to leave around the outside of the title.
 */
public TextTitle(String text, Font font, Paint paint, 
                 RectangleEdge position, 
                 HorizontalAlignment horizontalAlignment, 
                 VerticalAlignment verticalAlignment,
                 RectangleInsets padding) {

    super(position, horizontalAlignment, verticalAlignment, padding);

    if (text == null) {
        throw new NullPointerException("Null 'text' argument.");
    }
    if (font == null) {
        throw new NullPointerException("Null 'font' argument.");
    }
    if (paint == null) {
        throw new NullPointerException("Null 'paint' argument.");
    }
    this.text = text;
    this.font = font;
    this.paint = paint;
    // the textAlignment and the horizontalAlignment are separate things,
    // but it makes sense for the default textAlignment to match the
    // title's horizontal alignment...
    this.textAlignment = horizontalAlignment;
    this.backgroundPaint = null;
    this.content = null;
    this.toolTipText = null;
    this.urlText = null;

}
项目:parabuild-ci    文件:TextTitle.java   
/**
 * Sets the text alignment.
 * 
 * @param alignment  the alignment (<code>null</code> not permitted).
 */
public void setTextAlignment(HorizontalAlignment alignment) {
    if (alignment == null) {
        throw new IllegalArgumentException("Null 'alignment' argument.");
    }
    this.textAlignment = alignment;
    notifyListeners(new TitleChangeEvent(this));
}
项目:parabuild-ci    文件:TextTitle.java   
/**
 * Draws a the title horizontally within the specified area.  This method 
 * will be called from the {@link #draw(Graphics2D, Rectangle2D) draw} 
 * method.
 * 
 * @param g2  the graphics device.
 * @param area  the area for the title.
 */
protected void drawHorizontal(Graphics2D g2, Rectangle2D area) {
    Rectangle2D titleArea = (Rectangle2D) area.clone();
    g2.setFont(this.font);
    g2.setPaint(this.paint);
    TextBlockAnchor anchor = null;
    float x = 0.0f;
    HorizontalAlignment horizontalAlignment = getHorizontalAlignment();
    if (horizontalAlignment == HorizontalAlignment.LEFT) {
        x = (float) titleArea.getX();
        anchor = TextBlockAnchor.TOP_LEFT;
    }
    else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
        x = (float) titleArea.getMaxX();
        anchor = TextBlockAnchor.TOP_RIGHT;
    }
    else if (horizontalAlignment == HorizontalAlignment.CENTER) {
        x = (float) titleArea.getCenterX();
        anchor = TextBlockAnchor.TOP_CENTER;
    }
    float y = 0.0f;
    RectangleEdge position = getPosition();
    if (position == RectangleEdge.TOP) {
        y = (float) titleArea.getY();
    }
    else if (position == RectangleEdge.BOTTOM) {
        y = (float) titleArea.getMaxY();
        if (horizontalAlignment == HorizontalAlignment.LEFT) {
            anchor = TextBlockAnchor.BOTTOM_LEFT;
        }
        else if (horizontalAlignment == HorizontalAlignment.CENTER) {
            anchor = TextBlockAnchor.BOTTOM_CENTER;
        }
        else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
            anchor = TextBlockAnchor.BOTTOM_RIGHT;
        }
    }
    this.content.draw(g2, x, y, anchor);
}
项目:parabuild-ci    文件:ColumnArrangement.java   
/**
 * Creates a new instance.
 * 
 * @param hAlign  the horizontal alignment (currently ignored).
 * @param vAlign  the vertical alignment (currently ignored).
 * @param hGap  the horizontal gap.
 * @param vGap  the vertical gap.
 */
public ColumnArrangement(HorizontalAlignment hAlign, 
                         VerticalAlignment vAlign,
                         double hGap, double vGap) {        
    this.horizontalAlignment = hAlign;
    this.verticalAlignment = vAlign;
    this.horizontalGap = hGap;
    this.verticalGap = vGap;
}
项目:parabuild-ci    文件:ColumnArrangement.java   
/**
 * Arranges the blocks without any constraints.  This puts all blocks
 * into a single column.
 * 
 * @param container  the container.
 * @param g2  the graphics device.
 * 
 * @return The size after the arrangement.
 */
protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) {
    double y = 0.0;
    double height = 0.0;
    double maxWidth = 0.0;
    List blocks = container.getBlocks();
    int blockCount = blocks.size();
    if (blockCount > 0) {
        Size2D[] sizes = new Size2D[blocks.size()];
        for (int i = 0; i < blocks.size(); i++) {
            Block block = (Block) blocks.get(i);
            sizes[i] = block.arrange(g2, RectangleConstraint.NONE);
            height = height + sizes[i].getHeight();
            maxWidth = Math.max(sizes[i].width, maxWidth);
            block.setBounds(
                new Rectangle2D.Double(
                    0.0, y, sizes[i].width, sizes[i].height
                )
            );
            y = y + sizes[i].height + this.verticalGap;
        }
        if (blockCount > 1) {
            height = height + this.verticalGap * (blockCount - 1);   
        }
        if (this.horizontalAlignment != HorizontalAlignment.LEFT) {
            for (int i = 0; i < blocks.size(); i++) {
                //Block b = (Block) blocks.get(i);
                if (this.horizontalAlignment 
                        == HorizontalAlignment.CENTER) {
                    //TODO: shift block right by half
                }
                else if (this.horizontalAlignment 
                        == HorizontalAlignment.RIGHT) {
                    //TODO: shift block over to right
                }
            }            
        }
    }
    return new Size2D(maxWidth, height);
}
项目:parabuild-ci    文件:JFreeChart.java   
/**
 * Creates a rectangle that is aligned to the frame.
 * 
 * @param dimensions
 * @param frame
 * @param hAlign
 * @param vAlign
 * 
 * @return A rectangle.
 */
private Rectangle2D createAlignedRectangle2D(Size2D dimensions, 
        Rectangle2D frame, HorizontalAlignment hAlign, 
        VerticalAlignment vAlign) {
    double x = Double.NaN;
    double y = Double.NaN;
    if (hAlign == HorizontalAlignment.LEFT) {
        x = frame.getX();   
    }
    else if (hAlign == HorizontalAlignment.CENTER) {
        x = frame.getCenterX() - (dimensions.width / 2.0);   
    }
    else if (hAlign == HorizontalAlignment.RIGHT) {
        x = frame.getMaxX() - dimensions.width;   
    }
    if (vAlign == VerticalAlignment.TOP) {
        y = frame.getY();   
    }
    else if (vAlign == VerticalAlignment.CENTER) {
        y = frame.getCenterY() - (dimensions.height / 2.0);   
    }
    else if (vAlign == VerticalAlignment.BOTTOM) {
        y = frame.getMaxY() - dimensions.height;   
    }

    return new Rectangle2D.Double(x, y, dimensions.width, 
            dimensions.height);
}
项目:ccu-historian    文件:TitleTest.java   
/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    // use the TextTitle class because it is a concrete subclass
    Title t1 = new TextTitle();
    Title t2 = new TextTitle();
    assertEquals(t1, t2);

    t1.setPosition(RectangleEdge.LEFT);
    assertFalse(t1.equals(t2));
    t2.setPosition(RectangleEdge.LEFT);
    assertTrue(t1.equals(t2));

    t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));

    t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertTrue(t1.equals(t2));

    t1.setVisible(false);
    assertFalse(t1.equals(t2));
    t2.setVisible(false);
    assertTrue(t1.equals(t2));
}
项目:ccu-historian    文件:FlowArrangementTest.java   
/**
 * Confirm that the equals() method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    FlowArrangement f1 = new FlowArrangement(HorizontalAlignment.LEFT,
            VerticalAlignment.TOP, 1.0, 2.0);
    FlowArrangement f2 = new FlowArrangement(HorizontalAlignment.LEFT,
            VerticalAlignment.TOP, 1.0, 2.0);
    assertTrue(f1.equals(f2));
    assertTrue(f2.equals(f1));

    f1 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.TOP, 1.0, 2.0);
    assertFalse(f1.equals(f2));
    f2 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.TOP, 1.0, 2.0);
    assertTrue(f1.equals(f2));

    f1 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.BOTTOM, 1.0, 2.0);
    assertFalse(f1.equals(f2));
    f2 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.BOTTOM, 1.0, 2.0);
    assertTrue(f1.equals(f2));

    f1 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.BOTTOM, 1.1, 2.0);
    assertFalse(f1.equals(f2));
    f2 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.BOTTOM, 1.1, 2.0);
    assertTrue(f1.equals(f2));

    f1 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.BOTTOM, 1.1, 2.2);
    assertFalse(f1.equals(f2));
    f2 = new FlowArrangement(HorizontalAlignment.RIGHT,
            VerticalAlignment.BOTTOM, 1.1, 2.2);
    assertTrue(f1.equals(f2));

}
项目:ccu-historian    文件:FlowArrangementTest.java   
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    FlowArrangement f1 = new FlowArrangement(HorizontalAlignment.LEFT,
            VerticalAlignment.TOP, 1.0, 2.0);
    FlowArrangement f2 = (FlowArrangement) TestUtilities.serialised(f1);
    assertEquals(f1, f2);
}