/** * Creates a new composite title with a default border arrangement. */ public CompositeTitle() { this(new BlockContainer(new BorderArrangement())); }
/** * Fetches the latest legend items. */ protected void fetchLegendItems() { this.items.clear(); RectangleEdge p = getPosition(); if (RectangleEdge.isTopOrBottom(p)) { this.items.setArrangement(this.hLayout); } else { this.items.setArrangement(this.vLayout); } for (int s = 0; s < this.sources.length; s++) { LegendItemCollection legendItems = this.sources[s].getLegendItems(); if (legendItems != null) { for (int i = 0; i < legendItems.getItemCount(); i++) { LegendItem item = legendItems.get(i); Block block = createLegendItemBlock(item); this.items.add(block); } } } }
/** * Draws the container and all the blocks within it. * * @param g2 the graphics device. * @param area the area. */ @Override public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
BlockContainer blockcontainer = new BlockContainer(new BorderArrangement()); blockcontainer.add(labelblock, RectangleEdge.TOP); blockcontainer1.setPadding(2D, 10D, 5D, 2D); blockcontainer.add(blockcontainer1); legendtitle.setWrapper(blockcontainer); legendtitle.setPosition(RectangleEdge.BOTTOM);
contentArea = trimMargin(contentArea); drawBorder(g2, contentArea); contentArea = trimBorder(contentArea); contentArea = trimPadding(contentArea); Iterator iterator = this.blocks.iterator(); while (iterator.hasNext()) {
legendItem.setURLText(item.getURLText()); result = new BlockContainer(new CenterArrangement()); result.add(legendItem);
/** * Applies the attributes of this theme to the specified container. * * @param bc a block container ({@code null} not permitted). */ protected void applyToBlockContainer(BlockContainer bc) { Iterator iterator = bc.getBlocks().iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); applyToBlock(b); } }
RectangleConstraint constraint) { RectangleConstraint contentConstraint = container.toContentConstraint(constraint); Size2D contentSize = null; LengthConstraintType w = contentConstraint.getWidthConstraintType(); return new Size2D(container.calculateTotalWidth(contentSize.getWidth()), container.calculateTotalHeight(contentSize.getHeight()));
/** * Adds a block to the container. * * @param block the block ({@code null} permitted). */ public void add(Block block) { add(block, null); }
/** * Arranges the contents of the block, within the given constraints, and * returns the block size. * * @param g2 the graphics device. * @param constraint the constraint ({@code null} not permitted). * * @return The block size (in Java2D units, never {@code null}). */ @Override public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) { Size2D result = new Size2D(); fetchLegendItems(); if (this.items.isEmpty()) { return result; } BlockContainer container = this.wrapper; if (container == null) { container = this.items; } RectangleConstraint c = toContentConstraint(constraint); Size2D size = container.arrange(g2, c); result.height = calculateTotalHeight(size.height); result.width = calculateTotalWidth(size.width); return result; }
this.items.clear(); RectangleEdge p = getPosition(); if (RectangleEdge.isTopOrBottom(p)) { this.items.setArrangement(this.hLayout); this.items.setArrangement(this.vLayout);
/** * Arranges the contents of the block, within the given constraints, and * returns the block size. * * @param g2 the graphics device. * @param constraint the constraint ({@code null} not permitted). * * @return The block size (in Java2D units, never {@code null}). */ @Override public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) { RectangleConstraint contentConstraint = toContentConstraint(constraint); Size2D contentSize = this.container.arrange(g2, contentConstraint); return new Size2D(calculateTotalWidth(contentSize.getWidth()), calculateTotalHeight(contentSize.getHeight())); }
/** * Tests this title for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CompositeTitle)) { return false; } CompositeTitle that = (CompositeTitle) obj; if (!this.container.equals(that.container)) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } return super.equals(obj); }
BlockContainer blockcontainer = new BlockContainer(new BorderArrangement()); blockcontainer.add(labelblock, RectangleEdge.TOP); blockcontainer1.setPadding(2D, 10D, 5D, 2D); blockcontainer.add(blockcontainer1); legendtitle.setWrapper(blockcontainer); legendtitle.setPosition(RectangleEdge.BOTTOM);
contentArea = trimMargin(contentArea); drawBorder(g2, contentArea); contentArea = trimBorder(contentArea); contentArea = trimPadding(contentArea); Iterator iterator = this.blocks.iterator(); while (iterator.hasNext()) {
legendItem.setURLText(item.getURLText()); result = new BlockContainer(new CenterArrangement()); result.add(legendItem);
/** * Applies the attributes of this theme to the specified container. * * @param bc a block container (<code>null</code> not permitted). */ protected void applyToBlockContainer(BlockContainer bc) { Iterator iterator = bc.getBlocks().iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); applyToBlock(b); } }
RectangleConstraint constraint) { RectangleConstraint contentConstraint = container.toContentConstraint(constraint); Size2D contentSize = null; LengthConstraintType w = contentConstraint.getWidthConstraintType(); return new Size2D(container.calculateTotalWidth(contentSize.getWidth()), container.calculateTotalHeight(contentSize.getHeight()));
/** * Adds a block to the container. * * @param block the block (<code>null</code> permitted). */ public void add(Block block) { add(block, null); }
/** * Arranges the contents of the block, within the given constraints, and * returns the block size. * * @param g2 the graphics device. * @param constraint the constraint (<code>null</code> not permitted). * * @return The block size (in Java2D units, never <code>null</code>). */ public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) { Size2D result = new Size2D(); fetchLegendItems(); if (this.items.isEmpty()) { return result; } BlockContainer container = this.wrapper; if (container == null) { container = this.items; } RectangleConstraint c = toContentConstraint(constraint); Size2D size = container.arrange(g2, c); result.height = calculateTotalHeight(size.height); result.width = calculateTotalWidth(size.width); return result; }