Search in sources :

Example 6 with CCButton

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);
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel)

Example 7 with CCButton

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", "");
    }
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) QueryResults(com.sun.identity.console.base.model.QueryResults)

Example 8 with CCButton

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);
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) CCButton(com.sun.web.ui.view.html.CCButton) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with CCButton

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);
    }
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) ServicesModel(com.sun.identity.console.realm.model.ServicesModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 10 with CCButton

use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.

the class AuthConfigViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    resetButtonState(REMOVE_ENTRY_BUTTON);
    acModel = (AuthConfigurationModel) getModel();
    // set the page title to include the auth config name
    String title = acModel.getLocalizedString("page.title.auth.config.edit");
    String[] param = { getConfigName() };
    ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
    AuthConfigurationModel model = (AuthConfigurationModel) getModel();
    if (model != null) {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        ps.setAttributeValues(getValues(model), model);
    }
    if (!tablePopulated) {
        populateEntryTable();
    }
    CCButton btnReorder = (CCButton) getChild(REORDER_ENTRY_BUTTON);
    btnReorder.setDisabled(model.getNumberEntries() < 2);
    if (getInstanceNames().isEmpty()) {
        CCButton btnAdd = (CCButton) getChild(ADD_ENTRY_BUTTON);
        btnAdd.setDisabled(true);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.instance.list.empty");
    }
    showInvalidSet();
}
Also used : AuthConfigurationModel(com.sun.identity.console.authentication.model.AuthConfigurationModel) CCButton(com.sun.web.ui.view.html.CCButton) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet)

Aggregations

CCButton (com.sun.web.ui.view.html.CCButton)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)7 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)3 Map (java.util.Map)3 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)2 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)2 HashMap (java.util.HashMap)2 AuthConfigurationModel (com.sun.identity.console.authentication.model.AuthConfigurationModel)1 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1 AMViewConfig (com.sun.identity.console.base.AMViewConfig)1 QueryResults (com.sun.identity.console.base.model.QueryResults)1 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)1 IDRepoModel (com.sun.identity.console.realm.model.IDRepoModel)1 ServicesModel (com.sun.identity.console.realm.model.ServicesModel)1 IdSearchResults (com.sun.identity.idm.IdSearchResults)1 Policy (com.sun.identity.policy.Policy)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1