Search in sources :

Example 41 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class ServicesSelectViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    disableButton("button1", true);
    try {
        ServicesModel model = (ServicesModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        Map assignables = model.getAssignableServiceNames(curRealm);
        CCRadioButton rb = (CCRadioButton) getChild(ATTR_SERVICE_LIST);
        OptionList optList = AMFormatUtils.getSortedOptionList(assignables, model.getUserLocale());
        rb.setOptions(optList);
        String val = (String) rb.getValue();
        if ((val == null) || (val.length() == 0)) {
            rb.setValue(optList.getValue(0));
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : CCRadioButton(com.sun.web.ui.view.html.CCRadioButton) ServicesModel(com.sun.identity.console.realm.model.ServicesModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList)

Example 42 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class MAPCreateDeviceViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    disableButton("button1", true);
    MAPCreateDeviceModel model = (MAPCreateDeviceModel) getModel();
    String profileName = (String) getPageSessionAttribute(MAPClientManagerViewBean.PAGE_SESSION_PROFILE_NAME);
    Set styles = model.getStyleNames(profileName);
    if ((styles != null) && !styles.isEmpty()) {
        CCRadioButton btn = (CCRadioButton) getChild(RADIO_STYLE);
        OptionList styleList = new OptionList();
        for (Iterator iter = styles.iterator(); iter.hasNext(); ) {
            String name = (String) iter.next();
            styleList.add(name, name);
        }
        btn.setOptions(styleList);
        String value = (String) getDisplayFieldValue(RADIO_STYLE);
        if ((value == null) || (value.trim().length() == 0)) {
            setDisplayFieldValue(RADIO_STYLE, (String) styles.iterator().next());
        }
    }
}
Also used : CCRadioButton(com.sun.web.ui.view.html.CCRadioButton) Set(java.util.Set) MAPCreateDeviceModel(com.sun.identity.console.service.model.MAPCreateDeviceModel) Iterator(java.util.Iterator) OptionList(com.iplanet.jato.view.html.OptionList)

Example 43 with OptionList

use of com.iplanet.jato.view.html.OptionList 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 44 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class PolicyModelImpl method getAttrChoiceValue.

private OptionList getAttrChoiceValue(ActionSchema actionSchema, ResourceBundle rb) {
    OptionList optionList = new OptionList();
    String[] choices = actionSchema.getChoiceValues();
    for (int i = 0; i < choices.length; i++) {
        String choice = choices[i];
        String i18nKey = actionSchema.getChoiceValueI18NKey(choice);
        String lname = com.sun.identity.shared.locale.Locale.getString(rb, i18nKey, debug);
        if ((lname == null) || (lname.length() == 0)) {
            lname = i18nKey;
        }
        optionList.add(lname, choice);
    }
    return optionList;
}
Also used : OptionList(com.iplanet.jato.view.html.OptionList)

Example 45 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class PolicyModelImpl method getChoiceValues.

/**
     * Returns a option list of possible choices.
     *
     * @param name Name of Service Type.
     * @param actionSchema Action Schema.
     * @return a option list of possible choices.
     */
public OptionList getChoiceValues(String name, ActionSchema actionSchema) {
    ResourceBundle rb = (ResourceBundle) mapSvcTypeNameToResBundle.get(name);
    OptionList optList = null;
    AttributeSchema.Syntax syntax = actionSchema.getSyntax();
    AttributeSchema.UIType uiType = actionSchema.getUIType();
    if ((uiType != null) && (uiType == AttributeSchema.UIType.RADIO)) {
        if (syntax == AttributeSchema.Syntax.BOOLEAN) {
            optList = getAttrRadioBooleanChoiceValue(actionSchema, rb);
        } else {
            optList = getAttrChoiceValue(actionSchema, rb);
        }
    } else {
        optList = getAttrChoiceValue(actionSchema, rb);
    }
    return optList;
}
Also used : AttributeSchema(com.sun.identity.sm.AttributeSchema) ResourceBundle(java.util.ResourceBundle) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

OptionList (com.iplanet.jato.view.html.OptionList)75 Set (java.util.Set)35 Iterator (java.util.Iterator)27 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)25 Map (java.util.Map)24 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)21 HashSet (java.util.HashSet)17 List (java.util.List)15 HashMap (java.util.HashMap)13 ArrayList (java.util.ArrayList)9 Option (com.iplanet.jato.view.html.Option)7 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)7 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)7 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)6 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)6 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)6 TreeSet (java.util.TreeSet)6 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)5 TaskModel (com.sun.identity.console.task.model.TaskModel)5 CCSelect (com.sun.web.ui.view.html.CCSelect)5