Package cz.vutbr.fit.layout.impl
Class DefaultTextChunk
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.DefaultContentRect
-
- cz.vutbr.fit.layout.impl.DefaultTextChunk
-
- All Implemented Interfaces:
ContentRect,Rect,Taggable,TextChunk
- Direct Known Subclasses:
RDFTextChunk
public class DefaultTextChunk extends DefaultContentRect implements TextChunk
A default text chunk implementation.- Author:
- burgetr
-
-
Field Summary
-
Fields inherited from interface cz.vutbr.fit.layout.model.ContentRect
ATTR_SAME_AS
-
-
Constructor Summary
Constructors Constructor Description DefaultTextChunk()DefaultTextChunk(Rectangular r, Area sourceArea, Box sourceBox)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTag(Tag tag, float support)Adds a tag to this area.protected voidcopyStyle(Area src)ColorgetColor()Gets the text color of the chunk.ColorgetEffectiveBackgroundColor()Gets the efficient background color of the chunk.StringgetFontFamily()Gets the font family of the chunk.ChunkSetgetChunkSet()Gets the chunk set the chunk belongs to.TaggetMostSupportedTag()Obtains the tag with the greatest support that is assigned to this area.StringgetName()Gets a readable name of the chunk for listing purposes.AreagetSourceArea()Gets the source area the chunk was extracted from.BoxgetSourceBox()Gets the source box the chunk was extracted from.Set<Tag>getSupportedTags(float minSupport)Obtains all the tags with the support greater or equal to the specified value.Map<Tag,Float>getTags()Obtains the set of tags assigned to the area.floatgetTagSupport(Tag tag)Obtains the support of the given tag assignmentStringgetText()Gets the complete text of the chunk.booleanhasTag(Tag tag)Tests whether the area has this tag.booleanhasTag(Tag tag, float minSupport)Tests whether the area has this tag with a support greater or equal to the specified value.voidremoveAllTags(Collection<Tag> c)Removes all tags that belong to the given collection.voidremoveTag(Tag tag)Removes the specific tagvoidsetColor(Color color)voidsetEffectiveBackgroundColor(Color effectiveBackgroundColor)voidsetFontFamily(String fontFamily)voidsetChunkSet(ChunkSet chunkSet)voidsetName(String name)Sets a readable name of the chunk for listing purposes.voidsetSourceArea(Area sourceArea)voidsetSourceBox(Box sourceBox)voidsetText(String text)StringtoString()-
Methods inherited from class cz.vutbr.fit.layout.impl.DefaultContentRect
addUserAttribute, equals, getBackgroundColor, getBackgroundImagePng, getBorderCount, getBorderStyle, getBottomBorder, getBounds, getHeight, getId, getLeftBorder, getLine, getPageIri, getRightBorder, getTextStyle, getTopBorder, getUserAttribute, getWidth, getX1, getX2, getY1, getY2, hasBackground, hasBottomBorder, hashCode, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated, move, recomputeTextStyle, setBackgroundColor, setBackgroundImagePng, setBackgroundSeparated, setBorderStyle, setBounds, setId, setLine, setPageIri, setTextStyle
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cz.vutbr.fit.layout.model.ContentRect
addUserAttribute, getBackgroundColor, getBackgroundImagePng, getBorderCount, getBorderStyle, getBottomBorder, getBounds, getId, getLeftBorder, getLine, getPageIri, getRightBorder, getTextStyle, getTopBorder, getUserAttribute, hasBackground, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated, setBackgroundSeparated, setBounds, setLine
-
-
-
-
Constructor Detail
-
DefaultTextChunk
public DefaultTextChunk()
-
DefaultTextChunk
public DefaultTextChunk(Rectangular r, Area sourceArea, Box sourceBox)
-
-
Method Detail
-
getChunkSet
public ChunkSet getChunkSet()
Description copied from interface:TextChunkGets the chunk set the chunk belongs to.- Specified by:
getChunkSetin interfaceTextChunk- Returns:
- the chunk set or
nullwhen the chunk does not belong to any set.
-
setChunkSet
public void setChunkSet(ChunkSet chunkSet)
-
setText
public void setText(String text)
-
getText
public String getText()
Description copied from interface:TextChunkGets the complete text of the chunk.
-
getName
public String getName()
Description copied from interface:TextChunkGets a readable name of the chunk for listing purposes.
-
setName
public void setName(String name)
Description copied from interface:TextChunkSets a readable name of the chunk for listing purposes.
-
getSourceArea
public Area getSourceArea()
Description copied from interface:TextChunkGets the source area the chunk was extracted from.- Specified by:
getSourceAreain interfaceTextChunk- Returns:
- the source area
-
setSourceArea
public void setSourceArea(Area sourceArea)
-
getSourceBox
public Box getSourceBox()
Description copied from interface:TextChunkGets the source box the chunk was extracted from.- Specified by:
getSourceBoxin interfaceTextChunk- Returns:
- the source box
-
setSourceBox
public void setSourceBox(Box sourceBox)
-
getFontFamily
public String getFontFamily()
Description copied from interface:TextChunkGets the font family of the chunk.- Specified by:
getFontFamilyin interfaceTextChunk- Returns:
- the font family name
-
setFontFamily
public void setFontFamily(String fontFamily)
-
getColor
public Color getColor()
Description copied from interface:TextChunkGets the text color of the chunk.
-
setColor
public void setColor(Color color)
-
getEffectiveBackgroundColor
public Color getEffectiveBackgroundColor()
Description copied from interface:TextChunkGets the efficient background color of the chunk.- Specified by:
getEffectiveBackgroundColorin interfaceTextChunk- Returns:
- the background color or
nulwhen transparent.
-
setEffectiveBackgroundColor
public void setEffectiveBackgroundColor(Color effectiveBackgroundColor)
-
addTag
public void addTag(Tag tag, float support)
Description copied from interface:TaggableAdds a tag to this area. If the tag is already assigned to the area, the greater of the original and new support will be used.
-
hasTag
public boolean hasTag(Tag tag)
Description copied from interface:TaggableTests whether the area has this tag.
-
hasTag
public boolean hasTag(Tag tag, float minSupport)
Description copied from interface:TaggableTests whether the area has this tag with a support greater or equal to the specified value.
-
getSupportedTags
public Set<Tag> getSupportedTags(float minSupport)
Description copied from interface:TaggableObtains all the tags with the support greater or equal to the specified value.- Specified by:
getSupportedTagsin interfaceTaggable- Parameters:
minSupport- minimal required support- Returns:
- a set of tags with at least the minimal support (possibly empty)
-
getTagSupport
public float getTagSupport(Tag tag)
Description copied from interface:TaggableObtains the support of the given tag assignment- Specified by:
getTagSupportin interfaceTaggable- Parameters:
tag- The tag to be tested- Returns:
- The support of the given tag in the range 0.0 to 1.0. Returns 0.0 when the tag is not assigned to this area.
-
getMostSupportedTag
public Tag getMostSupportedTag()
Description copied from interface:TaggableObtains the tag with the greatest support that is assigned to this area.- Specified by:
getMostSupportedTagin interfaceTaggable- Returns:
- The tag with the greatest support or
nullif there are no tags assigned to this area
-
removeAllTags
public void removeAllTags(Collection<Tag> c)
Removes all tags that belong to the given collection.- Parameters:
c- A collection of tags to be removed.
-
removeTag
public void removeTag(Tag tag)
Removes the specific tag
-
copyStyle
protected void copyStyle(Area src)
-
-