/** * @see Layout#getEndPointSeparator(Point2D) */ @Override protected Point2D getEndPointSeparator(Point2D offset) { return new Point2D.Double(offset.getX(), getHeight()); }
/** * @see Content#refreshUp() */ @Override public final void refreshUp() { Rectangle2D minimalBounds = getMinimalBounds(); setHeight(minimalBounds.getHeight()); setWidth(minimalBounds.getWidth()); setContentsHeight(minimalBounds.getWidth()); super.refreshUp(); }
/** * @return minimal bounds of this element */ @Override public Rectangle2D getMinimalBounds() { Rectangle2D selfMinimalBounds = super.getMinimalBounds(); double width = 0; double height = 0; for (Content content: getContents()) { Rectangle2D contentMinimalBounds = content.getMinimalBounds(); width += contentMinimalBounds.getWidth(); if(height < contentMinimalBounds.getHeight()) { height = contentMinimalBounds.getHeight(); } } height = Math.max(height, selfMinimalBounds.getHeight()); width = Math.max(width, selfMinimalBounds.getWidth()); return new Rectangle2D.Double(getX(),getY(),width,height); }
public PaddingContent(Content content, double top, double left, double bottom, double right) { this.content = content; this.top = new EmptyContent(); this.left = new EmptyContent(); this.bottom = new EmptyContent(); this.right = new EmptyContent(); setTopPadding(top); setLeftPadding(left); setBottomPadding(bottom); setRightPadding(right); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.add(this.left); horizontalLayout.add(this.content); horizontalLayout.add(this.right); layout = new VerticalLayout(); layout.add(this.top); layout.add(horizontalLayout); layout.add(this.bottom); this.content.addParent(this); }
/** * Set the same height for all elements in the layout * @param height */ protected final void setContentsHeight(double height) { for (Content content: getContents()) { content.setHeight(height); content.refreshDown(); } } }