Example usage for org.apache.commons.jelly JellyException JellyException

List of usage examples for org.apache.commons.jelly JellyException JellyException

Introduction

In this page you can find the example usage for org.apache.commons.jelly JellyException JellyException.

Prototype

public JellyException(Throwable cause) 

Source Link

Usage

From source file:com.cyclopsgroup.waterview.web.taglib.BaseJellyTableControlTag.java

/**
 * Override method runScript in class BaseJellyTableControlTag
 *
 * @see com.cyclopsgroup.waterview.jelly.taglib.BaseJellyControlTag#runScript(org.apache.commons.jelly.Script, org.apache.commons.jelly.XMLOutput)
 *//*  www  .j a  v a  2 s.co m*/
protected void runScript(Script script, XMLOutput output) throws Exception {
    invokeBody(XMLOutput.createDummyXMLOutput());
    if (tableTag == null) {
        throw new JellyException("One table must be defined");
    }

    if (data == null) {
        throw new JellyException("Tabular data must be included");
    }

    JellyContext jc = new JellyContext(getContext());
    jc.setVariable("tableTag", tableTag);
    jc.setVariable("table", tableTag.getTable());
    jc.setVariable("tabularData", data);
    jc.setVariable("tableControl", this);
    script.run(jc, output);
}

From source file:com.cyclopsgroup.waterview.core.taglib.PortletTag.java

/**
 * Overwrite or implement method processTag()
 *
 * @see com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput)
 *//*from  w  ww.j  a v a  2 s .co  m*/
protected void processTag(XMLOutput output) throws Exception {
    PortletAware pa = (PortletAware) findAncestorWithClass(PortletAware.class);
    if (pa == null) {
        throw new JellyException("Portlet must be in a proper tag");
    }
    invokeBody(XMLOutput.createDummyXMLOutput());
    if (view == null) {
        throw new JellyException("A view must be defined");
    }
    ViewPortlet portlet = new ViewPortlet(view);
    portlet.setTitle(getTitle());
    portlet.setDescription(getDescription());
    pa.doPortlet(portlet);
}

From source file:com.cyclopsgroup.waterview.web.taglib.JellyTableControlTag.java

/**
 * Overwrite or implement method processTag()
 *
 * @see com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput)
 *///from  w  ww . j  av  a 2 s. c  om
protected void processTag(XMLOutput output) throws Exception {
    requireAttribute("script");

    invokeBody(XMLOutput.createDummyXMLOutput());
    JellyEngine je = (JellyEngine) getServiceManager().lookup(JellyEngine.ROLE);
    Script s = je.getScript(getScript());

    if (tableTag == null) {
        throw new JellyException("One table must be defined");
    }

    if (data == null) {
        throw new JellyException("Tabular data must be included");
    }

    JellyContext jc = new JellyContext(getContext());
    jc.setVariable("tableTag", tableTag);
    jc.setVariable("table", tableTag.getTable());
    jc.setVariable("tabularData", getData());
    s.run(jc, output);
}

From source file:org.kohsuke.stapler.jelly.groovy.JellyBuilder.java

private void configureTag(Tag tag, Map attributes) throws JellyException {
    if (tag instanceof DynaTag) {
        DynaTag dynaTag = (DynaTag) tag;

        for (Object o : attributes.entrySet()) {
            Entry entry = (Entry) o;/*  w  w w.  j  a  v a 2s .  c  om*/
            String name = (String) entry.getKey();
            if (name.equals("xmlns"))
                continue; // we'll process this by ourselves

            Object value = getValue(entry, dynaTag.getAttributeType(name));
            dynaTag.setAttribute(name, value);
        }
    } else {
        // treat the tag as a bean
        DynaBean dynaBean = new ConvertingWrapDynaBean(tag);
        for (Object o : attributes.entrySet()) {
            Entry entry = (Entry) o;
            String name = (String) entry.getKey();
            if (name.equals("xmlns"))
                continue; // we'll process this by ourselves

            DynaProperty property = dynaBean.getDynaClass().getDynaProperty(name);
            if (property == null) {
                throw new JellyException("This tag does not understand the '" + name + "' attribute");
            }

            dynaBean.set(name, getValue(entry, property.getType()));
        }
    }
}