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-94f89814c4dfmaster
parent
740f9b208a
commit
7cdf763aff
|
|
@ -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
|
||||
|
|
@ -48,6 +48,7 @@ public class AddressLoader extends AbstractContentTypeLoader {
|
|||
*
|
||||
* @return String Atring Array of fully qualified file names
|
||||
*/
|
||||
@Override
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())) {
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ import java.util.StringTokenizer;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>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}.</p>
|
||||
* <p>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}.</p>
|
||||
*
|
||||
* <p>Each content type is associated with a {@link
|
||||
* com.arsdigita.domain.DomainObject domain object} and a {@link
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,9 +196,18 @@ 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,
|
||||
|
|
@ -196,6 +216,7 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
|
|||
final ContentType type,
|
||||
final LifecycleDefinition ld,
|
||||
final WorkflowTemplate wf) {
|
||||
|
||||
final Template template = new Template();
|
||||
template.setName(name);
|
||||
template.setLabel(label);
|
||||
|
|
|
|||
|
|
@ -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 $
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* <code>content</code> is handled.
|
||||
* <UL><LI>If output escaping is in effect (true), <b>example</b>
|
||||
|
|
@ -59,21 +59,25 @@ public class Label extends DescriptiveComponent implements Cloneable {
|
|||
* <LI>If output escaping is disabled, <b>example</b> appears as the
|
||||
* String "example" in bold (i.e. retaining the markup.</LI></UL>
|
||||
* 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 <code>Label</code> 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 <code>Label</code> 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 <code>Label</code> with the specified text and
|
||||
* output escaping turned on if
|
||||
* <code>escaping</code> is
|
||||
* <code>true</code>.
|
||||
* output escaping turned on if <code>escaping</code> is <code>true</code>.
|
||||
*
|
||||
* The setting for output escaping affects how markup in the
|
||||
* <code>label</code> is handled. For example: <UL><LI>If output escaping is
|
||||
* in effect, <b>text</b> will appear literally.</LI> <LI>If output
|
||||
* escaping is disabled, <b>text</b> appears as the word "text" in
|
||||
* bold.</LI></UL>
|
||||
* <code>label</code> is handled. For example:
|
||||
* <UL><LI>If output escaping is in effect, <b>text</b> will appear
|
||||
* literally.</LI>
|
||||
* <LI>If output escaping is disabled, <b>text</b> appears as the
|
||||
* word "text" in bold.</LI></UL>
|
||||
*
|
||||
* @param label the text to display
|
||||
* @param escaping <code>true</code> if output escaping will be in effect;
|
||||
|
|
@ -127,8 +130,7 @@ public class Label extends DescriptiveComponent implements Cloneable {
|
|||
|
||||
/**
|
||||
* <p> Creates a new label with the specified text as GlobalizedMessage
|
||||
* and output escaping turned on if
|
||||
* <code>escaping</code> is
|
||||
* and output escaping turned on if <code>escaping</code> is
|
||||
* <code>true</code>. </p>
|
||||
*
|
||||
* @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. <p>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.
|
||||
* <p>
|
||||
* 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
|
||||
* <code>PrintListener</code> is expected to modify the target of the
|
||||
* <code>PrintEvent</code>.
|
||||
* since the <code>PrintListener</code> is expected to modify the target
|
||||
* of the <code>PrintEvent</code>.
|
||||
*
|
||||
* @param listener the print listener
|
||||
* @throws IllegalArgumentException if <code>listener</code> is null.
|
||||
|
|
@ -341,8 +347,8 @@ public class Label extends DescriptiveComponent implements Cloneable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes a previously added print listener. If
|
||||
* <code>listener</code> is not the listener that was added with {@link #addPrintListener
|
||||
* Removes a previously added print listener. If <code>listener</code> 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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue