use of com.sun.web.ui.model.CCAddRemoveModel 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.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class ResponseProviderOpViewBeanBase method createPropertyModel.
private boolean createPropertyModel() {
boolean init = false;
HttpServletRequest req = RequestManager.getRequestContext().getRequest();
String pType = (String) getPageSessionAttribute(PG_SESSION_PROVIDER_TYPE);
if ((pType == null) || (pType.trim().length() == 0)) {
pType = req.getParameter(getName() + "." + RESPONSEPROVIDER_TYPE);
if ((pType != null) && (pType.trim().length() > 0)) {
setPageSessionAttribute(PG_SESSION_PROVIDER_TYPE, pType);
}
}
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if ((curRealm == null) || (curRealm.trim().length() == 0)) {
curRealm = req.getParameter(getName() + "." + REALM_NAME);
if ((curRealm != null) && (curRealm.trim().length() > 0)) {
setPageSessionAttribute(AMAdminConstants.CURRENT_REALM, curRealm);
}
}
init = (curRealm != null) && (curRealm.trim().length() > 0) && (pType != null) && (pType.trim().length() > 0);
DelegationConfig dConfig = DelegationConfig.getInstance();
canModify = dConfig.hasPermission(curRealm, null, AMAdminConstants.PERMISSION_MODIFY, getModel(), getClass().getName());
if (init) {
propertySheetModel = new AMPropertySheetModel(getResponseProviderXML(curRealm, pType, !canModify));
propertySheetModel.clear();
if (canModify) {
addRemoveModel = new CCAddRemoveModel();
addRemoveModel.setShowMoveUpDownButtons("false");
addRemoveModel.clear();
propertySheetModel.setModel(VALUES_MULTIPLE_CHOICE_VALUE, addRemoveModel);
}
}
return init;
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class SAMLv2AffiliateViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
ps.init();
SAMLv2Model model = (SAMLv2Model) getModel();
try {
Map values = getStandardAffiliationValues();
Set allSPEntities = model.getallSPEntities(realm);
Set affiliateMembers = (Set) values.get(model.AFFILIATE_MEMBER);
allSPEntities.removeAll(affiliateMembers);
if (samladdRemoveModel == null) {
samladdRemoveModel = new CCAddRemoveModel();
}
if ((allSPEntities != null) && !allSPEntities.isEmpty()) {
samladdRemoveModel.setAvailableOptionList(createOptionList(allSPEntities));
}
if ((affiliateMembers != null) && !affiliateMembers.isEmpty()) {
samladdRemoveModel.setSelectedOptionList(createOptionList(affiliateMembers));
}
ps.setAttributeValues(values, model);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
ps.setAttributeValues(getExtendedAffiliationValues(), model);
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class SMDiscoveryDescriptionViewBeanBase method getValues.
private SMDescriptionData getValues() throws AMConsoleException {
SMDescriptionData smData = new SMDescriptionData();
smData.descriptionID = (String) getDisplayFieldValue(TF_DESCRIPTION_ID);
if (smData.descriptionID.length() == 0) {
smData.descriptionID = SAMLUtils.generateID();
}
CCAddRemove mechIdChild = (CCAddRemove) getChild(ATTR_NAME_SECURITY_MECH_ID);
mechIdChild.restoreStateData();
CCAddRemoveModel mechIdModel = (CCAddRemoveModel) propertySheetModel.getModel(ATTR_NAME_SECURITY_MECH_ID);
smData.securityMechId = getList(mechIdModel.getSelectedOptionList());
smData.endPointUrl = ((String) propertySheetModel.getValue(ATTR_NAME_SOAP_HTTP_END_POINT)).trim();
smData.soapAction = ((String) propertySheetModel.getValue(ATTR_NAME_SOAP_HTTP_ACTION)).trim();
if (smData.securityMechId.isEmpty()) {
throw new AMConsoleException("discovery.service.description.missing.securityMechId.message");
}
if (smData.endPointUrl.length() == 0) {
throw new AMConsoleException("discovery.service.description.missing.endPointUrl.message");
}
return smData;
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class IDFFAffiliateViewBean method populateValue.
private void populateValue(String name) {
IDFFModel model = (IDFFModel) getModelInternal();
try {
Map values = model.getAffiliateProfileAttributeValues(realm, name);
Set availableEntities = model.getAllEntityDescriptorNames(realm);
Set affliliatEntities = model.getAllAffiliateEntityDescriptorNames(realm);
Set affiliateMembers = model.getAllAffiliateMembers(realm, name);
availableEntities.removeAll(affiliateMembers);
availableEntities.removeAll(affliliatEntities);
if (affiliateMembersModel == null) {
affiliateMembersModel = new CCAddRemoveModel();
}
if ((availableEntities != null) && !availableEntities.isEmpty()) {
affiliateMembersModel.setAvailableOptionList(createOptionList(availableEntities));
}
if ((affiliateMembers != null) && !affiliateMembers.isEmpty()) {
affiliateMembersModel.setSelectedOptionList(createOptionList(affiliateMembers));
}
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTES);
ps.setAttributeValues(values, model);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
Aggregations