Added a PrintListener to the SingleSelect for the default category system of the new ContentSection in the ContentSectionCreateForm. Before this change new Term Domains were not shown until CCM was restarted.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2685 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
440bbe4d90
commit
6cf2fb1d57
|
|
@ -27,22 +27,25 @@ import com.arsdigita.bebop.SaveCancelSection;
|
|||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
/**
|
||||
* Form for creating a new ContentSection. Used by the {@link ContentSectionAppManager}.
|
||||
*
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
|
@ -65,17 +68,32 @@ public class ContentSectionCreateForm extends Form {
|
|||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.ui.section.new_section_root_category")));
|
||||
final SingleSelect rootCategorySelect = new SingleSelect(NEW_SECTION_ROOT_CAT);
|
||||
final DataCollection categories = SessionManager.getSession().retrieve(
|
||||
Category.BASE_DATA_OBJECT_TYPE);
|
||||
rootCategorySelect.addOption(new Option(""));
|
||||
Category current;
|
||||
while (categories.next()) {
|
||||
current = (Category) DomainObjectFactory.newInstance(categories.getDataObject());
|
||||
if (current.isRoot()) {
|
||||
rootCategorySelect.addOption(new Option(current.getID().toString(),
|
||||
|
||||
try {
|
||||
rootCategorySelect.addPrintListener(new PrintListener() {
|
||||
|
||||
@Override
|
||||
public void prepare(final PrintEvent event) {
|
||||
final SingleSelect target = (SingleSelect) event.getTarget();
|
||||
|
||||
final DataCollection categories = SessionManager.getSession().retrieve(
|
||||
Category.BASE_DATA_OBJECT_TYPE);
|
||||
Category current;
|
||||
while (categories.next()) {
|
||||
current = (Category) DomainObjectFactory.newInstance(categories.
|
||||
getDataObject());
|
||||
if (current.isRoot()) {
|
||||
target.addOption(new Option(current.getID().toString(),
|
||||
current.getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (TooManyListenersException ex) {
|
||||
throw new UncheckedWrapperException("Something has gone terribly wrong.", ex);
|
||||
}
|
||||
|
||||
rootCategorySelect.addValidationListener(new NotNullValidationListener());
|
||||
rootCategorySelect.addValidationListener(new NotEmptyValidationListener());
|
||||
add(rootCategorySelect);
|
||||
|
|
|
|||
Loading…
Reference in New Issue