ccm-cms-types-bookmark springt jetzt vom PropertiesStep zum nächsten Schritt weiter.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2250 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
cc6b96d27f
commit
416b3cb01d
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
|
@ -32,23 +31,23 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authoring step to edit the simple attributes of the Bookmark content
|
* Authoring step to edit the simple attributes of the Bookmark content type (and its subclasses).
|
||||||
* type (and its subclasses).
|
|
||||||
*/
|
*/
|
||||||
public class BookmarkPropertiesStep extends SimpleEditStep {
|
public class BookmarkPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
/** The name of the editing sheet added to this step */
|
/**
|
||||||
|
* The name of the editing sheet added to this step
|
||||||
|
*/
|
||||||
public static final String EDIT_SHEET_NAME = "edit";
|
public static final String EDIT_SHEET_NAME = "edit";
|
||||||
|
|
||||||
public BookmarkPropertiesStep( ItemSelectionModel itemModel,
|
public BookmarkPropertiesStep(final ItemSelectionModel itemModel,
|
||||||
AuthoringKitWizard parent ) {
|
final AuthoringKitWizard parent) {
|
||||||
super(itemModel, parent);
|
super(itemModel, parent);
|
||||||
|
|
||||||
BasicPageForm editSheet;
|
BasicPageForm editSheet;
|
||||||
|
|
||||||
editSheet = new BookmarkPropertyForm( itemModel );
|
editSheet = new BookmarkPropertyForm(itemModel, this);
|
||||||
add(EDIT_SHEET_NAME,
|
add(EDIT_SHEET_NAME,
|
||||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||||
|
|
@ -59,16 +58,14 @@ public class BookmarkPropertiesStep extends SimpleEditStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a component that displays the properties of the
|
* Returns a component that displays the properties of the Bookmark specified by the ItemSelectionModel passed in.
|
||||||
* Bookmark specified by the ItemSelectionModel passed in.
|
*
|
||||||
* @param itemModel The ItemSelectionModel to use
|
* @param itemModel The ItemSelectionModel to use
|
||||||
* @pre itemModel != null
|
* @pre itemModel != null
|
||||||
* @return A component to display the state of the basic properties
|
* @return A component to display the state of the basic properties of the release
|
||||||
* of the release
|
|
||||||
*/
|
*/
|
||||||
public static Component getBookmarkPropertySheet( ItemSelectionModel
|
public static Component getBookmarkPropertySheet(final ItemSelectionModel itemModel) {
|
||||||
itemModel ) {
|
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
|
|
||||||
|
|
||||||
sheet.add(GlobalizationUtil
|
sheet.add(GlobalizationUtil
|
||||||
.globalize("cms.contenttypes.ui.title"), Bookmark.TITLE);
|
.globalize("cms.contenttypes.ui.title"), Bookmark.TITLE);
|
||||||
|
|
@ -82,15 +79,9 @@ public class BookmarkPropertiesStep extends SimpleEditStep {
|
||||||
}
|
}
|
||||||
sheet.add(GlobalizationUtil
|
sheet.add(GlobalizationUtil
|
||||||
.globalize("cms.contenttypes.ui.summary"), Bookmark.DESCRIPTION);
|
.globalize("cms.contenttypes.ui.summary"), Bookmark.DESCRIPTION);
|
||||||
sheet.add(new GlobalizedMessage
|
sheet.add(new GlobalizedMessage("cms.contenttypes.ui.bookmark.url", Bookmark.RESOURCES),
|
||||||
("cms.contenttypes.ui.bookmark.url",Bookmark.RESOURCES),
|
|
||||||
Bookmark.URL);
|
Bookmark.URL);
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,90 +28,95 @@ import com.arsdigita.bebop.form.TextArea;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.AuthoringStep;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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.BasicPageForm;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to edit BasicPageForm the basic properties of an Bookmark. This form can be extended to create forms for Bookmark
|
||||||
|
* subclasses.
|
||||||
|
*/
|
||||||
|
public class BookmarkPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to edit BasicPageForm the basic properties of an Bookmark. This form can be
|
* parameter names
|
||||||
* extended to create forms for Bookmark subclasses.
|
|
||||||
*/
|
*/
|
||||||
public class BookmarkPropertyForm
|
|
||||||
extends BasicPageForm
|
|
||||||
implements FormProcessListener, FormInitListener {
|
|
||||||
|
|
||||||
/** parameter names */
|
|
||||||
public static final String DESCRIPTION = "description";
|
public static final String DESCRIPTION = "description";
|
||||||
public static final String URL = "url";
|
public static final String URL = "url";
|
||||||
|
/**
|
||||||
/** Name of this form */
|
* Name of this form
|
||||||
|
*/
|
||||||
public static final String ID = "Bookmark_edit";
|
public static final String ID = "Bookmark_edit";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new form to edit the Bookmark object specified
|
* AuthoringKit step managing this form
|
||||||
* by the item selection model passed in.
|
|
||||||
* @param itemModel The ItemSelectionModel to use to obtain the
|
|
||||||
* Bookmark to work on
|
|
||||||
*/
|
*/
|
||||||
public BookmarkPropertyForm( ItemSelectionModel itemModel ) {
|
private final BookmarkPropertiesStep step;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new form to edit the Bookmark object specified by the item selection model passed in.
|
||||||
|
*
|
||||||
|
* @param itemModel The ItemSelectionModel to use to obtain the Bookmark to work on
|
||||||
|
*/
|
||||||
|
public BookmarkPropertyForm(final ItemSelectionModel itemModel, final BookmarkPropertiesStep step) {
|
||||||
super(ID, itemModel);
|
super(ID, itemModel);
|
||||||
|
this.step = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds widgets to the form.
|
* Adds widgets to the form.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
add(new Label(GlobalizationUtil.globalize(
|
add(new Label(GlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.summary")));
|
"cms.contenttypes.ui.summary")));
|
||||||
ParameterModel descriptionParam
|
final ParameterModel descriptionParam = new StringParameter(DESCRIPTION);
|
||||||
= new StringParameter( DESCRIPTION );
|
final TextArea description = new TextArea(descriptionParam);
|
||||||
TextArea description = new TextArea( descriptionParam );
|
|
||||||
description.setCols(40);
|
description.setCols(40);
|
||||||
description.setRows(5);
|
description.setRows(5);
|
||||||
description.setHint(GlobalizationUtil.globalize(
|
description.setHint(GlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.summary_hint"));
|
"cms.contenttypes.ui.summary_hint"));
|
||||||
add(description);
|
add(description);
|
||||||
|
|
||||||
add( new Label( new GlobalizedMessage
|
add(new Label(new GlobalizedMessage("cms.contenttypes.ui.bookmark.url", Bookmark.RESOURCES)));
|
||||||
("cms.contenttypes.ui.bookmark.url",Bookmark.RESOURCES) ) );
|
final ParameterModel urlParam = new StringParameter(URL);
|
||||||
ParameterModel urlParam
|
final TextField url = new TextField(urlParam);
|
||||||
= new StringParameter( URL );
|
|
||||||
TextField url = new TextField( urlParam );
|
|
||||||
url.setSize(40);
|
url.setSize(40);
|
||||||
add(url);
|
add(url);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Form initialisation hook. Fills widgets with data. */
|
/**
|
||||||
public void init( FormSectionEvent fse ) {
|
* Form initialisation hook. Fills widgets with data.
|
||||||
FormData data = fse.getFormData();
|
*/
|
||||||
Bookmark item
|
public void init(final FormSectionEvent fse) {
|
||||||
= (Bookmark) super.initBasicWidgets( fse );
|
final FormData data = fse.getFormData();
|
||||||
|
final Bookmark item = (Bookmark) super.initBasicWidgets(fse);
|
||||||
|
|
||||||
data.put(DESCRIPTION, item.getDescription());
|
data.put(DESCRIPTION, item.getDescription());
|
||||||
data.put(URL, item.getURL());
|
data.put(URL, item.getURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Form processing hook. Saves Bookmark object. */
|
/**
|
||||||
public void process( FormSectionEvent fse ) {
|
* Form processing hook. Saves Bookmark object.
|
||||||
FormData data = fse.getFormData();
|
*/
|
||||||
|
public void process(final FormSectionEvent fse) {
|
||||||
|
final FormData data = fse.getFormData();
|
||||||
|
|
||||||
Bookmark item
|
final Bookmark item = (Bookmark) super.processBasicWidgets(fse);
|
||||||
= (Bookmark) super.processBasicWidgets( fse );
|
|
||||||
|
|
||||||
// save only if save button was pressed
|
// save only if save button was pressed
|
||||||
if (item != null
|
if (item != null
|
||||||
&& getSaveCancelSection().getSaveButton()
|
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
.isSelected( fse.getPageState() ) ) {
|
item.setDescription((String) data.get(DESCRIPTION));
|
||||||
item.setDescription( (String)
|
item.setURL((String) data.get(URL));
|
||||||
data.get( DESCRIPTION ) );
|
|
||||||
item.setURL( (String)
|
|
||||||
data.get( URL ) );
|
|
||||||
item.save();
|
item.save();
|
||||||
|
step.maybeForwardToNextStep(fse.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue