Modified various forms to use the label attribute instead of Label widget to name an input field.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2737 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2014-07-06 07:22:13 +00:00
parent 40f71ce13f
commit 550c37569b
53 changed files with 636 additions and 496 deletions

View File

@ -44,6 +44,7 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
/**
* Constructor
* @param model
**/
public FileAttachmentModelBuilder(ItemSelectionModel model) {
super();
@ -51,14 +52,18 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
}
/**
* @param table
* @param state
* @return a TableModel represented by the PageState
**/
@Override
public TableModel makeModel(Table table, PageState state) {
m_table = table;
return new FileAttachmentTableModel(getDataCollection(state));
}
/**
* @param state
* @return a data collection of Contacts
**/
public DataCollection getDataCollection(PageState state) {
@ -86,6 +91,7 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
/**
* @return the number of columns in the table model
**/
@Override
public int getColumnCount() {
return 1;
}
@ -94,6 +100,7 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
* @return true if there is more rows in this table model and
* false otherwise
**/
@Override
public boolean nextRow() {
if (_collection == null) {
return false;
@ -115,6 +122,7 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
* @return the Object for the specified column for the
* the current row
**/
@Override
public Object getElementAt(int columnIndex) {
if (columnIndex == 4) {
if(FileAttachment.getConfig().isShowAssetIDEnabled()){
@ -137,6 +145,7 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
/**
* @returns the Object key for the specified column
**/
@Override
public Object getKeyAt(int columnIndex) {
return _file.getID().toString();
}

View File

@ -96,13 +96,7 @@ public class FileAttachmentsStep extends SecurityPropertyEditor {
// The upload form.
m_uploadForm = new FileAttachmentUpload(m_item);
add("upload",
// XXX todo: method add expects a plain string as label parameter. Use
// of tostring() is ugly and not supported API (for debugging only).
// add method has to be refactored to accept a GlobalizedMessage
// Parameter instead of a plain string for the Label (2. parameter) !
// It is uggly to make an additional localize() to get an object which
// can be casted to String!
(String)FileAttachmentGlobalize.UploadNewFileLabel().localize(),
FileAttachmentGlobalize.UploadNewFileLabel(),
new WorkflowLockedComponentAccess(m_uploadForm, m_item),
m_uploadForm.getSaveCancelSection().getCancelButton());

View File

@ -87,7 +87,9 @@ public class FileDescriptionForm extends FormSection implements
*
* @param e
* the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void submitted(FormSectionEvent e) throws FormProcessException {
if (m_cancel.isSelected(e.getPageState())) {
m_fileModel.clearSelection(e.getPageState());
@ -99,9 +101,10 @@ public class FileDescriptionForm extends FormSection implements
/**
* Validation listener.
*
* @param event
* the FormSectionEvent
* @param event the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void validate(FormSectionEvent event) throws FormProcessException {
PageState state = event.getPageState();
FormData data = event.getFormData();
@ -116,6 +119,7 @@ public class FileDescriptionForm extends FormSection implements
* @param fse
* the FormSectionEvent
*/
@Override
public void init(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
@ -133,7 +137,9 @@ public class FileDescriptionForm extends FormSection implements
*
* @param fse
* the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void process(FormSectionEvent fse) throws FormProcessException {
PageState state = fse.getPageState();

View File

@ -97,78 +97,97 @@ public class AgendaPropertyForm extends BasicPageForm
protected void addWidgets() {
super.addWidgets();
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.summary")));
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.summary")));
ParameterModel summaryParam = new StringParameter(SUMMARY);
//summaryParam
// .addParameterListener(new NotNullValidationListener());
summaryParam.addParameterListener(new StringInRangeValidationListener(0, 4000));
TextArea summary = new TextArea(summaryParam);
summary.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.summary"));
summary.setCols(40);
summary.setRows(5);
summary.setHint(AgendaGlobalizationUtil.globalize(
"cms.contenttypes.ui.summary"));
add(summary);
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.agenda_date")));
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.agenda.agenda_date")));
ParameterModel agendaDateParam = new DateTimeParameter(AGENDA_DATE);
agendaDateParam
.addParameterListener(new NotNullValidationListener());
DateTime agendaDate = new DateTime(agendaDateParam);
agendaDate.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.agenda_date"));
add(agendaDate);
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.location")));
/* Input field for Location */
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.agenda.location")));
ParameterModel locationParam = new StringParameter(LOCATION);
//locationParam
// .addParameterListener(new NotNullValidationListener());
locationParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextArea location = new TextArea(locationParam);
location.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.location"));
location.setCols(40);
location.setRows(3);
add(location);
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.attendees")));
/* Input field for Attendees */
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.agenda.attendees")));
ParameterModel attendeesParam = new StringParameter(ATTENDEES);
//attendeesParam
// .addParameterListener(new NotNullValidationListener());
attendeesParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextArea attendees = new TextArea(attendeesParam);
attendees.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.attendees"));
attendees.setCols(40);
attendees.setRows(3);
add(attendees);
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.subject_items")));
/* Input field for Subject Items */
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.agenda.subject_items")));
ParameterModel subjectItemsParam = new StringParameter(SUBJECT_ITEMS);
//subjectItemsParam
// .addParameterListener(new NotNullValidationListener());
subjectItemsParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextArea subjectItems = new TextArea(subjectItemsParam);
subjectItems.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.subject_items"));
subjectItems.setCols(40);
subjectItems.setRows(3);
add(subjectItems);
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.contact_info")));
/* Input field for Contact Info */
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.agenda.contact_info")));
ParameterModel contactInfoParam = new StringParameter(CONTACT_INFO);
//contactInfoParam
// .addParameterListener(new NotNullValidationListener());
contactInfoParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextArea contactInfo = new TextArea(contactInfoParam);
contactInfo.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.contact_info"));
contactInfo.setCols(40);
contactInfo.setRows(3);
add(contactInfo);
add(new Label(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.creation_date")));
/* Input field for Contact Info */
// add(new Label(AgendaGlobalizationUtil
// .globalize("cms.contenttypes.ui.agenda.creation_date")));
ParameterModel creationDateParam = new DateParameter(CREATION_DATE);
creationDateParam
.addParameterListener(new NotNullValidationListener());
com.arsdigita.bebop.form.Date creationDate
= new com.arsdigita.bebop.form.Date(creationDateParam);
creationDate.setLabel(AgendaGlobalizationUtil
.globalize("cms.contenttypes.ui.agenda.creation_date"));
add(creationDate);
@ -176,7 +195,9 @@ public class AgendaPropertyForm extends BasicPageForm
/**
* Form initialisation hook. Fills widgets with data.
* @param fse
**/
@Override
public void init(FormSectionEvent fse) {
FormData data = fse.getFormData();
Agenda agenda = (Agenda) super.initBasicWidgets(fse);
@ -197,7 +218,9 @@ public class AgendaPropertyForm extends BasicPageForm
data.put(SUMMARY, agenda.getSummary());
}
/** Cancels streamlined editing. */
/** Cancels streamlined editing.
* @param fse */
@Override
public void submitted( FormSectionEvent fse ) {
if (m_step != null &&
getSaveCancelSection().getCancelButton()
@ -207,8 +230,10 @@ public class AgendaPropertyForm extends BasicPageForm
}
/**
* Form processing hook. Saves Agenda object.
* Form processing hook, saves Agenda object.
* @param fse
*/
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();

View File

@ -20,7 +20,6 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSubmissionListener;
@ -78,24 +77,20 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
protected void addWidgets() {
super.addWidgets();
//add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.lead")));
ParameterModel leadParam = new StringParameter(LEAD);
if (ContentSection.getConfig().mandatoryDescriptions()) {
leadParam.addParameterListener(
new NotEmptyValidationListener(
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);
lead.setLabel(GlobalizationUtil.globalize("cms.contenttypes.ui.lead"));
lead.setHint(GlobalizationUtil.globalize("cms.contenttypes.ui.lead_hint"));
lead.setCols(40);
lead.setRows(5);
add(lead);
}

View File

@ -36,10 +36,12 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* to edit BasicPageForm the basic properties of an Bookmark. This form can be extended to create forms for Bookmark
* subclasses.
* to edit BasicPageForm the basic properties of an Bookmark. This form can be
* extended to create forms for Bookmarksubclasses.
*/
public class BookmarkPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener {
public class BookmarkPropertyForm extends BasicPageForm
implements FormProcessListener,
FormInitListener {
/**
* parameter names
@ -57,11 +59,15 @@ public class BookmarkPropertyForm extends BasicPageForm implements FormProcessLi
private final BookmarkPropertiesStep step;
/**
* Creates a new form to edit the Bookmark object specified by the item selection model passed in.
* Creates a new form to edit the Bookmark object specified by the
* item selection model passed in.
*
* @param itemModel The ItemSelectionModel to use to obtain the Bookmark to work on
* @param itemModel The ItemSelectionModel to use to obtain the Bookmark
* to work on
* @param step
*/
public BookmarkPropertyForm(final ItemSelectionModel itemModel, final BookmarkPropertiesStep step) {
public BookmarkPropertyForm(final ItemSelectionModel itemModel,
final BookmarkPropertiesStep step) {
super(ID, itemModel);
this.step = step;
}
@ -73,27 +79,33 @@ public class BookmarkPropertyForm extends BasicPageForm implements FormProcessLi
protected void addWidgets() {
super.addWidgets();
add(new Label(GlobalizationUtil.globalize(
"cms.contenttypes.ui.summary")));
//add(new Label(GlobalizationUtil.globalize(
// "cms.contenttypes.ui.summary")));
final ParameterModel descriptionParam = new StringParameter(DESCRIPTION);
final TextArea description = new TextArea(descriptionParam);
description.setLabel(GlobalizationUtil.globalize(
"cms.contenttypes.ui.summary"));
description.setCols(40);
description.setRows(5);
description.setHint(GlobalizationUtil.globalize(
"cms.contenttypes.ui.summary_hint"));
add(description);
add(new Label(new GlobalizedMessage("cms.contenttypes.ui.bookmark.url", Bookmark.RESOURCES)));
// add(new Label(new GlobalizedMessage("cms.contenttypes.ui.bookmark.url", Bookmark.RESOURCES)));
final ParameterModel urlParam = new StringParameter(URL);
final TextField url = new TextField(urlParam);
url.setLabel(GlobalizationUtil.globalize(
"cms.contenttypes.ui.bookmark.url"));
url.setSize(40);
add(url);
}
/**
* @param fse
* Form initialisation hook. Fills widgets with data.
*/
@Override
public void init(final FormSectionEvent fse) {
final FormData data = fse.getFormData();
final Bookmark item = (Bookmark) super.initBasicWidgets(fse);
@ -104,7 +116,9 @@ public class BookmarkPropertyForm extends BasicPageForm implements FormProcessLi
/**
* Form processing hook. Saves Bookmark object.
* @param fse
*/
@Override
public void process(final FormSectionEvent fse) {
final FormData data = fse.getFormData();

View File

@ -89,7 +89,7 @@ public class DecisionTreeOptionEditForm extends Form
/**
* Constructor.
*
* @param selArticle the current article
* @param selTree the current decision tree
* @param selOption the current section
* @param container container which this form is added to
*/
@ -133,6 +133,7 @@ public class DecisionTreeOptionEditForm extends Form
/**
* Returns the save/cancel section from this form.
* @return
*/
public SaveCancelSection getSaveCancelSection() {
return m_saveCancelSection;
@ -161,7 +162,9 @@ public class DecisionTreeOptionEditForm extends Form
/**
* Form initialisation hook.
* @param fse
*/
@Override
public void init(FormSectionEvent fse) {
PageState state = fse.getPageState();
FormData data = fse.getFormData();
@ -205,27 +208,34 @@ public class DecisionTreeOptionEditForm extends Form
add(m_sectionWidget);
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.options.form.label")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.options.form.label")));
TextField labelWidget = new TextField(new TrimmedStringParameter(LABEL));
labelWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.options.form.label"));
labelWidget.addValidationListener(new NotNullValidationListener());
labelWidget.setSize(60);
add(labelWidget);
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.options.form.value")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.options.form.value")));
TextField valueWidget = new TextField(new TrimmedStringParameter(VALUE));
valueWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.options.form.value"));
valueWidget.addValidationListener(new NotNullValidationListener());
valueWidget.setSize(60);
add(valueWidget);
}
/**
* @param event
* @throws com.arsdigita.bebop.FormProcessException
* Called on form submission. Check to see if the user clicked the
* cancel button. If they did, don't continue with the form.
*/
@Override
public void submitted(FormSectionEvent event)
throws FormProcessException {
throws FormProcessException {
PageState state = event.getPageState();
if ( m_saveCancelSection.getCancelButton()
@ -234,23 +244,27 @@ public class DecisionTreeOptionEditForm extends Form
state, DecisionTreeOptionStep.OPTION_TABLE +
m_container.getTypeIDStr());
throw new FormProcessException(
(String)DecisionTreeGlobalizationUtil.globalize(
DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.options.form.submission_cancelled")
.localize());
);
}
}
/**
* Called after form has been validated. Create the new SectionOption and
* assign it to the current DecisionTree.
*
* @param event
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void process(FormSectionEvent event) throws FormProcessException {
PageState state = event.getPageState();
FormData data = event.getFormData();
DecisionTreeSection section = new DecisionTreeSection(new BigDecimal((String)data.get(SECTION)));
DecisionTreeSectionOption option = null;
DecisionTreeSectionOption option;
if (m_selOption.getSelectedKey(state) != null) {
BigDecimal id = new BigDecimal(m_selOption
.getSelectedKey(state).toString());

View File

@ -19,7 +19,6 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
@ -43,11 +42,11 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
public class DecisionTreePropertiesForm extends BasicPageForm implements
FormProcessListener, FormInitListener, FormSubmissionListener {
private final static String ID = "FORM_PROPERTIES";
public final static String DESCRIPTION = "description";
public final static String CANCEL_URL = "cancelURL";
private final static String ID = "FORM_PROPERTIES";
public final static String DESCRIPTION = "description";
public final static String CANCEL_URL = "cancelURL";
private DecisionTreePropertiesStep m_step;
private final DecisionTreePropertiesStep m_step;
/**
* Creates a new form to edit the Consultation object specified by the item
@ -69,22 +68,30 @@ public class DecisionTreePropertiesForm extends BasicPageForm implements
protected void addWidgets() {
super.addWidgets();
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.properties.form.description_label")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.properties.form.description_label")));
TextArea description = new TextArea(new TrimmedStringParameter(DESCRIPTION));
description.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.properties.form.description_label"));
description.setRows(5);
description.setCols(30);
add(description);
add(new Label(DecisionTreeGlobalizationUtil.globalize
("cms.contenttypes.ui.decisiontree.properties.cancel_url")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize
// ("cms.contenttypes.ui.decisiontree.properties.cancel_url")));
TextField cancelURL = new TextField(new StringParameter(CANCEL_URL));
cancelURL.setLabel(DecisionTreeGlobalizationUtil.globalize
("cms.contenttypes.ui.decisiontree.properties.cancel_url"));
cancelURL.setSize(60);
add(cancelURL);
}
/** Cancels streamlined editing. */
/**
* Cancels streamlined editing.
* @param fse
*/
@Override
public void submitted(FormSectionEvent fse) {
PageState state = fse.getPageState();
@ -94,7 +101,11 @@ public class DecisionTreePropertiesForm extends BasicPageForm implements
}
}
/** Form processing hook. Saves Event object. */
/**
* Form processing hook. Saves Event object.
* @param fse
*/
@Override
public void process(FormSectionEvent fse) {
PageState state = fse.getPageState();
FormData data = fse.getFormData();
@ -108,7 +119,11 @@ public class DecisionTreePropertiesForm extends BasicPageForm implements
m_step.maybeForwardToNextStep(state);
}
/** Form initialisation hook. Fills widgets with data. */
/**
* Form initialisation hook. Fills widgets with data.
* @param fse
*/
@Override
public void init(FormSectionEvent fse) {
DecisionTree item = (DecisionTree)initBasicWidgets(fse);

View File

@ -109,6 +109,7 @@ public class DecisionTreeSectionDeleteForm extends Form
* @param event
* @throws FormProcessException
*/
@Override
public void init ( FormSectionEvent event ) throws FormProcessException {
String sectionTitle = " ";
@ -127,17 +128,19 @@ public class DecisionTreeSectionDeleteForm extends Form
m_sectionNameValue[0] = sectionTitle;
}
@Override
public void submitted ( FormSectionEvent event ) throws FormProcessException {
PageState state = event.getPageState();
if ( m_saveCancelSection.getCancelButton().isSelected(state) ) {
throw new FormProcessException( (String)
throw new FormProcessException(
DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.submission_cancelled")
.localize());
);
}
}
@Override
public void process ( FormSectionEvent event ) throws FormProcessException {
PageState state = event.getPageState();

View File

@ -27,7 +27,6 @@ import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
@ -91,7 +90,7 @@ public class DecisionTreeSectionEditForm extends Form
/**
* Constructor creates an emnpty section form.
*
* @param selArticle the current article
* @param selTree the current Decision Tree
* @param selSection the current section
* @param container container which this form is added to
*/
@ -140,6 +139,8 @@ public class DecisionTreeSectionEditForm extends Form
/**
* Returns the save/cancel section from this form.
*
* @return
*/
public SaveCancelSection getSaveCancelSection() {
return m_saveCancelSection;
@ -149,24 +150,30 @@ public class DecisionTreeSectionEditForm extends Form
* Add form widgets for a Section.
*/
protected void addWidgets() {
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.title_label")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.sections.form.title_label")));
TextField titleWidget = new TextField(new TrimmedStringParameter(TITLE));
titleWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.title_label"));
titleWidget.addValidationListener(new NotEmptyValidationListener());
add(titleWidget);
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.parameter_name_label")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.sections.form.parameter_name_label")));
TextField parameterWidget = new TextField(new TrimmedStringParameter(PARAMETER_NAME));
parameterWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.parameter_name_label"));
parameterWidget.addValidationListener(new NotEmptyValidationListener());
parameterWidget.addValidationListener(new DecisionTreeParameterNameValidationListener());
add(parameterWidget);
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.instructions_label")),
ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH);
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.sections.form.instructions_label")),
// ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH);
CMSDHTMLEditor textWidget =
new CMSDHTMLEditor(new TrimmedStringParameter(INSTRUCTIONS));
textWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.instructions_label"));
textWidget.setRows(40);
textWidget.setCols(70);
textWidget.setWrap(CMSDHTMLEditor.SOFT);
@ -178,9 +185,13 @@ public class DecisionTreeSectionEditForm extends Form
* Initialize the form. If there is a selected section, ie. this
* is an 'edit' step rather than a 'create new' step, load the data
* into the form fields.
*
* @param event
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void init( FormSectionEvent event )
throws FormProcessException {
throws FormProcessException {
PageState state = event.getPageState();
FormData data = event.getFormData();
m_selInstructions.setSelectedObject(state,null);
@ -211,9 +222,12 @@ public class DecisionTreeSectionEditForm extends Form
/**
* Called on form submission. Check to see if the user clicked the
* cancel button. If they did, don't continue with the form.
* @param event
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void submitted( FormSectionEvent event )
throws FormProcessException {
throws FormProcessException {
PageState state = event.getPageState();
if ( m_saveCancelSection.getCancelButton()
@ -222,18 +236,22 @@ public class DecisionTreeSectionEditForm extends Form
state, DecisionTreeSectionStep.SECTION_TABLE +
m_container.getTypeIDStr());
throw new FormProcessException(
(String)DecisionTreeGlobalizationUtil.globalize(
DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.sections.form.submission_cancelled")
.localize());
);
}
}
/**
* Called after form has been validated. Create the new TreeSection and
* assign it to the current DecisionTree.
*
* @param event
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void process(FormSectionEvent event)
throws FormProcessException {
throws FormProcessException {
PageState state = event.getPageState();
FormData data = event.getFormData();
@ -282,6 +300,10 @@ public class DecisionTreeSectionEditForm extends Form
/**
* Utility method to create a Section from the form data supplied.
*
* @param event
* @param tree
* @return
*/
protected DecisionTreeSection createSection(FormSectionEvent event,
DecisionTree tree) {

View File

@ -50,6 +50,7 @@ import com.arsdigita.cms.contenttypes.DecisionTreeSection;
import com.arsdigita.cms.contenttypes.DecisionTreeSectionCollection;
import com.arsdigita.cms.contenttypes.util.DecisionTreeGlobalizationUtil;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* Form to edit an DecisionTreeOptionTarget for a DecisionTree.
@ -248,47 +249,50 @@ public class DecisionTreeTargetEditForm extends Form
new Label( DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.none")));
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.match_value")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.targets.form.match_value")));
m_matchValueWidget = new SingleSelect(MATCH_OPTION);
m_matchValueWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.match_value"));
m_matchValueWidget.addValidationListener(new NotNullValidationListener());
m_matchValueWidget.addOption(pleaseSelect);
try {
m_matchValueWidget.addPrintListener(new PrintListener() {
public void prepare(PrintEvent e) {
initMatchOptions(e);
}
});
try {
m_matchValueWidget.addPrintListener(new PrintListener() {
@Override
public void prepare(PrintEvent e) {
initMatchOptions(e);
}
});
} catch (TooManyListenersException e) {
throw new RuntimeException(e);
}
add(m_matchValueWidget);
add(m_matchValueWidget);
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.target_url_label")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.targets.form.target_url_label")));
m_targetURLWidget = new TextField(TARGET_URL);
m_targetURLWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.target_url_label"));
m_targetURLWidget.setSize(60);
add(m_targetURLWidget);
add(new Label(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.target_section_label")));
// add(new Label(DecisionTreeGlobalizationUtil.globalize(
// "cms.contenttypes.ui.decisiontree.targets.form.target_section_label")));
m_targetSectionWidget = new SingleSelect(TARGET_SECTION);
m_targetSectionWidget.setLabel(DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.target_section_label"));
m_targetSectionWidget.addOption(none);
try {
m_targetSectionWidget.addPrintListener(new PrintListener() {
try {
m_targetSectionWidget.addPrintListener(new PrintListener() {
@Override
public void prepare(PrintEvent e) {
initTargetOptions(e);
}
});
public void prepare(PrintEvent e) {
initTargetOptions(e);
}
});
} catch (TooManyListenersException e) {
throw new RuntimeException(e);
}
add(m_targetSectionWidget);
add(m_targetSectionWidget);
addValidationListener(new FormValidationListener() {
@Override
@ -297,17 +301,15 @@ public class DecisionTreeTargetEditForm extends Form
final PageState state = event.getPageState();
if ("".equals(m_targetURLWidget.getValue(state))
&& "".equals(m_targetSectionWidget.getValue(state))) {
String msg = (String) DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.target_required")
.localize();
GlobalizedMessage msg = DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.target_required");
throw new FormProcessException(msg);
}
if (!"".equals(m_targetURLWidget.getValue(state))
&& !"".equals(m_targetSectionWidget.getValue(state))) {
String msg = (String) DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.duplicate_target")
.localize();
GlobalizedMessage msg = DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.duplicate_target");
throw new FormProcessException(msg);
}
}
@ -325,21 +327,22 @@ public class DecisionTreeTargetEditForm extends Form
throws FormProcessException {
PageState state = event.getPageState();
if ( m_saveCancelSection.getCancelButton()
.isSelected(state) && m_container != null) {
m_container.onlyShowComponent(
state, DecisionTreeTargetStep.TARGET_TABLE +
m_container.getTypeIDStr());
throw new FormProcessException(
(String)DecisionTreeGlobalizationUtil.globalize(
if ( m_saveCancelSection.getCancelButton().isSelected(state)
&& m_container != null) {
m_container.onlyShowComponent(state,
DecisionTreeTargetStep.TARGET_TABLE +
m_container.getTypeIDStr());
throw new FormProcessException(
DecisionTreeGlobalizationUtil.globalize(
"cms.contenttypes.ui.decisiontree.targets.form.submission_cancelled")
.localize());
}
);
}
}
/**
* Called after form has been validated. Create the new
* DecisionTreeOptionTarget and assign it to the current DecisionTree.
*
* @param event
* @throws com.arsdigita.bebop.FormProcessException
*/
@ -358,7 +361,7 @@ public class DecisionTreeTargetEditForm extends Form
targetSection = new DecisionTreeSection(new BigDecimal(sectionID));
}
DecisionTreeOptionTarget target = null;
DecisionTreeOptionTarget target;
if (m_selTarget.getSelectedKey(state) != null) {
BigDecimal id = new BigDecimal(m_selTarget
.getSelectedKey(state).toString());

View File

@ -82,39 +82,49 @@ public class FAQItemPropertyForm extends BasicPageForm
/**
* Adds widgets to the form.
*/
@Override
protected void addWidgets() {
super.addWidgets();
add( new Label(FAQGlobalizationUtil
.globalize("cms.contenttypes.ui.faq.question")) );
// add( new Label(FAQGlobalizationUtil
// .globalize("cms.contenttypes.ui.faq.question")) );
ParameterModel questionParam
= new StringParameter( QUESTION );
questionParam
.addParameterListener( new NotNullValidationListener() );
TextArea question = new TextArea( questionParam );
question.setLabel(FAQGlobalizationUtil
.globalize("cms.contenttypes.ui.faq.question"));
question.setCols( 40 );
question.setRows( 5 );
add( question );
add( new Label(FAQGlobalizationUtil
.globalize("cms.contenttypes.ui.faq.answer")) );
// add( new Label(FAQGlobalizationUtil
// .globalize("cms.contenttypes.ui.faq.answer")) );
ParameterModel answerParam = new StringParameter( ANSWER );
answerParam
.addParameterListener( new NotNullValidationListener() );
answerParam.addParameterListener( new NotNullValidationListener() );
TextArea answer = new TextArea( answerParam );
answer.setLabel(FAQGlobalizationUtil
.globalize("cms.contenttypes.ui.faq.answer"));
answer.setCols( 40 );
answer.setRows( 5 );
add( answer );
add( new Label(FAQGlobalizationUtil
.globalize("cms.contenttypes.ui.faq.sectionName")) );
// add( new Label(FAQGlobalizationUtil
// .globalize("cms.contenttypes.ui.faq.sectionName")) );
ParameterModel sectionNameParam = new StringParameter( SECTION_NAME );
TextField sectionName = new TextField(sectionNameParam);
sectionName.setLabel(FAQGlobalizationUtil
.globalize("cms.contenttypes.ui.faq.sectionName"));
add(sectionName);
}
/** 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();
FAQItem faqItem = (FAQItem) super.initBasicWidgets( fse );
@ -124,7 +134,12 @@ public class FAQItemPropertyForm extends BasicPageForm
data.put(SECTION_NAME , faqItem.getSectionName());
}
/** Cancels streamlined editing. */
/**
* Cancels streamlined editing.
*
* @param fse
*/
@Override
public void submitted( FormSectionEvent fse ) {
if (m_step != null &&
getSaveCancelSection().getCancelButton()
@ -133,20 +148,22 @@ public class FAQItemPropertyForm extends BasicPageForm
}
}
/** Form processing hook. Saves FAQItem object. */
/**
* Form processing hook. Saves FAQItem object.
* @param fse */
@Override
public void process( FormSectionEvent fse ) {
FormData data = fse.getFormData();
FAQItem faqItem = (FAQItem) super.processBasicWidgets( fse );
// save only if save button was pressed
if( faqItem != null
&& getSaveCancelSection().getSaveButton()
.isSelected( fse.getPageState() ) ) {
faqItem.setQuestion( (String) data.get( QUESTION ) );
faqItem.setAnswer( (String) data.get( ANSWER ) );
faqItem.setSectionName( (String) data.get( SECTION_NAME) );
faqItem.save();
if( faqItem != null && getSaveCancelSection().getSaveButton()
.isSelected( fse.getPageState() ) ) {
faqItem.setQuestion( (String) data.get( QUESTION ) );
faqItem.setAnswer( (String) data.get( ANSWER ) );
faqItem.setSectionName( (String) data.get( SECTION_NAME) );
faqItem.save();
}
if (m_step != null) {
m_step.maybeForwardToNextStep(fse.getPageState());

View File

@ -79,18 +79,23 @@ public class FileStorageItemPropertyForm
protected void addWidgets() {
super.addWidgets();
add( new Label( GlobalizationUtil.globalize("cms.contenttypes.ui.lead") ) );
ParameterModel descriptionParam
= new StringParameter( FileStorageItem.DESCRIPTION );
// add( new Label( GlobalizationUtil.globalize("cms.contenttypes.ui.lead") ) );
ParameterModel descriptionParam = new StringParameter( FileStorageItem
.DESCRIPTION );
// descriptionParam.addParameterListener( new NotNullValidationListener() );
CMSDHTMLEditor description = new CMSDHTMLEditor( descriptionParam );
description.setLabel(GlobalizationUtil.globalize("cms.contenttypes.ui.lead"));
description.setCols( 40 );
description.setRows( 8 );
add( description );
}
/** 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();
FileStorageItem glossary_item
@ -99,7 +104,11 @@ public class FileStorageItemPropertyForm
data.put( FileStorageItem.DESCRIPTION, glossary_item.getDescription() );
}
/** Cancels streamlined editing. */
/**
* Cancels streamlined editing.
* @param fse
*/
@Override
public void submitted( FormSectionEvent fse ) {
if (m_step != null &&
getSaveCancelSection().getCancelButton()
@ -108,7 +117,9 @@ public class FileStorageItemPropertyForm
}
}
/** Form processing hook. Saves FileStorageItem object. */
/** Form processing hook. Saves FileStorageItem object.
* @param fse */
@Override
public void process( FormSectionEvent fse ) {
FormData data = fse.getFormData();

View File

@ -105,8 +105,8 @@ public class FormActions extends ProcessListenerEditor {
panel.setColumnWidth(2, "80%");
panel.setWidth("100%");
m_lrForm.add(new Label(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.form_mode_label")) );
// m_lrForm.add(new Label(FormItemGlobalizationUtil.globalize(
// "cms.contenttypes.ui.form_item.form_mode_label")) );
m_localRemote = new RadioGroup("remote");
Option local = new Option(Boolean.FALSE.toString(),
@ -118,9 +118,12 @@ public class FormActions extends ProcessListenerEditor {
"cms.contenttypes.ui.form_item.form_mode_remote")) );
m_localRemote.addOption(local);
m_localRemote.addOption(remote);
m_localRemote.setLabel(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.form_mode_label"));
m_localRemote.setLayout(RadioGroup.VERTICAL);
m_lrForm.add(m_localRemote);
m_remoteLabel = new Label(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.remote_url_label"));
m_lrForm.add(m_remoteLabel);

View File

@ -18,14 +18,20 @@
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Bebop;
import com.arsdigita.bebop.FormData;
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.DHTMLEditor;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.util.BebopConstants;
import com.arsdigita.cms.contenttypes.GlossaryItem;
import com.arsdigita.cms.contenttypes.util.GlossaryGlobalizationUtil;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.CMSDHTMLEditor;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.globalization.GlobalizedMessage;
@ -83,9 +89,39 @@ public class GlossaryItemPropertyForm extends BasicPageForm
*/
super.addWidgets();
GlossaryItemWidgetBuilder builder = new GlossaryItemWidgetBuilder();
add(builder.makeDefinitionLabel());
add(builder.makeDefinitionArea());
TextArea definition;
switch (GlossaryItem.getConfig().getDefinitionEditorType()) {
case WYSIWYG:
definition = new CMSDHTMLEditor(DEFINITION);
((CMSDHTMLEditor) definition).setWrap(DHTMLEditor.SOFT);
if (Bebop.getConfig().getDHTMLEditor()
.equals(BebopConstants.BEBOP_FCKEDITOR))
{
((CMSDHTMLEditor) definition).setConfig(
new DHTMLEditor.Config("glossaryitem",
GlossaryItem.getConfig().getFckEditorConfig()));
} else {
// remove this so end users cannot browse through back end
// folder system
((CMSDHTMLEditor) definition).hideButton("insertlink");
}
break;
default:
definition = new TextArea(DEFINITION);
definition.setWrap(TextArea.SOFT);
break;
}
definition.setLabel(GlossaryGlobalizationUtil
.globalize("cms.contenttypes.ui.glossary.definition"));
definition.addValidationListener(new NotNullValidationListener());
definition.setCols(40);
definition.setRows(5);
add(definition);
// GlossaryItemWidgetBuilder builder = new GlossaryItemWidgetBuilder();
// add(builder.makeDefinitionLabel());
// add(builder.makeDefinitionArea());
}
/**

View File

@ -39,7 +39,9 @@ import static com.arsdigita.cms.contenttypes.ui.GlossaryItemPropertyForm.DEFINIT
public class GlossaryItemWidgetBuilder {
public TextArea makeDefinitionArea() {
TextArea definition = null;
TextArea definition;
switch (GlossaryItem.getConfig().getDefinitionEditorType()) {
case WYSIWYG:
definition = new CMSDHTMLEditor(DEFINITION);
@ -62,14 +64,16 @@ public class GlossaryItemWidgetBuilder {
break;
}
definition.setLabel(GlossaryGlobalizationUtil
.globalize("cms.contenttypes.ui.glossary.definition"));
definition.addValidationListener(new NotNullValidationListener());
definition.setCols(40);
definition.setRows(5);
return definition;
}
public Label makeDefinitionLabel() {
return new Label(GlossaryGlobalizationUtil
.globalize("cms.contenttypes.ui.glossary.definition"));
}
// public Label makeDefinitionLabel() {
// return new Label(GlossaryGlobalizationUtil
// .globalize("cms.contenttypes.ui.glossary.definition"));
// }
}

View File

@ -67,7 +67,7 @@ public class GlossaryItemCreate extends PageCreate {
super.addWidgets();
GlossaryItemWidgetBuilder builder = new GlossaryItemWidgetBuilder();
add(builder.makeDefinitionLabel());
// add(builder.makeDefinitionLabel());
add(builder.makeDefinitionArea());
}

View File

@ -116,9 +116,9 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
Submit target = (Submit) e.getTarget();
if (healthCareFacility.getAddress() != null) {
target.setButtonLabel((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.change").localize());
target.setButtonLabel(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.change"));
} else {
target.setButtonLabel((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.add").localize());
target.setButtonLabel(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.add"));
}
}
});
@ -130,14 +130,14 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
@Override
public void validate(FormSectionEvent e) throws FormProcessException {
if (e.getFormData().get(ITEM_SEARCH) == null) {
throw new FormProcessException((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.wrong_type").localize());
throw new FormProcessException(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.wrong_type"));
}
}
public void submitted(FormSectionEvent e) throws FormProcessException {
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
init(e);
throw new FormProcessException((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.cancelled").localize());
throw new FormProcessException(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.cancelled"));
}
}
}

View File

@ -69,17 +69,16 @@ public class HealthCareFacilityContactAddForm extends BasicItemForm {
protected void addWidgets() {
// Attach a GenericContact object
add(new Label(HealthCareFacilityGlobalizationUtil.globalize(
"cms.contenttypes.ui.healthCareFacility.select_contact")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.GenericContact"));
this.m_itemSearch.setLabel(HealthCareFacilityGlobalizationUtil.globalize(
"cms.contenttypes.ui.healthCareFacility.select_contact"));
add(this.m_itemSearch);
// GenericContact type field
add(new Label(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.type")));
ParameterModel contactTypeParam = new StringParameter(HealthCareFacilityContactCollection.CONTACT_TYPE);
SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener());
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
contactType.addOption(new Option("", new Label(ContenttypesGlobalizationUtil.globalize("cms.ui.select_one"))));
// Add the Options to the SingleSelect widget
StringTokenizer keyList = HealthCareFacility.getConfig().getContactTypeKeys();
@ -87,7 +86,8 @@ public class HealthCareFacilityContactAddForm extends BasicItemForm {
String currentKey = keyList.nextToken();
contactType.addOption(new Option(currentKey, ((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contactType.key." + currentKey).localize())));
}
contactType.setLabel(HealthCareFacilityGlobalizationUtil.globalize(
"cms.contenttypes.ui.healthCareFacility.contact.type"));
add(contactType);
}

View File

@ -58,7 +58,7 @@ public class HealthCareFacilityDeleteAddressForm extends BasicPageForm implement
public void prepare(PrintEvent e) {
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(e.getPageState());
Submit target = (Submit) e.getTarget();
target.setButtonLabel((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address.button_label").localize());
target.setButtonLabel(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address.button_label"));
}
});
} catch (Exception ex) {

View File

@ -77,42 +77,45 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
@Override
public void addWidgets() {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.address")));
// add(new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.address")));
ParameterModel addressParam = new StringParameter(ADDRESS);
addressParam.addParameterListener(new NotNullValidationListener());
addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextArea address = new TextArea(addressParam);
address.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.address"));
address.setRows(5);
address.setCols(30);
add(address);
if (!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.postal_code") ));
ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE);
TextField postalCode = new TextField(postalCodeParam);
/* XXX NumberListener ?*/
postalCode.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.postal_code"));
add(postalCode);
}
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.city") ));
ParameterModel cityParam = new StringParameter(CITY);
TextField city = new TextField(cityParam);
city.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.city"));
add(city);
if (!HealthCareFacility.getConfig().getHideAddressState()) {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.state") ));
ParameterModel stateParam = new StringParameter(STATE);
TextField state = new TextField(stateParam);
state.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.state"));
add(state);
}
if (!HealthCareFacility.getConfig().getHideAddressCountry()) {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.iso_country_code") ));
// add(new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.iso_country_code") ));
ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE);
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2));
@ -140,6 +143,8 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
}
});
country.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.iso_country_code"));
add(country);
}

View File

@ -66,32 +66,27 @@ public class HistoricDatePropertyForm extends BasicPageForm implements FormProce
public void addWidgets() {
super.addWidgets();
add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.year")));
final IntegerParameter yearParam = new IntegerParameter(HistoricDate.YEAR);
final TextField year = new TextField(yearParam);
year.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.year"));
add(year);
add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.month")));
final IntegerParameter monthParam = new IntegerParameter(HistoricDate.MONTH);
final TextField month = new TextField(monthParam);
month.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.month"));
add(month);
add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.day_of_month")));
final IntegerParameter dayOfMonthParam = new IntegerParameter(HistoricDate.DAY_OF_MONTH);
final TextField dayOfMonth = new TextField(dayOfMonthParam);
dayOfMonth.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.day_of_month"));
add(dayOfMonth);
add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.date_is_approx")));
dateIsApprox = new CheckboxGroup(HistoricDate.DATE_IS_APPROX + "Group");
dateIsApprox.setLabel(HistoricDateGlobalizationUtil.globalize(
"historicdate.ui.date_is_approx"));
dateIsApprox.addOption(new Option(HistoricDate.DATE_IS_APPROX, ""));
add(dateIsApprox);
add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.lead")));
final ParameterModel leadParam = new StringParameter(HistoricDate.LEAD);
final TextArea lead = new TextArea(leadParam);
lead.setCols(80);

View File

@ -28,8 +28,6 @@ import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.Date;
import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.RadioGroup;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.BooleanParameter;
@ -53,6 +51,10 @@ public class ImagePropertyForm
extends BasicPageForm
implements FormProcessListener, FormInitListener, FormSubmissionListener {
/** Internal logger instance to faciliate debugging. Enable logging output
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
* and set com.arsdigita.cms.contenttypes.ui.ImagePropertyForm=DEBUG
* by uncommenting or adding the line. */
private final static org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.getLogger(ImagePropertyForm.class);
private ImagePropertiesStep m_step;
@ -87,11 +89,13 @@ public class ImagePropertyForm
protected void addWidgets() {
super.addWidgets();
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.caption")));
// add(new Label(ImageGlobalizationUtil
// .globalize("cms.contenttypes.ui.image.caption")));
ParameterModel captionParam = new StringParameter(Image.CAPTION);
captionParam.addParameterListener(new StringInRangeValidationListener(0, 400));
TextField caption = new TextField(captionParam);
caption.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.caption"));
add(caption);
/* Image doesn't use the description property part of the basic
@ -102,15 +106,17 @@ public class ImagePropertyForm
ParameterModel descriptionParam = new StringParameter(Image.DESCRIPTION);
descriptionParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextArea description = new TextArea(descriptionParam);
description.setLabel(GlobalizationUtil
.globalize("cms.contenttypes.ui.description"));
description.setRows(10);
description.setCols(60);
add(description);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.artist")));
ParameterModel artistParam = new StringParameter(Image.ARTIST);
artistParam.addParameterListener(new StringInRangeValidationListener(0, 200));
TextField artist = new TextField(artistParam);
artist.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.artist"));
add(artist);
ParameterModel skipDayParam = new BooleanParameter(Image.SKIPDAY);
@ -121,49 +127,51 @@ public class ImagePropertyForm
Hidden skipMonth = new Hidden(skipMonthParam);
add(skipMonth);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.publishDate")));
// add(new Label(ImageGlobalizationUtil
// .globalize("cms.contenttypes.ui.image.publishDate")));
IncompleteDateParameter publishDateParam = new IncompleteDateParameter(Image.PUBLISHDATE);
publishDateParam.allowSkipDay(true);
publishDateParam.allowSkipMonth(true);
Date publishDate = new Date(publishDateParam);
publishDate.setYearRange(Image.getConfig().getStartYear(),
GregorianCalendar.getInstance().get(Calendar.YEAR) + Image.getConfig().getEndYearDelta());
publishDate.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.publishDate"));
add(publishDate);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.source")));
ParameterModel sourceParam = new StringParameter(Image.SOURCE);
sourceParam.addParameterListener(new StringInRangeValidationListener(0, 600));
TextField source = new TextField(sourceParam);
source.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.source"));
add(source);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.media")));
ParameterModel mediaParam = new StringParameter(Image.MEDIA);
mediaParam.addParameterListener(new StringInRangeValidationListener(0, 300));
TextField media = new TextField(mediaParam);
media.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.media"));
add(media);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.copyright")));
ParameterModel copyrightParam = new StringParameter(Image.COPYRIGHT);
copyrightParam.addParameterListener(new StringInRangeValidationListener(0, 400));
TextField copyright = new TextField(copyrightParam);
copyright.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.copyright"));
add(copyright);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.site")));
ParameterModel siteParam = new StringParameter(Image.SITE);
siteParam.addParameterListener(new StringInRangeValidationListener(0, 500));
TextField site = new TextField(siteParam);
site.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.site"));
add(site);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.license")));
ParameterModel licenseParam = new StringParameter(Image.LICENSE);
licenseParam.addParameterListener(new StringInRangeValidationListener(0, 300));
TextField license = new TextField(licenseParam);
license.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.license"));
add(license);
add(new Label(ImageGlobalizationUtil
@ -171,20 +179,22 @@ public class ImagePropertyForm
ParameterModel materialParam = new StringParameter(Image.MATERIAL);
materialParam.addParameterListener(new StringInRangeValidationListener(0, 200));
TextField material = new TextField(materialParam);
material.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.material"));
add(material);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.technique")));
ParameterModel techniqueParam = new StringParameter(Image.TECHNIQUE);
techniqueParam.addParameterListener(new StringInRangeValidationListener(0, 200));
TextField technique = new TextField(techniqueParam);
technique.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.technique"));
add(technique);
add(new Label(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.origin")));
ParameterModel originParam = new StringParameter(Image.ORIGIN);
originParam.addParameterListener(new StringInRangeValidationListener(0, 200));
TextField origin = new TextField(originParam);
origin.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.origin"));
add(origin);
add(new Label(ImageGlobalizationUtil
@ -192,11 +202,15 @@ public class ImagePropertyForm
ParameterModel origSizeParam = new StringParameter(Image.ORIGSIZE);
origSizeParam.addParameterListener(new StringInRangeValidationListener(0, 100));
TextField origSize = new TextField(origSizeParam);
origSize.setLabel(ImageGlobalizationUtil
.globalize("cms.contenttypes.ui.image.origSize"));
add(origSize);
}
/** Form initialisation hook. Fills widgets with data. */
/**
* @param fse Form initialisation hook. Fills widgets with data.
*/
@Override
public void init(FormSectionEvent fse) {
// Do some initialization hook stuff
@ -233,7 +247,10 @@ public class ImagePropertyForm
FormData d = e.getFormData();
}
/** Cancels streamlined editing. */
/**
* Cancels streamlined editing.
* @param fse
*/
@Override
public void submitted(FormSectionEvent fse) {
if (m_step != null
@ -242,7 +259,10 @@ public class ImagePropertyForm
}
}
/** Form processing hook. Saves Event object. */
/**
* Form processing hook. Saves Event object.
* @param fse
*/
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();

View File

@ -19,8 +19,6 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.contenttypes.InlineSite;
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;
@ -28,19 +26,18 @@ import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.InlineSiteGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.util.GlobalizationUtil;
/**
* Form to edit the basic properties of an InlineSite. This form can be extended to create forms for InlineSite
* subclasses.
* Form to edit the basic properties of an InlineSite. This form can be
* extended to create forms for InlineSite subclasses.
*/
public class InlineSitePropertyForm extends BasicPageForm
implements FormProcessListener, FormInitListener {
@ -68,8 +65,9 @@ public class InlineSitePropertyForm extends BasicPageForm
*/
protected void addWidgets() {
super.addWidgets();
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description")));
m_description = new TextArea(ContentPage.DESCRIPTION);
m_description.setLabel(GlobalizationUtil.globalize(
"cms.contenttypes.ui.description"));
m_description.setCols(30);
m_description.setRows(5);
if (ContentSection.getConfig().mandatoryDescriptions()) {
@ -83,9 +81,10 @@ public class InlineSitePropertyForm extends BasicPageForm
4000));
add(m_description);
add(new Label("URL:"));
ParameterModel urlParam = new StringParameter("url");
m_url = new TextField(urlParam);
m_url.setLabel(InlineSiteGlobalizationUtil.globalize(
"cms.contenttypes.ui.inlinesite.url"));
m_url.setSize(40);
add(m_url);
}
@ -93,6 +92,7 @@ public class InlineSitePropertyForm extends BasicPageForm
/**
* Form initialisation hook. Fills widgets with data.
*/
@Override
public void init(FormSectionEvent fse) {
InlineSite site = (InlineSite) super.initBasicWidgets(fse);
@ -103,7 +103,9 @@ public class InlineSitePropertyForm extends BasicPageForm
/**
* Form processing hook. Saves InlineSite object.
* @param fse
*/
@Override
public void process(FormSectionEvent fse) {
InlineSite site = (InlineSite) super.processBasicWidgets(fse);

View File

@ -24,16 +24,14 @@ import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericAddress;
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.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.util.GlobalizationUtil;
import java.text.DateFormat;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
/**
*
@ -58,6 +56,10 @@ public class GenericAddressPropertiesStep extends SimpleEditStep {
setDisplayComponent(getAddressPropertySheet(itemModel));
}
/**
*
* @param itemModel
*/
protected void createEditSheet(ItemSelectionModel itemModel) {
BasicPageForm editSheet;
editSheet = new GenericAddressPropertyForm(itemModel, this);
@ -99,9 +101,10 @@ public class GenericAddressPropertiesStep extends SimpleEditStep {
GenericAddress.ISO_COUNTRY_CODE,
new DomainObjectPropertySheet.AttributeFormatter() {
@Override
public String format(DomainObject item,
String attribute,
PageState state) {
String attribute,
PageState state) {
GenericAddress address = (GenericAddress) item;
if (address != null && address.getIsoCountryCode() != null) {
return GenericAddress

View File

@ -82,9 +82,12 @@ public class GenericAddressPropertyForm extends BasicPageForm
addSubmissionListener(this);
}
/**
* Add the widgets specific to GenericAddress
*/
@Override
protected void addWidgets() {
super.addWidgets();
super.addWidgets(); // Add the standard widgets from super class
ParameterModel addressParam = new StringParameter(ADDRESS);
addressParam.addParameterListener(new NotNullValidationListener());
@ -149,15 +152,16 @@ public class GenericAddressPropertyForm extends BasicPageForm
country.addValidationListener(new ParameterListener() {
@Override
public void validate(ParameterEvent e)
throws FormProcessException {
ParameterData data = e.getParameterData();
String isoCode = (String) data.getValue();
s_log.debug("ISO code is : " + isoCode);
if (isoCode == null || isoCode.length() == 0) {
data.addError((String) ContenttypesGlobalizationUtil
data.addError(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.error_iso_country")
.localize());
);
}
}
@ -172,6 +176,7 @@ public class GenericAddressPropertyForm extends BasicPageForm
*
* @param fse
*/
@Override
public void init(FormSectionEvent fse) {
FormData data = fse.getFormData();
GenericAddress address = (GenericAddress) super.initBasicWidgets(fse);
@ -200,6 +205,7 @@ public class GenericAddressPropertyForm extends BasicPageForm
*
* @param fse
*/
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();

View File

@ -89,6 +89,7 @@ public class GenericArticlePropertiesStep extends SimpleEditStep {
ContentPage.LAUNCH_DATE,
new DomainObjectPropertySheet.AttributeFormatter() {
@Override
public String format(DomainObject item,
String attribute,
PageState state) {

View File

@ -9,19 +9,12 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.contenttypes.GenericAddress;
import com.arsdigita.cms.contenttypes.GenericContact;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
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 com.arsdigita.domain.DomainObject;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
/**
*
@ -37,7 +30,10 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
private final WorkflowLockedComponentAccess addAddress;
/**
* Creates a new instance of GenericContactAddressPropertiesStep
* Creates a new instance of GenericContactAddressPropertiesStep.
*
* @param itemModel
* @param parent
*/
public GenericContactAddressPropertiesStep(final ItemSelectionModel itemModel,
final AuthoringKitWizard parent) {
@ -60,38 +56,6 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
setDisplayComponent(getAddressPropertySheet(itemModel));
// this.itemModel = itemModel;
//
// BasicPageForm attachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel,
// this);
// BasicPageForm reattachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel,
// this);
// BasicPageForm editAddressSheet = new GenericContactEditAddressPropertyForm(itemModel, this);
// BasicPageForm deleteAddressSheet = new GenericContactDeleteAddressForm(
// itemModel, this);
//
// add(ADD_ADDRESS_SHEET_NAME,
// ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.attach_address"),
// new AttachAddressWorkflowLockedComponentAccess(attachAddressSheet,
// itemModel),
// attachAddressSheet.getSaveCancelSection().getCancelButton());
// add(CHANGE_ADDRESS_SHEET_NAME,
// ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.reattach_address"),
// new EditAddressWorkflowLockedComponentAccess(reattachAddressSheet,
// itemModel),
// reattachAddressSheet.getSaveCancelSection().getCancelButton());
//
// add(DELETE_ADDRESS_SHEET_NAME,
// ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.delete_address"),
// new EditAddressWorkflowLockedComponentAccess(deleteAddressSheet,
// itemModel),
// deleteAddressSheet.getSaveCancelSection().getCancelButton());
//
// /* Set the displayComponent for this step */
// setDisplayComponent(getAddressPropertySheet(itemModel));
}
public static Component getAddressPropertySheet(final ItemSelectionModel itemModel) {
@ -99,171 +63,4 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
return sheet;
}
/**
*
* @param itemModel
*
* @return
*/
// public static Component getAddressPropertySheet(ItemSelectionModel itemModel) {
//
// DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
// itemModel);
//
// sheet.add(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.address"),
// "address." + GenericAddress.ADDRESS,
// new DomainObjectPropertySheet.AttributeFormatter() {
//
// @Override
// public String format(final DomainObject obj,
// final String attribute,
// final PageState state) {
// final GenericAddress address = ((GenericContact) obj).getAddress();
// if ((address == null) || (address.getAddress() == null)) {
// return (String) GlobalizationUtil.globalize(
// "cms.ui.unknown").localize();
// } else {
// return address.getAddress();
//
// }
// }
//
// });
// if (!GenericContact.getConfig().getHideAddressPostalCode()) {
// sheet.add(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.postal_code"),
// "address." + GenericAddress.POSTAL_CODE,
// new DomainObjectPropertySheet.AttributeFormatter() {
//
// @Override
// public String format(final DomainObject obj,
// final String attribute,
// final PageState state) {
// final GenericAddress address = ((GenericContact) obj).getAddress();
// if ((address == null) || (address.getPostalCode() == null)) {
// return (String) GlobalizationUtil.globalize(
// "cms.ui.unknown").localize();
// } else {
// return address.getPostalCode();
//
// }
//
// }
//
// });
// }
// sheet.add(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.city"),
// "address." + GenericAddress.CITY,
// new DomainObjectPropertySheet.AttributeFormatter() {
//
// @Override
// public String format(final DomainObject obj,
// final String attribute,
// final PageState state) {
// final GenericAddress address = ((GenericContact) obj).getAddress();
// if ((address == null) || (address.getCity() == null)) {
// return (String) GlobalizationUtil.globalize(
// "cms.ui.unknown").localize();
// } else {
// return address.getCity();
//
// }
//
// }
//
// });
// if (!GenericContact.getConfig().getHideAddressState()) {
// sheet.add(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.state"),
// "address." + GenericAddress.STATE,
// new DomainObjectPropertySheet.AttributeFormatter() {
//
// @Override
// public String format(final DomainObject obj,
// final String attribute,
// final PageState state) {
// final GenericAddress address = ((GenericContact) obj).getAddress();
// if ((address == null) || (address.getState() == null)) {
// return (String) GlobalizationUtil.globalize(
// "cms.ui.unknown").localize();
// } else {
// return address.getState();
//
// }
//
// }
//
// });
// }
//
// if (!GenericContact.getConfig().getHideAddressCountry()) {
// sheet.add(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.address.iso_country_code"),
// "address." + GenericAddress.ISO_COUNTRY_CODE,
// new DomainObjectPropertySheet.AttributeFormatter() {
//
// @Override
// public String format(DomainObject item,
// String attribute,
// PageState state) {
// GenericAddress address = ((GenericContact) item).getAddress();
// if (address != null && address.getIsoCountryCode() != null) {
// return GenericAddress.getCountryNameFromIsoCode(address.
// getIsoCountryCode());
// } else {
// return (String) GlobalizationUtil.globalize(
// "cms.ui.unknown").localize();
// }
// }
//
// });
// }
//
// return sheet;
//
// }
//
// public static Component getEmptyBaseAddressPropertySheet(
// ItemSelectionModel itemModel) {
// return new Label(
// (ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.emptyAddress")));
// }
//
// private class EditAddressWorkflowLockedComponentAccess
// extends WorkflowLockedComponentAccess {
//
// public EditAddressWorkflowLockedComponentAccess(Component c,
// ItemSelectionModel i) {
// super(c, i);
// }
//
// @Override
// public boolean isVisible(PageState state) {
// GenericContact contact = (GenericContact) itemModel.
// getSelectedObject(state);
//
// return contact.hasAddress();
// }
//
// }
//
// private class AttachAddressWorkflowLockedComponentAccess extends WorkflowLockedComponentAccess {
//
// public AttachAddressWorkflowLockedComponentAccess(Component c,
// ItemSelectionModel i) {
// super(c, i);
// }
//
// @Override
// public boolean isVisible(PageState state) {
// GenericContact contact = (GenericContact) itemModel.
// getSelectedObject(state);
//
// return !contact.hasAddress();
// }
//
// }
}

View File

@ -47,12 +47,12 @@ public class GenericContactAddressSheet extends Table implements TableActionList
final TableColumnModel colModel = getColumnModel();
colModel.add(new TableColumn(
0,
new Label(""),
new Label(),
TABLE_COL_EDIT));
colModel.add(new TableColumn(
1,
new Label(""),
new Label(),
TABLE_COL_DEL));
setModelBuilder(new GenericContactAddressTableModelBuilder(itemModel));
@ -63,11 +63,14 @@ public class GenericContactAddressSheet extends Table implements TableActionList
addTableActionListener(this);
}
/**
*
*/
private class GenericContactAddressTableModelBuilder
extends LockableImpl
implements TableModelBuilder {
private ItemSelectionModel itemModel;
private final ItemSelectionModel itemModel;
public GenericContactAddressTableModelBuilder(final ItemSelectionModel itemModel) {
this.itemModel = itemModel;

View File

@ -2,7 +2,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
// import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormInitListener;
@ -72,12 +72,14 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
@Override
public void addWidgets() {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_address")));
// add(new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.select_address")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericAddress"));
m_itemSearch.setDisableCreatePane(true);
m_itemSearch.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_address"));
add(this.m_itemSearch);
}
@ -145,6 +147,11 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
}
}
/**
*
* @param e
* @throws FormProcessException
*/
@Override
public void validate(FormSectionEvent e) throws FormProcessException {
//Calling super.validate(e) here causes an exception because the super method checks things which not available
@ -154,10 +161,10 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
final FormData data = e.getFormData();
if (data.get(ITEM_SEARCH) == null) {
throw new FormProcessException((String) ContenttypesGlobalizationUtil.
throw new FormProcessException(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.contact.select_address.wrong_type").
localize());
"cms.contenttypes.ui.contact.select_address.wrong_type")
);
}
GenericContact contact = (GenericContact) getItemSelectionModel().
@ -173,14 +180,19 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
}
}
/**
*
* @param e
* @throws FormProcessException
*/
@Override
public void submitted(FormSectionEvent e) throws FormProcessException {
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
init(e);
throw new FormProcessException((String) ContenttypesGlobalizationUtil.
throw new FormProcessException(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.contact.select_address.cancelled").
localize());
"cms.contenttypes.ui.contact.select_address.cancelled")
);
}
}
}

View File

@ -1,3 +1,21 @@
/*
* Copyright (C) 2013 University 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
* 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;
@ -84,11 +102,13 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
@Override
public void addWidgets() {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_person")));
//add(new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.select_person")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericPerson"));
m_itemSearch.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_person"));
m_itemSearch.setDisableCreatePane(true);
add(this.m_itemSearch);
@ -128,6 +148,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
add(contactType);
}
@Override
public void init(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
@ -142,6 +163,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
}
}
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
@ -167,6 +189,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
try {
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
@Override
public void prepare(PrintEvent e) {
GenericContact contact = (GenericContact) getItemSelectionModel().
getSelectedObject(e.getPageState());
@ -191,17 +214,16 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
@Override
public void validate(FormSectionEvent e) throws FormProcessException {
//Calling super.validate(e) here causes an exception because the super method checks things which not available
//here.
//Calling super.validate(e) here causes an exception because the
//super method checks things which not available here.
final PageState state = e.getPageState();
final FormData data = e.getFormData();
if (data.get(ITEM_SEARCH) == null) {
throw new FormProcessException((String) ContenttypesGlobalizationUtil.
throw new FormProcessException(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.contact.select_person.wrong_type").
localize());
"cms.contenttypes.ui.contact.select_person.wrong_type"));
}
GenericContact contact = (GenericContact) getItemSelectionModel().
@ -211,19 +233,20 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
if (!(person.getContentBundle().hasInstance(contact.getLanguage(),
Kernel.getConfig().
languageIndependentItems()))) {
data.addError(
"cms.contenttypes.ui.contact.select_person.no_suitable_language_variant");
data.addError(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.contact.select_person.no_suitable_language_variant"));
}
}
@Override
public void submitted(FormSectionEvent e) throws FormProcessException {
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
init(e);
throw new FormProcessException((String) ContenttypesGlobalizationUtil.
throw new FormProcessException(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.contact.select_person.cancelled").
localize());
"cms.contenttypes.ui.contact.select_person.cancelled"));
}
}

View File

@ -56,6 +56,7 @@ public class GenericContactDeleteAddressForm extends BasicPageForm implements Fo
try {
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
@Override
public void prepare(PrintEvent e) {
GenericContact contact = (GenericContact)
getItemSelectionModel()
@ -71,6 +72,7 @@ public class GenericContactDeleteAddressForm extends BasicPageForm implements Fo
}
}
@Override
public final void process(final FormSectionEvent fse) throws FormProcessException {
final PageState state = fse.getPageState();

View File

@ -41,6 +41,7 @@ public class GenericContactDeletePersonForm extends BasicPageForm
addSaveCancelSection();
}
@Override
public void init(FormSectionEvent fse) {
}
@ -74,6 +75,7 @@ public class GenericContactDeletePersonForm extends BasicPageForm
}
}
@Override
public final void process(final FormSectionEvent fse) throws FormProcessException {
final PageState state = fse.getPageState();

View File

@ -55,7 +55,9 @@ public class GenericContactEntriesTable extends Table implements TableActionList
private ItemSelectionModel m_itemModel;
/**
* Creates a new instance of GenericContactEntriesTable
* Creates a new instance of GenericContactEntriesTable.
*
* @param itemModel
*/
public GenericContactEntriesTable(final ItemSelectionModel itemModel) {
@ -109,6 +111,7 @@ public class GenericContactEntriesTable extends Table implements TableActionList
m_itemModel = itemModel;
}
@Override
public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state);
@ -162,6 +165,7 @@ public class GenericContactEntriesTable extends Table implements TableActionList
* Return the
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
*/
@Override
public Object getElementAt(int columnIndex) {
switch (columnIndex) {
case 0:
@ -295,6 +299,7 @@ public class GenericContactEntriesTable extends Table implements TableActionList
* provide Implementation to TableActionListener method.
* Does nothing in our case.
*/
@Override
public void headSelected(TableActionEvent e) {
throw new UnsupportedOperationException("Not Implemented");
}

View File

@ -54,7 +54,9 @@ public class GenericContactEntryAddForm extends BasicItemForm {
private ItemSelectionModel m_itemModel;
/**
* Creates a new instance of CategoryLocalizationAddForm
* Creates a new instance of CategoryLocalizationAddForm.
*
* @param itemModel
*/
public GenericContactEntryAddForm(ItemSelectionModel itemModel) {
@ -121,6 +123,7 @@ public class GenericContactEntryAddForm extends BasicItemForm {
*
* @param fse
*/
@Override
public void init(FormSectionEvent fse) {
}
@ -129,6 +132,7 @@ public class GenericContactEntryAddForm extends BasicItemForm {
*
* @param fse
*/
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();
GenericContact contact = (GenericContact) m_itemModel.getSelectedObject(fse.getPageState());

View File

@ -50,7 +50,10 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
// private WorkflowLockedComponentAccess delPerson;
/**
* Creates a new instance of GenericContactPersonPropertiesStep
* Creates a new instance of GenericContactPersonPropertiesStep.
*
* @param itemModel
* @param parent
*/
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {

View File

@ -72,7 +72,6 @@ public class GenericContactPersonSheet extends Table implements TableActionListe
colModel.add(new TableColumn(
0,
new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.contact.person").localize(),
"cms.contenttypes.ui.genericcontact.person")),
TABLE_COL_EDIT));
colModel.add(new TableColumn(

View File

@ -1,3 +1,22 @@
/*
* Copyright (C) 2011-2013 Universitaet 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
* 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.PageState;

View File

@ -36,7 +36,6 @@ import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.contenttypes.GenericContact;
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationContactTypeCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
@ -46,8 +45,9 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.util.UncheckedWrapperException;
import java.util.TooManyListenersException;
import java.util.logging.Level;
import org.apache.log4j.Logger;
/**
@ -79,15 +79,17 @@ public class GenericOrganizationalUnitContactAddForm
@Override
protected void addWidgets() {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_contact")));
// add(new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.genericorgaunit.select_contact")));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(GenericContact.class
.getName()));
m_itemSearch.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_contact"));
m_itemSearch.setDisableCreatePane(false);
add(m_itemSearch);
selectedContactLabel = new Label("");
selectedContactLabel = new Label();
add(selectedContactLabel);
ParameterModel contactTypeParam = new StringParameter(
@ -213,8 +215,8 @@ public class GenericOrganizationalUnitContactAddForm
if ((editStep.getSelectedContact() == null)
&& (data.get(ITEM_SEARCH) == null)) {
data.addError(
"cms.contenttypes.ui.genericorgaunit.select_contact.no_contact_selected");
data.addError((ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_contact.no_contact_selected")));
return;
}

View File

@ -35,7 +35,6 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.GenericContact;
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationContactTypeCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
@ -92,22 +91,22 @@ public class GenericOrganizationalUnitContactTable extends Table implements
tabModel.add(new TableColumn(
2,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.contact.edit").localize(),
"cms.contenttypes.ui.genericorgaunit.contact.edit"),
TABLE_COL_EDIT_ASSOC));
tabModel.add(new TableColumn(
3,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.contact.action").localize(),
"cms.contenttypes.ui.genericorgaunit.contact.action"),
TABLE_COL_DEL));
tabModel.add(new TableColumn(
4,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.contact.up").localize(),
"cms.contenttypes.ui.genericorgaunit.contact.up"),
TABLE_COL_UP));
tabModel.add(new TableColumn(
5,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.contact.down").localize(),
"cms.contenttypes.ui.genericorgaunit.contact.down"),
TABLE_COL_DOWN));
setModelBuilder(
@ -230,6 +229,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
}
}
@Override
public Object getKeyAt(int columnIndex) {
return m_contact.getID();
}
@ -239,6 +239,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
extends LockableImpl
implements TableCellRenderer {
@Override
public Component getComponent(
Table table,
PageState state,
@ -293,6 +294,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
extends LockableImpl
implements TableCellRenderer {
@Override
public Component getComponent(
Table table,
PageState state,
@ -343,10 +345,10 @@ public class GenericOrganizationalUnitContactTable extends Table implements
orgaunit);
if (canDelete) {
ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) ContenttypesGlobalizationUtil.
link.setConfirmation(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.genericorgaunit.confirm_delete").
localize());
"cms.contenttypes.ui.genericorgaunit.confirm_delete")
);
return link;
} else {
return new Label(value.toString());
@ -369,7 +371,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
if (0 == row) {
s_log.debug("Row is first row in table, don't show up-link");
return new Label("");
return new Label();
} else {
ControlLink link = new ControlLink("up");
return link;
@ -399,7 +401,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
if ((contacts.size() - 1) == row) {
s_log.debug("Row is last row in table, don't show down-link");
return new Label("");
return new Label();
} else {
ControlLink link = new ControlLink("down");
return link;

View File

@ -78,16 +78,18 @@ public class GenericOrganizationalUnitPersonAddForm
@Override
protected void addWidgets() {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_person")));
// add(new Label(ContenttypesGlobalizationUtil.globalize(
// "cms.contenttypes.ui.genericorgaunit.select_person")));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(getPersonType()));
/*m_itemSearch.getItemField().addValidationListener(
new NotNullValidationListener());*/
m_itemSearch.setLabel(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_person"));
m_itemSearch.setDisableCreatePane(false);
add(this.m_itemSearch);
selectedPersonNameLabel = new Label("");
selectedPersonNameLabel = new Label();
add(selectedPersonNameLabel);
ParameterModel roleParam = new StringParameter(

View File

@ -149,10 +149,12 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
size()));
}
@Override
public int getColumnCount() {
return m_table.getColumnModel().size();
}
@Override
public boolean nextRow() {
boolean ret;
@ -167,6 +169,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
return ret;
}
@Override
public Object getElementAt(int columnIndex) {
switch (columnIndex) {
case 0:
@ -208,6 +211,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
}
}
@Override
public Object getKeyAt(int columnIndex) {
return m_person.getID();
}
@ -217,6 +221,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
private class EditCellRenderer extends LockableImpl implements
TableCellRenderer {
@Override
public Component getComponent(
Table table,
PageState state,
@ -307,6 +312,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
private class DeleteCellRenderer extends LockableImpl implements
TableCellRenderer {
@Override
public Component getComponent(
Table table,
PageState state,
@ -325,10 +331,9 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
orgaunit);
if (canEdit) {
ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) ContenttypesGlobalizationUtil.
link.setConfirmation(ContenttypesGlobalizationUtil.
globalize(
"cms.contenttypes.ui.genericorgaunit.persons.confirm_delete").
localize());
"cms.contenttypes.ui.genericorgaunit.persons.confirm_delete"));
return link;
} else {
return new Label(value.toString());

View File

@ -45,7 +45,7 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitAddForm
implements FormProcessListener,
FormInitListener {
private ItemSearchWidget itemSearch;
private final ItemSearchWidget itemSearch;
private final String ITEM_SEARCH = "subordinateOrgaUnits";
private final GenericOrgaUnitSubordinateOrgaUnitAddFormCustomizer customizer;
@ -60,6 +60,8 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitAddForm
ITEM_SEARCH,
ContentType.findByAssociatedObjectType(
customizer.getSubordinateOrgaUnitType()));
// Customizer methods have to be refactored, avoiding Strings
// itemSearch.setLabel(null);
itemSearch.setDisableCreatePane(true);
add(itemSearch);
}

View File

@ -69,9 +69,6 @@ public class GenericPersonAliasPropertiesStep extends SimpleEditStep {
final BasicPageForm setAliasSheet = new GenericPersonAliasSetForm(
itemModel,
this);
/*final BasicPageForm changeAliasSheet =
new GenericPersonAliasSetForm(itemModel,
this);*/
final BasicPageForm deleteAliasSheet = new GenericPersonAliasDeleteForm(
itemModel,
this);
@ -82,13 +79,6 @@ public class GenericPersonAliasPropertiesStep extends SimpleEditStep {
new GenericPersonAliasSetWorkflowLockedComponentAccess(setAliasSheet,
itemModel),
setAliasSheet.getSaveCancelSection().getCancelButton());
/*add(CHANGE_ALIAS_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.change_alias").localize(),
new GenericPersonAliasEditWorkflowLockedComponentAccess(
changeAliasSheet,
itemModel),
changeAliasSheet.getSaveCancelSection().getCancelButton());*/
add(DELETE_ALIAS_SHEET_NAME,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.delete_alias"),

View File

@ -358,7 +358,9 @@ public class LinkPropertyForm extends FormSection
* data
*
* @param event the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void validate(FormSectionEvent event)
throws FormProcessException {
PageState state = event.getPageState();
@ -472,7 +474,9 @@ public class LinkPropertyForm extends FormSection
* Init listener. For edit actions, fills the form with current data
*
* @param fse the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/
@Override
public void init(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();

View File

@ -256,7 +256,7 @@ public class LinkTable extends Table {
downLabel.setClassAttr("linkSort");
return new ControlLink(downLabel);
} else {
return new Label("");
return new Label();
}
} else {
throw new UncheckedWrapperException("column out of bounds");
@ -325,6 +325,7 @@ public class LinkTable extends Table {
}
}
@Override
public void headSelected(TableActionEvent e) {
}
}

View File

@ -48,6 +48,7 @@ public abstract class LinkTableModelBuilder
* @param t The <code>Table</code> for the current page.
* @param s The <code>PageState</code> for the current request
*/
@Override
public TableModel makeModel(Table t,
PageState s) {
s_log.debug("LinkTableModelBuilder.makemodel");
@ -83,6 +84,7 @@ public abstract class LinkTableModelBuilder
m_link = null;
}
@Override
public boolean nextRow() {
s_log.debug(String.format("m_links.size() = %d", m_links.size()));
@ -99,15 +101,18 @@ public abstract class LinkTableModelBuilder
}
}
@Override
public int getColumnCount() {
return (int) m_links.size();
}
@Override
public Object getElementAt(int columnIndex) {
return m_link;
}
@Override
public Object getKeyAt(int columnIndex) {
return m_link.getID();
}

View File

@ -79,6 +79,7 @@ public class ResettableContainer extends SimpleContainer implements Resettable {
* @pre (pc != null)
* @post (m_components.contains(pc))
**/
@Override
public void add(Component pc) {
add(pc, true);
}
@ -91,6 +92,7 @@ public class ResettableContainer extends SimpleContainer implements Resettable {
* should override the add method if they wish to provide special
* handling of constraints.
**/
@Override
public void add(Component pc, int constraints) {
add(pc);
}
@ -99,6 +101,7 @@ public class ResettableContainer extends SimpleContainer implements Resettable {
* Adds the component to this pane with the specified default
* visibility.
*
* @param pc
* @param defaultVisibility The default visibility of this component
* @pre (pc != null)
**/
@ -155,6 +158,7 @@ public class ResettableContainer extends SimpleContainer implements Resettable {
*
* @param state The state of the current request.
**/
@Override
public void reset(PageState state) {
// Reset all resettable components automatically
Iterator iter = m_resettableComponents.iterator();
@ -169,6 +173,7 @@ public class ResettableContainer extends SimpleContainer implements Resettable {
*
* @param p The page this container belongs to.
**/
@Override
public void register(Page p) {
Iterator iter = m_componentsNotVisibleByDefault.iterator();
while (iter.hasNext()) {

View File

@ -75,6 +75,7 @@ public class SelectFilter implements Filter {
this.queryProperty = queryProperty;
}
@Override
public String getFilter() {
if ((value == null) || value.isEmpty()) {
if (allOptionIsDefault) {

View File

@ -244,6 +244,7 @@ public class ItemSearchWidget extends FormSection
+ " cms.ui.item_search.selected"));
selectedItemLabel.addPrintListener(new PrintListener() {
@Override
public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget();
target.setLabel(GlobalizationUtil.globalize(
@ -254,6 +255,7 @@ public class ItemSearchWidget extends FormSection
final Label searchLabel = new Label(searchLabelText);
searchLabel.addPrintListener(new PrintListener() {
@Override
public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget();
target.setLabel(searchLabelText);
@ -403,6 +405,7 @@ public class ItemSearchWidget extends FormSection
return m_item;
}
@Override
public void init(FormSectionEvent e) throws FormProcessException {
PageState s = e.getPageState();
try {

View File

@ -62,7 +62,7 @@ import org.apache.log4j.Logger;
*
* @version $Id: FormSection.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class FormSection extends SimpleComponent implements Container {
public class FormSection extends DescriptiveComponent implements Container {
/** Internal logger instance to faciliate debugging. Enable logging output
* by editing /WEB-INF/conf/log4j.properties int the runtime environment

View File

@ -60,18 +60,30 @@ public class Date extends Widget implements BebopConstants {
private int m_year_end;
private Locale m_locale;
// Inner classes for the fragment widgets
/**
* Inner class for the year fragment
*/
protected class YearFragment extends SingleSelect {
protected Date parent;
private boolean autoCurrentYear; //Decide wether to set the current year if year is null
/**
* Constructor.
* @param name
* @param parent
*/
public YearFragment(String name, Date parent) {
super(name);
this.parent = parent;
setHint(GlobalizationUtil.globalize("bebop.date.year.hint"));
}
/**
*
* @param ps
* @return
*/
@Override
protected ParameterData getParameterData(PageState ps) {
Object value = getValue(ps);
@ -81,10 +93,19 @@ public class Date extends Widget implements BebopConstants {
return new ParameterData(getParameterModel(), value);
}
/**
*
* @param autoCurrentYear
*/
public void setAutoCurrentYear(final boolean autoCurrentYear) {
this.autoCurrentYear = autoCurrentYear;
}
/**
*
* @param ps
* @return
*/
@Override
public Object getValue(PageState ps) {
ParameterModel model = parent.getParameterModel();
@ -104,6 +125,9 @@ public class Date extends Widget implements BebopConstants {
}
/**
*
*/
protected class MonthFragment extends SingleSelect {
protected Date parent;
@ -135,6 +159,9 @@ public class Date extends Widget implements BebopConstants {
}
/**
*
*/
protected class DayFragment extends TextField {
protected Date parent;
@ -199,6 +226,10 @@ public class Date extends Widget implements BebopConstants {
}
/**
* Constructor.
* @param name
*/
public Date(String name) {
this(new DateParameter(name));
}
@ -245,7 +276,9 @@ public class Date extends Widget implements BebopConstants {
/**
* Returns a string naming the type of this widget.
* @return
*/
@Override
public String getType() {
return "date";
}
@ -253,23 +286,31 @@ public class Date extends Widget implements BebopConstants {
/**
* Sets the <tt>MAXLENGTH</tt> attribute for the <tt>INPUT</tt> tag used to render this form
* element.
* @param length
*/
public void setMaxLength(int length) {
setAttribute("MAXLENGTH", String.valueOf(length));
}
@Override
public boolean isCompound() {
return true;
}
/**
* The XML tag for this derived class of Widget.
* @return
*/
@Override
protected String getElementTag() {
return BEBOP_DATE;
}
/**
*
* @param ps
* @param parent
*/
@Override
public void generateWidget(PageState ps, Element parent) {
@ -357,7 +398,7 @@ public class Date extends Widget implements BebopConstants {
* pointer is already set. To explicity change the _form pointer the developer must first call
* setForm(null)
*
* @param the <code>Form</code> Object for this Widget.
* @param f the <code>Form</code> Object for this Widget.
*
* @exception IllegalStateException if form already set.
*/

View File

@ -40,6 +40,7 @@ public class DateTime extends Widget implements BebopConstants {
/**
* Construct a new DateTime. The model must be a DateTimeParameter
* @param model
*/
public DateTime(ParameterModel model) {
this(model, false);
@ -47,6 +48,8 @@ public class DateTime extends Widget implements BebopConstants {
/**
* Construct a new DateTime. The model must be a DateTimeParameter
* @param model
* @param showSeconds
*/
public DateTime(ParameterModel model, boolean showSeconds) {
super(model);
@ -71,7 +74,9 @@ public class DateTime extends Widget implements BebopConstants {
/**
* Returns a string naming the type of this widget.
* @return
*/
@Override
public String getType() {
return "dateTime";
}