Package org.structr.rest.serialization.html

Examples of org.structr.rest.serialization.html.Tag


  @Override
  public RestWriter beginDocument(final String baseUrl, final String propertyView) throws IOException {

    String currentType = baseUrl.replace(restPath + "/", "").replace("/" + propertyView, "");

    Tag head = doc.block("head");
    head.empty("link").attr(new Rel("stylesheet"), new Type("text/css"), new Href("//structr.org/rest.css"));
    head.inline("script").attr(new Type("text/javascript"), new Src("//structr.org/CollapsibleLists.js"));
    head.inline("title").text(baseUrl);

    Tag body = doc.block("body").attr(new Onload("CollapsibleLists.apply(true);"));
    Tag top  = body.block("div").id("top");

    final App app  = StructrApp.getInstance(securityContext);
    final Tag left = body.block("div").id("left");

    try (final Tx tx = app.tx()) {

      for (SchemaNode node : app.nodeQuery(SchemaNode.class).getAsList()) {

        final String rawType = node.getName();
        top.inline("a").attr(new Href(restPath + "/" + rawType), new If(rawType.equals(currentType), new Css("active"))).text(rawType);
      }

    } catch (Throwable t) {
      t.printStackTrace();
    }

    for (String view : StructrApp.getConfiguration().getPropertyViews()) {

      if (!hiddenViews.contains(view)) {
        left.inline("a").attr(new Href(restPath + "/" + currentType + "/" + view), new If(view.equals(propertyView), new Css("active"))).text(view);
      }
    }

    // main div
    currentElement = body.block("div").id("right");
View Full Code Here


    if (!hasName) {

      currentElement = currentElement.block(LI);

      Tag b = currentElement.block("b");

      if (graphObject != null) {

        final String name = graphObject.getProperty(AbstractNode.name);
        final String uuid = graphObject.getUuid();
        final String type = graphObject.getType();

        if (name != null) {

          b.inline("span").css("name").text(name);
        }

        if (uuid != null) {

          b.inline("span").css("id").text(uuid);
        }

        if (type != null) {

          b.inline("span").css("type").text(type);
        }
      }
    }

    currentElement.inline("span").text("{");
View Full Code Here

TOP

Related Classes of org.structr.rest.serialization.html.Tag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.