Search in sources :

Example 31 with SerializedField

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

the class AbstractAuditViewBean method createChild.

@Override
protected View createChild(String name) {
    if (!populatedSubConfigTable && name.equals(TBL_SUB_CONFIG)) {
        populatedSubConfigTable = true;
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        populateTableModel(szCache.<List<SMSubConfig>>getSerializedObj());
    }
    return super.createChild(name);
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig)

Example 32 with SerializedField

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

the class AbstractAuditViewBean method populateTableModel.

private void populateTableModel(List<SMSubConfig> subConfigs) {
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();
    if (CollectionUtils.isEmpty(subConfigs)) {
        return;
    }
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List<SMSubConfig> cache = new ArrayList<>(subConfigs.size());
    boolean firstEntry = true;
    for (SMSubConfig conf : subConfigs) {
        if (firstEntry) {
            firstEntry = false;
        } else {
            tblModel.appendRow();
        }
        tblModel.setValue(TBL_SUB_CONFIG_DATA_NAME, conf.getName());
        tblModel.setValue(TBL_SUB_CONFIG_HREF_NAME, conf.getName());
        tblModel.setValue(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 33 with SerializedField

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

the class EntityServicesViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
    table.restoreStateData();
    Integer[] selected = tblModel.getSelectedRows();
    Set names = new HashSet(selected.length * 2);
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List cache = (List) szCache.getSerializedObj();
    if (selected.length > 0) {
        for (int i = 0; i < selected.length; i++) {
            names.add((String) cache.get(selected[i].intValue()));
        }
        try {
            EntitiesModel model = (EntitiesModel) getModel();
            String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
            model.unassignServices(universalId, names);
            if (selected.length == 1) {
                setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "entities.message.service.unassigned");
            } else {
                setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "entities.message.service.unassigned.pural");
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "entities.message.service.unassigned.non.selected");
    }
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) 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) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 34 with SerializedField

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

the class EntityServicesViewBean method populateTableModel.

private void populateTableModel(Map nameToDisplayNames) {
    tblModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    if ((nameToDisplayNames != null) && !nameToDisplayNames.isEmpty()) {
        Map reverseMap = AMFormatUtils.reverseStringMap(nameToDisplayNames);
        EntitiesModel model = (EntitiesModel) getModel();
        List list = AMFormatUtils.sortKeyInMap(reverseMap, model.getUserLocale());
        List cache = new ArrayList(list.size());
        boolean firstEntry = true;
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblModel.appendRow();
            }
            String displayName = (String) iter.next();
            String name = (String) reverseMap.get(displayName);
            tblModel.setValue(TBL_DATA_NAME_EX, "");
            tblModel.setValue(TBL_DATA_NAME, displayName);
            tblModel.setValue(TBL_DATA_ACTION_HREF, name);
            cache.add(name);
        }
        szCache.setValue((Serializable) cache);
    } else {
        szCache.setValue(null);
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 35 with SerializedField

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

the class ServicesViewBean method createChild.

protected View createChild(String name) {
    View view = null;
    if (name.equals(CHILD_TBL_TILED_VIEW)) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        populateTableModel((Map) szCache.getSerializedObj());
        view = new ServicesTiledView(this, tblModel, name);
    } else if (name.equals(TBL_SEARCH)) {
        ServicesTiledView tView = (ServicesTiledView) getChild(CHILD_TBL_TILED_VIEW);
        CCActionTable child = new CCActionTable(this, tblModel, name);
        child.setTiledView(tView);
        view = child;
    } else if (name.equals(PAGETITLE)) {
        view = new CCPageTitle(this, ptModel, name);
    } else if (tblModel.isChildSupported(name)) {
        view = tblModel.createChild(this, name);
    } else if (ptModel.isChildSupported(name)) {
        view = ptModel.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) CCPageTitle(com.sun.web.ui.view.pagetitle.CCPageTitle)

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