public static Html create(String text) { return new Html(text); }
/** * get html content of page * * @return html */ public Html getHtml() { if (html == null) { html = new Html(rawText, request.getUrl()); } return html; }
Page page = new Page(); page.setRawText(content); page.setHtml(new Html(content, request.getUrl())); page.setUrl(new PlainText(request.getUrl())); page.setRequest(request);
@Override public void process(Page page) { List<String> relativeUrl = page.getHtml().xpath("//li[@class='item clearfix']/div/a/@href").all(); page.addTargetRequests(relativeUrl); relativeUrl = page.getHtml().xpath("//div[@id='zh-question-related-questions']//a[@class='question_link']/@href").all(); page.addTargetRequests(relativeUrl); List<String> answers = page.getHtml().xpath("//div[@id='zh-question-answer-wrap']/div").all(); boolean exist = false; for(String answer:answers){ String vote = new Html(answer).xpath("//div[@class='zm-votebar']//span[@class='count']/text()").toString(); if(Integer.valueOf(vote) >= voteNum){ page.putField("vote",vote); page.putField("content",new Html(answer).xpath("//div[@class='zm-editable-content']")); page.putField("userid", new Html(answer).xpath("//a[@class='author-link']/@href")); exist = true; } } if(!exist){ page.setSkip(true); } }
Html.prototype.getVal = function() { return 'internal: '+ this.val; }; var html = new Html('x'); alert(html.getVal());
public Result yourAction() { Html myHtml = new Html("<h1>it works out of the box</h1>"); return ok(yourView.render(myHtml)); }
public class TestLabel { private org.zkoss.zhtml.Label testLabel; TestLabel() { Html update = new Html("a"); testLabel.appendChild(update); testLabel.setVisible(true); } }
public static Html create(String text) { return new Html(text); }
Html html = new Html("<div class=\"myStyle\">xxxx</div>");
Html html = new Html("<div style=\"font-weight: bold;\">xxxx</div>");
/** * get html content of page * * @return html */ public Html getHtml() { if (html == null) { html = new Html(rawText, request.getUrl()); } return html; }
Style mainDivStyle = new Style(); mainDivStyle.addCssProperties(AlignItems.CENTER, new BackgroundColor( CssColorName.AQUA.getColorName())); Html html = new Html(null) { Body body = new Body(this) { Div mainDiv = new Div(this, mainDivStyle); Footer footer = new Footer(this); }; }; try { //to write to a file html.toOutputStream(new FileOutputStream("/home/ansgar/html_work/html-by-wffweb.html")); //to print in to console //System.out.println(html.toHtmlString()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
Listcell c = new Listcell(); Html h = new Html(); h.setContent("MY HTML STRING HERE"); c.appendChild(h); listitem.appendChild(c);
Style mainDivStyle = new Style(); mainDivStyle.addCssProperties(AlignItems.CENTER, new BackgroundColor( CssColorName.AQUA.getColorName())); Html html = new Html(null) { Body body = new Body(this) { Div mainDiv = new Div(this, mainDivStyle); Footer footer = new Footer(this); }; }; try { //to write to a file html.toOutputStream(new FileOutputStream("/home/ansgar/html_work/html-by-wffweb.html")); //to print in to console //System.out.println(html.toHtmlString()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
Html html = new Html(null) {{ new Head(this); new Body(this) {{ new H1(this) {{ new NoTag(this, "spacial characters taken from an external resource like file/database : 女 学校 ä ö ü Ä"); }}; }}; }}; System.out.println(html.toHtmlString(StandardCharsets.UTF_8));
Html html = new Html(null) { Head head = new Head(this); Body body = new Body(this) { Blank blank = new Blank(this, "Hello World"); }; }; // prepends the doc type <!DOCTYPE html> html.setPrependDocType(true); System.out.println(html.toHtmlString());
Html html = new Html(null) { Head head = new Head(this); Body body = new Body(this) { Blank blank = new Blank(this, "Hello World"); }; }; // prepends the doc type <!DOCTYPE html> html.setPrependDocType(true); System.out.println(html.toHtmlString());
public AbstractHtml render() { Html html = new Html(null) {
ColumnConfig column1 = new ColumnConfig("1", 200); column1.setRenderer(new GridCellRenderer<TaskModel>() { public Object render(TaskModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<TaskModel> taskModelListStore, Grid<TaskModel> taskModelGrid) { VerticalPanel panel1 = new VerticalPanel(); panel1.add(new Html("html")); panel1.add(new Label("label")); panel1.add(new Text("text")); panel1.add(new Button("button")); return panel1; } }); ColumnConfig column2 = new ColumnConfig("2", 200); column2.setRenderer(new GridCellRenderer<TaskModel>() { public Object render(TaskModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<TaskModel> taskModelListStore, Grid<TaskModel> taskModelGrid) { return new Text("text"); } });
@Override public void process(Page page) { List<String> relativeUrl = page.getHtml().xpath("//li[@class='item clearfix']/div/a/@href").all(); page.addTargetRequests(relativeUrl); relativeUrl = page.getHtml().xpath("//div[@id='zh-question-related-questions']//a[@class='question_link']/@href").all(); page.addTargetRequests(relativeUrl); List<String> answers = page.getHtml().xpath("//div[@id='zh-question-answer-wrap']/div").all(); boolean exist = false; for(String answer:answers){ String vote = new Html(answer).xpath("//div[@class='zm-votebar']//span[@class='count']/text()").toString(); if(Integer.valueOf(vote) >= voteNum){ page.putField("vote",vote); page.putField("content",new Html(answer).xpath("//div[@class='zm-editable-content']")); page.putField("userid", new Html(answer).xpath("//a[@class='author-link']/@href")); exist = true; } } if(!exist){ page.setSkip(true); } }