public class LayoutExtractor extends Object
Constructor and Description |
---|
LayoutExtractor()
Default constructor
|
LayoutExtractor(long timeout)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
com.trolltech.qt.webkit.QWebElement |
getBody()
Get the BODY element of the loaded page
|
List<ElementInfo> |
getLayoutInfo()
Get the layout info of the page
|
boolean |
load(String url)
Load a web page from a URL
|
boolean |
load(URL url)
Load a web page from a URL
|
boolean |
loadHTML(String html)
Load a web page from an HTML string
|
protected String |
nodeToString(com.trolltech.qt.webkit.QWebElement n,
boolean pretty) |
MBFImage |
render()
Render the current page to an image
|
MBFImage |
render(int maxwidth,
int maxheight)
Render the current page to an image of the given size or smaller
|
MBFImage |
renderContentLayout(Float[] contentColour,
Float[] nonContent,
Float[] nonContentInside)
Render the layout of the content.
|
MBFImage |
renderContentLayout(MBFImage image,
Float[] contentColour,
Float[] nonContent,
Float[] nonContentInside)
Render the layout of the content.
|
MBFImage |
renderLayoutInfo(Float[] color)
Render ALL the content boxes to a new image in the given color
|
MBFImage |
renderLayoutInfo(MBFImage image,
Float[] colour)
Render ALL the content boxes to the given image in the given color
|
void |
waitForBrowser(long ms)
Run the browser for ms milliseconds.
|
public LayoutExtractor()
public LayoutExtractor(long timeout)
timeout
- public boolean load(String url)
url
- the urlpublic boolean load(URL url)
url
- the urlpublic boolean loadHTML(String html)
html
- the HTML stringpublic List<ElementInfo> getLayoutInfo()
public MBFImage renderLayoutInfo(Float[] color)
color
- Colorpublic MBFImage renderLayoutInfo(MBFImage image, Float[] colour)
image
- Image to draw on top ofcolour
- Colorpublic com.trolltech.qt.webkit.QWebElement getBody()
protected String nodeToString(com.trolltech.qt.webkit.QWebElement n, boolean pretty)
public MBFImage renderContentLayout(Float[] contentColour, Float[] nonContent, Float[] nonContentInside)
contentColour
- Colour for contentnonContent
- Colour for non-contentnonContentInside
- Colour for non-content inside contentpublic MBFImage renderContentLayout(MBFImage image, Float[] contentColour, Float[] nonContent, Float[] nonContentInside)
image
- image to draw intocontentColour
- Colour for contentnonContent
- Colour for non-contentnonContentInside
- Colour for non-content inside contentpublic MBFImage render()
public MBFImage render(int maxwidth, int maxheight)
maxwidth
- maxheight
- public void waitForBrowser(long ms)
ms
- time to wait