use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.
the class AMPropertySheetModel method createChild.
public View createChild(View parent, String name, AMModel model) {
String tagName = (String) childMap.get(name);
View view = null;
if (tagName != null) {
if (tagName.equals(ORDERED_LIST)) {
CCOrderedListModel m = new CCOrderedListModel();
view = new CCOrderedList((ContainerView) parent, m, name);
m.setAddButtonLabel(model.getLocalizedString("addremove.orderable.list.add.button"));
m.setDeleteButtonLabel(model.getLocalizedString("addremove.orderable.list.delete.button"));
setModel(name, m);
} else if (tagName.equals(UNORDERED_LIST)) {
CCUnOrderedListModel m = new CCUnOrderedListModel();
view = new CCUnOrderedList((ContainerView) parent, m, name);
setModel(name, m);
} else if (tagName.equals(MAP_LIST) || tagName.equals(GLOBAL_MAP_LIST)) {
CCMapListModel m = new CCMapListModel();
view = new CCMapList((ContainerView) parent, m, name);
m.setValueOptionList(mapOptionList.get(name));
m.setKeyLabel(model.getLocalizedString("maplist.key.label"));
m.setValueLabel(model.getLocalizedString("maplist.value.label"));
m.setMsgInvalidEntry(model.getLocalizedString("maplist.msg.invalid.entry"));
m.setMsgInvalidKey(model.getLocalizedString("maplist.msg.invalid.key"));
m.setMsgInvalidValue(model.getLocalizedString("maplist.msg.invalid.value"));
m.setMsgInvalidNoKey(model.getLocalizedString("maplist.msg.invalid.nokey"));
setModel(name, m);
} else if (tagName.equals(ADDREMOVE_LIST)) {
CCAddRemoveModel m = (CCAddRemoveModel) getModel(name);
if (m == null) {
setModel(name, new CCAddRemoveModel());
}
}
}
if (view == null) {
view = super.createChild(parent, name);
}
if (CCEditableList.class.isInstance(view)) {
CCEditableList editable = (CCEditableList) view;
CCEditableListModel m = (CCEditableListModel) editable.getModel();
m.setAddBtnLabel(model.getLocalizedString("editableList.addButtonLabel"));
m.setRemoveBtnLabel(model.getLocalizedString("editableList.deleteButtonLabel"));
}
children.add(view);
return view;
}
use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.
the class ServerEditViewBeanBase method getAttributeValues.
protected Map<String, String> getAttributeValues() {
Map<String, String> map = new HashMap<String, String>();
for (String uiName : activePropertyNames) {
View view = getChild(uiName);
String value;
if (view instanceof CCEditableList) {
CCEditableList list = (CCEditableList) view;
list.restoreStateData();
// Create a comma delimited String from the items in the OptionList for storage.
value = StringUtils.join(getValues(list.getModel().getOptionList()), ",");
} else {
value = (String) getDisplayFieldValue(uiName);
}
String propertyName = getActualPropertyName(uiName);
if (view instanceof CCCheckBox) {
value = (value.equals("true")) ? ServerPropertyValidator.getTrueValue(propertyName) : ServerPropertyValidator.getFalseValue(propertyName);
}
if (view instanceof CCPassword) {
// encrypt and include in the map of attribute values to save
if (!AMPropertySheetModel.passwordRandom.equals(value)) {
value = AccessController.doPrivileged(new EncodeAction(value));
map.put(propertyName, value);
}
} else {
map.put(propertyName, value);
}
}
return map;
}
use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.
the class AMPropertySheetModel method clear.
public void clear() {
super.clear();
for (Iterator iter = children.iterator(); iter.hasNext(); ) {
View view = (View) iter.next();
if (CCAddRemove.class.isInstance(view)) {
CCAddRemoveModel m = (CCAddRemoveModel) getModel(view.getName());
m.clear();
m.setAvailableOptionList(new OptionList());
m.setSelectedOptionList(new OptionList());
} else if (CCEditableList.class.isInstance(view)) {
CCEditableListModel m = (CCEditableListModel) getModel(view.getName());
m.setOptionList(new OptionList());
((CCEditableList) view).resetStateData();
} else if (CCOrderedList.class.isInstance(view)) {
CCOrderedListModel m = (CCOrderedListModel) getModel(view.getName());
m.setSelectedOptionList(new OptionList());
((CCOrderedList) view).resetStateData();
} else if (CCUnOrderedList.class.isInstance(view)) {
CCUnOrderedListModel m = (CCUnOrderedListModel) getModel(view.getName());
m.setOptionList(new OptionList());
((CCUnOrderedList) view).resetStateData();
} else if (CCMapList.class.isInstance(view)) {
CCMapListModel m = (CCMapListModel) getModel(view.getName());
m.setOptionList(new OptionList());
((CCMapList) view).resetStateData();
} else {
if (DisplayFieldImpl.class.isInstance(view)) {
((DisplayFieldImpl) view).setValues(null);
}
}
}
}
use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.
the class ConditionOpViewBeanBase method getConditionValues.
protected Map getConditionValues(PolicyModel model, String realmName, String conditionType) {
List propertyNames = model.getConditionPropertyNames(realmName, conditionType);
Map values = new HashMap(propertyNames.size() * 2);
for (Iterator iter = propertyNames.iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
View child = getChild(name);
if (child instanceof CCEditableList) {
CCEditableList list = (CCEditableList) child;
list.restoreStateData();
CCEditableListModel m = (CCEditableListModel) list.getModel();
Set selected = getValues(m.getOptionList());
if ((selected != null) && !selected.isEmpty()) {
values.put(name, selected);
}
} else {
Object[] array = propertySheetModel.getValues(name);
if ((array != null) && (array.length > 0)) {
if (array.length == 1) {
String v = array[0].toString();
if ((v != null) && (v.trim().length() > 0)) {
Set val = new HashSet(2);
val.add(v.trim());
values.put(name, val);
}
} else {
values.put(name, AMAdminUtils.toSet(array));
}
}
}
}
return values;
}
use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.
the class SMDiscoveryBootstrapRefOffViewBeanBase method getValues.
protected SMDiscoEntryData getValues(boolean validated) throws AMConsoleException {
SMDiscoEntryData smDisco = new SMDiscoEntryData();
smDisco.abstractValue = ((String) propertySheetModel.getValue(ATTR_ABSTRACT)).trim();
smDisco.serviceType = ((String) propertySheetModel.getValue(ATTR_SERVICE_TYPE)).trim();
smDisco.providerId = ((String) propertySheetModel.getValue(ATTR_PROVIDER_ID)).trim();
String optionFlag = (String) propertySheetModel.getValue(ATTR_RESOURCE_OFFERING_OPTIONS_OPTIONS);
smDisco.noOption = optionFlag.equalsIgnoreCase("true");
CCEditableList eList = (CCEditableList) getChild(ATTR_RESOURCE_OFFERING_OPTIONS_LIST);
eList.restoreStateData();
CCEditableListModel eModel = (CCEditableListModel) eList.getModel();
OptionList options = eModel.getOptionList();
if (options != null) {
smDisco.options = AMAdminUtils.toList(options);
}
List descData = (List) removePageSessionAttribute(ATTR_SECURITY_MECH_ID);
if (descData != null) {
smDisco.descData = descData;
}
smDisco.directives = getDirectiveMechIDMapping();
if (validated) {
if ((descData == null) || descData.isEmpty()) {
throw new AMConsoleException("discovery.service.bootstrapResOff.missing.service.desc.message");
} else if (smDisco.serviceType.length() == 0) {
throw new AMConsoleException("discovery.service.bootstrapResOff.missing.serviceType.message");
} else if (smDisco.providerId.length() == 0) {
throw new AMConsoleException("discovery.service.bootstrapResOff.missing.providerId.message");
}
}
return smDisco;
}
Aggregations