Examples of XhtmlTemplate


Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

    @Override
    @Produces(MediaType.APPLICATION_XHTML_XML)
    public String resources() {
        init();
        final XhtmlTemplate xhtml = new XhtmlTemplate("Home Page", getServletRequest());

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

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

    @Override
    public String user() {
        init();

        final XhtmlTemplate xhtml = new XhtmlTemplate("User", getServletRequest());
        xhtml.appendToBody(asDivIsisSession());
        xhtml.appendToBody(resourcesDiv());

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

        final Element ul = xhtmlRenderer.ul(HtmlClass.ROLES);
        final List<String> roles = getSession().getRoles();
        for (final String role : roles) {
            ul.appendChild(xhtmlRenderer.li_p(role, HtmlClass.ROLE));
        }
        div.appendChild(ul);

        xhtml.appendToBody(div);

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

        }

        final String javascriptFile =
            isJavascriptDebug() ? Constants.JQUERY_SRC_JS : Constants.JQUERY_MIN_JS;
        // html template
        final XhtmlTemplate xhtml =
            new XhtmlTemplate(objectAdapter.titleString(), getServletRequest(), javascriptFile,
                Constants.ISIS_REST_SUPPORT_JS);

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

        // object div
        final Element objectDiv = div(HtmlClass.OBJECT);
        xhtml.appendToBody(objectDiv);

        // title & Oid
        final Element objectSpecsDiv = asDivTableObjectDetails(objectAdapter);
        xhtml.appendToDiv(objectDiv, objectSpecsDiv);
        // xhtml.appendToBody(div);

        // properties (in line table)
        final Element propertiesTableEl = asDivTableProperties(getSession(), objectAdapter);
        xhtml.appendToDiv(objectDiv, propertiesTableEl);
        // xhtml.appendToBody(propertiesTableEl);

        // collections
        final Element collectionsDivEl = asDivTableCollections(getSession(), objectAdapter);
        xhtml.appendToDiv(objectDiv, collectionsDivEl);
        // xhtml.appendToBody(collectionsDivEl);

        // actions
        final Element actionsDivEl = asDivTableActions(getSession(), objectAdapter);
        xhtml.appendToDiv(objectDiv, actionsDivEl);
        // xhtml.appendToBody(actionsDivEl);

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

        if (consent.isVetoed()) {
            throw new WebApplicationException(responseOfBadRequest(consent));
        }

        // html template
        final XhtmlTemplate xhtml =
            new XhtmlTemplate(nakedObject.titleString() + "." + propertyId, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());
        xhtml.appendToBody(resourcesDiv());

        // title & Oid
        final Element div = asDivTableObjectDetails(nakedObject);
        xhtml.appendToBody(div);

        // if valid, then set
        property.setAssociation(nakedObject, proposedValueNO);

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

        if (consent.isVetoed()) {
            throw new WebApplicationException(responseOfBadRequest(consent));
        }

        // html template
        final XhtmlTemplate xhtml =
            new XhtmlTemplate(objectAdapter.titleString() + "." + propertyId, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());
        xhtml.appendToBody(resourcesDiv());

        // title & Oid
        final Element div = asDivTableObjectDetails(objectAdapter);
        xhtml.appendToBody(div);

        // if valid, then clear
        property.clearAssociation(objectAdapter);

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

        if (!association.isOneToManyAssociation()) {
            throw new WebApplicationException(responseOfBadRequest("Not a collection"));
        }

        // html template
        final XhtmlTemplate xhtml =
            new XhtmlTemplate(objectAdapter.titleString() + "." + collectionId, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());
        xhtml.appendToBody(resourcesDiv());

        // title & Oid
        Element div = asDivTableObjectDetails(objectAdapter);
        xhtml.appendToBody(div);

        // collection name & contents
        final OneToManyAssociation collection = (OneToManyAssociation) association;

        div = xhtmlRenderer.div_p(collectionId, HtmlClass.COLLECTION);

        final Element ul = xhtmlRenderer.ul(HtmlClass.COLLECTION);
        div.appendChild(ul);

        final ObjectAdapter collectionObj = collection.get(objectAdapter);

        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collectionObj);
        for (final Iterator<ObjectAdapter> iter = facet.iterator(collectionObj); iter.hasNext();) {
            final ObjectAdapter associatedNO = iter.next();
            ul.appendChild(toLiAHref(associatedNO));
        }

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

        if (consent.isVetoed()) {
            throw new WebApplicationException(responseOfBadRequest(consent));
        }

        // html template
        final XhtmlTemplate xhtml =
            new XhtmlTemplate(objectAdapter.titleString() + "." + collectionId, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());
        xhtml.appendToBody(resourcesDiv());

        // title & Oid
        final Element div = asDivTableObjectDetails(objectAdapter);
        xhtml.appendToBody(div);

        // if valid, then set
        if (modification == CollectionModificationType.ADD_TO) {
            collection.addElement(objectAdapter, proposedValueNO);
        } else {
            collection.removeElement(objectAdapter, proposedValueNO);
        }

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

Examples of org.apache.isis.viewer.xhtml.viewer.html.XhtmlTemplate

                proposedArguments[i] = argNO;
            }
        }

        // html template
        final XhtmlTemplate xhtml = new XhtmlTemplate(nakedObject.titleString() + "." + actionId, getServletRequest());
        xhtml.appendToBody(asDivIsisSession());

        // title & Oid
        Element div = asDivTableObjectDetails(nakedObject);
        xhtml.appendToBody(div);

        // action Name
        div = xhtmlRenderer.div_p(actionId, HtmlClass.COLLECTION);
        xhtml.appendToBody(div);

        // TODO: should be checking if enabled, or indeed, if visible?
        // probably for modifying properties and collections too.

        // validate
        final Consent consent = action.isProposedArgumentSetValid(nakedObject, proposedArguments);
        if (consent.isVetoed()) {
            throw new WebApplicationException(responseOfBadRequest(consent));
        }

        // invoke the action
        final ActionInvocationFacet actionInvocationFacet = action.getFacet(ActionInvocationFacet.class);
        final ObjectAdapter result = actionInvocationFacet.invoke(nakedObject, proposedArguments);
        if (result == null) {
            // do nothing;
            // NB: this is not a response of NO_CONTENT
            // (not sure if it ought to be, can't see how you would return it)
        } else {
            final Object object = result.getObject();
            xhtml.appendToBody(actionResult(object));
        }

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

Examples of org.pirkaengine.core.template.XhtmlTemplate

     */
    @Test
    public void create_public_field() throws ModelDeficientPropertyException {
       
        @SuppressWarnings("serial")
        Template template = new XhtmlTemplate("test") {
            @Override
            public Map<String, Object> createViewModel() {
                HashMap<String, Object> model = new HashMap<String, Object>();
                model.put("name", new Object());
                return model;
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

     */
    @Test
    public void create_getter() throws ModelDeficientPropertyException {
       
        @SuppressWarnings("serial")
        Template template = new XhtmlTemplate("test") {
            @Override
            public Map<String, Object> createViewModel() {
                HashMap<String, Object> model = new HashMap<String, Object>();
                model.put("name", new Object());
                return model;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.