UI fuer Publikationen mit Verlag (nur fuer Backup, ist noch nicht getestet).
git-svn-id: https://svn.libreccm.org/ccm/trunk@513 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
80791e4adf
commit
0b27623c5c
|
|
@ -5,7 +5,10 @@ import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SaveCancelSection;
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
import com.arsdigita.bebop.form.Option;
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.form.RadioGroup;
|
import com.arsdigita.bebop.form.RadioGroup;
|
||||||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||||
|
|
@ -24,13 +27,16 @@ import org.apache.log4j.Logger;
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class PublicationAuthorAddForm extends BasicItemForm {
|
public class PublicationAuthorAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(
|
private static final Logger s_log = Logger.getLogger(
|
||||||
PublicationAuthorAddForm.class);
|
PublicationAuthorAddForm.class);
|
||||||
private PublicationPropertiesStep m_step;
|
private PublicationPropertiesStep m_step;
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private SaveCancelSection m_saveCancelSection;
|
//private SaveCancelSection m_saveCancelSection;
|
||||||
private final String ITEM_SEARCH = "authors";
|
private final String ITEM_SEARCH = "authors";
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,10 @@ public class PublicationPropertiesStep extends SimpleEditStep {
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SegementedPanel getSegmentedPanel() {
|
||||||
|
return segmentedPanel;
|
||||||
|
}
|
||||||
|
|
||||||
protected void addBasicProperties(ItemSelectionModel itemModel,
|
protected void addBasicProperties(ItemSelectionModel itemModel,
|
||||||
AuthoringKitWizard parent) {
|
AuthoringKitWizard parent) {
|
||||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationWithPublisherPropertiesStep
|
||||||
|
extends PublicationPropertiesStep {
|
||||||
|
|
||||||
|
public PublicationWithPublisherPropertiesStep(
|
||||||
|
ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent) {
|
||||||
|
super(itemModel, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addBasicProperties(
|
||||||
|
ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent) {
|
||||||
|
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
||||||
|
parent,
|
||||||
|
EDIT_SHEET_NAME);
|
||||||
|
|
||||||
|
BasicPageForm editBasicSheet =
|
||||||
|
new PublicationWithPublisherPropertyForm(itemModel, this);
|
||||||
|
|
||||||
|
basicProperties.add(EDIT_SHEET_NAME, (String) PublicationGlobalizationUtil.
|
||||||
|
globalize("publications.ui.publication.edit_basic_sheet").
|
||||||
|
localize(), new WorkflowLockedComponentAccess(editBasicSheet,
|
||||||
|
itemModel),
|
||||||
|
editBasicSheet.
|
||||||
|
getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
basicProperties.setDisplayComponent(getPublicationPropertySheet(
|
||||||
|
itemModel));
|
||||||
|
|
||||||
|
getSegmentedPanel().addSegment(
|
||||||
|
new Label((String) PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.publication.basic_properties").
|
||||||
|
localize()), basicProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publisher;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationWithPublisherPropertyForm
|
||||||
|
extends PublicationPropertyForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener,
|
||||||
|
FormSubmissionListener {
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(
|
||||||
|
PublicationWithPublisherPropertyForm.class);
|
||||||
|
private PublicationWithPublisherPropertiesStep m_step;
|
||||||
|
private ItemSearchWidget m_itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "publisher";
|
||||||
|
public static final String ID = "PublicationWithPublisherEdit";
|
||||||
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
|
public PublicationWithPublisherPropertyForm(ItemSelectionModel itemModel) {
|
||||||
|
this(itemModel, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationWithPublisherPropertyForm(
|
||||||
|
ItemSelectionModel itemModel,
|
||||||
|
PublicationWithPublisherPropertiesStep step) {
|
||||||
|
super(itemModel, step);
|
||||||
|
m_step = step;
|
||||||
|
addSubmissionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addWidgets() {
|
||||||
|
super.addWidgets();
|
||||||
|
|
||||||
|
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.with_publisher.publisher").localize()));
|
||||||
|
m_itemSearch =
|
||||||
|
new ItemSearchWidget(
|
||||||
|
ITEM_SEARCH,
|
||||||
|
ContentType.findByAssociatedObjectType(
|
||||||
|
Publisher.class.getName()));
|
||||||
|
add(m_itemSearch);
|
||||||
|
|
||||||
|
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.with_publisher.isbn").localize()));
|
||||||
|
ParameterModel isbnParam = new StringParameter(
|
||||||
|
PublicationWithPublisher.ISBN);
|
||||||
|
TextField isbn = new TextField(isbnParam);
|
||||||
|
add(isbn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||||
|
super.init(fse);
|
||||||
|
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PublicationWithPublisher publication =
|
||||||
|
(PublicationWithPublisher) super.
|
||||||
|
initBasicWidgets(fse);
|
||||||
|
|
||||||
|
data.put(ITEM_SEARCH,
|
||||||
|
publication.getPublisher());
|
||||||
|
data.put(PublicationWithPublisher.ISBN, publication.getISBN());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||||
|
super.process(fse);
|
||||||
|
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PublicationWithPublisher publication =
|
||||||
|
(PublicationWithPublisher) super.
|
||||||
|
processBasicWidgets(fse);
|
||||||
|
|
||||||
|
if ((publication != null) && getSaveCancelSection().getSaveButton().
|
||||||
|
isSelected(fse.getPageState())) {
|
||||||
|
publication.setPublisher((Publisher) data.get(ITEM_SEARCH));
|
||||||
|
publication.setISBN((String) data.get(PublicationWithPublisher.ISBN));
|
||||||
|
|
||||||
|
publication.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_step != null) {
|
||||||
|
m_step.maybeForwardToNextStep(fse.getPageState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue