public Element setId(String id) { addAttribute("id", id); return this; }
public Element setId(String id) { addAttribute("id", id); return this; }
private void updateHrefSuffix(Element element, String href) { if (!(href.endsWith(".html"))) { int dot = href.lastIndexOf("."); if (dot > 0) { String modifiedHref = href.substring(0, dot) + ".html"; element.removeAttribute("href"); element.addAttribute("href", modifiedHref); } } }
private Element stackTraceTogglingButton() { return new Element("input") .addStyleClass("stackTraceButton") .setId("stackTraceButton" + buttonId) .addAttribute("type", "button") .addAttribute("onclick", "javascript:toggleStackTrace('" + buttonId + "')") .addAttribute("value", "View Stack"); }
private void updateHrefSuffix(Element element, String href) { if (!(href.endsWith(".html"))) { int dot = href.lastIndexOf("."); if (dot > 0) { String modifiedHref = href.substring(0, dot) + ".html"; element.removeAttribute("href"); element.addAttribute("href", modifiedHref); } } }
public Element addStyleClass(String styleClass) { String currentClass = getAttributeValue("class"); if (currentClass != null) { styleClass = currentClass + " " + styleClass; } addAttribute("class", styleClass); return this; }
private Element stackTraceTogglingButton() { return new Element("input") .addStyleClass("stackTraceButton") .setId("stackTraceButton" + buttonId) .addAttribute("type", "button") .addAttribute("onclick", "javascript:toggleStackTrace('" + buttonId + "')") .addAttribute("value", "View Stack"); }
public Element addStyleClass(String styleClass) { String currentClass = getAttributeValue("class"); if (currentClass != null) { styleClass = currentClass + " " + styleClass; } addAttribute("class", styleClass); return this; }
static void addClass(Element resultElement, String newClass) { String className = resultElement.getAttributeValue("class"); resultElement .addAttribute("class", className == null ? newClass : className + " " + newClass); } }
protected void addResultsGeneratedBy(Element footer) { footer.appendText("Results generated by "); Element link = new Element("a"); link.addAttribute("href", CONCORDION_WEBSITE_URL); link.addAttribute("style", "font-weight: bold; text-decoration: none; color: #89C;"); footer.appendChild(link); link.appendText("Concordion"); } }
protected void addResultsGeneratedBy(Element footer) { footer.appendText("Results generated by "); Element link = new Element("a"); link.addAttribute("href", CONCORDION_WEBSITE_URL); link.addAttribute("style", "font-weight: bold; text-decoration: none; color: #89C;"); footer.appendChild(link); link.appendText("Concordion"); } }
private Element createBreadcrumbElement(Resource documentResource, Resource indexPageResource, SpecificationConverter specificationConverter) throws IOException { String breadcrumbWording = getBreadcrumbWordingForResource(indexPageResource, specificationConverter); Element a = new Element("a"); Resource indexPageAsHtmlResource = new Resource(indexPageResource.getPath().replaceFirst("\\..*$", "\\.html")); a.addAttribute("href", documentResource.getRelativePath(indexPageAsHtmlResource)); a.appendText(breadcrumbWording); return a; }
private Element createBreadcrumbElement(Resource documentResource, Resource indexPageResource, SpecificationConverter specificationConverter) throws IOException { String breadcrumbWording = getBreadcrumbWordingForResource(indexPageResource, specificationConverter); Element a = new Element("a"); Resource indexPageAsHtmlResource = new Resource(indexPageResource.getPath().replaceFirst("\\..*$", "\\.html")); a.addAttribute("href", documentResource.getRelativePath(indexPageAsHtmlResource)); a.appendText(breadcrumbWording); return a; }
private void ensureDocumentHasTogglingScript(Element element) { Element rootElement = element.getRootElement(); if (!rootElementsWithScript.contains(rootElement)) { rootElementsWithScript.add(rootElement); Element head = rootElement.getFirstDescendantNamed("head"); if (head == null) { System.out.println(rootElement.toXML()); } Check.notNull(head, "Document <head> section is missing"); if (head != null) { Element script = new Element("script").addAttribute("type", "text/javascript"); head.prependChild(script); script.appendText(resourceSource.readResourceAsString(TOGGLING_SCRIPT_RESOURCE_PATH)); } } }
private void ensureDocumentHasTogglingScript(Element element) { Element rootElement = element.getRootElement(); if (!rootElementsWithScript.contains(rootElement)) { rootElementsWithScript.add(rootElement); Element head = rootElement.getFirstDescendantNamed("head"); if (head == null) { System.out.println(rootElement.toXML()); } Check.notNull(head, "Document <head> section is missing"); if (head != null) { Element script = new Element("script").addAttribute("type", "text/javascript"); head.prependChild(script); script.appendText(resourceSource.readResourceAsString(TOGGLING_SCRIPT_RESOURCE_PATH)); } } }
public void beforeParsing(Document document) { Element rootElement = new Element(document.getRootElement()); String newValue = text; String existingValue = rootElement.getAttributeValue(FAKE_EXTENSION_ATTR_NAME); if (existingValue != null) { newValue = existingValue + ", " + newValue; } rootElement.addAttribute(FAKE_EXTENSION_ATTR_NAME, newValue); } }
public static void setupCommandForExample(CommandCall node, ResultRecorder resultRecorder, String exampleName) { node.getElement().addAttribute("id", exampleName); // let's be really nice and add the implementation status text into the element itself. ImplementationStatusChecker checker = ImplementationStatusChecker.implementationStatusCheckerFor(resultRecorder.getImplementationStatus()); Element fixtureNode = new Element("p"); fixtureNode.appendText(checker.printNoteToString()); node.getElement().prependChild(fixtureNode); }
public static void setupCommandForExample(CommandCall node, ResultRecorder resultRecorder, String exampleName) { node.getElement().addAttribute("id", exampleName); // let's be really nice and add the implementation status text into the element itself. ImplementationStatusChecker checker = ImplementationStatusChecker.implementationStatusCheckerFor(resultRecorder.getImplementationStatus()); Element fixtureNode = new Element("p"); fixtureNode.appendText(checker.printNoteToString()); node.getElement().prependChild(fixtureNode); }
private void formatRequest(Element origRequestElement, HttpRequest httpRequest) { Element caption = null; if (addCaptions) { caption = new Element("div").addAttribute("class", "requestCaption").appendText("Request:"); if (httpRequest.server != null) { caption.appendChild(new Element("small").appendText(" (to " + httpRequest.server + ")")); } } Element newRequestElement = replaceWithEmptyElement(origRequestElement, name, namespace, caption); addClass(newRequestElement, "requestContent"); Element requestPre = new Element("pre"); newRequestElement.appendChild(requestPre); requestPre.appendChild(new Element("span").appendText(httpRequest.method + " ")); requestPre.appendChild(new Element("b").appendText(httpRequest.getPathAndQuery() + " ")); requestPre.appendChild(new Element("span").addAttribute("class", "defaultValue").appendText("HTTP/1.1")); for (Map.Entry<String, String> header : httpRequest.headers.entries()) { requestPre.appendText("\n" + header.getKey() + ": " + header.getValue()); } if (httpRequest.body != null) { requestPre.appendText("\n\n"); requestPre.appendChild(new Element("span").appendText(httpRequest.body).addAttribute("class", "reqBody")); } }
public Map<String, Object> simulate(String href, Class<?> testClass) { final Element element = new Element("a"); element.addAttribute("href", href);