Search in sources :

Example 6 with CCNavNode

use of com.sun.web.ui.model.CCNavNode in project OpenAM by OpenRock.

the class AMViewConfig method addAgentTabs.

public CCNavNode addAgentTabs(CCTabsModel tabModel, AMModel model, int idx) {
    CCNavNode selected = null;
    Map mapSupported = getSupportedAgentTypesMap(model);
    List supported = getSupportedAgentTypes(model);
    if (!supported.isEmpty()) {
        CCNavNode agentNode = (CCNavNode) tabModel.getNodeById(AMAdminConstants.TAB_AGENT_PREFIX_INT);
        if (agentNode != null) {
            for (int i = 0; i < supported.size(); i++) {
                String t = (String) supported.get(i);
                int nodeId = Integer.parseInt(AMAdminConstants.TAB_AGENT_PREFIX + i);
                String i18nKey = (String) mapSupported.get(t);
                if (i18nKey == null) {
                    i18nKey = "agenttype." + t;
                }
                CCNavNode n = n = new CCNavNode(nodeId, i18nKey, t, t);
                if (nodeId == idx) {
                    selected = n;
                }
                agentNode.addChild(n);
            }
        }
    }
    return selected;
}
Also used : CCNavNode(com.sun.web.ui.model.CCNavNode) ArrayList(java.util.ArrayList) NodeList(org.w3c.dom.NodeList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) NamedNodeMap(org.w3c.dom.NamedNodeMap)

Example 7 with CCNavNode

use of com.sun.web.ui.model.CCNavNode in project OpenAM by OpenRock.

the class AMViewConfig method addEntityTabs.

public boolean addEntityTabs(CCTabsModel tabModel, String realmName, AMModel model) {
    boolean added = false;
    List supported = getSupportedEntityTypes(realmName, model);
    if (!supported.isEmpty()) {
        CCNavNode subjectNode = (CCNavNode) tabModel.getNodeById(AMAdminConstants.SUBJECTS_NODE_ID);
        if (subjectNode != null) {
            for (Iterator i = supported.iterator(); i.hasNext(); ) {
                String t = (String) i.next();
                subjectNode.addChild(new CCNavNode(t.hashCode(), t, t, t));
            }
            added = true;
        }
    }
    return added;
}
Also used : CCNavNode(com.sun.web.ui.model.CCNavNode) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) NodeList(org.w3c.dom.NodeList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List)

Example 8 with CCNavNode

use of com.sun.web.ui.model.CCNavNode in project OpenAM by OpenRock.

the class AMViewConfig method addSessionTabs.

public CCTabsModel addSessionTabs(CCTabsModel tabModel, AMModel model) {
    if (tabModel == null) {
        tabModel = new CCTabsModel();
    }
    CCNavNode sessionNode = (CCNavNode) tabModel.getNodeById(AMAdminConstants.SESSIONS_NODE_ID);
    if (sessionNode != null) {
        if ((tabs == null) || (tabs.isEmpty()) || (sessionNode.getChildren() == null) || (sessionNode.getChildren().size() >= 2)) {
            return tabModel;
        }
        AMTabEntry[] entries = new AMTabEntry[2];
        entries[0] = (AMTabEntry) sessionNode.getChildren().get(0);
        entries[1] = (AMTabEntry) sessionNode.getChildren().get(1);
        for (AMTabEntry entry : entries) {
            sessionNode.addChild(new CCNavNode(entry.getID(), entry.getLabel(), entry.getTooltip(), entry.getStatus()));
        }
    }
    return tabModel;
}
Also used : CCTabsModel(com.sun.web.ui.model.CCTabsModel) CCNavNode(com.sun.web.ui.model.CCNavNode)

Example 9 with CCNavNode

use of com.sun.web.ui.model.CCNavNode in project OpenAM by OpenRock.

the class AMTabEntry method getNavNode.

public CCNavNode getNavNode(AccessControlModel model, String realmName) {
    boolean hasChild = true;
    CCNavNode navNode = null;
    if (canView() && canView(model, realmName)) {
        navNode = new CCNavNode(getID(), label, tooltip, status);
        if (!children.isEmpty()) {
            hasChild = false;
            for (Iterator iter = children.iterator(); iter.hasNext(); ) {
                AMTabEntry child = (AMTabEntry) iter.next();
                CCNavNode childNavNode = child.getNavNode(model, realmName);
                if (childNavNode != null) {
                    navNode.addChild(childNavNode);
                    hasChild = true;
                }
            }
        }
    }
    return (hasChild) ? navNode : null;
}
Also used : CCNavNode(com.sun.web.ui.model.CCNavNode) Iterator(java.util.Iterator)

Example 10 with CCNavNode

use of com.sun.web.ui.model.CCNavNode in project OpenAM by OpenRock.

the class EntityEditViewBean method createPropertyModel.

protected boolean createPropertyModel() {
    boolean created = super.createPropertyModel();
    if (created) {
        String type = (String) getPageSessionAttribute(ENTITY_TYPE);
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        EntitiesModel model = (EntitiesModel) getModel();
        tabModel = new CCTabsModel();
        tabModel.addNode(new CCNavNode(TAB_PROFILE, "profile.tab", "", ""));
        if (model.canAssignService(curRealm, type)) {
            tabModel.addNode(new CCNavNode(TAB_SERVICES, "services.tab", "", ""));
        }
        try {
            Set memberOfs = model.getIdTypeMemberOf(curRealm, type);
            for (Iterator iter = memberOfs.iterator(); iter.hasNext(); ) {
                IdType t = (IdType) iter.next();
                tabModel.addNode(new CCNavNode(t.hashCode(), t.getName(), "", ""));
            }
            Set beMemberOfs = model.getIdTypeBeMemberOf(curRealm, type);
            if ((beMemberOfs != null) && !beMemberOfs.isEmpty()) {
                for (Iterator i = beMemberOfs.iterator(); i.hasNext(); ) {
                    IdType t = (IdType) i.next();
                    tabModel.addNode(new CCNavNode(t.hashCode(), t.getName(), "", ""));
                }
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
        tabModel.setSelectedNode(TAB_PROFILE);
    }
    return created;
}
Also used : CCTabsModel(com.sun.web.ui.model.CCTabsModel) CCNavNode(com.sun.web.ui.model.CCNavNode) HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel) IdType(com.sun.identity.idm.IdType)

Aggregations

CCNavNode (com.sun.web.ui.model.CCNavNode)11 Iterator (java.util.Iterator)6 CCTabsModel (com.sun.web.ui.model.CCTabsModel)5 List (java.util.List)5 OptionList (com.iplanet.jato.view.html.OptionList)4 ArrayList (java.util.ArrayList)4 NodeList (org.w3c.dom.NodeList)4 AMViewConfig (com.sun.identity.console.base.AMViewConfig)2 AccessControlModel (com.sun.identity.console.base.model.AccessControlModel)2 AccessControlModelImpl (com.sun.identity.console.base.model.AccessControlModelImpl)2 Set (java.util.Set)2 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)1 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)1 MAPServiceModel (com.sun.identity.console.service.model.MAPServiceModel)1 IdType (com.sun.identity.idm.IdType)1 CCTabs (com.sun.web.ui.view.tabs.CCTabs)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1