Package cz.vutbr.fit.layout.io
Class HTMLOutputOperator
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.BaseService
-
- cz.vutbr.fit.layout.impl.BaseParametrizedOperation
-
- cz.vutbr.fit.layout.impl.BaseOperator
-
- cz.vutbr.fit.layout.io.HTMLOutputOperator
-
- All Implemented Interfaces:
AreaTreeOperator
,ParametrizedOperation
,Service
public class HTMLOutputOperator extends BaseOperator
This operator serializes the area tree to an HTML file.- Author:
- burgetr
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
HTMLOutputOperator.Style
Element style representation.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
boxTreeOnly
Should we produce the box tree only or should we rely on the area tree?protected String
filename
Path to the output file/protected boolean
produceHeader
Should we produce the HTML header and footer?protected static String
UNIT
Default length unit
-
Constructor Summary
Constructors Constructor Description HTMLOutputOperator()
HTMLOutputOperator(String filename, boolean produceHeader, boolean boxTreeOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(AreaTree atree)
Applies the operation to the given tree.void
apply(AreaTree atree, Area root)
Applies the operation to the given subtree of the tree.String
colorString(String spec)
Converts the CSS specification rgb(r,g,b) to #rrggbbList<Parameter>
defineParams()
Creates the parameter definition for this operation.void
dumpTo(AreaTree tree, Page sourcePage, PrintWriter out)
Formats the complete area tree to an output stream.void
dumpTo(Page page, PrintWriter out)
Formats the complete box tree to an output stream.protected String
getAreaStyle(Area a)
protected HTMLOutputOperator.Style
getBoxStyle(Box box, int px, int py)
protected HTMLOutputOperator.Style
getBoxStyle(ContentRect parent, Box box)
boolean
getBoxTreeOnly()
String
getCategory()
A category that allows to group similar services.String
getDescription()
Obtains a longer description of the service.String
getFilename()
String
getId()
Obtains a unique ID of the serviceString
getName()
Obtains a descriptive name of the service that may be presented to the user.boolean
getProduceHeader()
void
setBoxTreeOnly(boolean boxTreeOnly)
void
setFilename(String filename)
void
setProduceHeader(boolean produceHeader)
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseOperator
toString
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseParametrizedOperation
getParam, getParams, getParamString, setParam
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseService
getServiceManager, setServiceManager
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cz.vutbr.fit.layout.api.ParametrizedOperation
getParam, getParams, getParamString, setParam
-
Methods inherited from interface cz.vutbr.fit.layout.api.Service
setServiceManager
-
-
-
-
Field Detail
-
UNIT
protected static final String UNIT
Default length unit- See Also:
- Constant Field Values
-
produceHeader
protected boolean produceHeader
Should we produce the HTML header and footer?
-
boxTreeOnly
protected boolean boxTreeOnly
Should we produce the box tree only or should we rely on the area tree?
-
filename
protected String filename
Path to the output file/
-
-
Constructor Detail
-
HTMLOutputOperator
public HTMLOutputOperator()
-
HTMLOutputOperator
public HTMLOutputOperator(String filename, boolean produceHeader, boolean boxTreeOnly)
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:Service
Obtains a unique ID of the service
-
getName
public String getName()
Description copied from interface:Service
Obtains a descriptive name of the service that may be presented to the user.- Returns:
- the operator name
-
getDescription
public String getDescription()
Description copied from interface:Service
Obtains a longer description of the service.- Returns:
- the description
-
getCategory
public String getCategory()
Description copied from interface:Service
A category that allows to group similar services.- Returns:
- Category name or
null
when no category is assigned.
-
defineParams
public List<Parameter> defineParams()
Description copied from class:BaseParametrizedOperation
Creates the parameter definition for this operation.- Overrides:
defineParams
in classBaseParametrizedOperation
- Returns:
- The list of parameters.
-
getProduceHeader
public boolean getProduceHeader()
-
setProduceHeader
public void setProduceHeader(boolean produceHeader)
-
getBoxTreeOnly
public boolean getBoxTreeOnly()
-
setBoxTreeOnly
public void setBoxTreeOnly(boolean boxTreeOnly)
-
getFilename
public String getFilename()
-
setFilename
public void setFilename(String filename)
-
apply
public void apply(AreaTree atree)
Description copied from interface:AreaTreeOperator
Applies the operation to the given tree.- Parameters:
atree
- the area tree to be modified.
-
apply
public void apply(AreaTree atree, Area root)
Description copied from interface:AreaTreeOperator
Applies the operation to the given subtree of the tree.- Parameters:
atree
- the area tree to be modified.root
- the root node of the affected subtree.
-
dumpTo
public void dumpTo(AreaTree tree, Page sourcePage, PrintWriter out)
Formats the complete area tree to an output stream.- Parameters:
tree
- the area tree to be printedout
- a writer to be used for output
-
dumpTo
public void dumpTo(Page page, PrintWriter out)
Formats the complete box tree to an output stream.- Parameters:
page
- the page box tree to be printedout
- a writer to be used for output
-
getBoxStyle
protected HTMLOutputOperator.Style getBoxStyle(ContentRect parent, Box box)
-
getBoxStyle
protected HTMLOutputOperator.Style getBoxStyle(Box box, int px, int py)
-
-