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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations