List of usage examples for org.apache.commons.jelly JellyTagException JellyTagException
public JellyTagException(Throwable cause)
From source file:com.cyclopsgroup.waterview.core.taglib.GetPortletsTag.java
/** * Override method processTag in class GetPanelComponentsTag * * @see com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput) *//*from www . jav a 2 s .c o m*/ protected void processTag(XMLOutput output) throws Exception { requireAttribute("var"); requireAttribute("panel"); Page page = (Page) getContext().getVariable(Page.NAME); if (page == null) { throw new JellyTagException("Page is not found"); } PanelContent content = page.getPanelContent(getPanel()); List portlets; if (content == null) { invokeBody(XMLOutput.createDummyXMLOutput()); portlets = new ArrayList(defaultPortlets); } else if (content.isAppend()) { invokeBody(XMLOutput.createDummyXMLOutput()); portlets = new ArrayList(defaultPortlets); CollectionUtils.addAll(portlets, content.getPortlets()); } else { portlets = new ArrayList(); CollectionUtils.addAll(portlets, content.getPortlets()); } getContext().setVariable(getVar(), portlets); }
From source file:com.cyclopsgroup.waterview.web.taglib.HorizontalTabControlTag.java
/** * Overwrite or implement method processTag() * * @see com.cyclopsgroup.waterview.jelly.taglib.BaseJellyControlTag#processTag(org.apache.commons.jelly.XMLOutput) *///ww w . ja v a 2s . co m protected void processTag(XMLOutput output) throws Exception { requireAttribute("name"); invokeBody(XMLOutput.createDummyXMLOutput()); if (tabTags.isEmpty()) { throw new JellyTagException("At least one tab must be defined"); } String selectedTabName = (String) getRuntimeData().getSessionContext().get(getUniqueTagId()); if (StringUtils.isNotEmpty(selectedTabName)) { setSelected(selectedTabName); } else if (StringUtils.isEmpty(getSelected()) || !tabTags.containsKey(getSelected())) { setSelected((String) tabTags.keySet().iterator().next()); } super.processTag(output); }
From source file:com.cyclopsgroup.waterview.navigator.impl.NodeTag.java
/** * Overwrite or implement method processTag() * * @see com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput) *///from w ww . j av a 2s.c o m protected void processTag(XMLOutput output) throws Exception { requireAttribute("title"); requireAttribute("page"); if (getParent() instanceof TreeTag) { parentPath = ((TreeTag) getParent()).getPosition(); } else if (getParent() instanceof NodeTag) { ((NodeTag) getParent()).requireAttribute("name"); parentPath = ((NodeTag) getParent()).getPath(); } else { throw new JellyTagException("Parent tag must be tree or node"); } NavigationTag nt = (NavigationTag) findAncestorWithClass(NavigationTag.class); DefaultNavigatorNode node = new DefaultNavigatorNode(nt.getNavigator(), getName(), parentPath); path = node.getPath(); node.getAttributes().set(DefaultNavigatorNode.PAGE_NAME, getPage()); node.getAttributes().set(DefaultNavigatorNode.TITLE_NAME, getTitle()); node.getAttributes().set(DefaultNavigatorNode.DESCRIPTION_NAME, getDescription()); node.getAttributes().set(DefaultNavigatorNode.HIDDEN_NAME, isHidden() ? "true" : "false"); nt.getNavigator().addNode(node); invokeBody(output); }
From source file:com.cyclopsgroup.waterview.utils.TagSupportBase.java
/** * Overwrite or implement method doTag() * * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput) *///from w ww .j av a 2 s. c om public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { try { processTag(output); } catch (Exception e) { JellyTagException ex = null; if (e instanceof JellyTagException) { ex = (JellyTagException) e; } else { ex = new JellyTagException(e); } URL[] scriptResources = getScriptResources(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < scriptResources.length; i++) { URL url = scriptResources[i]; sb.append(">").append(url.toString()); } ex.setFileName(sb.toString()); throw ex; } }
From source file:com.cyclopsgroup.waterview.utils.TagSupportBase.java
/** * Require body of a tag/*from w ww . jav a 2 s .c o m*/ * * @throws JellyTagException If the body is empty, throw it out */ protected final void requireBody() throws JellyTagException { if (StringUtils.isEmpty(getBodyText())) { throw new JellyTagException("Body text is required"); } }
From source file:com.cyclopsgroup.waterview.utils.TagSupportBase.java
/** * Require this tag to be inside given tag class * * @param parentTagClass Given tag class * @return Parent tag//from w ww .j av a 2 s . co m * @throws JellyTagException Throw it if requirement is not met */ protected final Tag requireInside(Class parentTagClass) throws JellyTagException { Tag parent = findAncestorWithClass(parentTagClass); if (parent == null) { throw new JellyTagException("Tag must be inside " + parentTagClass.getName()); } return parent; }
From source file:com.cyclopsgroup.waterview.utils.TagSupportBase.java
/** * Require parent to be a class/*from ww w .ja v a 2 s . co m*/ * * @param parentTagClass Parent class * @throws JellyTagException Throw it out if not matched * @return Parent tag */ protected final Tag requireParent(Class parentTagClass) throws JellyTagException { if (!parentTagClass.isAssignableFrom(getParent().getClass())) { throw new JellyTagException("Tag's parent must be " + parentTagClass.getName()); } return getParent(); }
From source file:org.apache.cactus.integration.maven.CactusScannerTag.java
/** * {@inheritDoc}// ww w .j a v a 2 s.c o m * @see TaskSource#setTaskProperty(String, Object) */ public void setTaskProperty(String theName, Object theValue) throws JellyTagException { try { BeanUtils.setProperty(this, theName, theValue); } catch (IllegalAccessException anException) { throw new JellyTagException(anException); } catch (InvocationTargetException anException) { throw new JellyTagException(anException); } }
From source file:org.codehaus.nanning.jelly.InterceptorTag.java
public void doTag(XMLOutput xmlOutput) throws JellyTagException { try {//from www . ja v a 2s .c o m Class interceptorClass = Thread.currentThread().getContextClassLoader().loadClass(getBodyText().trim()); ((AspectTag) getParent()).addInterceptor(interceptorClass); } catch (ClassNotFoundException e) { new JellyTagException(e); } }
From source file:org.codehaus.nanning.jelly.InterfaceTag.java
public void doTag(XMLOutput xmlOutput) throws JellyTagException { try {/*from w ww . j av a 2 s . c o m*/ Class interfaceClass = Thread.currentThread().getContextClassLoader().loadClass(getBodyText().trim()); ((AspectTag) getParent()).setAspectInterface(interfaceClass); } catch (ClassNotFoundException e) { throw new JellyTagException(e); } }