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 String
ATTR_SAME_AS
A 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 void
addUserAttribute(String name, Object value)
Sets a user-defined attribute for the tree node.Color
getBackgroundColor()
Obtains the background color of the area.byte[]
getBackgroundImagePng()
Gets the PNG image data of the background image if present.int
getBorderCount()
Obtains the number of defined borders for the box.Border
getBorderStyle(Border.Side side)
Obtains the properties of the box border at the given side.int
getBottomBorder()
Obtains the bottom border width.Rectangular
getBounds()
Obtains the pixel position within in the page.int
getId()
Obtains a unique ID of the area within the page.int
getLeftBorder()
Obtains the left border width.ContentLine
getLine()
Returns the content line the area belongs to.org.eclipse.rdf4j.model.IRI
getPageIri()
Obtains the IRI of the page this block belongs to.int
getRightBorder()
Obtains the right border width.TextStyle
getTextStyle()
Gets the text style statistics of the content.int
getTopBorder()
Obtains the top border width.<P> P
getUserAttribute(String name, Class<P> clazz)
Obtains the user-defined attribute value assigned to the node.boolean
hasBackground()
Checks whether the box has a background color or image.boolean
hasBottomBorder()
Checks whether the box has the bottom border defined.boolean
hasLeftBorder()
Checks whether the box has the left border defined.boolean
hasRightBorder()
Checks whether the box has right top border defined.boolean
hasTopBorder()
Checks whether the box has the top border defined.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.void
setBackgroundSeparated(boolean backgroundSeparated)
Sets whether the box is separated by background.void
setBounds(Rectangular bounds)
Sets the pixel position within the page.void
setLine(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
null
for 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
null
if no image is present in the background
-
hasBackground
boolean hasBackground()
Checks whether the box has a background color or image.- Returns:
true
when 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
null
when 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:
true
if 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:
true
if 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:
true
if 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:
true
if 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:
true
for 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
null
when no such attribute is present.
-
-