diff --git a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java
index 5048ccb4c..a54f7aa97 100755
--- a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java
+++ b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java
@@ -19,20 +19,13 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Article;
-import com.arsdigita.domain.DomainObject;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
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;
import com.arsdigita.cms.util.GlobalizationUtil;
-import java.text.DateFormat;
-
/**
* Authoring step to edit the simple attributes of the Article content
@@ -41,25 +34,25 @@ import java.text.DateFormat;
* This authoring step replaces
* the com.arsdigita.ui.authoring.PageEdit step for this type.
*/
-public class ArticlePropertiesStep
- extends SimpleEditStep {
+public class ArticlePropertiesStep extends GenericArticlePropertiesStep {
/** The name of the editing sheet added to this step */
public static String EDIT_SHEET_NAME = "edit";
- public ArticlePropertiesStep( ItemSelectionModel itemModel,
- AuthoringKitWizard parent ) {
- super( itemModel, parent );
-
- setDefaultEditKey(EDIT_SHEET_NAME);
+ public ArticlePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
+ super(itemModel, parent);
+ }
+ @Override
+ protected void createEditSheet(ItemSelectionModel itemModel) {
BasicPageForm editSheet;
+ editSheet = new ArticlePropertyForm(itemModel, this);
+ add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
+ }
- editSheet = new ArticlePropertyForm( itemModel, this );
- add( EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel),
- editSheet.getSaveCancelSection().getCancelButton() );
-
- setDisplayComponent( getArticlePropertySheet( itemModel ) );
+ @Override
+ protected void setDisplayComponent(ItemSelectionModel itemModel) {
+ setDisplayComponent(getArticlePropertySheet(itemModel));
}
/**
@@ -70,32 +63,11 @@ public class ArticlePropertiesStep
* @return A component to display the state of the basic properties
* of the release
*/
- public static Component getArticlePropertySheet( ItemSelectionModel
- itemModel ) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
-
- sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.name"), Article.NAME );
- sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.title"), Article.TITLE );
- if (!ContentSection.getConfig().getHideLaunchDate()) {
- sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.launch_date"),
- ContentPage.LAUNCH_DATE,
- new DomainObjectPropertySheet.AttributeFormatter() {
- public String format(DomainObject item,
- String attribute,
- PageState state) {
- ContentPage page = (ContentPage) item;
- if(page.getLaunchDate() != null) {
- return DateFormat.getDateInstance(DateFormat.LONG)
- .format(page.getLaunchDate());
- } else {
- return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
- }
- }
- });
- }
- sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.lead"), Article.LEAD );
+ public static Component getArticlePropertySheet(ItemSelectionModel itemModel) {
+ DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) getGenericArticlePropertySheet(itemModel);
+
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.lead"), Article.LEAD);
return sheet;
}
-
}
diff --git a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java
index be0b70e0b..0ad5597d1 100755
--- a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java
+++ b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java
@@ -18,7 +18,6 @@
*/
package com.arsdigita.cms.contenttypes.ui;
-
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
@@ -34,22 +33,18 @@ import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Article;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.util.GlobalizationUtil;
-
/**
* Form to edit the basic properties of an article. This form can be
* extended to create forms for Article subclasses.
*/
-public class ArticlePropertyForm
- extends BasicPageForm
- implements FormProcessListener, FormInitListener, FormSubmissionListener {
+public class ArticlePropertyForm extends GenericArticlePropertyForm
+ implements FormProcessListener, FormInitListener, FormSubmissionListener {
+
private final static org.apache.log4j.Logger s_log =
- org.apache.log4j.Logger.getLogger(ArticlePropertyForm.class);
-
+ org.apache.log4j.Logger.getLogger(ArticlePropertyForm.class);
private ArticlePropertiesStep m_step;
-
public static final String LEAD = "lead";
/**
@@ -58,8 +53,8 @@ public class ArticlePropertyForm
* @param itemModel The ItemSelectionModel to use to obtain the
* Article to work on
*/
- public ArticlePropertyForm( ItemSelectionModel itemModel ) {
- this( itemModel, null );
+ public ArticlePropertyForm(ItemSelectionModel itemModel) {
+ this(itemModel, null);
}
/**
@@ -69,76 +64,72 @@ public class ArticlePropertyForm
* Article to work on
* @param step The ArticlePropertiesStep which controls this form.
*/
- public ArticlePropertyForm( ItemSelectionModel itemModel, ArticlePropertiesStep step ) {
- super( ID, itemModel );
- m_step = step;
+ public ArticlePropertyForm(ItemSelectionModel itemModel, ArticlePropertiesStep step) {
+ super(itemModel, step);
addSubmissionListener(this);
}
/**
* Adds widgets to the form.
*/
+ @Override
protected void addWidgets() {
super.addWidgets();
- add( new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.lead") ) );
- ParameterModel leadParam
- = new StringParameter( LEAD );
-
+ add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.lead")));
+ ParameterModel leadParam = new StringParameter(LEAD);
+
if (ContentSection.getConfig().mandatoryDescriptions()) {
- leadParam.addParameterListener(
+ leadParam.addParameterListener(
new NotEmptyValidationListener(
- GlobalizationUtil.globalize(
- "cms.contenttypes.ui.description_missing")));
- }
+ GlobalizationUtil.globalize(
+ "cms.contenttypes.ui.description_missing")));
+ }
//leadParam
// .addParameterListener( new NotNullValidationListener() );
- leadParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
- TextArea lead = new TextArea( leadParam );
- lead.setCols( 40 );
- lead.setRows( 5 );
- add( lead );
+ leadParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
+ TextArea lead = new TextArea(leadParam);
+ lead.setCols(40);
+ lead.setRows(5);
+ add(lead);
}
+ @Override
public void validate(FormSectionEvent e) throws FormProcessException {
FormData d = e.getFormData();
}
-
-
-
/** Form initialisation hook. Fills widgets with data. */
- public void init( FormSectionEvent fse ) {
+ @Override
+ public void init(FormSectionEvent fse) {
// Do some initialization hook stuff
FormData data = fse.getFormData();
- Article article
- = (Article) super.initBasicWidgets( fse );
+ Article article = (Article) super.initBasicWidgets(fse);
- data.put( LEAD, article.getLead() );
+ data.put(LEAD, article.getLead());
}
/** Cancels streamlined editing. */
- public void submitted( FormSectionEvent fse ) {
- if (m_step != null &&
- getSaveCancelSection().getCancelButton()
- .isSelected( fse.getPageState())) {
+ @Override
+ public void submitted(FormSectionEvent fse) {
+ if (m_step != null
+ && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
m_step.cancelStreamlinedCreation(fse.getPageState());
}
}
/** Form processing hook. Saves Event object. */
- public void process( FormSectionEvent fse ) {
+ @Override
+ public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();
- Article article
- = (Article) super.processBasicWidgets( fse );
+ Article article = (Article) super.processBasicWidgets(fse);
// save only if save button was pressed
- if( article != null
- && getSaveCancelSection().getSaveButton()
- .isSelected( fse.getPageState() ) ) {
+ if (article != null
+ && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
- article.setLead( (String) data.get( LEAD ) );
+ article.setLead((String) data.get(LEAD));
article.save();
}
if (m_step != null) {
diff --git a/ccm-cms-types-newsitem/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/NewsItem.xml b/ccm-cms-types-newsitem/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/NewsItem.xml
index 3395f584f..30ef7052a 100755
--- a/ccm-cms-types-newsitem/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/NewsItem.xml
+++ b/ccm-cms-types-newsitem/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/NewsItem.xml
@@ -23,13 +23,6 @@
-
-
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertiesStep.java
new file mode 100755
index 000000000..c33f5f410
--- /dev/null
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertiesStep.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.GenericArticle;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
+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;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import java.text.DateFormat;
+
+/**
+ * Authoring step to edit the simple attributes of the GenericArticle content
+ * type (and its subclasses). The attributes edited are 'name', 'title',
+ * 'article date', 'location', and 'article type'.
+ * This authoring step replaces
+ * the com.arsdigita.ui.authoring.PageEdit step for this type.
+ */
+public class GenericArticlePropertiesStep extends SimpleEditStep {
+
+ /** The name of the editing sheet added to this step */
+ public static String EDIT_SHEET_NAME = "edit";
+ DomainObjectPropertySheet get;
+
+ public GenericArticlePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
+ super(itemModel, parent);
+
+ setDefaultEditKey(EDIT_SHEET_NAME);
+ createEditSheet(itemModel);
+
+ setDisplayComponent(itemModel);
+ }
+
+ protected void createEditSheet(ItemSelectionModel itemModel) {
+ BasicPageForm editSheet;
+ editSheet = new GenericArticlePropertyForm(itemModel, this);
+ add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
+ }
+
+ protected void setDisplayComponent(ItemSelectionModel itemModel) {
+ setDisplayComponent(getGenericArticlePropertySheet(itemModel));
+ }
+
+ /**
+ * Returns a component that displays the properties of the
+ * Article specified by the ItemSelectionModel passed in.
+ * @param itemModel The ItemSelectionModel to use
+ * @pre itemModel != null
+ * @return A component to display the state of the basic properties
+ * of the release
+ */
+ public static Component getGenericArticlePropertySheet(ItemSelectionModel itemModel) {
+ DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
+
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), GenericArticle.NAME);
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), GenericArticle.TITLE);
+ if (!ContentSection.getConfig().getHideLaunchDate()) {
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.launch_date"),
+ ContentPage.LAUNCH_DATE,
+ new DomainObjectPropertySheet.AttributeFormatter() {
+
+ public String format(DomainObject item,
+ String attribute,
+ PageState state) {
+ ContentPage page = (ContentPage) item;
+ if (page.getLaunchDate() != null) {
+ return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
+ } else {
+ return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize();
+ }
+ }
+ });
+ }
+ return sheet;
+ }
+}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java
new file mode 100755
index 000000000..85e24b503
--- /dev/null
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.GenericArticle;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+
+/**
+ * Form to edit the basic properties of an article. This form can be
+ * extended to create forms for Article subclasses.
+ */
+public class GenericArticlePropertyForm extends BasicPageForm
+ implements FormProcessListener, FormInitListener, FormSubmissionListener {
+
+ private final static org.apache.log4j.Logger s_log =
+ org.apache.log4j.Logger.getLogger(GenericArticlePropertyForm.class);
+ private GenericArticlePropertiesStep m_step;
+
+ /**
+ * Creates a new form to edit the Article object specified
+ * by the item selection model passed in.
+ * @param itemModel The ItemSelectionModel to use to obtain the
+ * Article to work on
+ */
+ public GenericArticlePropertyForm(ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ /**
+ * Creates a new form to edit the GenericArticle object specified
+ * by the item selection model passed in.
+ * @param itemModel The ItemSelectionModel to use to obtain the
+ * GenericArticle to work on
+ * @param step The GenericArticlePropertiesStep which controls this form.
+ */
+ public GenericArticlePropertyForm(ItemSelectionModel itemModel, GenericArticlePropertiesStep step) {
+ super(ID, itemModel);
+ m_step = step;
+ addSubmissionListener(this);
+ }
+
+ /**
+ * Adds widgets to the form.
+ */
+ @Override
+ protected void addWidgets() {
+ super.addWidgets();
+ }
+
+ @Override
+ public void validate(FormSectionEvent e) throws FormProcessException {
+ FormData d = e.getFormData();
+ }
+
+ /** Form initialisation hook. Fills widgets with data. */
+ public void init(FormSectionEvent fse) {
+ // Do some initialization hook stuff
+ FormData data = fse.getFormData();
+ GenericArticle article = (GenericArticle) super.initBasicWidgets(fse);
+ }
+
+ /** Cancels streamlined editing. */
+ public void submitted(FormSectionEvent fse) {
+ if (m_step != null
+ && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
+ m_step.cancelStreamlinedCreation(fse.getPageState());
+ }
+ }
+
+ /** Form processing hook. Saves Event object. */
+ public void process(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+
+ GenericArticle article = (GenericArticle) super.processBasicWidgets(fse);
+
+ // save only if save button was pressed
+ if (article != null
+ && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
+
+ article.save();
+ }
+ if (m_step != null) {
+ m_step.maybeForwardToNextStep(fse.getPageState());
+ }
+ }
+}