Search in sources :

Example 6 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class SCServiceProfileViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    AMModel model = (AMModel) getModel();
    String serviceName = (String) getPageSessionAttribute(AMServiceProfile.SERVICE_NAME);
    Object[] arg = { model.getLocalizedServiceName(serviceName) };
    return MessageFormat.format(model.getLocalizedString("breadcrumbs.services.edit"), arg);
}
Also used : AMModel(com.sun.identity.console.base.model.AMModel)

Example 7 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class AgentsViewBean method createParentagePath.

private CCBreadCrumbs createParentagePath(String name) {
    CCBreadCrumbsModel model = null;
    AMModel ammodel = (AMModel) getModel();
    String curRealm = getCurrentRealm();
    if (curRealm.charAt(0) != '/') {
        curRealm = "/" + curRealm;
    }
    String startDN = ammodel.getStartDN();
    if (startDN.charAt(0) != '/') {
        startDN = "/" + startDN;
    }
    String startDNString = AMFormatUtils.DNToName(ammodel, ammodel.getStartDSDN());
    if (curRealm.equals(startDN)) {
        model = new CCBreadCrumbsModel();
        setDisplayFieldValue(TXT_ROOT, startDNString);
    } else {
        int idx = curRealm.indexOf(startDN);
        String subRealm = (idx == 0) ? curRealm.substring(startDN.length()) : curRealm;
        List list = reverseParentagePath(subRealm);
        if (!list.isEmpty()) {
            list.remove(list.size() - 1);
        }
        /*
             * The model is initialized with the name of the current realm.
             * This entry is not selectable, just displayed as a label.
             */
        idx = subRealm.lastIndexOf("/");
        if (idx != -1) {
            subRealm = subRealm.substring(idx + 1);
        }
        model = new CCBreadCrumbsModel(SMSSchema.unescapeName(subRealm));
        StringBuilder baseDN = new StringBuilder(200);
        baseDN.append(startDN);
        /*
             * each row added to the model is a selectable entry in the
             * parentage path
             */
        model.appendRow();
        model.setValue(CCBreadCrumbsModel.LABEL, SMSSchema.unescapeName(startDNString));
        model.setValue(CCBreadCrumbsModel.COMMANDFIELD, PARENTAGE_PATH_HREF);
        model.setValue(CCBreadCrumbsModel.HREF_VALUE, baseDN.toString());
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            String tok = (String) iter.next();
            if (!baseDN.toString().equals("/")) {
                baseDN.append("/").append(tok);
            } else {
                baseDN.append(tok);
            }
            model.appendRow();
            model.setValue(CCBreadCrumbsModel.LABEL, SMSSchema.unescapeName(tok));
            model.setValue(CCBreadCrumbsModel.COMMANDFIELD, PARENTAGE_PATH_HREF);
            model.setValue(CCBreadCrumbsModel.HREF_VALUE, baseDN.toString());
        }
    }
    return new CCBreadCrumbs(this, model, name);
}
Also used : AMModel(com.sun.identity.console.base.model.AMModel) CCBreadCrumbs(com.sun.web.ui.view.breadcrumb.CCBreadCrumbs) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) CCBreadCrumbsModel(com.sun.web.ui.model.CCBreadCrumbsModel)

Example 8 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class AMViewBeanBase method getContentType.

protected String getContentType() {
    AMModel model = getModel();
    Locale locale = model.getUserLocale();
    String agentType = model.getClientType();
    String content_type = AMI18NUtils.getContentType(agentType);
    return content_type;
}
Also used : Locale(java.util.Locale) AMModel(com.sun.identity.console.base.model.AMModel)

Example 9 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class AMViewBeanBase method getPath.

// this builds a display string only
public String getPath(String child) {
    AMModel model = getModel();
    StringBuilder path = new StringBuilder();
    String startDN = model.getStartDN();
    if (startDN.charAt(0) != '/') {
        startDN = "/" + startDN;
    }
    if (child.charAt(0) != '/') {
        child = "/" + child;
    }
    path.append(startDN);
    if (!child.equals(startDN)) {
        int idx = child.indexOf(startDN);
        String subRealm = (idx == 0) ? child.substring(startDN.length()) : child;
        StringTokenizer st = new StringTokenizer(subRealm, "/");
        while (st.hasMoreTokens()) {
            path.append(" > ").append(SMSSchema.unescapeName(st.nextToken()));
        }
    }
    return path.toString();
}
Also used : StringTokenizer(java.util.StringTokenizer) AMModel(com.sun.identity.console.base.model.AMModel)

Example 10 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class AMViewBeanBase method getCharset.

protected String getCharset() {
    AMModel model = getModel();
    Locale locale = model.getUserLocale();
    String agentType = model.getClientType();
    String charset = AMI18NUtils.getCharset(agentType, locale);
    return BrowserEncoding.mapHttp2JavaCharset(charset);
}
Also used : Locale(java.util.Locale) AMModel(com.sun.identity.console.base.model.AMModel)

Aggregations

AMModel (com.sun.identity.console.base.model.AMModel)33 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)14 HttpServletRequest (javax.servlet.http.HttpServletRequest)13 Iterator (java.util.Iterator)4 SMDiscoveryServiceModelImpl (com.sun.identity.console.service.model.SMDiscoveryServiceModelImpl)3 SubConfigModelImpl (com.sun.identity.console.service.model.SubConfigModelImpl)3 List (java.util.List)3 Set (java.util.Set)3 SMG11NModelImpl (com.sun.identity.console.service.model.SMG11NModelImpl)2 WSPersonalProfileServiceModelImpl (com.sun.identity.console.webservices.model.WSPersonalProfileServiceModelImpl)2 CCBreadCrumbsModel (com.sun.web.ui.model.CCBreadCrumbsModel)2 CCBreadCrumbs (com.sun.web.ui.view.breadcrumb.CCBreadCrumbs)2 CCSelect (com.sun.web.ui.view.html.CCSelect)2 ArrayList (java.util.ArrayList)2 Locale (java.util.Locale)2 RequestContext (com.iplanet.jato.RequestContext)1 OptionList (com.iplanet.jato.view.html.OptionList)1 AMCommonNameGenerator (com.sun.identity.console.base.model.AMCommonNameGenerator)1 SCSAML2SOAPBindingModelImpl (com.sun.identity.console.service.model.SCSAML2SOAPBindingModelImpl)1 SCSOAPBindingModelImpl (com.sun.identity.console.service.model.SCSOAPBindingModelImpl)1