Package cz.vutbr.fit.layout.json.impl
Class JSONBoxTreeBuilder
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.BaseBoxTreeBuilder
-
- cz.vutbr.fit.layout.json.impl.JSONBoxTreeBuilder
-
public abstract class JSONBoxTreeBuilder extends BaseBoxTreeBuilder
A generic box tree builder for JSON-based renderers.- Author:
- burgetr
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_FONT_FAMILYstatic floatDEFAULT_FONT_SIZE-
Fields inherited from class cz.vutbr.fit.layout.impl.BaseBoxTreeBuilder
pageTitle, pageUrl, preserveAux, useVisualBounds
-
-
Constructor Summary
Constructors Constructor Description JSONBoxTreeBuilder(boolean useVisualBounds, boolean preserveAux)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PagegetPage()protected abstract InputFileinvokeRenderer(URL url)Invokes the renderer and parses its ouptut.protected InputFileloadJSON(InputStream istream, String charsetName)Parses an input stream and creates an input file representationprotected InputFileloadJSON(String path)Parses a local file produced by the backend.voidparse(String urlstring)voidparse(URL url)protected voidparseInputFile(InputFile input, URL url)voidparseJSON(String path)-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseBoxTreeBuilder
buildTree, computeBackgrounds, computeVisualBounds, contentEncloses, getMinimalVisualBounds, markChildNodes, markNodesInside, recomputeBounds, recomputeVisualBounds, recomputeVisualBounds, takeChildren, visuallyEncloses
-
-
-
-
Field Detail
-
DEFAULT_FONT_FAMILY
public static final String DEFAULT_FONT_FAMILY
- See Also:
- Constant Field Values
-
DEFAULT_FONT_SIZE
public static final float DEFAULT_FONT_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public void parse(String urlstring) throws MalformedURLException, IOException, InterruptedException
-
parse
public void parse(URL url) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
parseJSON
public void parseJSON(String path) throws IOException
- Throws:
IOException
-
parseInputFile
protected void parseInputFile(InputFile input, URL url) throws IOException
- Throws:
IOException
-
getPage
public Page getPage()
- Specified by:
getPagein classBaseBoxTreeBuilder
-
invokeRenderer
protected abstract InputFile invokeRenderer(URL url) throws IOException, InterruptedException
Invokes the renderer and parses its ouptut.- Parameters:
url-- Returns:
- the parsed output of the backend, or
nullfor an unexpected EOF - Throws:
IOExceptionInterruptedException
-
loadJSON
protected InputFile loadJSON(String path) throws IOException
Parses a local file produced by the backend.- Parameters:
path- the path to the file to parse- Returns:
- the parsed file
- Throws:
IOException
-
loadJSON
protected InputFile loadJSON(InputStream istream, String charsetName) throws IOException
Parses an input stream and creates an input file representation- Parameters:
istream- the input stream to parsecharsetName- charset used in the input stream- Returns:
- the parsed file
- Throws:
IOException
-
-