Package org.apache.isis.viewer.xhtml.viewer.tree

Examples of org.apache.isis.viewer.xhtml.viewer.tree.Element


        final XhtmlTemplate xhtml = new XhtmlTemplate("Specifications", getServletRequest());

        xhtml.appendToBody(asDivIsisSession());
        xhtml.appendToBody(resourcesDiv());

        final Element div = xhtmlRenderer.div_p("Specifications", HtmlClass.SECTION);

        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATIONS);
        final ArrayList<ObjectSpecification> allSpecs =
            Lists.newArrayList(getSpecificationLoader().allSpecifications());
        Collections.sort(allSpecs, ObjectSpecification.COMPARATOR_FULLY_QUALIFIED_CLASS_NAME);
        final List<ObjectSpecification> sorted = allSpecs;
        for (final ObjectSpecification spec : sorted) {
            final String specFullName = spec.getFullIdentifier();
            final String uri =
                MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
            ul.appendChild(xhtmlRenderer.li_a(uri, specFullName, "spec", "specs", HtmlClass.SPECIFICATION));
        }
        div.appendChild(ul);

        xhtml.appendToBody(div);
View Full Code Here


        final ObjectSpecification noSpec = getSpecification(specFullName);

        xhtml.appendToBody(asDivTableFacets(noSpec, noSpec.getFullIdentifier()));

        final Element propertiesDivEl = asDivProperties(noSpec);
        xhtml.appendToBody(propertiesDivEl);

        final Element collectionsDivEl = asDivCollections(noSpec);
        xhtml.appendToBody(collectionsDivEl);

        for (final ActionType type : ACTION_TYPES) {
            final Element actionsDivEl = asDivActions(noSpec, type);
            xhtml.appendToBody(actionsDivEl);
        }

        return xhtml.toXML();
    }
View Full Code Here

        return xhtml.toXML();
    }

    private Element asDivProperties(final ObjectSpecification noSpec) {
        final Element div = xhtmlRenderer.div_p("Properties", HtmlClass.PROPERTIES);

        final List<OneToOneAssociation> properties = noSpec.getProperties();
        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
        div.appendChild(ul);
        for (final ObjectAssociation property : properties) {
            final String propertyId = property.getIdentifier().getMemberName();
            final String path =
                MessageFormat.format("{0}/specs/{1}/property/{2}", getServletRequest().getContextPath(),
                    noSpec.getFullIdentifier(), propertyId);
            final Element li = xhtmlRenderer.li_a(path, propertyId, "property", "spec", HtmlClass.PROPERTY);
            ul.appendChild(li);
        }
        return div;
    }
View Full Code Here

        }
        return div;
    }

    private Element asDivCollections(final ObjectSpecification noSpec) {
        final Element div = xhtmlRenderer.div_p("Collections", HtmlClass.COLLECTIONS);

        final List<OneToManyAssociation> collections = noSpec.getCollections();
        final Element ul = xhtmlRenderer.ul(HtmlClass.COLLECTIONS);
        div.appendChild(ul);
        for (final ObjectAssociation collection : collections) {
            final String collectionId = collection.getIdentifier().getMemberName();
            final String path =
                MessageFormat.format("{0}/specs/{1}/collection/{2}", getServletRequest().getContextPath(),
                    noSpec.getFullIdentifier(), collectionId);
            final Element li = xhtmlRenderer.li_a(path, collectionId, "collection", "spec", HtmlClass.COLLECTION);
            ul.appendChild(li);
        }
        return div;
    }
View Full Code Here

        }
        return div;
    }

    private Element asDivActions(final ObjectSpecification noSpec, final ActionType type) {
        final Element div = xhtmlRenderer.div_p(type.name() + " actions", HtmlClass.ACTIONS);

        final List<ObjectAction> actions = ActionUtils.flattened(noSpec.getObjectActions(type));
        final Element ul = xhtmlRenderer.ul(HtmlClass.ACTIONS);
        div.appendChild(ul);
        for (final ObjectAction action : actions) {
            final Identifier actionIdentifier = action.getIdentifier();
            final String actionId = actionIdentifier.toNameParmsIdentityString();
            final String noSpecFullName = noSpec.getFullIdentifier();
            final String uri =
                MessageFormat.format("{0}/specs/{1}/action/{2}", getServletRequest().getContextPath(), noSpecFullName,
                    actionId);
            final Element li = xhtmlRenderer.li_a(uri, actionId, "action", "spec", HtmlClass.ACTION);
            ul.appendChild(li);
        }
        return div;
    }
View Full Code Here

        final String specAndProperty = specFullName + "/property/" + propertyName;
        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndProperty, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());

        // owners
        final Element div = xhtmlRenderer.div_p("Owners", null);
        xhtml.appendToBody(div);
        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);

        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
        ul.appendChild(xhtmlRenderer.aHref(uri, "owning spec", "spec", "property", HtmlClass.SPECIFICATION));

        div.appendChild(ul);

        final ObjectSpecification noSpec = getSpecification(specFullName);
        final ObjectAssociation property = noSpec.getAssociation(propertyName);
View Full Code Here

        final String specAndCollection = specFullName + "/collection/" + collectionName;
        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndCollection, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());

        // owners
        final Element div = xhtmlRenderer.div_p("Owners", null);
        xhtml.appendToBody(div);
        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);

        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
        ul.appendChild(xhtmlRenderer.aHref(uri, "owning spec", "spec", "collection", HtmlClass.SPECIFICATION));

        div.appendChild(ul);

        final ObjectSpecification noSpec = getSpecification(specFullName);
        final ObjectAssociation collection = noSpec.getAssociation(collectionName);
View Full Code Here

        final String... javaScriptFiles) {
        this(titleStr, servletRequest.getSession().getServletContext(), javaScriptFiles);
    }

    private XhtmlTemplate(final String titleStr, final ServletContext servletContext, final String... javaScriptFiles) {
        this.html = new Element("html");
        addHeadAndTitle(titleStr);
        for (final String javaScriptFile : javaScriptFiles) {
            final Element script = new Element("script");
            script.addAttribute(new Attribute("type", "text/javascript"));
            script.addAttribute(new Attribute("src", "/" + javaScriptFile));
            script.appendChild(""); // force the </script> to be separate.
            head.appendChild(script);
        }
        addBody();
    }
View Full Code Here

        }
        addBody();
    }

    private void addHeadAndTitle(final String titleStr) {
        head = new Element("head");
        html.appendChild(head);
        final Element title = new Element("title");
        title.appendChild(titleStr);
        head.appendChild(title);
    }
View Full Code Here

     * <p>
     * The <tt>id</tt> attribute is so that Javascript can use <tt>document.getElementById(&quot;body&quot;);</tt>
     *
     */
    private void addBody() {
        body = new Element("body");
        body.addAttribute(new Attribute("id", "body"));
        html.appendChild(body);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.xhtml.viewer.tree.Element

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.