Search in sources :

Example 51 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class SCServiceProfileViewBean method populateTableModel.

private void populateTableModel(List<SMSubConfig> subconfig) {
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();
    if (subconfig != null) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        List<SMSubConfig> cache = new ArrayList<>(subconfig.size());
        if (!subconfig.isEmpty()) {
            tblModel.clearAll();
            boolean firstEntry = true;
            for (SMSubConfig conf : subconfig) {
                if (conf.isHidden()) {
                    continue;
                }
                if (firstEntry) {
                    firstEntry = false;
                } else {
                    tblModel.appendRow();
                }
                tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_NAME, conf.getLocalizedName() == null ? conf.getName() : conf.getLocalizedName());
                tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME, conf.getName());
                tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
                cache.add(conf);
            }
        }
        szCache.setValue(cache);
    }
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) ArrayList(java.util.ArrayList) CCActionTable(com.sun.web.ui.view.table.CCActionTable)

Example 52 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class ServerSiteViewBean method handleTblSiteButtonDeleteRequest.

/**
     * Deletes site.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblSiteButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SITES);
    table.restoreStateData();
    Integer[] selected = tblSiteModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE_1);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        String name = (String) list.get(selected[i].intValue());
        names.add(name);
    }
    try {
        ServerSiteModel model = (ServerSiteModel) getModel();
        model.deleteSites(names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "siteconfig.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "siteconfig.message.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 53 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class ServerSiteViewBean method createChild.

protected View createChild(String name) {
    View view = null;
    if (name.equals(TBL_SERVERS)) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE_SERVER);
        populateServerTableModel((Map) szCache.getSerializedObj());
        view = new CCActionTable(this, tblServerModel, name);
    } else if (name.equals(TBL_SITES)) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE_SITE);
        populateSiteTableModel((Map) szCache.getSerializedObj());
        view = new CCActionTable(this, tblSiteModel, name);
    } else if (name.equals(PAGETITLE)) {
        view = new CCPageTitle(this, ptModel, name);
    } else if (tblSiteModel.isChildSupported(name)) {
        view = tblSiteModel.createChild(this, name);
    } else if (tblServerModel.isChildSupported(name)) {
        view = tblServerModel.createChild(this, name);
    } else {
        view = super.createChild(name);
    }
    return view;
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) CCActionTable(com.sun.web.ui.view.table.CCActionTable) View(com.iplanet.jato.view.View) HashMap(java.util.HashMap) Map(java.util.Map) CCPageTitle(com.sun.web.ui.view.pagetitle.CCPageTitle)

Example 54 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class SubConfigEditViewBean method handleTblSubConfigButtonDeleteRequest.

/**
     * Deletes sub configuration.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        SMSubConfig sc = (SMSubConfig) list.get(selected[i].intValue());
        names.add(sc.getName());
    }
    try {
        SubConfigModel model = (SubConfigModel) getModel();
        model.deleteSubConfigurations(names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    submitCycle = false;
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 55 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class UMUserPasswordResetOptionsViewBean method populateTableModelEx.

private void populateTableModelEx() {
    if (!tblModelPopulated) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        List data = (List) szCache.getSerializedObj();
        if (data != null) {
            populateTableModel(data);
            tblModelPopulated = true;
        }
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) List(java.util.List)

Aggregations

SerializedField (com.sun.identity.console.components.view.html.SerializedField)57 ArrayList (java.util.ArrayList)33 List (java.util.List)31 CCActionTable (com.sun.web.ui.view.table.CCActionTable)28 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)19 Iterator (java.util.Iterator)19 HashSet (java.util.HashSet)17 Set (java.util.Set)17 Map (java.util.Map)15 HashMap (java.util.HashMap)14 View (com.iplanet.jato.view.View)10 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)9 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)9 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)8 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)6 ServerSiteModel (com.sun.identity.console.service.model.ServerSiteModel)6 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)5 IdRepoException (com.sun.identity.idm.IdRepoException)4 SSOToken (com.iplanet.sso.SSOToken)3 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)3