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