Search in sources :

Example 1 with CCTagBase

use of com.sun.web.ui.taglib.common.CCTagBase in project OpenAM by OpenRock.

the class CCPropertySheetTag method getValueHTML.

@Override
protected String getValueHTML(Node valueNode, String labelId, boolean levelThree) throws JspException, IllegalArgumentException {
    if (valueNode == null) {
        CCDebug.trace1("Property node missing value element");
        return null;
    }
    String viewName = getAttributeValue(valueNode, "name", "");
    String tagclassName = getAttributeValue(valueNode, "tagclass", "com.sun.web.ui.taglib.html.CCStaticTextFieldTag");
    View child = null;
    if (!tagclassName.equals("com.sun.web.ui.taglib.spacer.CCSpacerTag") && !tagclassName.equals("org.forgerock.openam.console.ui.taglib.spacer.CCSpacerTag")) {
        child = containerView.getChild(viewName);
    }
    CCTagBase tag = getCCTag(tagclassName);
    tag.setName(viewName);
    if (labelId != null) {
        tag.setElementId(labelId);
    }
    if (tagclassName.equals("com.sun.web.ui.taglib.html.CCCheckBoxTag")) {
        CCCheckBoxTag cb = (CCCheckBoxTag) tag;
        cb.setStyleLevel(levelThree ? "3" : "2");
        cb.setElementId(getNextLabelId());
    } else if (tagclassName.equals("com.sun.web.ui.taglib.html.CCRadioButtonTag")) {
        CCRadioButtonTag rb = (CCRadioButtonTag) tag;
        rb.setStyleLevel(levelThree ? "3" : "2");
        rb.setElementId(getNextLabelId());
    }
    if (valueNode.hasChildNodes()) {
        NodeList childNodeList = valueNode.getChildNodes();
        BodyContent bodyContent = null;
        if (tag instanceof BodyTag) {
            bodyContent = new CCBodyContentImpl(new CCJspWriterImpl(null, 100, false));
        }
        OptionList options = null;
        if (child != null && (child instanceof SelectableGroup)) {
            options = new OptionList();
        }
        for (int i = 0; i < childNodeList.getLength(); i++) {
            parseValueChildNode(childNodeList.item(i), tag, bodyContent, options);
        }
        if (bodyContent != null) {
            ((BodyTag) tag).setBodyContent(bodyContent);
        }
        if (options != null && options.size() > 0) {
            ((SelectableGroup) child).setOptions(options);
        }
    }
    if (tag.getBundleID() == null) {
        tag.setBundleID(getBundleID());
    }
    tag.setTabIndex(getTabIndex());
    String html = null;
    if (fireBeginDisplayEvent(containerView, tag)) {
        html = tag.getHTMLString(getParent(), pageContext, child);
    }
    return fireEndDisplayEvent(containerView, tag, html);
}
Also used : CCBodyContentImpl(com.sun.web.ui.common.CCBodyContentImpl) BodyTag(javax.servlet.jsp.tagext.BodyTag) NodeList(org.w3c.dom.NodeList) CCJspWriterImpl(com.sun.web.ui.common.CCJspWriterImpl) CCCheckBoxTag(com.sun.web.ui.taglib.html.CCCheckBoxTag) View(com.iplanet.jato.view.View) BodyContent(javax.servlet.jsp.tagext.BodyContent) SelectableGroup(com.iplanet.jato.view.html.SelectableGroup) CCRadioButtonTag(com.sun.web.ui.taglib.html.CCRadioButtonTag) OptionList(com.iplanet.jato.view.html.OptionList) CCTagBase(com.sun.web.ui.taglib.common.CCTagBase)

Example 2 with CCTagBase

use of com.sun.web.ui.taglib.common.CCTagBase in project OpenAM by OpenRock.

the class ActionSchemaGUI method getCCTag.

private CCTagBase getCCTag(HttpServletRequest req, String name) throws JspException {
    CCTagBase tag = null;
    Class tagclass = null;
    try {
        ClassLoader classLoader = getClassLoader(req);
        tagclass = classLoader.loadClass(name);
    } catch (ClassNotFoundException e) {
        throw new JspException(e.getMessage());
    }
    if (CCTagBase.class.isAssignableFrom(tagclass)) {
        try {
            tag = (CCTagBase) tagclass.newInstance();
        } catch (InstantiationException e) {
            throw new JspException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new JspException(e.getMessage());
        }
    } else {
        throw new IllegalArgumentException("CCTagBase is not a superclass of: " + tagclass);
    }
    return tag;
}
Also used : JspException(javax.servlet.jsp.JspException) CCTagClass(com.sun.web.ui.common.CCTagClass) CCTagBase(com.sun.web.ui.taglib.common.CCTagBase)

Example 3 with CCTagBase

use of com.sun.web.ui.taglib.common.CCTagBase in project OpenAM by OpenRock.

the class ActionSchemaGUI method getHTMLString.

public String getHTMLString(AMViewBeanBase viewBean, PageContext pageContext, ActionSchema actionSchema, String actionTableName) throws JspException {
    StringBuilder buff = new StringBuilder(1000);
    int syntax = AMDisplayType.getInstance().getDisplaySyntax(actionSchema);
    HttpServletRequest req = viewBean.getRequestContext().getRequest();
    CCTagBase parentTag = getCCTag(req, CCTagClass.ACTIONTABLE);
    parentTag.setName(actionTableName);
    switch(syntax) {
        case AMDisplayType.SYNTAX_RADIO:
            String viewName = AMViewInterface.PREFIX_RADIO_BUTTON + actionSchema.getName();
            View view = viewBean.getChild(viewName);
            CCTagBase tag = getCCTag(req, CCTagClass.RADIOBUTTON);
            tag.setName(viewName);
            buff.append(tag.getHTMLString(parentTag, pageContext, view));
            break;
    }
    return buff.toString();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) View(com.iplanet.jato.view.View) CCTagBase(com.sun.web.ui.taglib.common.CCTagBase)

Aggregations

CCTagBase (com.sun.web.ui.taglib.common.CCTagBase)3 View (com.iplanet.jato.view.View)2 OptionList (com.iplanet.jato.view.html.OptionList)1 SelectableGroup (com.iplanet.jato.view.html.SelectableGroup)1 CCBodyContentImpl (com.sun.web.ui.common.CCBodyContentImpl)1 CCJspWriterImpl (com.sun.web.ui.common.CCJspWriterImpl)1 CCTagClass (com.sun.web.ui.common.CCTagClass)1 CCCheckBoxTag (com.sun.web.ui.taglib.html.CCCheckBoxTag)1 CCRadioButtonTag (com.sun.web.ui.taglib.html.CCRadioButtonTag)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JspException (javax.servlet.jsp.JspException)1 BodyContent (javax.servlet.jsp.tagext.BodyContent)1 BodyTag (javax.servlet.jsp.tagext.BodyTag)1 NodeList (org.w3c.dom.NodeList)1