/** * @see Content#refreshUp() */ @Override protected void refreshUp() { Rectangle2D minimalBounds = getMinimalBounds(); setWidth(minimalBounds.getWidth()); setHeight(minimalBounds.getHeight()); super.refreshUp(); }
/** * @return minimal bounds of this element */ @Override public Rectangle2D getMinimalBounds() { return getShape().getBounds(); }
/** * @see Content#draw(Graphics2D) */ @Override public void draw(Graphics2D graphics) { content.draw(graphics, getShapeOffset()); }
/** * @see Content#refreshUp() */ @Override public void refreshUp() { setShape(createRectangle()); super.refreshUp(); }
/** * @see Content#refreshDown() */ @Override protected void refreshDown() { setShape(createCustomShape()); super.refreshDown(); }
public ContentBorder(ContentInsideShape contentShape, Color color) { contentShape.addParent(this); this.setBorderColor(color); this.setContent(contentShape); }
/** * @see Content#refreshUp() */ @Override public void refreshUp() { setShape(createCustomShape()); super.refreshUp(); }
/** * @see Content#refreshDown() */ @Override protected void refreshDown() { setShape(createEllipse()); super.refreshDown(); }
/** * Checks whether a point contained in the shape * @param point * @return true if the point contains in shape otherwise false */ @Override public boolean contains(Point2D point) { return getShape().contains(point); }
/** * @see Content#refreshUp() */ @Override public void refreshUp() { setShape(createRoundRectangle()); super.refreshUp(); }
/** * @see Content#refreshDown() */ @Override protected void refreshDown() { setShape(createRoundRectangle()); super.refreshDown(); }
/** * @see ContentInsideShape#getShape() */ protected Shape getShape() { return ((ContentInsideShape)getContent()).getShape(); }
/** * @see Content#refreshUp() */ @Override public void refreshUp() { setShape(createEllipse()); super.refreshUp(); }
/** * @see Content#refreshDown() */ @Override protected void refreshDown() { setShape(createRectangle()); super.refreshDown(); }
/** * @see ContentInsideShape#getShape() */ protected Shape getShape() { return ((ContentInsideShape)getContent()).getShape(); }
/** * set new content for shape * @param content */ protected final void setContent(Content content) { if(null != this.content) { this.content.removeParent(this); } if(null == content) { content = new EmptyContent(); } content.addParent(this); this.content = content; refreshUp(); }
/** * Calculates the offset of content to make it in the center of the shape * @return offset */ protected Point2D getShapeOffset() { Rectangle2D shapeBounds = getShape().getBounds(); return new Point2D.Double( (shapeBounds.getWidth() - content.getWidth()) / 2, (shapeBounds.getHeight() - content.getHeight()) / 2 ); }