Fixed a bug in the GenericOrganizationalUnitAddForm class. The wrong variable was used in one PrintListener causing an "Widget is locked exception".

git-svn-id: https://svn.libreccm.org/ccm/trunk@2933 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-10-31 07:27:58 +00:00
parent 63725fbf56
commit f2877c74c9
1 changed files with 40 additions and 40 deletions

View File

@ -58,13 +58,13 @@ import org.apache.log4j.Logger;
* @version $Id$ * @version $Id$
*/ */
public class GenericOrganizationalUnitPersonAddForm public class GenericOrganizationalUnitPersonAddForm
extends BasicItemForm extends BasicItemForm
implements FormProcessListener, implements FormProcessListener,
FormInitListener, FormInitListener,
FormSubmissionListener { FormSubmissionListener {
private static final Logger logger = Logger.getLogger( private static final Logger logger = Logger.getLogger(
GenericOrganizationalUnitPersonAddForm.class); GenericOrganizationalUnitPersonAddForm.class);
private GenericOrganizationalUnitPersonPropertiesStep m_step; private GenericOrganizationalUnitPersonPropertiesStep m_step;
private ItemSearchWidget m_itemSearch; private ItemSearchWidget m_itemSearch;
private final String ITEM_SEARCH = "orgaunitPerson"; private final String ITEM_SEARCH = "orgaunitPerson";
@ -87,7 +87,7 @@ public class GenericOrganizationalUnitPersonAddForm
/*m_itemSearch.getItemField().addValidationListener( /*m_itemSearch.getItemField().addValidationListener(
new NotNullValidationListener());*/ new NotNullValidationListener());*/
m_itemSearch.setLabel(ContenttypesGlobalizationUtil.globalize( m_itemSearch.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_person")); "cms.contenttypes.ui.genericorgaunit.select_person"));
m_itemSearch.setDisableCreatePane(false); m_itemSearch.setDisableCreatePane(false);
add(this.m_itemSearch); add(this.m_itemSearch);
@ -95,10 +95,10 @@ public class GenericOrganizationalUnitPersonAddForm
add(selectedPersonNameLabel); add(selectedPersonNameLabel);
ParameterModel roleParam = new StringParameter( ParameterModel roleParam = new StringParameter(
GenericOrganizationalUnitPersonCollection.PERSON_ROLE); GenericOrganizationalUnitPersonCollection.PERSON_ROLE);
SingleSelect roleSelect = new SingleSelect(roleParam); SingleSelect roleSelect = new SingleSelect(roleParam);
roleSelect.setLabel(ContenttypesGlobalizationUtil.globalize( roleSelect.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.person.role")); "cms.contenttypes.ui.genericorgaunit.person.role"));
roleSelect.addValidationListener(new NotNullValidationListener()); roleSelect.addValidationListener(new NotNullValidationListener());
try { try {
@ -110,23 +110,23 @@ public class GenericOrganizationalUnitPersonAddForm
target.clearOptions(); target.clearOptions();
target.addOption( target.addOption(
new Option("", new Option("",
new Label(ContenttypesGlobalizationUtil new Label(ContenttypesGlobalizationUtil
.globalize("cms.ui.select_one")))); .globalize("cms.ui.select_one"))));
final RelationAttributeCollection roles = new RelationAttributeCollection( final RelationAttributeCollection roles = new RelationAttributeCollection(
getRoleAttributeName()); getRoleAttributeName());
roles.addLanguageFilter(Kernel.getConfig().getDefaultLanguage()); roles.addLanguageFilter(Kernel.getConfig().getDefaultLanguage());
while (roles.next()) { while (roles.next()) {
RelationAttribute role; RelationAttribute role;
role = roles.getRelationAttribute(); role = roles.getRelationAttribute();
//target.addOption(new Option(role.getKey(), role.getName())); //target.addOption(new Option(role.getKey(), role.getName()));
target.addOption(new Option( target.addOption(new Option(
role.getKey(), role.getKey(),
new Label(new GlobalizedMessage( new Label(new GlobalizedMessage(
role.getKey(), role.getKey(),
getRoleAttributeName(), getRoleAttributeName(),
new RelationAttributeResourceBundleControl())))); new RelationAttributeResourceBundleControl()))));
} }
} }
@ -137,10 +137,10 @@ public class GenericOrganizationalUnitPersonAddForm
add(roleSelect); add(roleSelect);
final ParameterModel statusModel = new StringParameter( final ParameterModel statusModel = new StringParameter(
GenericOrganizationalUnitPersonCollection.STATUS); GenericOrganizationalUnitPersonCollection.STATUS);
final SingleSelect statusSelect = new SingleSelect(statusModel); final SingleSelect statusSelect = new SingleSelect(statusModel);
statusSelect.setLabel(ContenttypesGlobalizationUtil.globalize( statusSelect.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.person.status")); "cms.contenttypes.ui.genericorgaunit.person.status"));
statusSelect.addValidationListener(new NotNullValidationListener()); statusSelect.addValidationListener(new NotNullValidationListener());
try { try {
statusSelect.addPrintListener(new PrintListener() { statusSelect.addPrintListener(new PrintListener() {
@ -150,23 +150,23 @@ public class GenericOrganizationalUnitPersonAddForm
final SingleSelect target = (SingleSelect) event.getTarget(); final SingleSelect target = (SingleSelect) event.getTarget();
target.clearOptions(); target.clearOptions();
statusSelect.addOption(new Option("", target.addOption(new Option("",
new Label(ContenttypesGlobalizationUtil. new Label(ContenttypesGlobalizationUtil.
globalize("cms.ui.select_one")))); globalize("cms.ui.select_one"))));
RelationAttributeCollection statusColl = new RelationAttributeCollection( RelationAttributeCollection statusColl = new RelationAttributeCollection(
getStatusAttributeName()); getStatusAttributeName());
statusColl.addLanguageFilter(Kernel.getConfig().getDefaultLanguage()); statusColl.addLanguageFilter(Kernel.getConfig().getDefaultLanguage());
while (statusColl.next()) { while (statusColl.next()) {
RelationAttribute status; RelationAttribute status;
status = statusColl.getRelationAttribute(); status = statusColl.getRelationAttribute();
//target.addOption(new Option(status.getKey(), status.getName())); //target.addOption(new Option(status.getKey(), status.getName()));
target.addOption(new Option( target.addOption(new Option(
status.getKey(), status.getKey(),
new Label(new GlobalizedMessage( new Label(new GlobalizedMessage(
status.getKey(), status.getKey(),
getStatusAttributeName(), getStatusAttributeName(),
new RelationAttributeResourceBundleControl())))); new RelationAttributeResourceBundleControl()))));
} }
} }
@ -214,7 +214,7 @@ public class GenericOrganizationalUnitPersonAddForm
FormData data = fse.getFormData(); FormData data = fse.getFormData();
PageState state = fse.getPageState(); PageState state = fse.getPageState();
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel(). GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel().
getSelectedObject(state); getSelectedObject(state);
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) { if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
@ -228,9 +228,9 @@ public class GenericOrganizationalUnitPersonAddForm
orga.addPerson(personToAdd, orga.addPerson(personToAdd,
(String) data.get( (String) data.get(
GenericOrganizationalUnitPersonCollection.PERSON_ROLE), GenericOrganizationalUnitPersonCollection.PERSON_ROLE),
(String) data.get( (String) data.get(
GenericOrganizationalUnitPersonCollection.STATUS)); GenericOrganizationalUnitPersonCollection.STATUS));
m_itemSearch.publishCreatedItem(data, personToAdd); m_itemSearch.publishCreatedItem(data, personToAdd);
} else { } else {
GenericOrganizationalUnitPersonCollection persons; GenericOrganizationalUnitPersonCollection persons;
@ -244,9 +244,9 @@ public class GenericOrganizationalUnitPersonAddForm
} }
persons.setRoleName((String) data.get( persons.setRoleName((String) data.get(
GenericOrganizationalUnitPersonCollection.PERSON_ROLE)); GenericOrganizationalUnitPersonCollection.PERSON_ROLE));
persons.setStatus((String) data.get( persons.setStatus((String) data.get(
GenericOrganizationalUnitPersonCollection.STATUS)); GenericOrganizationalUnitPersonCollection.STATUS));
selector.setSelectedPerson(null); selector.setSelectedPerson(null);
selector.setSelectedPersonRole(null); selector.setSelectedPersonRole(null);
@ -261,7 +261,7 @@ public class GenericOrganizationalUnitPersonAddForm
public void submitted(FormSectionEvent fse) throws FormProcessException { public void submitted(FormSectionEvent fse) throws FormProcessException {
if (this.getSaveCancelSection().getCancelButton().isSelected( if (this.getSaveCancelSection().getCancelButton().isSelected(
fse.getPageState())) { fse.getPageState())) {
selector.setSelectedPerson(null); selector.setSelectedPerson(null);
selector.setSelectedPersonRole(null); selector.setSelectedPersonRole(null);
selector.setSelectedPersonStatus(null); selector.setSelectedPersonStatus(null);
@ -276,16 +276,16 @@ public class GenericOrganizationalUnitPersonAddForm
final FormData data = fse.getFormData(); final FormData data = fse.getFormData();
if ((selector.getSelectedPerson() == null) if ((selector.getSelectedPerson() == null)
&& (data.get(ITEM_SEARCH) == null)) { && (data.get(ITEM_SEARCH) == null)) {
data.addError( data.addError(
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.person.no_person_selected")); "cms.contenttypes.ui.genericorgaunit.person.no_person_selected"));
return; return;
} }
if (selector.getSelectedPerson() == null) { if (selector.getSelectedPerson() == null) {
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel(). GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel().
getSelectedObject(state); getSelectedObject(state);
GenericPerson person = (GenericPerson) data.get(ITEM_SEARCH); GenericPerson person = (GenericPerson) data.get(ITEM_SEARCH);
@ -312,8 +312,8 @@ public class GenericOrganizationalUnitPersonAddForm
person.getID().toString()));*/ person.getID().toString()));*/
if (persons.size() > 0) { if (persons.size() > 0) {
data.addError( data.addError(
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.person.already_added")); "cms.contenttypes.ui.genericorgaunit.person.already_added"));
} }
persons.close(); persons.close();