use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.
the class AgentsViewBean method getAgentNames.
private void getAgentNames() {
AgentsModel model = (AgentsModel) getModel();
String filter = ((String) getDisplayFieldValue(TF_FILTER));
String gfilter = ((String) getDisplayFieldValue(TF_GROUP_FILTER));
if ((filter == null) || (filter.length() == 0)) {
filter = "*";
setDisplayFieldValue(TF_FILTER, "*");
} else {
filter = filter.trim();
}
if ((gfilter == null) || (gfilter.length() == 0)) {
gfilter = "*";
setDisplayFieldValue(TF_GROUP_FILTER, "*");
} else {
gfilter = gfilter.trim();
}
// this is to faciliate combined types.
String agentType = getDisplayIDType();
AMViewConfig cfg = AMViewConfig.getInstance();
Set agentTypes = cfg.getCombineAgentTypes(agentType);
if (agentTypes == null) {
agentTypes = new HashSet(2);
agentTypes.add(agentType);
} else {
supportedTypes.addAll(agentTypes);
}
try {
Set agents = new HashSet();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
int errorCode = model.getAgentNames(curRealm, agentTypes, filter, agents);
switch(errorCode) {
case IdSearchResults.SIZE_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
break;
case IdSearchResults.TIME_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
break;
}
Set agentGroups = new HashSet();
errorCode = model.getAgentGroupNames(curRealm, agentTypes, gfilter, agentGroups);
switch(errorCode) {
case IdSearchResults.SIZE_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
break;
case IdSearchResults.TIME_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
break;
}
Map results = new HashMap(4);
results.put(CACHE_AGENTS, agents);
results.put(CACHE_AGENT_GROUPS, agentGroups);
populateTableModel(results);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
CCButton b = (CCButton) getChild(TBL_BUTTON_ADD);
b.setDisabled(true);
b = (CCButton) getChild(TBL_BUTTON_ADD_GROUP);
b.setDisabled(true);
}
}
use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.
the class AgentsViewBean method beginDisplay.
/**
* Sets the agent title and populates the agent and agent group
* action table.
*
* @param event Display Event.
* @throws ModelControlException if cannot access to framework model.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event, false);
resetButtonState(TBL_BUTTON_DELETE);
AgentsModel model = (AgentsModel) getModel();
String agentType = getDisplayIDType();
Object[] param = { agentType };
ptModel.setPageTitleText(model.getLocalizedString("agenttype." + agentType));
ptModel.setPageTitleHelpMessage(model.getLocalizedString("agenttype." + agentType + ".help"));
tblModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agents.title.name"), param));
tblModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
tblModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
tblGroupModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agent.groups.title.name"), param));
tblGroupModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
tblGroupModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
getAgentNames();
CCButton b = (CCButton) getChild(TBL_BUTTON_DELETE);
b.setDisabled(true);
b = (CCButton) getChild(TBL_BUTTON_DELETE_GROUP);
b.setDisabled(true);
}
use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.
the class PolicyNormalViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
try {
populateAttributes();
} catch (AMConsoleException e) {
//NO-OP
/* attribute values will not be populated if cached policy
* cannot be located.
*/
}
CCButton btn = (CCButton) getChild("tblSubjectsButtonDelete");
btn.setDisabled(true);
btn = (CCButton) getChild("tblResponseProvidersButtonDelete");
btn.setDisabled(true);
btn = (CCButton) getChild("tblConditionsButtonDelete");
btn.setDisabled(true);
PolicyModel model = (PolicyModel) getModel();
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
QueryResults subjectsQuery = model.getActiveSubjectTypes(realm);
Map subjects = (Map) subjectsQuery.getResults();
if ((subjects == null) || subjects.isEmpty()) {
((CCButton) getChild("tblSubjectsButtonAdd")).setDisabled(true);
setDisplayFieldValue("tblSubjectsNote", model.getLocalizedString("policy.no.subject.types"));
} else {
setDisplayFieldValue("tblSubjectsNote", "");
}
Map conditions = model.getActiveConditionTypes(realm);
if ((conditions == null) || conditions.isEmpty()) {
((CCButton) getChild("tblConditionsButtonAdd")).setDisabled(true);
setDisplayFieldValue("tblConditionsNote", model.getLocalizedString("policy.no.condition.types"));
} else {
setDisplayFieldValue("tblConditionsNote", "");
}
Map responseProviders = model.getActiveResponseProviderTypes(realm);
if ((responseProviders == null) || responseProviders.isEmpty()) {
((CCButton) getChild("tblResponseProvidersButtonAdd")).setDisabled(true);
setDisplayFieldValue("tblResponseProvidersNote", model.getLocalizedString("policy.no.response.providers.types"));
} else {
setDisplayFieldValue("tblResponseProvidersNote", "");
}
}
use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
try {
populateRulesTable();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
CCButton btn = (CCButton) getChild("tblRulesButtonAdd");
if (!model.canCreateRule(policy, realmName)) {
btn.setDisabled(true);
}
btn = (CCButton) getChild("tblRulesButtonDelete");
btn.setDisabled(true);
Map serviceTypes = model.getServiceTypeNames();
if ((serviceTypes == null) || serviceTypes.isEmpty()) {
((CCButton) getChild("tblRulesButtonDelete")).setDisabled(true);
setDisplayFieldValue("tblRulesNote", model.getLocalizedString("policy.no.service.types"));
} else {
setDisplayFieldValue("tblRulesNote", "");
}
if (!isInlineAlertMessageSet() && cachedPolicy.isPolicyModified() && isProfilePage()) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.unsaved.message");
}
} catch (AMConsoleException e) {
CCButton btn = (CCButton) getChild("tblRulesButtonAdd");
btn.setDisabled(true);
btn = (CCButton) getChild("tblRulesButtonDelete");
btn.setDisabled(true);
}
}
use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.
the class ServicesViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
resetButtonState(TBL_BUTTON_DELETE);
getServiceNames();
setPageTitle(getModel(), "page.title.realms.services");
ServicesModel model = (ServicesModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
if (model.getAssignableServiceNames(curRealm).isEmpty()) {
CCButton btnAdd = (CCButton) getChild(TBL_BUTTON_ADD);
btnAdd.setDisabled(true);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "services.noservices.for.assignment.message");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
CCButton btnAdd = (CCButton) getChild(TBL_BUTTON_ADD);
btnAdd.setDisabled(true);
}
}
Aggregations