Package cz.vutbr.fit.layout.model
Interface ContentRect
-
- All Superinterfaces:
Rect
- All Known Implementing Classes:
BoxImpl,BoxImpl,BoxNode,DefaultArea,DefaultBox,DefaultContentRect,DefaultTextChunk,DefaultTreeContentRect,RDFArea,RDFBox,RDFTextChunk
public interface ContentRect extends Rect
A generic rectangular content within a page.- Author:
- burgetr
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_SAME_ASA node attribute that links to an equivalent node (e.g. produced by copying a node to another tree).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddUserAttribute(String name, Object value)Sets a user-defined attribute for the tree node.ColorgetBackgroundColor()Obtains the background color of the area.byte[]getBackgroundImagePng()Gets the PNG image data of the background image if present.intgetBorderCount()Obtains the number of defined borders for the box.BordergetBorderStyle(Border.Side side)Obtains the properties of the box border at the given side.intgetBottomBorder()Obtains the bottom border width.RectangulargetBounds()Obtains the pixel position within in the page.intgetId()Obtains a unique ID of the area within the page.intgetLeftBorder()Obtains the left border width.ContentLinegetLine()Returns the content line the area belongs to.org.eclipse.rdf4j.model.IRIgetPageIri()Obtains the IRI of the page this block belongs to.intgetRightBorder()Obtains the right border width.TextStylegetTextStyle()Gets the text style statistics of the content.intgetTopBorder()Obtains the top border width.<P> PgetUserAttribute(String name, Class<P> clazz)Obtains the user-defined attribute value assigned to the node.booleanhasBackground()Checks whether the box has a background color or image.booleanhasBottomBorder()Checks whether the box has the bottom border defined.booleanhasLeftBorder()Checks whether the box has the left border defined.booleanhasRightBorder()Checks whether the box has right top border defined.booleanhasTopBorder()Checks whether the box has the top border defined.booleanisBackgroundSeparated()Checks whether the box is separated by background, i.e. its background color is not transparent and it is different from the ancestor background.voidsetBackgroundSeparated(boolean backgroundSeparated)Sets whether the box is separated by background.voidsetBounds(Rectangular bounds)Sets the pixel position within the page.voidsetLine(ContentLine line)Assigns the content line to the area.
-
-
-
Field Detail
-
ATTR_SAME_AS
static final String ATTR_SAME_AS
A node attribute that links to an equivalent node (e.g. produced by copying a node to another tree).- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
int getId()
Obtains a unique ID of the area within the page.- Returns:
- the area ID
-
getPageIri
org.eclipse.rdf4j.model.IRI getPageIri()
Obtains the IRI of the page this block belongs to.- Returns:
- the page IRI
-
getBounds
Rectangular getBounds()
Obtains the pixel position within in the page.- Returns:
- The rectangular pixel position.
-
setBounds
void setBounds(Rectangular bounds)
Sets the pixel position within the page.- Parameters:
bounds- the new position
-
getBackgroundColor
Color getBackgroundColor()
Obtains the background color of the area.- Returns:
- A color or
nullfor transparent background
-
getBackgroundImagePng
byte[] getBackgroundImagePng()
Gets the PNG image data of the background image if present. The image should have the same size as the content bounds.- Returns:
- the image data or
nullif no image is present in the background
-
hasBackground
boolean hasBackground()
Checks whether the box has a background color or image.- Returns:
truewhen the box has a defined background color or image
-
getTextStyle
TextStyle getTextStyle()
Gets the text style statistics of the content.- Returns:
- the text style statistics
-
getLine
ContentLine getLine()
Returns the content line the area belongs to.- Returns:
- The content line or
nullwhen the area does not belong to any line
-
setLine
void setLine(ContentLine line)
Assigns the content line to the area.- Parameters:
line- the content line to be assigned.
-
getBorderCount
int getBorderCount()
Obtains the number of defined borders for the box.- Returns:
- the number of defined borders (0..4)
-
hasTopBorder
boolean hasTopBorder()
Checks whether the box has the top border defined.- Returns:
trueif the box has a top border
-
getTopBorder
int getTopBorder()
Obtains the top border width.- Returns:
- the width of the border or 0 when there is no border
-
hasBottomBorder
boolean hasBottomBorder()
Checks whether the box has the bottom border defined.- Returns:
trueif the box has a bottom border
-
getBottomBorder
int getBottomBorder()
Obtains the bottom border width.- Returns:
- the width of the border or 0 when there is no border
-
hasLeftBorder
boolean hasLeftBorder()
Checks whether the box has the left border defined.- Returns:
trueif the box has a left border
-
getLeftBorder
int getLeftBorder()
Obtains the left border width.- Returns:
- the width of the border or 0 when there is no border
-
hasRightBorder
boolean hasRightBorder()
Checks whether the box has right top border defined.- Returns:
trueif the box has a right border
-
getRightBorder
int getRightBorder()
Obtains the right border width.- Returns:
- the width of the border or 0 when there is no border
-
getBorderStyle
Border getBorderStyle(Border.Side side)
Obtains the properties of the box border at the given side.- Parameters:
side- the border side.- Returns:
- the corresponding border properties.
-
isBackgroundSeparated
boolean isBackgroundSeparated()
Checks whether the box is separated by background, i.e. its background color is not transparent and it is different from the ancestor background.- Returns:
truefor background-separated boxes
-
setBackgroundSeparated
void setBackgroundSeparated(boolean backgroundSeparated)
Sets whether the box is separated by background. This is typically determined and set during the box tree construction.- Parameters:
backgroundSeparated-
-
addUserAttribute
void addUserAttribute(String name, Object value)
Sets a user-defined attribute for the tree node. This allows to assign multiple attributes identified by their names.- Parameters:
name- the attribute namevalue- the attribute value
-
getUserAttribute
<P> P getUserAttribute(String name, Class<P> clazz)
Obtains the user-defined attribute value assigned to the node.- Parameters:
name- the attribute nameclazz- the class of the required attribute- Returns:
- an object of the given class representing the value of the attribute (application-specific)
or
nullwhen no such attribute is present.
-
-