diff --git a/ccm-cms-types-job/src/com/arsdigita/cms/contenttypes/ui/JobPropertyForm.java b/ccm-cms-types-job/src/com/arsdigita/cms/contenttypes/ui/JobPropertyForm.java index ded4d08a8..567b12e69 100755 --- a/ccm-cms-types-job/src/com/arsdigita/cms/contenttypes/ui/JobPropertyForm.java +++ b/ccm-cms-types-job/src/com/arsdigita/cms/contenttypes/ui/JobPropertyForm.java @@ -34,7 +34,6 @@ import com.arsdigita.cms.contenttypes.Job; import com.arsdigita.cms.contenttypes.util.JobGlobalizationUtil; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.CMSDHTMLEditor; -import com.arsdigita.cms.util.GlobalizationUtil; /** @@ -94,77 +93,79 @@ public class JobPropertyForm extends BasicPageForm /** * Adds widgets to the form. **/ + @Override protected void addWidgets() { + super.addWidgets(); // Job content type currently does not use the default - // basic descriuption properties (as persisted in cms-pages and by + // basic description properties (as persisted in cms-pages and by // default part of the object list). Would be convenient to move the // ct specific overview property to basic description. - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.overview"))); ParameterModel bodyParam = new StringParameter(BODY); CMSDHTMLEditor body = new CMSDHTMLEditor(bodyParam); + body.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.overview")); body.setCols(40); body.setRows(10); add(body); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.grade"))); ParameterModel gradeParam = new StringParameter(GRADE); TextField grade = new TextField(gradeParam); + grade.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.grade")); grade.setSize(30); grade.setMaxLength(30); add(grade); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.closing_date"))); ParameterModel closingDateParam = new DateParameter(CLOSING_DATE); com.arsdigita.bebop.form.Date closingDate = new com.arsdigita.bebop.form.Date(closingDateParam ); + closingDate.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.closing_date")); add(closingDate); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.salary"))); ParameterModel salaryParam = new StringParameter(SALARY); CMSDHTMLEditor salary = new CMSDHTMLEditor(salaryParam); + salary.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.salary")); salary.setCols(40); salary.setRows(10); add(salary); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.ref_number"))); ParameterModel refNumberParam = new StringParameter(REF_NUMBER); TextField refNumber = new TextField(refNumberParam); + refNumber.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.ref_number")); refNumber.setSize(30); refNumber.setMaxLength(30); add(refNumber); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.department"))); ParameterModel departmentParam = new StringParameter(DEPARTMENT); TextField department = new TextField(departmentParam); + department.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.department")); department.setSize(30); department.setMaxLength(30); add(department); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.job_description"))); ParameterModel jobDescriptionParam = new StringParameter(JOB_DESCRIPTION); CMSDHTMLEditor jobDescription = new CMSDHTMLEditor(jobDescriptionParam); + jobDescription.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.job_description")); jobDescription.setCols(40); jobDescription.setRows(10); add(jobDescription); - add(new Label(JobGlobalizationUtil - .globalize("cms.contenttypes.ui.job.person_specification"))); ParameterModel personSpecificationParam = new StringParameter(PERSON_SPECIFICATION); CMSDHTMLEditor personSpecification = new CMSDHTMLEditor(personSpecificationParam); + personSpecification.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.person_specification")); personSpecification.setCols(40); personSpecification.setRows(10); add(personSpecification); @@ -174,12 +175,16 @@ public class JobPropertyForm extends BasicPageForm ParameterModel contactDetailsParam = new StringParameter(CONTACT_DETAILS); CMSDHTMLEditor contactDetails = new CMSDHTMLEditor(contactDetailsParam); + contactDetails.setLabel(JobGlobalizationUtil + .globalize("cms.contenttypes.ui.job.contact_details")); contactDetails.setCols(40); contactDetails.setRows(10); add(contactDetails); } - /** Form initialisation hook. Fills widgets with data. */ + /** + * @param fse Form initialisation hook. Fills widgets with data. */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); Job job = (Job) super.initBasicWidgets(fse); @@ -196,7 +201,10 @@ public class JobPropertyForm extends BasicPageForm } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -205,7 +213,10 @@ public class JobPropertyForm extends BasicPageForm } } - /** Form processing hook. Saves Job object. */ + /** + * Form processing hook. Saves Job object. + * @param fse */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/ui/LegalNoticePropertyForm.java b/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/ui/LegalNoticePropertyForm.java index 4d4efc62f..8f1b21232 100755 --- a/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/ui/LegalNoticePropertyForm.java +++ b/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/ui/LegalNoticePropertyForm.java @@ -20,7 +20,6 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.FormData; -import com.arsdigita.bebop.Label; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; @@ -32,7 +31,6 @@ import com.arsdigita.cms.contenttypes.LegalNotice; import com.arsdigita.cms.contenttypes.util.LegalNoticeGlobalizationUtil; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.BasicPageForm; -import com.arsdigita.cms.util.GlobalizationUtil; /** * Form to edit the basic properties of a legal notice. These are name, title, @@ -78,19 +76,24 @@ public class LegalNoticePropertyForm extends BasicPageForm /** * Adds widgets to the form. */ + @Override protected void addWidgets() { super.addWidgets(); - add(new Label(LegalNoticeGlobalizationUtil - .globalize("cms.contenttypes.ui.legal_notice.government_uid"))); ParameterModel governmentUIDParam = new StringParameter(GOVERNMENT_UID); TextField governmentUID = new TextField(governmentUIDParam); + governmentUID.setLabel(LegalNoticeGlobalizationUtil + .globalize("cms.contenttypes.ui.legal_notice.government_uid")); governmentUID.setSize(30); add(governmentUID); } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); LegalNotice notice = (LegalNotice) super.initBasicWidgets(fse); @@ -98,7 +101,11 @@ public class LegalNoticePropertyForm extends BasicPageForm data.put(GOVERNMENT_UID, notice.getGovernmentUID()); } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse + */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -107,7 +114,11 @@ public class LegalNoticePropertyForm extends BasicPageForm } } - /** Form processing hook. Saves LegalNotice object. */ + /** + * Form processing hook. Saves LegalNotice object. + * @param fse + */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java index 1d064cd07..e9a692d74 100644 --- a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java @@ -19,18 +19,12 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.FormData; -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.ItemSelectionModel; import com.arsdigita.cms.contenttypes.Member; -import com.arsdigita.cms.contenttypes.util.MemberGlobalizationUtil; -import com.arsdigita.cms.ui.authoring.BasicPageForm; import org.apache.log4j.Logger; /** diff --git a/ccm-cms-types-minutes/src/com/arsdigita/cms/contenttypes/ui/MinutesPropertyForm.java b/ccm-cms-types-minutes/src/com/arsdigita/cms/contenttypes/ui/MinutesPropertyForm.java index 0874966a4..c30701cd6 100755 --- a/ccm-cms-types-minutes/src/com/arsdigita/cms/contenttypes/ui/MinutesPropertyForm.java +++ b/ccm-cms-types-minutes/src/com/arsdigita/cms/contenttypes/ui/MinutesPropertyForm.java @@ -20,7 +20,6 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.FormData; -import com.arsdigita.bebop.Label; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; @@ -85,50 +84,51 @@ public class MinutesPropertyForm extends BasicPageForm /** * Adds widgets to the form. **/ + @Override protected void addWidgets() { super.addWidgets(); - add(new Label(MinutesGlobalizationUtil - .globalize("cms.contenttypes.ui.minutes.reference"))); ParameterModel minuteNumberParam = new StringParameter(MINUTE_NUMBER); TextArea minuteNumber = new TextArea(minuteNumberParam); + minuteNumber.setLabel(MinutesGlobalizationUtil + .globalize("cms.contenttypes.ui.minutes.reference")); minuteNumber.setCols(40); minuteNumber.setRows(3); minuteNumber.addValidationListener(new StringLengthValidationListener(100)); add(minuteNumber); - add(new Label(GlobalizationUtil - .globalize("cms.contenttypes.ui.description"))); ParameterModel descriptionParam = new StringParameter(DESCRIPTION); TextArea description = new TextArea(descriptionParam); + description.setLabel(GlobalizationUtil + .globalize("cms.contenttypes.ui.description")); description.setCols(40); description.setRows(5); description.addValidationListener(new StringLengthValidationListener(4000)); add(description); - add(new Label(MinutesGlobalizationUtil - .globalize("cms.contenttypes.ui.minutes.action_item"))); ParameterModel actionItemParam = new StringParameter(ACTION_ITEM); TextArea actionItem = new TextArea(actionItemParam); + actionItem.setLabel(MinutesGlobalizationUtil + .globalize("cms.contenttypes.ui.minutes.action_item")); actionItem.setCols(40); actionItem.setRows(3); actionItem.addValidationListener(new StringLengthValidationListener(4000)); add(actionItem); - add(new Label(MinutesGlobalizationUtil - .globalize("cms.contenttypes.ui.minutes.attendees"))); ParameterModel attendeesParam = new StringParameter(ATTENDEES); TextArea attendees = new TextArea(attendeesParam); + attendees.setLabel(MinutesGlobalizationUtil + .globalize("cms.contenttypes.ui.minutes.attendees")); attendees.setCols(40); attendees.setRows(3); attendees.addValidationListener(new StringLengthValidationListener(1000)); add(attendees); - add(new Label(MinutesGlobalizationUtil - .globalize("cms.contenttypes.ui.minutes.description_of"))); ParameterModel descriptionOfMinutesParam = new StringParameter(DESCRIPTION_OF_MINUTES); TextArea descriptionOfMinutes = new TextArea(descriptionOfMinutesParam); + descriptionOfMinutes.setLabel(MinutesGlobalizationUtil + .globalize("cms.contenttypes.ui.minutes.description_of")); descriptionOfMinutes.setCols(40); descriptionOfMinutes.setRows(5); descriptionOfMinutes.addValidationListener(new StringLengthValidationListener(4000)); @@ -136,7 +136,11 @@ public class MinutesPropertyForm extends BasicPageForm } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); Minutes minutes = (Minutes) super.initBasicWidgets(fse); @@ -148,7 +152,11 @@ public class MinutesPropertyForm extends BasicPageForm data.put(MINUTE_NUMBER, minutes.getMinuteNumber()); } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse + */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -157,7 +165,11 @@ public class MinutesPropertyForm extends BasicPageForm } } - /** Form processing hook. Saves Minutes object. */ + /** + * Form processing hook. Saves Minutes object. + * @param fse + */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ArticleSectionPanel.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ArticleSectionPanel.java index c11d9c138..69dcfa59c 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ArticleSectionPanel.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ArticleSectionPanel.java @@ -142,8 +142,7 @@ public class ArticleSectionPanel extends SimpleComponent implements if (item instanceof ContentBundle) { ContentBundle bundle; HttpServletRequest request; - ContentItem resolved = null; - + ContentItem resolved; bundle = (ContentBundle) item; resolved = bundle.getInstance(GlobalizationHelper @@ -160,7 +159,7 @@ public class ArticleSectionPanel extends SimpleComponent implements protected ArticleSection[] getSections(ContentItem item, final PageState state) { - PageNumber number = null; + PageNumber number; try { number = (PageNumber) state.getValue(m_page); } catch (IllegalArgumentException e) { @@ -309,11 +308,8 @@ public class ArticleSectionPanel extends SimpleComponent implements XMLGenerator xmlGenerator = getXMLGenerator(state, item); ArticleSection sections[] = getSections(item, state); - for (int i = 0; i < sections.length; i++) { - generateSectionXML(state, - content, - sections[i], - xmlGenerator); + for (ArticleSection section : sections) { + generateSectionXML(state, content, section, xmlGenerator); } } @@ -323,6 +319,7 @@ public class ArticleSectionPanel extends SimpleComponent implements final XMLGenerator xmlGenerator) { CMSExcursion excursion = new CMSExcursion() { + @Override public void excurse() { setContentItem(section); xmlGenerator.generateXML(state, parent, null); @@ -341,8 +338,8 @@ public class ArticleSectionPanel extends SimpleComponent implements // the position in the list of sections, or the string 'all' private class PageNumber { - private boolean m_all; - private Integer m_number; + private final boolean m_all; + private final Integer m_number; public PageNumber(String number) throws NumberFormatException { @@ -373,11 +370,13 @@ public class ArticleSectionPanel extends SimpleComponent implements super(name); } + @Override public Object transformValue(HttpServletRequest request) throws IllegalArgumentException { return transformSingleValue(request); } + @Override public Object unmarshal(String encoded) throws IllegalArgumentException { @@ -387,13 +386,14 @@ public class ArticleSectionPanel extends SimpleComponent implements try { return new PageNumber(encoded); } catch (NumberFormatException e) { - e.printStackTrace(); + //e.printStackTrace(); throw new IllegalArgumentException(getName() + " should be a BigDecimal: '" + encoded + "'"); } } + @Override public Class getValueClass() { return PageNumber.class; } diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ImageUploadSection.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ImageUploadSection.java index 26dbad13b..0be8e44ea 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ImageUploadSection.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/ImageUploadSection.java @@ -84,14 +84,19 @@ public class ImageUploadSection extends FormSection MPArticleGlobalizationUtil .globalize("cms.contenttypes.ui.mparticle.section.select_image"))); add(new FileUpload(m_name + IMAGE)); - add(new Label( - MPArticleGlobalizationUtil - .globalize("cms.contenttypes.ui.mparticle.section.caption"))); + TextField caption = new TextField(m_name + CAPTION); + caption.setLabel(MPArticleGlobalizationUtil + .globalize("cms.contenttypes.ui.mparticle.section.caption")); caption.setSize(40); add(caption); } + /** + * + * @param name + * @param selImage + */ public ImageUploadSection(String name, ItemSelectionModel selImage) { this(name, selImage, new ColumnPanel(2, true)); @@ -109,6 +114,8 @@ public class ImageUploadSection extends FormSection /** * Initialise the caption text field. Should be called from the * form init listener. + * + * @param event */ public void initImageUpload(FormSectionEvent event) { FormData data = event.getFormData(); @@ -135,6 +142,9 @@ public class ImageUploadSection extends FormSection /** * Return the filname from the upload widget. Should be called * from the form process listener. + * + * @param event + * @return */ public String getImageFilename(FormSectionEvent event) { FormData data = event.getFormData(); @@ -144,6 +154,9 @@ public class ImageUploadSection extends FormSection /** * Return a File object from the file upload widget. Should be * called from the form process listener. + * + * @param event + * @return */ public File getImage(FormSectionEvent event) { FormData data = event.getFormData(); @@ -163,6 +176,9 @@ public class ImageUploadSection extends FormSection /** * Process the image upload. Should be called form the form * process listener. + * + * @param event + * @return */ public ReusableImageAsset processImageUpload(FormSectionEvent event) { ReusableImageAsset a = null; diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java index 89ff9f6ac..f06b96d9c 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java @@ -34,11 +34,21 @@ import com.arsdigita.util.Assert; +/** + * Worker class to create the multipart article's edit form. + * + */ public class MultiPartArticleEditForm extends MultiPartArticleForm - implements FormSubmissionListener { + implements FormSubmissionListener { private final SimpleEditStep m_step; + /** + * Constructor. + * + * @param itemModel + * @param step + */ public MultiPartArticleEditForm(ItemSelectionModel itemModel, SimpleEditStep step) { super("MultiPartArticleEditForm", itemModel); diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java index 958399ecb..ca415cb25 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java @@ -19,10 +19,11 @@ package com.arsdigita.cms.contenttypes.ui.mparticle; import com.arsdigita.bebop.ColumnPanel; +import com.arsdigita.bebop.Embedded; import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormSection; -import com.arsdigita.bebop.Label; +//import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.event.FormInitListener; @@ -77,6 +78,13 @@ public abstract class MultiPartArticleForm extends FormSection private static final Logger s_log = Logger.getLogger(MultiPartArticleForm.class); + + /** + * Constructor. + * + * @param formName + * @param itemModel + */ public MultiPartArticleForm(String formName, ItemSelectionModel itemModel) { super(new ColumnPanel(2)); @@ -98,24 +106,38 @@ public abstract class MultiPartArticleForm extends FormSection addValidationListener(this); } + /** + * + */ public void addSaveCancelSection() { m_saveCancelSection = new SaveCancelSection(); add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); } + /** + * + * @return + */ public SaveCancelSection getSaveCancelSection() { return m_saveCancelSection; } - private Label m_script = new Label(String.format( + /** Constant property, placeholder for a javascript element. */ + private final Embedded m_script = new Embedded(String.format( "", Web.getWebappContextPath()), false); + /** + * + */ protected void addWidgets() { - add(new Label(GlobalizationUtil - .globalize("cms.contenttypes.ui.title"))); + + // add(new Label(GlobalizationUtil + // .globalize("cms.contenttypes.ui.title"))); TextField titleWidget = new TextField(new TrimmedStringParameter(TITLE)); + titleWidget.setLabel(GlobalizationUtil + .globalize("cms.contenttypes.ui.title")); titleWidget.addValidationListener(new NotNullValidationListener()); titleWidget.setOnFocus("if (this.form." + NAME + ".value == '') { " + " defaulting = true; this.form." + NAME @@ -125,9 +147,11 @@ public abstract class MultiPartArticleForm extends FormSection ); add(titleWidget); - add(new Label(GlobalizationUtil - .globalize("cms.contenttypes.ui.name"))); + //add(new Label(GlobalizationUtil + // .globalize("cms.contenttypes.ui.name"))); TextField nameWidget = new TextField(new TrimmedStringParameter(NAME)); + nameWidget.setLabel(GlobalizationUtil + .globalize("cms.contenttypes.ui.name")); nameWidget.addValidationListener(new NotNullValidationListener()); nameWidget.addValidationListener(new URLTokenValidationListener()); nameWidget.setOnFocus("defaulting = false"); @@ -138,8 +162,8 @@ public abstract class MultiPartArticleForm extends FormSection add(nameWidget); if (!ContentSection.getConfig().getHideLaunchDate()) { - add(new Label(GlobalizationUtil - .globalize("cms.ui.authoring.page_launch_date"))); + //add(new Label(GlobalizationUtil + // .globalize("cms.ui.authoring.page_launch_date"))); ParameterModel launchDateParam = new DateParameter(LAUNCH_DATE); com.arsdigita.bebop.form.Date launchDate = new com.arsdigita.bebop.form.Date(launchDateParam); @@ -150,32 +174,42 @@ public abstract class MultiPartArticleForm extends FormSection // if launch date is required, help user by suggesting today's date launchDateParam.setDefaultValue(new Date()); } + launchDate.setLabel(GlobalizationUtil + .globalize("cms.ui.authoring.page_launch_date")); add(launchDate); } - add(new Label(GlobalizationUtil - .globalize("cms.contenttypes.ui.summary"))); + //add(new Label(GlobalizationUtil + // .globalize("cms.contenttypes.ui.summary"))); TextArea summaryWidget = new TextArea(new TrimmedStringParameter(SUMMARY)); if (ContentSection.getConfig().mandatoryDescriptions()) { summaryWidget .addValidationListener(new NotEmptyValidationListener(GlobalizationUtil .globalize("cms.contenttypes.ui.description_missing"))); } + summaryWidget.setLabel(GlobalizationUtil + .globalize("cms.contenttypes.ui.summary")); summaryWidget.setRows(5); summaryWidget.setCols(30); summaryWidget.setHint(GlobalizationUtil.globalize( - "cms.contenttypes.ui.summary_hint")); + "cms.contenttypes.ui.summary_hint")); add(summaryWidget); } + @Override public abstract void init(FormSectionEvent e) throws FormProcessException; + @Override public abstract void process(FormSectionEvent e) throws FormProcessException; + @Override public abstract void validate(FormSectionEvent e) throws FormProcessException; /** - * Utility method to initialize the name/title/summary widgets + * Utility method to initialize the name/title/summary widgets. + * + * @param e + * @return */ public MultiPartArticle initBasicWidgets(FormSectionEvent e) { Assert.exists(m_itemModel, ItemSelectionModel.class); @@ -197,7 +231,10 @@ public abstract class MultiPartArticleForm extends FormSection } /** - * Utility method to process the name/title/summary widgets + * Utility method to process the name/title/summary widgets. + * + * @param e + * @return */ public MultiPartArticle processBasicWidgets(FormSectionEvent e) { Assert.exists(m_itemModel, ItemSelectionModel.class); @@ -251,6 +288,7 @@ public abstract class MultiPartArticleForm extends FormSection * @param state the current page state * * @return the new content item (or a proper subclass) + * @throws com.arsdigita.bebop.FormProcessException */ public MultiPartArticle createArticle(PageState state) throws FormProcessException { @@ -273,6 +311,7 @@ public abstract class MultiPartArticleForm extends FormSection return article; } + @Override public void generateXML(PageState ps, Element parent) { m_script.generateXML(ps, parent); super.generateXML(ps, parent); diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java index 5ec6f5868..3fe19a903 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java @@ -54,6 +54,11 @@ public class SectionDeleteForm extends Form private Label m_sectionNameLabel; + /** + * + * @param selArticle + * @param selSection + */ public SectionDeleteForm ( ItemSelectionModel selArticle, ItemSelectionModel selSection) { @@ -77,7 +82,11 @@ public class SectionDeleteForm extends Form addProcessListener(this); } - protected SaveCancelSection addSaveCancelSection () { + /** + * + * @return + */ + protected SaveCancelSection addSaveCancelSection () { m_saveCancelSection = new SaveCancelSection(); m_saveCancelSection.getSaveButton().setButtonLabel( GlobalizationUtil.globalize("cms.ui.delete")); diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java index 5d549e3ab..0e42c1733 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java @@ -158,31 +158,38 @@ public class SectionEditForm extends Form { * Add form widgets for a Section. */ protected void addWidgets() { - add(new Label(MPArticleGlobalizationUtil - .globalize("cms.contenttypes.ui.mparticle.section.title"))); + + //add(new Label(MPArticleGlobalizationUtil + // .globalize("cms.contenttypes.ui.mparticle.section.title"))); TextField titleWidget = new TextField( - new TrimmedStringParameter(TITLE)); + new TrimmedStringParameter(TITLE)); titleWidget.addValidationListener(new NotNullValidationListener()); + titleWidget.setLabel(MPArticleGlobalizationUtil + .globalize("cms.contenttypes.ui.mparticle.section.title")); add(titleWidget); - add(new Label(MPArticleGlobalizationUtil - .globalize("cms.contenttypes.ui.mparticle.section.text")), - ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH); + //add(new Label(MPArticleGlobalizationUtil + // .globalize("cms.contenttypes.ui.mparticle.section.text")), + // ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH); CMSDHTMLEditor textWidget = new CMSDHTMLEditor(new TrimmedStringParameter(TEXT)); + textWidget.setLabel(MPArticleGlobalizationUtil + .globalize("cms.contenttypes.ui.mparticle.section.text")); textWidget.setRows(40); textWidget.setCols(70); textWidget.setWrap(CMSDHTMLEditor.SOFT); add(textWidget, ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH); - add(new Label(MPArticleGlobalizationUtil - .globalize("cms.contenttypes.ui.mparticle.section.image")), - ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); + //add(new Label(MPArticleGlobalizationUtil + // .globalize("cms.contenttypes.ui.mparticle.section.image")), + // ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); m_imageUpload = new ImageUploadSection("image", m_selImage); + m_imageUpload.setLabel(MPArticleGlobalizationUtil + .globalize("cms.contenttypes.ui.mparticle.section.image")); add(m_imageUpload, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); - add(new Label("")); + //add(new Label()); CheckboxGroup pageBreak = new CheckboxGroup(PAGE_BREAK); pageBreak.addOption(new Option("true", new Label(MPArticleGlobalizationUtil diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java index 803ccdb0a..243243a8b 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java @@ -105,6 +105,8 @@ public class SectionTable extends Table { setModelBuilder(new SectionTableModelBuilder(m_selArticle, m_moveSection)); addTableActionListener(new TableActionListener() { + + @Override public void cellSelected(TableActionEvent event) { PageState state = event.getPageState(); @@ -143,6 +145,7 @@ public class SectionTable extends Table { } } + @Override public void headSelected(TableActionEvent event) { // do nothing } @@ -183,6 +186,7 @@ public class SectionTable extends Table { * @param state * @return */ + @Override public TableModel makeModel(Table table, PageState state) { table.getRowSelectionModel().clearSelection(state); @@ -223,6 +227,7 @@ public class SectionTable extends Table { } /** Return the number of columsn this TableModel has. */ + @Override public int getColumnCount() { return m_colModel.size(); } @@ -230,6 +235,7 @@ public class SectionTable extends Table { /** Move to the next row and return true if the model is now positioned * on a valid row. */ + @Override public boolean nextRow() { if (m_sections.next()) { m_section = (ArticleSection) m_sections.getArticleSection(); @@ -281,6 +287,7 @@ public class SectionTable extends Table { /** * Return the key for the given column and the current row. */ + @Override public Object getKeyAt(int columnIndex) { return m_section.getID(); } @@ -303,11 +310,12 @@ public class SectionTable extends Table { m_active = active; } + @Override public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) { - Component ret = null; + Component ret; SecurityManager sm = CMS.getSecurityManager(state); ContentItem item = (ContentItem) m_selArticle.getSelectedObject(state); diff --git a/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/ui/NewsItemPropertyForm.java b/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/ui/NewsItemPropertyForm.java index 8643d1369..e1d3ba781 100755 --- a/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/ui/NewsItemPropertyForm.java +++ b/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/ui/NewsItemPropertyForm.java @@ -91,15 +91,18 @@ public class NewsItemPropertyForm extends BasicPageForm */ @Override protected void addWidgets() { + super.addWidgets(); // summary (lead) - add(new Label(NewsItemGlobalizationUtil - .globalize("cms.contenttypes.ui.newsitem.lead"))); + // add(new Label(NewsItemGlobalizationUtil + // .globalize("cms.contenttypes.ui.newsitem.lead"))); ParameterModel leadParam = new StringParameter(LEAD); //leadParam // .addParameterListener(new NotNullValidationListener()); TextArea lead = new TextArea(leadParam); + lead.setLabel(NewsItemGlobalizationUtil + .globalize("cms.contenttypes.ui.newsitem.lead")); lead.setCols(50); lead.setRows(5); add(lead); @@ -114,24 +117,32 @@ public class NewsItemPropertyForm extends BasicPageForm new Label(NewsItemGlobalizationUtil.globalize( "cms.contenttypes.ui.newsitem.no")))); - add(new Label(NewsItemGlobalizationUtil.globalize( - "cms.contenttypes.ui.newsitem.homepage"))); + // add(new Label(NewsItemGlobalizationUtil.globalize( + // "cms.contenttypes.ui.newsitem.homepage"))); + homepageWidget.setLabel(NewsItemGlobalizationUtil.globalize( + "cms.contenttypes.ui.newsitem.homepage")); add(homepageWidget); } // publication date - add(new Label(NewsItemGlobalizationUtil.globalize( - "cms.contenttypes.ui.newsitem.date"))); + // add(new Label(NewsItemGlobalizationUtil.globalize( + // "cms.contenttypes.ui.newsitem.date"))); ParameterModel newsDateParam = new DateParameter(NEWS_DATE); newsDateParam.addParameterListener(new NotNullValidationListener()); m_newsDate = new com.arsdigita.bebop.form.Date(newsDateParam); m_newsDate.setYearRange(NewsItem.getConfig().getStartYear(), GregorianCalendar.getInstance().get(Calendar.YEAR) + NewsItem.getConfig().getEndYearDelta()); + m_newsDate.setLabel(NewsItemGlobalizationUtil.globalize( + "cms.contenttypes.ui.newsitem.date")); add(m_newsDate); } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); NewsItem item = (NewsItem) super.initBasicWidgets(fse); @@ -151,7 +162,11 @@ public class NewsItemPropertyForm extends BasicPageForm } } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse + */ + @Override public void submitted(FormSectionEvent fse) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -160,7 +175,11 @@ public class NewsItemPropertyForm extends BasicPageForm } } - /** Form processing hook. Saves NewsItem object. */ + /** + * Form processing hook. Saves NewsItem object. + * @param fse + */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); @@ -175,7 +194,8 @@ public class NewsItemPropertyForm extends BasicPageForm item.setLead((String) data.get(LEAD)); if (!NewsItem.getConfig().getHideHomepageField()) { String isHomepage = (String) data.get(IS_HOMEPAGE); - item.setIsHomepage(new Boolean(isHomepage)); + // item.setIsHomepage(new Boolean(isHomepage)); + item.setIsHomepage(Boolean.valueOf(isHomepage)); } item.save(); } diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationImageForm.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationImageForm.java index 6971fb6a3..776007162 100755 --- a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationImageForm.java +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationImageForm.java @@ -118,6 +118,7 @@ public class OrganizationImageForm extends Form implements FormInitListener, m_imageDisplay = new ImageDisplay(itemModel) { + @Override protected ImageAsset getImageAsset(PageState state) { ImageAsset image = (ImageAsset) ((Organization) getImageSelectionModel() @@ -150,13 +151,15 @@ public class OrganizationImageForm extends Form implements FormInitListener, add(m_currentLabel); add(m_imageDisplay); - m_label = new Label(OrganizationGlobalizationUtil.globalize - ("cms.contenttypes.ui.organization.image")); - add(m_label); + // m_label = new Label(OrganizationGlobalizationUtil.globalize + // ("cms.contenttypes.ui.organization.image")); + // add(m_label); m_upload = new FileUpload(IMAGE); + m_upload.setLabel(OrganizationGlobalizationUtil.globalize + ("cms.contenttypes.ui.organization.image")); add(m_upload); - m_radioLabel = new Label(""); + m_radioLabel = new Label(); add(m_radioLabel); add(m_group); m_saveCancelSection = new SaveCancelSection(); @@ -172,14 +175,24 @@ public class OrganizationImageForm extends Form implements FormInitListener, return m_itemModel; } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override public void init( FormSectionEvent fse ) { PageState state = fse.getPageState(); Organization item = (Organization) getItemSelectionModel() .getSelectedObject(state); } - /** Form processing hook. Saves Organization object. */ + /** + * Form processing hook. Saves Organization object. + * + * @param fse + * @throws com.arsdigita.bebop.FormProcessException + */ + @Override public void process( FormSectionEvent fse ) throws FormProcessException { PageState state = fse.getPageState(); FormData data = fse.getFormData(); @@ -216,9 +229,8 @@ public class OrganizationImageForm extends Form implements FormInitListener, } } else { throw new FormProcessException - ((String)(OrganizationGlobalizationUtil.globalize - ("cms.contenttypes.ui.organization.image_option_null") - .localize())); + (OrganizationGlobalizationUtil.globalize + ("cms.contenttypes.ui.organization.image_option_null")); } } else if (imageOption != null && imageOption.equals(DELETE_OPTION)) { // @@ -243,6 +255,12 @@ public class OrganizationImageForm extends Form implements FormInitListener, } } + /** + * + * @param fse + * @throws FormProcessException + */ + @Override public void validate(FormSectionEvent fse) throws FormProcessException { FormData data = fse.getFormData(); String imageOption = (String)data.get(IMAGE + IMAGE_OPTIONS); @@ -274,6 +292,12 @@ public class OrganizationImageForm extends Form implements FormInitListener, } } + /** + * + * @param fse + * @throws FormProcessException + */ + @Override public void submitted(FormSectionEvent fse) throws FormProcessException { if (m_step != null && m_saveCancelSection.getCancelButton() diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationPropertyForm.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationPropertyForm.java index c16ef4663..803521be5 100755 --- a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationPropertyForm.java +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationPropertyForm.java @@ -78,22 +78,31 @@ public class OrganizationPropertyForm /** * Adds widgets to the form. */ + @Override protected void addWidgets() { super.addWidgets(); TextField link = new TextField(LINK); - add(new Label(OrganizationGlobalizationUtil.globalize( - "cms.contenttypes.ui.organization.link"))); + //add(new Label(OrganizationGlobalizationUtil.globalize( + // "cms.contenttypes.ui.organization.link"))); + link.setLabel(OrganizationGlobalizationUtil.globalize( + "cms.contenttypes.ui.organization.link")); add(link); TextField contact = new TextField(CONTACT); - add(new Label(OrganizationGlobalizationUtil.globalize( - "cms.contenttypes.ui.organization.contact"))); + //add(new Label(OrganizationGlobalizationUtil.globalize( + // "cms.contenttypes.ui.organization.contact"))); + contact.setLabel(OrganizationGlobalizationUtil.globalize( + "cms.contenttypes.ui.organization.contact")); add(contact); } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override public void init( FormSectionEvent fse ) { FormData data = fse.getFormData(); Organization glossary_item @@ -103,7 +112,11 @@ public class OrganizationPropertyForm data.put( CONTACT, glossary_item.getContact() ); } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse + */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -112,7 +125,11 @@ public class OrganizationPropertyForm } } - /** Form processing hook. Saves Organization object. */ + /** + * Form processing hook. Saves Organization object. + * @param fse + */ + @Override public void process( FormSectionEvent fse ) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-pressrelease/src/com/arsdigita/cms/contenttypes/ui/PressReleasePropertyForm.java b/ccm-cms-types-pressrelease/src/com/arsdigita/cms/contenttypes/ui/PressReleasePropertyForm.java index b3bb07b6e..8f2b411f3 100755 --- a/ccm-cms-types-pressrelease/src/com/arsdigita/cms/contenttypes/ui/PressReleasePropertyForm.java +++ b/ccm-cms-types-pressrelease/src/com/arsdigita/cms/contenttypes/ui/PressReleasePropertyForm.java @@ -20,7 +20,6 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.FormData; -import com.arsdigita.bebop.Label; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; @@ -87,31 +86,32 @@ public class PressReleasePropertyForm extends BasicPageForm /** * Adds widgets to the form. */ + @Override protected void addWidgets() { super.addWidgets(); - add(new Label(GlobalizationUtil - .globalize("cms.contenttypes.ui.summary"))); ParameterModel summaryParam = new StringParameter(SUMMARY); TextArea summary = new TextArea(summaryParam); + summary.setLabel(GlobalizationUtil + .globalize("cms.contenttypes.ui.summary")); summary.setCols(40); summary.setRows(7); summary.addValidationListener(new StringLengthValidationListener(4000)); add(summary); - add(new Label(PressReleaseGlobalizationUtil - .globalize("cms.contenttypes.ui.pressrelease.contact_info"))); ParameterModel contactInfoParam = new StringParameter(CONTACT_INFO); CMSDHTMLEditor contactInfo = new CMSDHTMLEditor(contactInfoParam); + contactInfo.setLabel(PressReleaseGlobalizationUtil + .globalize("cms.contenttypes.ui.pressrelease.contact_info")); contactInfo.setCols(40); contactInfo.setRows(10); contactInfo.addValidationListener(new StringLengthValidationListener(1000)); add(contactInfo); - add(new Label(PressReleaseGlobalizationUtil - .globalize("cms.contenttypes.ui.pressrelease.ref_code"))); ParameterModel refCodeParam = new StringParameter(REF_CODE); TextField refCode = new TextField(refCodeParam); + refCode.setLabel(PressReleaseGlobalizationUtil + .globalize("cms.contenttypes.ui.pressrelease.ref_code")); refCode.setSize(30); refCode.setMaxLength(30); refCode.addValidationListener(new StringLengthValidationListener(80)); @@ -120,7 +120,9 @@ public class PressReleasePropertyForm extends BasicPageForm /** * Form initialisation hook. Fills widgets with data. + * @param fse */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); PressRelease release @@ -133,7 +135,9 @@ public class PressReleasePropertyForm extends BasicPageForm /** * Cancels streamlined editing. + * @param fse */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -144,7 +148,9 @@ public class PressReleasePropertyForm extends BasicPageForm /** * Form processing hook. Saves PressRelease object. + * @param fse */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java index c83658eb9..debf3082e 100644 --- a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java +++ b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java @@ -35,8 +35,8 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen private final static Logger s_log = Logger.getLogger(ResearchNetworkMembershipPropertyForm.class); public final static String ID = "researchnetwork_membership_edit"; - private ItemSelectionModel m_itemModel; - private ResearchNetworkMembershipSelectionModel m_membershipModel; + private final ItemSelectionModel m_itemModel; + private final ResearchNetworkMembershipSelectionModel m_membershipModel; private ItemSearchWidget m_personSearch; private final static String PERSON_SEARCH = "membership"; private SaveCancelSection m_saveCancelSection; @@ -61,8 +61,9 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen } protected void addWidgets() { - add(new Label(ResearchNetworkGlobalizationUtil.globalize("cms.contenttypes.ui.researchnetwork.membership.person"))); this.m_personSearch = new ItemSearchWidget(PERSON_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.Person")); + this.m_personSearch.setLabel(ResearchNetworkGlobalizationUtil.globalize( + "cms.contenttypes.ui.researchnetwork.membership.person")); add(this.m_personSearch); } @@ -71,6 +72,7 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen try { this.m_saveCancelSection.getCancelButton().addPrintListener(new PrintListener() { + @Override public void prepare(PrintEvent e) { Submit target = (Submit) e.getTarget(); if (m_membershipModel.isSelected(e.getPageState())) { @@ -83,6 +85,7 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen this.m_saveCancelSection.getSaveButton().addPrintListener(new PrintListener() { + @Override public void prepare(PrintEvent e) { Submit target = (Submit) e.getTarget(); if(m_membershipModel.isSelected(e.getPageState())) { @@ -116,11 +119,13 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen Assert.exists(network); ResearchNetworkMembership membership = new ResearchNetworkMembership(); membership.setResearchNetworkMembershipOwner(network); - s_log.debug("set network to: " + membership.getResearchNetworkMembershipOwner().getResearchNetworkTitle()); + s_log.debug("set network to: " + membership.getResearchNetworkMembershipOwner() + .getResearchNetworkTitle()); return membership; } - protected void setMembershipProperties(ResearchNetworkMembership membership, FormSectionEvent event) { + protected void setMembershipProperties(ResearchNetworkMembership membership, + FormSectionEvent event) { PageState state = event.getPageState(); FormData data = event.getFormData(); @@ -129,6 +134,7 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen membership.save(); } + @Override public void init(FormSectionEvent event) throws FormProcessException { FormData data = event.getFormData(); PageState state = event.getPageState(); @@ -148,6 +154,7 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen } } + @Override public void process(FormSectionEvent event) throws FormProcessException { PageState state = event.getPageState(); ResearchNetworkMembership membership; @@ -167,12 +174,14 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen init(event); } + @Override public void validate(FormSectionEvent event) throws FormProcessException { if (event.getFormData().get(PERSON_SEARCH) == null) { throw new FormProcessException("Person selection is required"); } } + @Override public void submitted(FormSectionEvent event) throws FormProcessException { if (this.m_saveCancelSection.getCancelButton().isSelected(event.getPageState())) { m_membershipModel.clearSelection(event.getPageState()); diff --git a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkPropertyForm.java b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkPropertyForm.java index 7f5a932cf..69f01a6c9 100644 --- a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkPropertyForm.java +++ b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkPropertyForm.java @@ -48,36 +48,47 @@ public class ResearchNetworkPropertyForm extends BasicPageForm implements FormPr public void addWidgets() { super.addWidgets(); - add(new Label(ResearchNetworkGlobalizationUtil.globalize("cms.contenttypes.researchnetwork.ui.title"))); ParameterModel researchNetworkTitleParam = new StringParameter(RESEARCHNETWORK_TITLE); TextField researchNetworkTitle = new TextField(researchNetworkTitleParam); researchNetworkTitle.addValidationListener(new NotNullValidationListener()); + researchNetworkTitle.setLabel(ResearchNetworkGlobalizationUtil.globalize( + "cms.contenttypes.researchnetwork.ui.title")); add(researchNetworkTitle); - add(new Label(ResearchNetworkGlobalizationUtil.globalize("cms.contenttypes.researchnetwork.ui.description"))); TextArea researchNetworkAreaDescription = new TextArea(RESEARCHNETWORK_DESCRIPTION); + researchNetworkAreaDescription.setLabel(ResearchNetworkGlobalizationUtil + .globalize("cms.contenttypes.researchnetwork.ui.description")); researchNetworkAreaDescription.setRows(10); researchNetworkAreaDescription.setCols(30); add(researchNetworkAreaDescription); - add(new Label(ResearchNetworkGlobalizationUtil.globalize("cms.contenttypes.researchnetwork.ui.direction"))); TextArea researchNetworkDirection = new TextArea(RESEARCHNETWORK_DIRECTION); + researchNetworkDirection.setLabel(ResearchNetworkGlobalizationUtil + .globalize("cms.contenttypes.researchnetwork.ui.direction")); researchNetworkDirection.setRows(5); researchNetworkDirection.setCols(30); add(researchNetworkDirection); - add(new Label(ResearchNetworkGlobalizationUtil.globalize("cms.contenttypes.researchnetwork.ui.coordination"))); TextArea researchNetworkCoordination = new TextArea(RESEARCHNETWORK_COORDINATION); + researchNetworkCoordination.setLabel(ResearchNetworkGlobalizationUtil + .globalize("cms.contenttypes.researchnetwork.ui.coordination")); researchNetworkCoordination.setRows(5); researchNetworkCoordination.setCols(30); add(researchNetworkCoordination); - add(new Label(ResearchNetworkGlobalizationUtil.globalize("cms.contenttypes.researchnetwork.ui.website"))); ParameterModel researchNetworkWebsiteParam = new StringParameter(RESEARCHNETWORK_WEBSITE); TextField researchNetworkWebsite = new TextField(researchNetworkWebsiteParam); + researchNetworkWebsite.setLabel(ResearchNetworkGlobalizationUtil + .globalize("cms.contenttypes.researchnetwork.ui.website")); add(researchNetworkWebsite); } + /** + * + * @param e + * @throws FormProcessException + */ + @Override public void init(FormSectionEvent e) throws FormProcessException { FormData data = e.getFormData(); ResearchNetwork network = (ResearchNetwork) super.initBasicWidgets(e); @@ -89,6 +100,7 @@ public class ResearchNetworkPropertyForm extends BasicPageForm implements FormPr data.put(RESEARCHNETWORK_DESCRIPTION, network.getResearchNetworkDescription()); } + @Override public void process(FormSectionEvent e) throws FormProcessException { FormData data = e.getFormData(); @@ -109,6 +121,7 @@ public class ResearchNetworkPropertyForm extends BasicPageForm implements FormPr } } + @Override public void submitted(FormSectionEvent e) throws FormProcessException { if ((this.m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) { this.m_step.cancelStreamlinedCreation(e.getPageState()); diff --git a/ccm-cms-types-service/src/com/arsdigita/cms/contenttypes/ui/ServicePropertyForm.java b/ccm-cms-types-service/src/com/arsdigita/cms/contenttypes/ui/ServicePropertyForm.java index a7dca50c4..00f944bc1 100755 --- a/ccm-cms-types-service/src/com/arsdigita/cms/contenttypes/ui/ServicePropertyForm.java +++ b/ccm-cms-types-service/src/com/arsdigita/cms/contenttypes/ui/ServicePropertyForm.java @@ -87,46 +87,47 @@ public class ServicePropertyForm extends BasicPageForm * Adds widgets to the form. */ protected void addWidgets() { + super.addWidgets(); - add(new Label(GlobalizationUtil - .globalize("cms.contenttypes.ui.summary"))); ParameterModel summaryParam = new StringParameter(SUMMARY); TextArea summary = new TextArea(summaryParam); + summary.setLabel(GlobalizationUtil + .globalize("cms.contenttypes.ui.summary")); summary.setCols(40); summary.setRows(5); add(summary); - add(new Label(ServiceGlobalizationUtil - .globalize("cms.contenttypes.ui.service.services_provided"))); ParameterModel servicesProvidedParam = new StringParameter(SERVICES_PROVIDED); TextArea servicesProvided = new TextArea(servicesProvidedParam); + servicesProvided.setLabel(ServiceGlobalizationUtil + .globalize("cms.contenttypes.ui.service.services_provided")); servicesProvided.setCols(40); servicesProvided.setRows(5); add(servicesProvided); - add(new Label(ServiceGlobalizationUtil - .globalize("cms.contenttypes.ui.service.opening_times"))); ParameterModel openingTimesParam = new StringParameter(OPENING_TIMES); TextArea openingTimes = new TextArea(openingTimesParam); + openingTimes.setLabel(ServiceGlobalizationUtil + .globalize("cms.contenttypes.ui.service.opening_times")); openingTimes.setCols(40); openingTimes.setRows(5); add(openingTimes); - add(new Label(ServiceGlobalizationUtil - .globalize("cms.contenttypes.ui.service.address"))); ParameterModel addressParam = new StringParameter(ADDRESS); TextArea address = new TextArea(addressParam); + address.setLabel(ServiceGlobalizationUtil + .globalize("cms.contenttypes.ui.service.address")); address.setCols(40); address.setRows(5); add(address); - add(new Label(ServiceGlobalizationUtil - .globalize("cms.contenttypes.ui.service.contacts"))); ParameterModel contactsParam = new StringParameter(CONTACTS); TextArea contacts = new TextArea(contactsParam); + contacts.setLabel(ServiceGlobalizationUtil + .globalize("cms.contenttypes.ui.service.contacts")); contacts.setCols(40); contacts.setRows(5); add(contacts); @@ -135,7 +136,9 @@ public class ServicePropertyForm extends BasicPageForm /** * Form initialisation hook. Fills widgets with data. + * @param fse */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); Service service = (Service) super.initBasicWidgets(fse); @@ -149,7 +152,9 @@ public class ServicePropertyForm extends BasicPageForm /** * Cancels streamlined editing. + * @param fse */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -160,7 +165,9 @@ public class ServicePropertyForm extends BasicPageForm /** * Form processing hook. Saves Service object. + * @param fse */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java index 4afe4fa8e..4c1697cf3 100755 --- a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java +++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java @@ -118,24 +118,24 @@ public class SimpleAddressPropertyForm extends BasicPageForm protected void addWidgets() { super.addWidgets(); - add( new Label( SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.address" ) ) ); ParameterModel addressBodyParam = new StringParameter( ADDRESS ); addressBodyParam.addParameterListener( new NotNullValidationListener( ) ); addressBodyParam.addParameterListener( new StringInRangeValidationListener(0, 1000) ); TextArea addressBody = new TextArea( addressBodyParam ); + addressBody.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.address" )); addressBody.setRows(5); addressBody.setCols(30); add( addressBody ); if (!SimpleAddress.getConfig().getHideCountryCodeSelection()) { - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.iso_country_code") )); + // add( new Label(SimpleAddressGlobalizationUtil.globalize( + // "cms.contenttypes.ui.simpleaddress.iso_country_code") )); ParameterModel isoCountryCodeParam = new StringParameter( ISO_COUNTRY_CODE ); //isoCountryCodeParam.addParameterListener( new NotNullValidationListener( ) ); - // Don't assume submission via drop-down menu isoCountryCode - isoCountryCodeParam.addParameterListener( + // Don't assume submission via drop-down menu isoCountryCode + isoCountryCodeParam.addParameterListener( new StringInRangeValidationListener(0, 2) ); SingleSelect isoCountryCode = new SingleSelect( isoCountryCodeParam ); @@ -154,6 +154,7 @@ public class SimpleAddressPropertyForm extends BasicPageForm isoCountryCode.addValidationListener( new ParameterListener() { + @Override public void validate(ParameterEvent e) throws FormProcessException { // the --select one-- option is not allowed ParameterData data = e.getParameterData(); @@ -167,93 +168,98 @@ public class SimpleAddressPropertyForm extends BasicPageForm } }}); + isoCountryCode.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.iso_country_code")); add( isoCountryCode ); } if (!SimpleAddress.getConfig().getHidePostalCode()) { - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.postal_code") ) ); ParameterModel postalCodeParam = new StringParameter( POSTAL_CODE ); // postalCodeParam.addParameterListener( new NotNullValidationListener( ) ); postalCodeParam.addParameterListener( new StringInRangeValidationListener(0, 20) ); TextField postalCode = new TextField( postalCodeParam ); + postalCode.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.postal_code")); postalCode.setMaxLength( 20 ); add( postalCode ); } - add( new Label( SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.phone" ) ) ); ParameterModel phoneParam = new StringParameter( PHONE ); phoneParam.addParameterListener( new StringInRangeValidationListener(0,20) ); TextField phone = new TextField( phoneParam ); + phone.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.phone" )); phone.setSize(20); phone.setMaxLength( 20 ); add( phone ); - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.mobile" ) ) ); ParameterModel mobileParam = new StringParameter( MOBILE ); mobileParam.addParameterListener( new StringInRangeValidationListener(0, 20) ); TextField mobile = new TextField( mobileParam ); + mobile.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.mobile" )); mobile.setSize(20); mobile.setMaxLength( 20 ); add( mobile ); - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.fax") ) ); ParameterModel faxParam = new StringParameter( FAX ); faxParam.addParameterListener( new StringInRangeValidationListener(0, 20) ); TextField fax = new TextField( faxParam ); + fax.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.fax")); fax.setSize(20); fax.setMaxLength( 20 ); add( fax ); - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.email" ) ) ); ParameterModel emailParam = new StringParameter( EMAIL ); emailParam.addParameterListener( new StringInRangeValidationListener(0, 75) ); TextField email = new TextField( emailParam ); + email.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.email" )); email.setSize(25); email.setMaxLength( 75 ); email.setHint(SimpleAddressGlobalizationUtil.globalize - ( "cms.contenttypes.ui.simpleaddress.email_hint") - .localize().toString()); + ( "cms.contenttypes.ui.simpleaddress.email_hint")); add( email ); - add(new Label("")); + + add(new Label()); add(new Label(SimpleAddressGlobalizationUtil.globalize( "cms.contenttypes.ui.simpleaddress.email_desc") ) ); - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.uri") ) ); + // add( new Label(SimpleAddressGlobalizationUtil.globalize( + // "cms.contenttypes.ui.simpleaddress.uri") ) ); ParameterModel uriParam = new StringParameter( URI ); uriParam.addParameterListener( new StringInRangeValidationListener(0,250) ); TextField uri = new TextField( uriParam ); - uri.addValidationListener(new URLValidationListener(){ + uri.addValidationListener(new URLValidationListener() { @Override - public void validate(ParameterEvent e)throws FormProcessException{ - ParameterData d = e.getParameterData(); - String value = (String)d.getValue(); - if(value.indexOf("http")<0) - value = "http://" + value; - d.setValue(value); - super.validate(e); - } - }); + public void validate(ParameterEvent e) throws FormProcessException { + ParameterData d = e.getParameterData(); + String value = (String) d.getValue(); + if (value.indexOf("http") < 0) { + value = "http://" + value; + } + d.setValue(value); + super.validate(e); + } + }); + uri.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.uri")); uri.setSize(30); uri.setMaxLength( 250 ); uri.setHint(SimpleAddressGlobalizationUtil.globalize - ( "cms.contenttypes.ui.simpleaddress.uri_hint") - .localize().toString()); + ( "cms.contenttypes.ui.simpleaddress.uri_hint")); add( uri ); - add(new Label("")); + + add(new Label()); add(new Label(SimpleAddressGlobalizationUtil.globalize( "cms.contenttypes.ui.simpleaddress.uri_desc") ) ); - add( new Label(SimpleAddressGlobalizationUtil.globalize( - "cms.contenttypes.ui.simpleaddress.notes") ) ); ParameterModel notesParam = new StringParameter( NOTES ); TextArea notes = new TextArea( notesParam ); + notes.setLabel(SimpleAddressGlobalizationUtil.globalize( + "cms.contenttypes.ui.simpleaddress.notes")); notes.setRows(8); notes.setCols(30); add( notes ); @@ -261,7 +267,9 @@ public class SimpleAddressPropertyForm extends BasicPageForm /** * Form initialization hook. Fills widgets with data. + * @param fse */ + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); SimpleAddress address = ( SimpleAddress ) super.initBasicWidgets(fse); @@ -292,7 +300,11 @@ public class SimpleAddressPropertyForm extends BasicPageForm } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse + */ + @Override public void submitted( FormSectionEvent fse ) { if (m_step != null && getSaveCancelSection().getCancelButton() @@ -303,7 +315,9 @@ public class SimpleAddressPropertyForm extends BasicPageForm /** * Form processing hook. Saves SimpleAddress object. + * @param fse */ + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); diff --git a/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationPropertyForm.java b/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationPropertyForm.java index 8045300e4..0494b9107 100644 --- a/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationPropertyForm.java +++ b/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationPropertyForm.java @@ -6,37 +6,38 @@ import com.arsdigita.cms.ItemSelectionModel; /** * - * @author Jens Pelzetter - * @version $Id$ + * @author Jens Pelzetter + * @version $Id: SimpleOrganizationPropertyForm.java 1611 2012-04-23 08:57:28Z + * jensp $ */ public class SimpleOrganizationPropertyForm extends GenericOrganizationalUnitPropertyForm { - - private SimpleOrganizationPropertiesStep m_step; + + private SimpleOrganizationPropertiesStep m_step; public static final String ID = "SimpleOrganization_edit"; - + public SimpleOrganizationPropertyForm(final ItemSelectionModel itemModel) { this(itemModel, null); } - + public SimpleOrganizationPropertyForm( final ItemSelectionModel itemModel, - final SimpleOrganizationPropertiesStep step) { + final SimpleOrganizationPropertiesStep step) { super(itemModel, step); m_step = step; - addSubmissionListener(this); + addSubmissionListener(this); } - + @Override public void addWidgets() { super.addWidgets(); } - + @Override public void init(final FormSectionEvent fse) throws FormProcessException { super.init(fse); super.initBasicWidgets(fse); } - + public void process(final FormSectionEvent fse) throws FormProcessException { super.process(fse); } diff --git a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java index 76c961f15..6e00d8efd 100755 --- a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java +++ b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java @@ -35,80 +35,87 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm; */ public class SiteProxyAtoZPropertyForm extends BasicItemForm { - private TextField m_title_atoz; + private TextField m_title_atoz; - private RadioGroup m_radiogroupUsedInAtoZ; + private RadioGroup m_radiogroupUsedInAtoZ; - private ItemSelectionModel m_selectionModel; + private ItemSelectionModel m_selectionModel; - private SiteProxy siteProxy; + private SiteProxy siteProxy; - /** - * Creates a new form to edit the SiteProxy object specified by the item - * selection model passed in. - * - * @param itemModel - * The ItemSelectionModel to use to obtain the SiteProxy to work - * on - */ - public SiteProxyAtoZPropertyForm(ItemSelectionModel itemModel) { - super("siteProxyAtoZEdit", itemModel); - m_selectionModel = itemModel; - } + /** + * Creates a new form to edit the SiteProxy object specified by the item + * selection model passed in. + * + * @param itemModel The ItemSelectionModel to use to obtain the SiteProxy to + * work on + */ + public SiteProxyAtoZPropertyForm(ItemSelectionModel itemModel) { + super("siteProxyAtoZEdit", itemModel); + m_selectionModel = itemModel; + } - /** - * Adds widgets to the form. - */ + /** + * Adds widgets to the form. + */ @Override - protected void addWidgets() { + protected void addWidgets() { - add(new Label(SiteProxyGlobalizationUtil - .globalize("cms.contenttypes.ui.siteproxy.label.atoztitle"))); - m_title_atoz = new TextField(SiteProxy.TITLE_ATOZ); - m_title_atoz.setSize(50); - add(m_title_atoz); + m_title_atoz = new TextField(SiteProxy.TITLE_ATOZ); + m_title_atoz.setLabel(SiteProxyGlobalizationUtil + .globalize("cms.contenttypes.ui.siteproxy.label.atoztitle")); + m_title_atoz.setSize(50); + add(m_title_atoz); - add(new Label(SiteProxyGlobalizationUtil - .globalize("cms.contenttypes.ui.siteproxy.label.usedinatoz"))); - m_radiogroupUsedInAtoZ = new RadioGroup(SiteProxy.USED_IN_ATOZ); - m_radiogroupUsedInAtoZ.addOption(new - Option(Boolean.TRUE.toString(), - new Label( SiteProxyGlobalizationUtil.globalize( - "cms.contenttypes.ui.siteproxy.option.usedinatoz.yes")) - )); - m_radiogroupUsedInAtoZ.addOption(new - Option(Boolean.FALSE.toString(), - new Label( SiteProxyGlobalizationUtil.globalize( - "cms.contenttypes.ui.siteproxy.option.usedinatoz.no")) - )); - add(m_radiogroupUsedInAtoZ); - } + m_radiogroupUsedInAtoZ = new RadioGroup(SiteProxy.USED_IN_ATOZ); + m_radiogroupUsedInAtoZ.addOption(new Option(Boolean.TRUE.toString(), + new Label(SiteProxyGlobalizationUtil.globalize( + "cms.contenttypes.ui.siteproxy.option.usedinatoz.yes")) + )); + m_radiogroupUsedInAtoZ.addOption(new Option(Boolean.FALSE.toString(), + new Label(SiteProxyGlobalizationUtil.globalize( + "cms.contenttypes.ui.siteproxy.option.usedinatoz.no")) + )); + m_radiogroupUsedInAtoZ.setLabel(SiteProxyGlobalizationUtil + .globalize("cms.contenttypes.ui.siteproxy.label.usedinatoz")); + add(m_radiogroupUsedInAtoZ); + } - /** Form initialisation hook. Fills widgets with data. */ - public void init(FormSectionEvent fse) { - PageState pageState = fse.getPageState(); - siteProxy = (SiteProxy) m_selectionModel.getSelectedObject(pageState); - if (siteProxy == null) - return; + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override + public void init(FormSectionEvent fse) { + PageState pageState = fse.getPageState(); + siteProxy = (SiteProxy) m_selectionModel.getSelectedObject(pageState); + if (siteProxy == null) { + return; + } - m_title_atoz.setValue(pageState, siteProxy.getAtoZTitle()); - m_radiogroupUsedInAtoZ.setValue(pageState, new Boolean(siteProxy - .isUsedInAtoZ()).toString()); - } + m_title_atoz.setValue(pageState, siteProxy.getAtoZTitle()); + m_radiogroupUsedInAtoZ.setValue(pageState, Boolean.valueOf(siteProxy + .isUsedInAtoZ()).toString()); + } - /** Form processing hook. Saves SiteProxy object. */ - public void process(FormSectionEvent fse) { - PageState pageState = fse.getPageState(); - siteProxy = (SiteProxy) m_selectionModel.getSelectedObject(pageState); - /* proced only when siteProxy is present and save button was pressed */ - if ((siteProxy == null) - && !getSaveCancelSection().getSaveButton() - .isSelected(pageState)) - return; + /** + * Form processing hook. Saves SiteProxy object. + * @param fse + */ + @Override + public void process(FormSectionEvent fse) { + PageState pageState = fse.getPageState(); + siteProxy = (SiteProxy) m_selectionModel.getSelectedObject(pageState); + /* proced only when siteProxy is present and save button was pressed */ + if ((siteProxy == null) + && !getSaveCancelSection().getSaveButton() + .isSelected(pageState)) { + return; + } - siteProxy.setAtoZTitle((String) m_title_atoz.getValue(pageState)); - siteProxy.setUsedInAtoZ(new Boolean((String) m_radiogroupUsedInAtoZ - .getValue(pageState)).booleanValue()); - siteProxy.save(); - } + siteProxy.setAtoZTitle((String) m_title_atoz.getValue(pageState)); + siteProxy.setUsedInAtoZ(Boolean.valueOf((String) m_radiogroupUsedInAtoZ + .getValue(pageState)).booleanValue()); + siteProxy.save(); + } } diff --git a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyPropertyForm.java b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyPropertyForm.java index 3496b5be3..dcda33941 100755 --- a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyPropertyForm.java +++ b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyPropertyForm.java @@ -19,15 +19,14 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.cms.contenttypes.SiteProxy; -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.form.TextField; import com.arsdigita.bebop.parameters.ParameterModel; -import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.util.SiteProxyGlobalizationUtil; import com.arsdigita.cms.ui.authoring.BasicPageForm; /** @@ -53,17 +52,24 @@ public class SiteProxyPropertyForm extends BasicPageForm /** * Adds widgets to the form. */ + @Override protected void addWidgets() { + super.addWidgets(); - add(new Label("URL:")); ParameterModel urlParam = new StringParameter("url"); + m_url.setLabel(SiteProxyGlobalizationUtil + .globalize("cms.contenttypes.ui.siteproxy.url")); m_url = new TextField(urlParam); m_url.setSize(40); add(m_url); } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + * @param fse + */ + @Override public void init(FormSectionEvent fse) { SiteProxy site = (SiteProxy) super.initBasicWidgets(fse); @@ -71,7 +77,11 @@ public class SiteProxyPropertyForm extends BasicPageForm site.getURL()); } - /** Form processing hook. Saves SiteProxy object. */ + /** + * Form processing hook. Saves SiteProxy object. + * @param fse + */ + @Override public void process(FormSectionEvent fse) { SiteProxy site = (SiteProxy) super.processBasicWidgets(fse); diff --git a/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/ui/SurveyPropertiesForm.java b/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/ui/SurveyPropertiesForm.java index 615ba69cc..eba0c2acc 100755 --- a/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/ui/SurveyPropertiesForm.java +++ b/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/ui/SurveyPropertiesForm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved. + * Copyright (C) 2012 Univerity of Bremen. 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 @@ -44,6 +44,10 @@ import com.arsdigita.cms.contenttypes.Survey; import com.arsdigita.cms.ui.authoring.BasicPageForm; +/** + * + * + */ public class SurveyPropertiesForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener { private SurveyPropertiesStep m_step; @@ -81,52 +85,65 @@ public class SurveyPropertiesForm extends BasicPageForm implements FormProcessLi @Override public void addWidgets() { + super.addWidgets(); - add(new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.description").localize())); ParameterModel descriptionParam = new StringParameter(DESCRIPTION); descriptionParam.addParameterListener(new StringInRangeValidationListener(0, 4000)); TextArea description = new TextArea(descriptionParam); + description.setLabel(SurveyGlobalizationUtil + .globalize("cms.contenttypes.ui.survey.description")); description.setRows(20); description.setCols(60); add(description); - add(new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.start_date").localize())); Date startDate = new Date(START_DATE); + startDate.setLabel(SurveyGlobalizationUtil + .globalize("cms.contenttypes.ui.survey.start_date")); add(startDate); - add(new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.end_date").localize())); Date endDate = new Date(END_DATE); + endDate.setLabel(SurveyGlobalizationUtil + .globalize("cms.contenttypes.ui.survey.end_date")); add(endDate); - add(new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.should_quiz_responses_be_public").localize())); ParameterModel responsesPublicParam = new BooleanParameter(RESPONSES_PUBLIC); responsesPublicParam.addParameterListener(new NotNullValidationListener()); RadioGroup responsesPublic = new RadioGroup(responsesPublicParam); - Option rp1 = new Option("true", new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.Yes").localize())); - Option rp2 = new Option("false", new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.No").localize())); + Option rp1 = new Option("true", new Label(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.Yes"))); + Option rp2 = new Option("false", new Label(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.No"))); + responsesPublic.setLabel(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.should_quiz_responses_be_public")); responsesPublic.addOption(rp1); responsesPublic.addOption(rp2); add(responsesPublic); - add(new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.show_results_during_survey").localize())); ParameterModel resultsDuringSurveyParam = new BooleanParameter(RESULTS_DURING_SURVEY); resultsDuringSurveyParam.addParameterListener(new NotNullValidationListener()); RadioGroup resultsDuringSurvey = new RadioGroup(resultsDuringSurveyParam); - Option rds1 = new Option("true", new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.Yes").localize())); - Option rds2 = new Option("false", new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.No").localize())); + Option rds1 = new Option("true", new Label(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.Yes"))); + Option rds2 = new Option("false", new Label(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.No"))); + resultsDuringSurvey.setLabel(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.show_results_during_survey")); resultsDuringSurvey.addOption(rds1); resultsDuringSurvey.addOption(rds2); add(resultsDuringSurvey); - add(new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.should_quiz_responses_be_anonym").localize())); ParameterModel responsesAnonymParam = new BooleanParameter(RESPONSES_ANONYM); responsesAnonymParam.addParameterListener(new NotNullValidationListener()); RadioGroup responsesAnonym = new RadioGroup(responsesAnonymParam); - Option ra1 = new Option("true", new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.Yes").localize())); - Option ra2 = new Option("false", new Label((String) SurveyGlobalizationUtil.globalize("cms.contenttypes.ui.survey.No").localize())); + Option ra1 = new Option("true", new Label(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.Yes"))); + Option ra2 = new Option("false", new Label(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.No"))); responsesAnonym.addOption(ra1); responsesAnonym.addOption(ra2); + responsesAnonym.setLabel(SurveyGlobalizationUtil.globalize( + "cms.contenttypes.ui.survey.should_quiz_responses_be_anonym")); add(responsesAnonym); } @@ -172,6 +189,7 @@ public class SurveyPropertiesForm extends BasicPageForm implements FormProcessLi } } + @Override public void submitted(FormSectionEvent e) throws FormProcessException { if ((m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) { m_step.cancelStreamlinedCreation(e.getPageState()); diff --git a/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/ui/XMLFeedProperties.java b/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/ui/XMLFeedProperties.java index 85f8c03df..ba7c1e6c7 100755 --- a/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/ui/XMLFeedProperties.java +++ b/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/ui/XMLFeedProperties.java @@ -65,11 +65,11 @@ public class XMLFeedProperties extends FormProperties { super.addWidgets(); m_url = new TextField(new StringParameter("url")); + m_url.setLabel(XMLFeedGlobalizationUtil.globalize( + "cms.contenttypes.ui.xmlfeed.feed_url")); m_url.setHint(XMLFeedGlobalizationUtil.globalize( "cms.contenttypes.ui.xmlfeed.feed_url_hint")); m_url.setSize(50); - add(new Label(XMLFeedGlobalizationUtil.globalize( - "cms.contenttypes.ui.xmlfeed.feed_url"))); add(m_url); } diff --git a/ccm-weblog/src/org/undp/weblog/ui/WebLogEditForm.java b/ccm-weblog/src/org/undp/weblog/ui/WebLogEditForm.java index 142263e38..9d39da216 100755 --- a/ccm-weblog/src/org/undp/weblog/ui/WebLogEditForm.java +++ b/ccm-weblog/src/org/undp/weblog/ui/WebLogEditForm.java @@ -27,149 +27,150 @@ import com.arsdigita.web.Web; * @author Peter Kopunec */ public class WebLogEditForm extends Form implements FormInitListener, - FormValidationListener, FormProcessListener { + FormValidationListener, + FormProcessListener { - private static final String NAME_TITLE = "title"; + private static final String NAME_TITLE = "title"; - private static final String NAME_LEAD = "lead"; + private static final String NAME_LEAD = "lead"; - private static final String NAME_BODY = "body"; + private static final String NAME_BODY = "body"; - private final WebLogView m_parent; + private final WebLogView m_parent; - private Submit m_save; + private Submit m_save; - private final boolean m_createNew; + private final boolean m_createNew; - public WebLogEditForm(WebLogView parent, boolean createNew) { - super("webLogEditForm"); - m_parent = parent; - m_createNew = createNew; + public WebLogEditForm(WebLogView parent, boolean createNew) { - setMethod("POST"); + super("webLogEditForm"); - add(new Label(GlobalizationUtil.localize("webLogEditForm.title")), - BlockStylable.RIGHT | BlockStylable.TOP); - add(new TextField(NAME_TITLE)); + m_parent = parent; + m_createNew = createNew; - add(new Label(GlobalizationUtil.localize("webLogEditForm.lead")), - BlockStylable.RIGHT | BlockStylable.TOP); - TextArea lead = new TextArea(NAME_LEAD); - lead.setCols(80); - lead.setRows(12); - add(lead); + setMethod("POST"); - add(new Label(GlobalizationUtil.localize("webLogEditForm.body")), - BlockStylable.RIGHT | BlockStylable.TOP); - DHTMLEditor body = new DHTMLEditor(NAME_BODY); - body.setCols(80); - body.setRows(20); - add(body); + add(new Label(GlobalizationUtil.globalize("webLogEditForm.title")), + BlockStylable.RIGHT | BlockStylable.TOP); + add(new TextField(NAME_TITLE)); - add(new Label("")); - SimpleContainer buttons = new SimpleContainer(); - m_save = new Submit(GlobalizationUtil.localize("saveButton")); - buttons.add(m_save); - buttons.add(new Submit(GlobalizationUtil.localize("cancelButton"))); - add(buttons); + TextArea lead = new TextArea(NAME_LEAD); + lead.setLabel(GlobalizationUtil.globalize("webLogEditForm.lead")); + lead.setCols(80); + lead.setRows(12); + add(lead); - addInitListener(this); - addValidationListener(this); - addProcessListener(this); - } + DHTMLEditor body = new DHTMLEditor(NAME_BODY); + body.setLabel(GlobalizationUtil.globalize("webLogEditForm.body")); + body.setCols(80); + body.setRows(20); + add(body); - public void init(FormSectionEvent e) throws FormProcessException { - if (!m_createNew) { - BigDecimal enityID = m_parent.getEntityID(e.getPageState()); - if (enityID != null) { - WebLog entity = new WebLog(enityID); - FormData data = e.getFormData(); - data.put(NAME_TITLE, entity.getTitle()); - data.put(NAME_LEAD, entity.getLead()); - data.put(NAME_BODY, entity.getBody()); - } - } - } + add(new Label("")); + SimpleContainer buttons = new SimpleContainer(); + m_save = new Submit(GlobalizationUtil.globalize("saveButton")); + buttons.add(m_save); + buttons.add(new Submit(GlobalizationUtil.globalize("cancelButton"))); + add(buttons); - public void validate(FormSectionEvent e) throws FormProcessException { - if (m_save.isSelected(e.getPageState())) { - validate(e.getFormData()); - } - } + addInitListener(this); + addValidationListener(this); + addProcessListener(this); + } - private boolean validate(FormData data) { - if (!m_parent.canUserAdminApplication()) { - data.addError("Insufficient rights"); - } + public void init(FormSectionEvent e) throws FormProcessException { + if (!m_createNew) { + BigDecimal enityID = m_parent.getEntityID(e.getPageState()); + if (enityID != null) { + WebLog entity = new WebLog(enityID); + FormData data = e.getFormData(); + data.put(NAME_TITLE, entity.getTitle()); + data.put(NAME_LEAD, entity.getLead()); + data.put(NAME_BODY, entity.getBody()); + } + } + } - String title = (String) data.get(NAME_TITLE); - if (title == null || title.length() == 0) { - data.addError(NAME_TITLE, GlobalizationUtil - .localize("error.parameterRequired")); - } else { - if (title.length() > 200) { - data.addError(NAME_TITLE, GlobalizationUtil - .localize("error.parameterSize200")); - } - } + public void validate(FormSectionEvent e) throws FormProcessException { + if (m_save.isSelected(e.getPageState())) { + validate(e.getFormData()); + } + } - String lead = (String) data.get(NAME_LEAD); - if (lead == null || lead.length() == 0) { - data.addError(NAME_LEAD, GlobalizationUtil - .localize("error.parameterRequired")); - } else { - if (lead.length() > 4000) { - data.addError(NAME_LEAD, GlobalizationUtil - .localize("error.parameterSize4000")); - } - } + private boolean validate(FormData data) { + if (!m_parent.canUserAdminApplication()) { + data.addError("Insufficient rights"); + } - String body = (String) data.get(NAME_BODY); - if (body == null || body.length() == 0) { - data.addError(NAME_BODY, GlobalizationUtil - .localize("error.parameterRequired")); - } + String title = (String) data.get(NAME_TITLE); + if (title == null || title.length() == 0) { + data.addError(NAME_TITLE, GlobalizationUtil + .localize("error.parameterRequired")); + } else { + if (title.length() > 200) { + data.addError(NAME_TITLE, GlobalizationUtil + .localize("error.parameterSize200")); + } + } - return data.isValid(); - } + String lead = (String) data.get(NAME_LEAD); + if (lead == null || lead.length() == 0) { + data.addError(NAME_LEAD, GlobalizationUtil + .localize("error.parameterRequired")); + } else { + if (lead.length() > 4000) { + data.addError(NAME_LEAD, GlobalizationUtil + .localize("error.parameterSize4000")); + } + } - public void process(FormSectionEvent e) throws FormProcessException { - PageState ps = e.getPageState(); - if (m_save.isSelected(ps)) { - FormData data = e.getFormData(); - if (validate(data)) { - String title = (String) data.get(NAME_TITLE); - String lead = (String) data.get(NAME_LEAD); - String body = (String) data.get(NAME_BODY); + String body = (String) data.get(NAME_BODY); + if (body == null || body.length() == 0) { + data.addError(NAME_BODY, GlobalizationUtil + .localize("error.parameterRequired")); + } - WebLog entity; - if (m_createNew) { - entity = new WebLog(); - entity.setApplication((WebLogApplication) Web.getWebContext() - .getApplication()); - entity.setOwner(Web.getWebContext().getUser()); - } else { - BigDecimal enityID = (BigDecimal) m_parent - .getEntityIDParam().transformValue( - e.getPageState().getRequest()); - entity = new WebLog(enityID); - } - entity.setTitle(title); - entity.setLead(lead); - entity.setBody(body); - entity.save(); - processBack(ps); - } - } else { - processBack(ps); - } - } + return data.isValid(); + } - protected WebLogView getParent() { - return m_parent; - } + public void process(FormSectionEvent e) throws FormProcessException { + PageState ps = e.getPageState(); + if (m_save.isSelected(ps)) { + FormData data = e.getFormData(); + if (validate(data)) { + String title = (String) data.get(NAME_TITLE); + String lead = (String) data.get(NAME_LEAD); + String body = (String) data.get(NAME_BODY); - protected void processBack(PageState ps) { - m_parent.displayWebLogsList(ps); - } + WebLog entity; + if (m_createNew) { + entity = new WebLog(); + entity.setApplication((WebLogApplication) Web.getWebContext() + .getApplication()); + entity.setOwner(Web.getWebContext().getUser()); + } else { + BigDecimal enityID = (BigDecimal) m_parent + .getEntityIDParam().transformValue( + e.getPageState().getRequest()); + entity = new WebLog(enityID); + } + entity.setTitle(title); + entity.setLead(lead); + entity.setBody(body); + entity.save(); + processBack(ps); + } + } else { + processBack(ps); + } + } + + protected WebLogView getParent() { + return m_parent; + } + + protected void processBack(PageState ps) { + m_parent.displayWebLogsList(ps); + } }