From 7cdf763aff39c5797bac07d73c4fca51a2d81c70 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 2 Jul 2014 20:42:52 +0000 Subject: [PATCH] Replaced Label widget by setLabel / setHint for CT Event, some reformatting and documentation added. git-svn-id: https://svn.libreccm.org/ccm/trunk@2735 8810af33-2d31-482b-a856-94f89814c4df --- .../cms/contenttypes/AddressLoader.java | 5 +- .../contenttypes/EventResources.properties | 2 + .../contenttypes/EventResources_de.properties | 2 + .../contenttypes/EventResources_fr.properties | 2 + .../contenttypes/ui/EventPropertiesStep.java | 4 +- .../contenttypes/ui/EventPropertyForm.java | 100 +++++++++++++----- .../src/com/arsdigita/cms/ContentType.java | 55 ++++++---- .../AbstractContentTypeLoader.java | 51 ++++++--- .../cms/ui/authoring/NewItemForm.java | 6 +- ccm-core/src/com/arsdigita/bebop/Label.java | 92 ++++++++-------- 10 files changed, 209 insertions(+), 110 deletions(-) diff --git a/ccm-cms-types-address/src/com/arsdigita/cms/contenttypes/AddressLoader.java b/ccm-cms-types-address/src/com/arsdigita/cms/contenttypes/AddressLoader.java index c6bbc4d9f..f5e254a0c 100755 --- a/ccm-cms-types-address/src/com/arsdigita/cms/contenttypes/AddressLoader.java +++ b/ccm-cms-types-address/src/com/arsdigita/cms/contenttypes/AddressLoader.java @@ -20,7 +20,7 @@ package com.arsdigita.cms.contenttypes; /** - * Loader executes nonrecurring once at install time and loads the e-Form + * Loader executes nonrecurring once at install time and loads the Address * contenttype package persistently into database. * * It uses the base class to create the database schema and the required @@ -34,7 +34,7 @@ package com.arsdigita.cms.contenttypes; public class AddressLoader extends AbstractContentTypeLoader { /** Defines the xml file containing the Address content type property - * definitions. */ + * definitions. */ private static final String[] TYPES = { "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Address.xml" }; @@ -48,6 +48,7 @@ public class AddressLoader extends AbstractContentTypeLoader { * * @return String Atring Array of fully qualified file names */ + @Override public String[] getTypes() { return TYPES; } diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources.properties b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources.properties index b5de8b928..804f24326 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources.properties +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources.properties @@ -22,3 +22,5 @@ cms.contenttypes.ui.event.cost=Cost: cms.contenttypes.ui.event.there_are_no_events=There are no events. cms.contenttypes.event.type_label=Event cms.contenttypes.event_type_not_registered=Type not registered +cms.contenttypes.ui.event.lead_hint=A short description of the focus of the event and its main topic. Should be no longer than 2-3 sentences. The lead text will be displayed in the detail view of the event as well as in listings of events. +cms.contenttypes.ui.event.end_date_hint=Optionally enter an end date. It is displayed on the detail view as well as in listings of other short references. diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_de.properties b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_de.properties index cc06c307a..a07f25f24 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_de.properties +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_de.properties @@ -23,3 +23,5 @@ cms.contenttypes.ui.event.cost=Kosten: cms.contenttypes.ui.event.there_are_no_events=Es sind keine Veranstaltungen vorhanden. cms.contenttypes.event.type_label=Veranstaltung cms.contenttypes.event_type_not_registered=Typ nicht registriert +cms.contenttypes.ui.event.lead_hint=Kurze Beschreibung der Veranstaltung und ihres zentralen Themas. Die L\u00e4nge sollte maximal 2-3 S\u00e4tze betragen. Die Zusammenfassung wird sowohl in der Vollansicht der Veranstaltung als auch in allen Teilsichten und Listen angezeigt. +cms.contenttypes.ui.event.end_date_hint=Ein optionales Enddatum; es wird sowohl in der Vollansicht als auch in allen Listen und sonstigen Referencen angezeigt. diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_fr.properties b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_fr.properties index 6b198e62c..170ccdbb1 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_fr.properties +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/EventResources_fr.properties @@ -23,3 +23,5 @@ cms.contenttypes.ui.event.link_to_map=Link to Map cms.contenttypes.ui.event.cost=Cost: cms.contenttypes.ui.event.there_are_no_events=Il n'y a aucun \u00e9venement cms.contenttypes.event.type_label=Event +cms.contenttypes.ui.event.lead_hint=A short description of the focus of the event and its main topic. Should be no longer than 2-3 sentences. The lead text will be displayed in the detail view of the event as well as in listings of events. +cms.contenttypes.ui.event.end_date_hint=Optionally enter an end date. It is displayed on the detail view as well as in listings of other short references. diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java index 3918394ad..a004f587b 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java @@ -35,8 +35,6 @@ import com.arsdigita.globalization.GlobalizationHelper; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import java.text.DateFormat; -import java.util.Calendar; -import java.util.Date; /** * Authoring step to view/edit the simple attributes of the Event content type (and @@ -141,7 +139,7 @@ public class EventPropertiesStep extends SimpleEditStep { return sheet; } - /** + /** * Private class which implements an AttributeFormatter interface for * date values. * Its format(...) class returns a string representation for either a diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java index 851a0bbf2..e312ce992 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java @@ -117,69 +117,93 @@ public class EventPropertyForm extends BasicPageForm super.addWidgets(); /* Summary (lead) */ - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.lead")) ); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.lead")) ); ParameterModel leadParam = new StringParameter(LEAD); if(Event.getConfig().isLeadTextOptional()) { leadParam.addParameterListener(new NotNullValidationListener()); } TextArea lead = new TextArea(leadParam); + lead.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.lead")); lead.setCols(50); lead.setRows(5); add(lead); + /* Start date and time */ + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.start_date")) ); ParameterModel eventStartDateParam = new DateParameter(START_DATE); - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.start_date")) ); eventStartDateParam.addParameterListener(new NotNullValidationListener()); // Use bebop date instead of java.util.date m_startDate = new com.arsdigita.bebop.form.Date(eventStartDateParam); + m_startDate.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.start_date")); // Set the upper und lower boundary of the year select box m_startDate.setYearRange(Event.getConfig().getStartYear(), - GregorianCalendar.getInstance().get(Calendar.YEAR) + Event.getConfig().getEndYearDelta()); + GregorianCalendar.getInstance().get(Calendar.YEAR) + + Event.getConfig().getEndYearDelta()); add(m_startDate); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.start_time")) ); ParameterModel eventStartTimeParam = new TimeParameter(START_TIME); - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.start_time")) ); if(Event.getConfig().isStartTimeOptional()) { eventStartTimeParam.addParameterListener(new NotNullValidationListener()); } Time startTime = new Time(eventStartTimeParam); + startTime.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.start_time")); add(startTime); /* End date and time */ ParameterModel eventEndDateParam = new DateParameter(END_DATE); - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.end_date"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.end_date"))); // Use bebop date instead of java.util.date m_endDate = new com.arsdigita.bebop.form.Date(eventEndDateParam); + m_endDate.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.end_date")); + m_endDate.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.end_date_hint")); m_endDate.setYearRange(Event.getConfig().getStartYear(), GregorianCalendar.getInstance().get(Calendar.YEAR) + Event.getConfig().getEndYearDelta()); add(m_endDate); ParameterModel eventEndTimeParam = new TimeParameter(END_TIME); - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.end_time"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.end_time"))); Time endTime = new Time(eventEndTimeParam); + endTime.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.end_time")); + endTime.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.end_time_hint")); add(endTime); /* optional additional / literal date description */ if (!Event.getConfig().getHideDateDescription()) { - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.date_description"))); + //add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.date_description"))); ParameterModel eventDateParam = new StringParameter(EVENT_DATE); //eventDateParam // .addParameterListener(new NotNullValidationListener()); if (Event.getConfig().getUseHtmlDateDescription()) { CMSDHTMLEditor eventDate = new CMSDHTMLEditor(eventDateParam); + eventDate.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.date_description")); + eventDate.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.date_description_hint")); eventDate.setCols(40); eventDate.setRows(8); add(eventDate); } else { eventDateParam.addParameterListener(new StringInRangeValidationListener(0, 100)); TextArea eventDate = new TextArea(eventDateParam); + eventDate.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.date_description")); + eventDate.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.date_description_hint")); eventDate.setCols(50); eventDate.setRows(2); add(eventDate); @@ -188,12 +212,16 @@ public class EventPropertyForm extends BasicPageForm /* extensive description of location */ - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.location"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.location"))); ParameterModel locationParam = new StringParameter(LOCATION); //locationParam // .addParameterListener(new NotNullValidationListener()); CMSDHTMLEditor location = new CMSDHTMLEditor(locationParam); + location.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.location")); + location.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.location_hint")); location.setCols(40); location.setRows(8); add(location); @@ -201,13 +229,17 @@ public class EventPropertyForm extends BasicPageForm /* optional: main contributor */ if (!Event.getConfig().getHideMainContributor()) { - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.main_contributor"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.main_contributor"))); ParameterModel mainContributorParam = new StringParameter(MAIN_CONTRIBUTOR); - //mainContributorParam - // .addParameterListener(new NotNullValidationListener()); + //mainContributorParam.addParameterListener( + // new NotNullValidationListener()); CMSDHTMLEditor mainContributor = new CMSDHTMLEditor(mainContributorParam); + mainContributor.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.main_contributor")); + mainContributor.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.main_contributor_hint")); mainContributor.setCols(40); mainContributor.setRows(10); add(mainContributor); @@ -216,12 +248,16 @@ public class EventPropertyForm extends BasicPageForm /* optional: event type */ if (!Event.getConfig().getHideEventType()) { - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.event_type"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.event_type"))); ParameterModel eventTypeParam = new StringParameter(EVENT_TYPE); //eventTypeParam // .addParameterListener(new NotNullValidationListener()); TextField eventType = new TextField(eventTypeParam); + eventType.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.event_type")); + eventType.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.event_type_hint")); eventType.setSize(30); eventType.setMaxLength(30); add(eventType); @@ -230,12 +266,16 @@ public class EventPropertyForm extends BasicPageForm /* optional: link to map */ if (!Event.getConfig().getHideLinkToMap()) { - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.link_to_map"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.link_to_map"))); ParameterModel mapLinkParam = new StringParameter(MAP_LINK); //mapLinkParam // .addParameterListener(new NotNullValidationListener()); TextArea mapLink = new TextArea(mapLinkParam); + mapLink.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.link_to_map")); + mapLink.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.link_to_map_hint")); mapLink.setCols(40); mapLink.setRows(2); add(mapLink); @@ -244,10 +284,14 @@ public class EventPropertyForm extends BasicPageForm /* optional: costs */ if (!Event.getConfig().getHideCost()) { - add(new Label(EventGlobalizationUtil - .globalize("cms.contenttypes.ui.event.cost"))); + // add(new Label(EventGlobalizationUtil + // .globalize("cms.contenttypes.ui.event.cost"))); ParameterModel costParam = new TrimmedStringParameter(COST); TextField cost = new TextField(costParam); + cost.setLabel(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.cost")); + cost.setHint(EventGlobalizationUtil.globalize( + "cms.contenttypes.ui.event.cost_hint")); cost.setSize(30); cost.setMaxLength(30); add(cost); @@ -327,7 +371,11 @@ public class EventPropertyForm extends BasicPageForm } } - /** Cancels streamlined editing. */ + /** + * Cancels streamlined editing. + * @param fse + */ + @Override public void submitted(FormSectionEvent fse) { if (m_step != null && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) { diff --git a/ccm-cms/src/com/arsdigita/cms/ContentType.java b/ccm-cms/src/com/arsdigita/cms/ContentType.java index 84842e064..14d224ce9 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentType.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentType.java @@ -45,11 +45,10 @@ import java.util.StringTokenizer; import org.apache.log4j.Logger; /** - *

A Content Type defines the characteristics of a content - * item. Content management resources are registered to a content - * type, including the {@link com.arsdigita.cms.AuthoringKit - * Authoring Kit}, and {@link com.arsdigita.cms.Template - * templates}.

+ *

A Content Type defines the characteristics of a content item. Content + * management resources are registered to a content type, including + * the {@link com.arsdigita.cms.AuthoringKit Authoring Kit}, and + * {@link com.arsdigita.cms.Template templates}.

* *

Each content type is associated with a {@link * com.arsdigita.domain.DomainObject domain object} and a {@link @@ -362,7 +361,7 @@ public class ContentType extends ACSObject { } /** - * Create an authoring kit to this content type. To save this authoring + * Create an authoring kit to this content type. To save this authoring * kit, you need to call save() method on the * returned AuthoringKit. * @@ -424,7 +423,8 @@ public class ContentType extends ACSObject { } /** - * Add an ancestor to the list of descendants, if not already in the list + * Add an ancestor to the list of descendants, if not already in the list. + * * @param newAncestor ID of the ancestor to add */ public void addAncestor(BigDecimal newAncestor) { @@ -449,7 +449,8 @@ public class ContentType extends ACSObject { } /** - * Remove an ancestor id from the list of descendants + * Remove an ancestor id from the list of descendants. + * * @param ancestor ID to be removed */ public void delAncestor(BigDecimal ancestor) { @@ -464,8 +465,8 @@ public class ContentType extends ACSObject { // Delete the additional slash ancestors.replace("//", "/"); - // If the list only contains a single slash, - // we have just removed the last list entry, so the list is empty + // If the list only contains a single slash, we have just removed + // the last list entry, so the list is empty if (ancestors.equals("/")) { ancestors = ""; } @@ -476,7 +477,8 @@ public class ContentType extends ACSObject { } /** - * Get the list of ancestors + * Get the list of ancestors. + * * @return */ public String getAncestors() { @@ -484,7 +486,8 @@ public class ContentType extends ACSObject { } /** - * Add a descendant to the list of descendants, if not already in list + * Add a descendant to the list of descendants, if not already in list. + * * @param newDescendant ID of the descendant to add */ public void addDescendants(BigDecimal newDescendant) { @@ -645,6 +648,11 @@ public class ContentType extends ACSObject { return new ContentTypeCollection(dc); } + /** + * + * @param ct + * @return + */ public static ContentTypeCollection getDescendantsOf(ContentType ct) { ContentTypeCollection ctc = ContentType.getRegisteredContentTypes(); @@ -674,9 +682,9 @@ public class ContentType extends ACSObject { private static List s_xsl = new ArrayList(); /** + * Registers an XSL file against a content type. * NB this interface is liable to change. * - * Registers an XSL file against a content type. * @param type the content type * @param path the path relative to the server root */ @@ -685,9 +693,9 @@ public class ContentType extends ACSObject { } /** + * Unregisters an XSL file against a content type. * NB this interface is liable to change. * - * Unregisters an XSL file against a content type. * @param type the content type * @param path the path relative to the server root */ @@ -698,24 +706,31 @@ public class ContentType extends ACSObject { /** * Gets an iterator of java.net.URL objects for - * all registered XSL files + * all registered XSL files. + * + * @return */ public static Iterator getXSLFileURLs() { return new EntryIterator(s_xsl.iterator()); } + /** + * + */ private static class EntryIterator implements Iterator { - private Iterator m_inner; + private final Iterator m_inner; public EntryIterator(Iterator inner) { m_inner = inner; } + @Override public boolean hasNext() { return m_inner.hasNext(); } + @Override public Object next() { XSLEntry entry = (XSLEntry) m_inner.next(); String path = entry.getPath(); @@ -730,15 +745,19 @@ public class ContentType extends ACSObject { } } + @Override public void remove() { m_inner.remove(); } } + /** + * + */ private static class XSLEntry { - private ContentType m_type; - private String m_path; + private final ContentType m_type; + private final String m_path; public XSLEntry(ContentType type, String path) { diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java index 0e7e7ac76..51ddbd49a 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java @@ -66,7 +66,10 @@ import org.apache.log4j.Logger; **/ public abstract class AbstractContentTypeLoader extends PackageLoader { - /** Logger instance for debugging */ + /** Internal logger instance to faciliate debugging. Enable logging output + * by editing /WEB-INF/conf/log4j.properties int hte runtime environment + * and set com.arsdigita.cms.contenttypes.AbstractContentTypeLoader=DEBUG + * by uncommenting or adding the line. */ private static final Logger s_log = Logger.getLogger( AbstractContentTypeLoader.class); @@ -74,9 +77,11 @@ public abstract class AbstractContentTypeLoader extends PackageLoader { * * @param ctx */ + @Override public void run(final ScriptContext ctx) { new KernelExcursion() { + @Override protected void excurse() { setEffectiveParty(Kernel.getSystemParty()); @@ -93,8 +98,8 @@ public abstract class AbstractContentTypeLoader extends PackageLoader { private void createTypes(ScriptContext ctx) { XMLContentTypeHandler handler = new XMLContentTypeHandler(); String[] contentTypes = getTypes(); - for (int i = 0; i < contentTypes.length; i++) { - XML.parseResource(contentTypes[i], handler); + for (String contentType : contentTypes) { + XML.parseResource(contentType, handler); } List types = handler.getContentTypes(); @@ -110,8 +115,7 @@ public abstract class AbstractContentTypeLoader extends PackageLoader { continue; } - LifecycleDefinitionCollection ldc = - section.getLifecycleDefinitions(); + LifecycleDefinitionCollection ldc = section.getLifecycleDefinitions(); LifecycleDefinition ld = null; if (ldc.next()) { ld = ldc.getLifecycleDefinition(); @@ -130,6 +134,13 @@ public abstract class AbstractContentTypeLoader extends PackageLoader { } } + /** + * + * @param section + * @param type + * @param ld + * @param wf + */ protected void prepareSection(final ContentSection section, final ContentType type, final LifecycleDefinition ld, @@ -152,7 +163,7 @@ public abstract class AbstractContentTypeLoader extends PackageLoader { */ protected abstract String[] getTypes(); - /* + /** * */ private boolean isLoadableInto(ContentSection section) { @@ -185,17 +196,27 @@ public abstract class AbstractContentTypeLoader extends PackageLoader { } /** - * This provides an easy way to subtypes to register default - * templates during the loading. When this is used, it should - * be called by the loader class by overriding prepareSection + * This provides an easy way to subtypes to register default templates + * during the loading. When this is used, it should be called by the + * loader class by overriding prepareSection. + * + * @param name + * @param label + * @param templateIs + * @param section + * @param type + * @param ld + * @param wf + * @return */ protected Template setDefaultTemplate(final String name, - final String label, - final InputStream templateIs, - final ContentSection section, - final ContentType type, - final LifecycleDefinition ld, - final WorkflowTemplate wf) { + final String label, + final InputStream templateIs, + final ContentSection section, + final ContentType type, + final LifecycleDefinition ld, + final WorkflowTemplate wf) { + final Template template = new Template(); template.setName(name); template.setLabel(label); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java index 350dc35c3..6549f2beb 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java @@ -49,9 +49,9 @@ import java.math.BigDecimal; import org.apache.log4j.Logger; /** - * A form which displays a select box of all content types available under the - * given content section, and forwards to the item creation UI when the user - * selects a content type to instantiate. + * A form element which displays a select box of all content types available + * under the given content section, and forwards to the item creation UI when + * the user selects a content type to instantiate. * * @author Stanislav Freidin (sfreidin@arsdigtia.com) * @version $Revision: #12 $ $DateTime: 2004/08/17 23:15:09 $ diff --git a/ccm-core/src/com/arsdigita/bebop/Label.java b/ccm-core/src/com/arsdigita/bebop/Label.java index a48b8e9a7..0137aba6d 100755 --- a/ccm-core/src/com/arsdigita/bebop/Label.java +++ b/ccm-core/src/com/arsdigita/bebop/Label.java @@ -43,15 +43,15 @@ import com.arsdigita.xml.Element; */ public class Label extends DescriptiveComponent implements Cloneable { - private static final String NO_LABEL = ""; public static final String BOLD = "b"; public static final String ITALIC = "i"; // the default label private GlobalizedMessage m_label; // a requestlocal set of labels (to avoid printlisteners) - private RequestLocal m_requestLabel = new RequestLocal(); + private final RequestLocal m_requestLabel = new RequestLocal(); private String m_fontWeight; + /** The setting for output escaping affects how markup in the * content is handled. *

* Default is false. */ - private boolean m_escaping = false; // default for a primitive + private boolean m_escaping = false; // default for a primitive anyway private PrintListener m_printListener; /** * Constructor creates a new Label with empty text. */ public Label() { - this(NO_LABEL); + // A kind of fallback (or a hack) here. Parameter label is taken as + // a key for some (unknown) Resource bundle. Because GlobalizedMessage + // will not find a corrresponding message it will display the key + // itself, 'faking' a globalized message. + m_label = new GlobalizedMessage(" "); } /** * Creates a new Label with the specified (fixed) text. * * @param label the text to display - * @deprecated refactor to use Label(GlobalizedMessage label) instad + * @deprecated refactor to use Label(GlobalizedMessage label) instead */ public Label(String label) { this(label, true); @@ -81,15 +85,14 @@ public class Label extends DescriptiveComponent implements Cloneable { /** * Creates a new Label with the specified text and - * output escaping turned on if - * escaping is - * true. + * output escaping turned on if escaping is true. * * The setting for output escaping affects how markup in the - * label is handled. For example: + * label is handled. For example: + * * * @param label the text to display * @param escaping true if output escaping will be in effect; @@ -127,8 +130,7 @@ public class Label extends DescriptiveComponent implements Cloneable { /** *

Creates a new label with the specified text as GlobalizedMessage - * and output escaping turned on if - * escaping is + * and output escaping turned on if escaping is * true.

* * @param label the text to display as GlobalizedMessage @@ -166,15 +168,18 @@ public class Label extends DescriptiveComponent implements Cloneable { } /** - * . + * Provides the Label as Text, localized for the current request. + * * Although it is not recommended, this method may be overridden to - * dynamically generate the text of the label. Overriding code may need the - * page state.

If possible, derived classes should override - * {@link #getLabel()} instead, which is called from this method. As long as - * we don't have a static method to obtain ApplicationContext, this is a way - * to get the RequestContext (that is, to determine the locale). When - * ApplicationContext gets available, that will become the suggested way for - * overriding code to get context. + * dynamically generate the text of the label. Overriding code may need + * the page state. + *

+ * If possible, derived classes should override {@link #getLabel()} instead, + * which is called from this method. As long as we don't have a static + * method to obtain ApplicationContext, this is a way to get the + * RequestContext (to determine the locale). When ApplicationContext gets + * available, that will become the suggested way for overriding code to get + * context. * * @param state the current page state * @return the string produced for this label @@ -183,16 +188,16 @@ public class Label extends DescriptiveComponent implements Cloneable { return (String) getGlobalizedMessage(state).localize(state.getRequest()); } - /** - * . - * - * This method may be overridden to dynamically generate the default text of - * the label. - * - * @return the string produced for this label. - * - * @deprecated Use {@link #getGlobalizedMessage()} - */ + // /** + // * . + // * + // * This method may be overridden to dynamically generate the default text of + // * the label. + // * + // * @return the string produced for this label. + // * + // * @deprecated Use {@link #getGlobalizedMessage()} + // */ // Conflicts with Super's getLabel message of type GlobalizedMessage. But isn't // needed anyway. Should deleted as soon as the refactoring of Label is // completed (i.e. any string Label ironed out). @@ -256,8 +261,10 @@ public class Label extends DescriptiveComponent implements Cloneable { if (label == null || label.length() == 0) { label = " "; } - // Seems to be quite useless. label is taken as a key for some (unknown) - // Resource bundle. + // A kind of fallback (or a hack) here. Parameter label is taken as + // a key for some (unknown) Resource bundle. Because GlobalizedMessage + // will not find a corrresponding message it will display the key + // itself, 'faking' a globalized message. setLabel(new GlobalizedMessage(label), state); } @@ -319,9 +326,8 @@ public class Label extends DescriptiveComponent implements Cloneable { /** * Adds a print listener. Only one print listener can be set for a label, - * since the - * PrintListener is expected to modify the target of the - * PrintEvent. + * since the PrintListener is expected to modify the target + * of the PrintEvent. * * @param listener the print listener * @throws IllegalArgumentException if listener is null. @@ -341,8 +347,8 @@ public class Label extends DescriptiveComponent implements Cloneable { } /** - * Removes a previously added print listener. If - * listener is not the listener that was added with {@link #addPrintListener + * Removes a previously added print listener. If listener is + * not the listener that was added with {@link #addPrintListener * addPrintListener}, an IllegalArgumentException will be thrown. * * @param listener the listener that was added with @@ -408,10 +414,10 @@ public class Label extends DescriptiveComponent implements Cloneable { } /* - * This may break with normal JDOM. We may need to have a node - * for the case where there is no weight. The problem comes in that - * setText *may* kill the other content in the node. It will kill the - * other text, so it may be a good idea anyways. + * This may break with normal JDOM. We may need to have a node for + * the case where there is no weight. The problem comes in that + * setText *may* kill the other content in the node. It will kill + * the other text, so it may be a good idea anyways. */ label.setText(target.getLabel(state)); }