Several enhancements for the handling of the new labels and hints:

- Hints are now shown for ControlLinks
- The standard theme uses an better symbol
- Hints and new style labels now work for DHTMLEditors, and widgets Date, Time and DateTime


git-svn-id: https://svn.libreccm.org/ccm/trunk@2755 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-07-11 18:38:38 +00:00
parent 112910e484
commit c510e1566a
12 changed files with 531 additions and 479 deletions

View File

@ -23,7 +23,6 @@ import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
/** /**
* *
* *
@ -49,7 +48,7 @@ public class CMSDHTMLEditor extends DHTMLEditor {
private void addPlugins() { private void addPlugins() {
String[] plugins = ContentSection.getConfig().getDHTMLEditorPlugins(); String[] plugins = ContentSection.getConfig().getDHTMLEditorPlugins();
if (plugins != null) { if (plugins != null) {
for (int i = 0 ; i < plugins.length ; i++) { for (int i = 0; i < plugins.length; i++) {
addPlugin(plugins[i]); addPlugin(plugins[i]);
} }
} }
@ -58,7 +57,7 @@ public class CMSDHTMLEditor extends DHTMLEditor {
private void hideButtons() { private void hideButtons() {
String[] hiddenButtons = ContentSection.getConfig().getDHTMLEditorHiddenButtons(); String[] hiddenButtons = ContentSection.getConfig().getDHTMLEditorHiddenButtons();
if (hiddenButtons != null) { if (hiddenButtons != null) {
for (int i = 0 ; i < hiddenButtons.length ; i++) { for (int i = 0; i < hiddenButtons.length; i++) {
hideButton(hiddenButtons[i]); hideButton(hiddenButtons[i]);
} }
} }

View File

@ -281,6 +281,7 @@ public class DHTMLEditor extends TextArea {
Element editor = parent.newChildElement(getElementTag(), BEBOP_XML_NS); Element editor = parent.newChildElement(getElementTag(), BEBOP_XML_NS);
editor.addAttribute("name", getName()); editor.addAttribute("name", getName());
generateDescriptionXML(state, editor);
// Set the needed config params so they don't have to be hardcoded in the theme // Set the needed config params so they don't have to be hardcoded in the theme
editor.addAttribute("editor_url", Web.getWebappContextPath().concat(getEditorURL())); editor.addAttribute("editor_url", Web.getWebappContextPath().concat(getEditorURL()));

View File

@ -324,6 +324,7 @@ public class Date extends Widget implements BebopConstants {
date.addAttribute("label", (String) getLabel().localize(ps.getRequest())); date.addAttribute("label", (String) getLabel().localize(ps.getRequest()));
} }
exportAttributes(date); exportAttributes(date);
generateDescriptionXML(ps, date);
generateLocalizedWidget(ps, date); generateLocalizedWidget(ps, date);
// If Element could be null insert an extra widget to clear entry // If Element could be null insert an extra widget to clear entry

View File

@ -112,6 +112,8 @@ public class DateTime extends Widget implements BebopConstants {
m_date.generateLocalizedWidget(ps, datetime); m_date.generateLocalizedWidget(ps, datetime);
m_time.generateLocalizedWidget(ps, datetime); m_time.generateLocalizedWidget(ps, datetime);
generateDescriptionXML(ps, datetime);
// If Element could be null insert a extra widget to clear entry // If Element could be null insert a extra widget to clear entry
if (!hasValidationListener(new NotNullValidationListener())) { if (!hasValidationListener(new NotNullValidationListener())) {
datetime.newChildElement("NoDateTime"); datetime.newChildElement("NoDateTime");

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.bebop.form; package com.arsdigita.bebop.form;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -28,8 +27,6 @@ import com.arsdigita.bebop.parameters.ParameterModel;
// in a constant which is used when generating XML // in a constant which is used when generating XML
import com.arsdigita.bebop.util.BebopConstants; import com.arsdigita.bebop.util.BebopConstants;
/** /**
* A class representing a textarea field in an HTML form. * A class representing a textarea field in an HTML form.
* *
@ -68,13 +65,9 @@ public class TextArea extends Widget implements BebopConstants {
// ------------------------------------- // -------------------------------------
// * * * Fields * * * // * * * Fields * * *
// ------------------------------------- // -------------------------------------
// ------------------------------------- // -------------------------------------
// * * * Methods * * * // * * * Methods * * *
// ------------------------------------- // -------------------------------------
public TextArea(String name) { public TextArea(String name) {
super(name); super(name);
} }
@ -149,45 +142,48 @@ public class TextArea extends Widget implements BebopConstants {
/** /**
* Set the default value (text) * Set the default value (text)
*
* @deprecated [since 17Aug2001] use {@link Widget#setDefaultValue(Object)} * @deprecated [since 17Aug2001] use {@link Widget#setDefaultValue(Object)}
*/ */
public void setValue( String text ) { public void setValue(String text) {
this.setDefaultValue(text); this.setDefaultValue(text);
} }
/** /**
* Is this a compound widget? * Is this a compound widget?
*
* @return false * @return false
*/ */
public boolean isCompound() { public boolean isCompound() {
return false; return false;
} }
/** The XML tag. /**
* @return The tag to be used for the top level DOM element * The XML tag.
* generated for this type of Widget. */ *
* @return The tag to be used for the top level DOM element generated for this type of Widget.
*/
protected String getElementTag() { protected String getElementTag() {
return BEBOP_TEXTAREA; return BEBOP_TEXTAREA;
} }
/** /**
* Generates the DOM for the textarea widget. * Generates the DOM for the textarea widget.
* <p>Generates DOM fragment: * <p>
* <p><code>&lt;bebop:textarea name=... value=... [onXXX=...]/> * Generates DOM fragment:
* <p>
* <code>&lt;bebop:textarea name=... value=... [onXXX=...]/>
* </code> * </code>
*/ */
public void generateWidget( PageState state, Element parent ) { public void generateWidget(PageState state, Element parent) {
Element textarea = parent.newChildElement(getElementTag(), BEBOP_XML_NS); Element textarea = parent.newChildElement(getElementTag(), BEBOP_XML_NS);
textarea.addAttribute("name", getName()); textarea.addAttribute("name", getName());
if (getLabel() != null) generateDescriptionXML(state, textarea);
textarea.addAttribute("label",
(String)getLabel().localize(state.getRequest()));
ParameterData pData = getParameterData(state); ParameterData pData = getParameterData(state);
if( null != pData ) { if (null != pData) {
String value = pData.marshal(); String value = pData.marshal();
if ( value == null ) { if (value == null) {
value = ""; value = "";
} }
textarea.addAttribute("value", value); textarea.addAttribute("value", value);

View File

@ -21,7 +21,13 @@ package com.arsdigita.bebop.form;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.parameters.*; import com.arsdigita.bebop.parameters.DateTimeParameter;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.NumberInRangeValidationListener;
import com.arsdigita.bebop.parameters.ParameterData;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.TimeParameter;
import com.arsdigita.bebop.util.BebopConstants; import com.arsdigita.bebop.util.BebopConstants;
import com.arsdigita.globalization.GlobalizationHelper; import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -258,6 +264,7 @@ public class Time extends Widget implements BebopConstants {
Element time = parent.newChildElement(getElementTag(), BEBOP_XML_NS); Element time = parent.newChildElement(getElementTag(), BEBOP_XML_NS);
time.addAttribute("name", getParameterModel().getName()); time.addAttribute("name", getParameterModel().getName());
generateDescriptionXML(ps, time);
generateLocalizedWidget(ps, time); generateLocalizedWidget(ps, time);
// If Element could be null insert a extra widget to clear entry // If Element could be null insert a extra widget to clear entry

View File

@ -52,18 +52,16 @@ import com.arsdigita.xml.Element;
* </p> * </p>
* *
* <p> * <p>
* A widget may correspond to a standard HTML form element, or to a more * A widget may correspond to a standard HTML form element, or to a more specific element or set of
* specific element or set of elements, such as a date widget that allows * elements, such as a date widget that allows input of month, day and year (and possibly time as
* input of month, day and year (and possibly time as well).</p> * well).</p>
* *
* <p> * <p>
* This class and its subclasses provide methods to set all element attributes * This class and its subclasses provide methods to set all element attributes except for
* except for <code>VALUE</code>, which is typically dependent on the request. * <code>VALUE</code>, which is typically dependent on the request. At the time of a request, a
* At the time of a request, a widget object merges a dynamically specified * widget object merges a dynamically specified value or set of values with its own set of
* value or set of values with its own set of persistent attributes to render * persistent attributes to render the final HTML for the widget. Other dynamic attributes may be
* the final HTML for the widget. Other dynamic attributes may be associated * associated with the form component via a <code>WidgetPeer</code> associated with the widget.</p>
* with the form component via a <code>WidgetPeer</code> associated with the
* widget.</p>
* *
* @author Karl Goldstein * @author Karl Goldstein
* @author Uday Mathur * @author Uday Mathur
@ -80,7 +78,9 @@ public abstract class Widget extends DescriptiveComponent
private ParameterListener m_forwardParameter = null; private ParameterListener m_forwardParameter = null;
private PrintListener m_printListener; private PrintListener m_printListener;
private Form m_form; private Form m_form;
/** The optional (localized) label (or title) of this widget. */ /**
* The optional (localized) label (or title) of this widget.
*/
// Use parent's class' instead // Use parent's class' instead
// private GlobalizedMessage m_label; // private GlobalizedMessage m_label;
@ -96,7 +96,6 @@ public abstract class Widget extends DescriptiveComponent
static final String ON_CHANGE = "onChange"; static final String ON_CHANGE = "onChange";
static final String ON_KEY_UP = "onKeyUp"; static final String ON_KEY_UP = "onKeyUp";
/** /**
* Constructor, creates a new widget. * Constructor, creates a new widget.
* *
@ -110,8 +109,8 @@ public abstract class Widget extends DescriptiveComponent
* Constructor, creates a new widget. * Constructor, creates a new widget.
* *
* <p> * <p>
* Each new widget is associated with a ParameterModel describing the * Each new widget is associated with a ParameterModel describing the data object(s) submitted
* data object(s) submitted from the widget. * from the widget.
* *
* @param model * @param model
*/ */
@ -121,7 +120,6 @@ public abstract class Widget extends DescriptiveComponent
m_parameterModel = model; m_parameterModel = model;
} }
/** /**
* Returns true if the widget consists of multiple HTML elements. * Returns true if the widget consists of multiple HTML elements.
* *
@ -130,8 +128,7 @@ public abstract class Widget extends DescriptiveComponent
public abstract boolean isCompound(); public abstract boolean isCompound();
/** /**
* Returns a string naming the type of this widget. Must be implemented by * Returns a string naming the type of this widget. Must be implemented by subclasses!
* subclasses!
* *
* @return * @return
*/ */
@ -143,11 +140,13 @@ public abstract class Widget extends DescriptiveComponent
*/ */
protected ParameterListener createParameterListener() { protected ParameterListener createParameterListener() {
return new ParameterListener() { return new ParameterListener() {
@Override @Override
public void validate(ParameterEvent evt) public void validate(ParameterEvent evt)
throws FormProcessException { throws FormProcessException {
fireValidation(new ParameterEvent(Widget.this, evt.getParameterData())); fireValidation(new ParameterEvent(Widget.this, evt.getParameterData()));
} }
}; };
} }
@ -166,8 +165,8 @@ public abstract class Widget extends DescriptiveComponent
PageState ps = evt.getPageState(); PageState ps = evt.getPageState();
if ( (!validateInvisible() && !ps.isVisibleOnPage(this)) if ((!validateInvisible() && !ps.isVisibleOnPage(this))
|| ((m_guard != null) && m_guard.shouldValidate(ps)) ) { || ((m_guard != null) && m_guard.shouldValidate(ps))) {
return; return;
} }
@ -198,6 +197,7 @@ public abstract class Widget extends DescriptiveComponent
* Test for existens of a particular type of ValidationListener * Test for existens of a particular type of ValidationListener
* *
* @param listener Subtype of ParameterListern which is tested for * @param listener Subtype of ParameterListern which is tested for
*
* @return true if subtype is in the list * @return true if subtype is in the list
*/ */
public boolean hasValidationListener(ParameterListener listener) { public boolean hasValidationListener(ParameterListener listener) {
@ -208,11 +208,12 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Adds a print listener for this widget. Only one print listener can * Adds a print listener for this widget. Only one print listener can be set for a widget, since
* be set for a widget, since the <code>PrintListener</code> is expected * the <code>PrintListener</code> is expected to modify the target of the
* to modify the target of the <code>PrintEvent</code>. * <code>PrintEvent</code>.
* *
* @param listener the print listener * @param listener the print listener
*
* @throws IllegalArgumentException <code>listener</code> is null * @throws IllegalArgumentException <code>listener</code> is null
* @throws TooManyListenersException a print listener has previously been added * @throws TooManyListenersException a print listener has previously been added
* @pre listener != null * @pre listener != null
@ -229,12 +230,12 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Set the print listener for this widget. Since there can only be one * Set the print listener for this widget. Since there can only be one print listener for a
* print listener for a widget, this lets you just set it and avoid * widget, this lets you just set it and avoid writing a try/catch block for
* writing a try/catch block for "TooManyListenersException". Any existing * "TooManyListenersException". Any existing listener will be overwritten.
* listener will be overwritten.
* *
* @param listener the print listener * @param listener the print listener
*
* @throws IllegalArgumentException <code>listener</code> is null * @throws IllegalArgumentException <code>listener</code> is null
* @pre listener != null * @pre listener != null
*/ */
@ -247,15 +248,14 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Remove a previously added print listener. * Remove a previously added print listener. If <code>listener</code> is not the listener that
* If <code>listener</code> is not the listener that has been added with * has been added with {@link #addPrintListener addPrintListener}, an IllegalArgumentException
* {@link #addPrintListener addPrintListener}, an IllegalArgumentException
* will be thrown. * will be thrown.
* *
* @param listener the listener that had been added with * @param listener the listener that had been added with <code>addPrintListener</code>
* <code>addPrintListener</code> *
* @throws IllegalArgumentException <code>listener</code> is not the * @throws IllegalArgumentException <code>listener</code> is not the currently registered print
* currently registered print listener or is <code>null</code>. * listener or is <code>null</code>.
* @pre listener != null * @pre listener != null
*/ */
public void removePrintListener(PrintListener listener) public void removePrintListener(PrintListener listener)
@ -270,9 +270,8 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Registers the ParameterModel of this Widget with the containing Form. * Registers the ParameterModel of this Widget with the containing Form. This method is used by
* This method is used by the Bebop framework and should not be used by * the Bebop framework and should not be used by application developers.
* application developers.
* *
* @param form * @param form
* @param model * @param model
@ -285,12 +284,12 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the Form Object for this Widget. * Sets the Form Object for this Widget. This method will throw an exception if the _form
* This method will throw an exception if the _form pointer is already set. * pointer is already set. To explicity change the m_form pointer the developer must first call
* To explicity change the m_form pointer the developer must first call
* setForm(null) * setForm(null)
* *
* @param form The <code>Form</code> Object for this Widget * @param form The <code>Form</code> Object for this Widget
*
* @exception IllegalStateException if form already set. * @exception IllegalStateException if form already set.
*/ */
public void setForm(final Form form) { public void setForm(final Form form) {
@ -304,10 +303,11 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Gets the Form Object for this Widget. * Gets the Form Object for this Widget. Throws an exception if the Widget doesn't belong to a
* Throws an exception if the Widget doesn't belong to a form. * form.
* *
* @return the {@link Form} Object for this Widget. * @return the {@link Form} Object for this Widget.
*
* @post return != null * @post return != null
*/ */
public Form getForm() throws RuntimeException { public Form getForm() throws RuntimeException {
@ -320,8 +320,7 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the <tt>ONFOCUS</tt> attribute for the HTML tags that compose * Sets the <tt>ONFOCUS</tt> attribute for the HTML tags that compose this element.
* this element.
* *
* @param javascriptCode * @param javascriptCode
*/ */
@ -330,8 +329,7 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the <tt>ONBLUR</tt> attribute for the HTML tags that compose * Sets the <tt>ONBLUR</tt> attribute for the HTML tags that compose this element.
* this element.
* *
* @param javascriptCode * @param javascriptCode
*/ */
@ -340,8 +338,7 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the <tt>ONSELECT</tt> attribute for the HTML tags that compose * Sets the <tt>ONSELECT</tt> attribute for the HTML tags that compose this element.
* this element.
* *
* @param javascriptCode * @param javascriptCode
*/ */
@ -350,8 +347,7 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the <tt>ONCHANGE</tt> attribute for the HTML tags that compose * Sets the <tt>ONCHANGE</tt> attribute for the HTML tags that compose this element.
* this element.
* *
* @param javascriptCode * @param javascriptCode
*/ */
@ -360,8 +356,7 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the <tt>ON_KEY_UP</tt> attribute for the HTML tags that compose * Sets the <tt>ON_KEY_UP</tt> attribute for the HTML tags that compose this element.
* this element.
* *
* @param javascriptCode * @param javascriptCode
*/ */
@ -370,9 +365,8 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Sets the default value in the parameter model for this element. * Sets the default value in the parameter model for this element. This is a static property and
* This is a static property and this method should not be invoked * this method should not be invoked at request time (not even in a PrintListener).
* at request time (not even in a PrintListener).
* *
* @param value * @param value
*/ */
@ -381,9 +375,8 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Marks this widget as readonly, which has the effect of preventing the * Marks this widget as readonly, which has the effect of preventing the user from modifying the
* user from modifying the widget's contents. * widget's contents. This method can only be called on unlocked widgets.
* This method can only be called on unlocked widgets.
*/ */
public void setReadOnly() { public void setReadOnly() {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -391,9 +384,8 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Marks this widget as disabled, which has the effect of preventing the * Marks this widget as disabled, which has the effect of preventing the widget's value being
* widget's value being submitted with the form, and will typically cause * submitted with the form, and will typically cause the widget to be 'grayed out' on the form.
* the widget to be 'grayed out' on the form.
* This method can only be called on unlocked widgets. * This method can only be called on unlocked widgets.
*/ */
public void setDisabled() { public void setDisabled() {
@ -405,8 +397,9 @@ public abstract class Widget extends DescriptiveComponent
* Sets a popup hint for the widget. * Sets a popup hint for the widget.
* *
* @param hint * @param hint
* @deprecated refactor to use a GlobalizedMessage instead and use *
* setHint(GlobalizedMessage hint) * @deprecated refactor to use a GlobalizedMessage instead and use setHint(GlobalizedMessage
* hint)
*/ */
public void setHint(String hint) { public void setHint(String hint) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -424,7 +417,6 @@ public abstract class Widget extends DescriptiveComponent
// Assert.isUnlocked(this); // Assert.isUnlocked(this);
// setAttribute("hint", (String) hint.localize()); // setAttribute("hint", (String) hint.localize());
// } // }
/** /**
* Sets a Label for the widget. * Sets a Label for the widget.
* *
@ -434,7 +426,6 @@ public abstract class Widget extends DescriptiveComponent
// public void setLabel(GlobalizedMessage label) { // public void setLabel(GlobalizedMessage label) {
// m_label = label; // m_label = label;
// } // }
/** /**
* Sets a Label for the widget. * Sets a Label for the widget.
* *
@ -444,7 +435,6 @@ public abstract class Widget extends DescriptiveComponent
// public GlobalizedMessage getLabel() { // public GlobalizedMessage getLabel() {
// return m_label; // return m_label;
// } // }
/** /**
* Gets the default value in the parameter model for this element. * Gets the default value in the parameter model for this element.
* *
@ -463,30 +453,28 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* The "pass in" property determines whether the value for this parameter * The "pass in" property determines whether the value for this parameter is generally passed in
* is generally passed in from the outside. * from the outside. If this property is <code>true</code>, the model always tries to get the
* If this property is <code>true</code>, the model always tries to get the * parameter value from the request, no matter whether the request is the initial request or a
* parameter value from the request, no matter whether the request is the * submission of the form to which the widget belongs.
* initial request or a submission of the form to which the widget belongs.
* *
* <p> * <p>
* If this property is <code>false</code>, the parameter value is only read * If this property is <code>false</code>, the parameter value is only read from the request if
* from the request if it is a submission of the form containing the widget. * it is a submission of the form containing the widget.
* *
* <p> * <p>
* By default, this property is <code>false</code>. * By default, this property is <code>false</code>.
* *
* @return <code>true</code> if an attempt should always be made to * @return <code>true</code> if an attempt should always be made to retrieve the parameter value
* retrieve the parameter value from the request. * from the request.
*/ */
public final boolean isPassIn() { public final boolean isPassIn() {
return getParameterModel().isPassIn(); return getParameterModel().isPassIn();
} }
/** /**
* Set whether this parameter should be treated as a "pass in" parameter. * Set whether this parameter should be treated as a "pass in" parameter. This is a static
* This is a static property of the ParameterModel and this method should * property of the ParameterModel and this method should not be invoked at request-time.
* not be invoked at request-time.
* *
* @see #isPassIn * @see #isPassIn
* @param v <code>true</code> if this parameter is a pass in parameter. * @param v <code>true</code> if this parameter is a pass in parameter.
@ -497,10 +485,8 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* The ParameterModel is normally set via the constructors. * The ParameterModel is normally set via the constructors. This method is only rarely needed.
* This method is only rarely needed. * Please note that the previous ParameterModel and all its listeners will be lost.
* Please note that the previous ParameterModel and all its listeners
* will be lost.
* *
* @param parameterModel * @param parameterModel
*/ */
@ -510,11 +496,10 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Allows access to underlying parameterModel. The ParameterModel contains * Allows access to underlying parameterModel. The ParameterModel contains static
* static (request-independent) properties of a Widget such as its name, * (request-independent) properties of a Widget such as its name, default value and its
* default value and its listeners. The ParameterModel can not be modified * listeners. The ParameterModel can not be modified once Page.lock() has been invoked (not even
* once Page.lock() has been invoked (not even in a PrintListener). * in a PrintListener). This is done after the Page has been built, normally at server startup.
* This is done after the Page has been built, normally at server startup.
* *
* @return * @return
*/ */
@ -524,15 +509,14 @@ public abstract class Widget extends DescriptiveComponent
/** /**
* <p> * <p>
* This method creates the DOM for the widget. The method is called by the * This method creates the DOM for the widget. The method is called by the Bebop framework and
* Bebop framework and should not be invoked by application developers. * should not be invoked by application developers.
* </p> * </p>
* *
* <p> * <p>
* The method first fires the print event allowing application developers * The method first fires the print event allowing application developers to set certain
* to set certain properties of the Widget at request time in a * properties of the Widget at request time in a PrintListener. The methods generateWidget and
* PrintListener. The methods generateWidget and generateErrors will then * generateErrors will then be invoked to generate either of the following
* be invoked to generate either of the following
* </p> * </p>
* *
* <p> * <p>
@ -580,8 +564,7 @@ public abstract class Widget extends DescriptiveComponent
/** /**
* The XML tag. * The XML tag.
* *
* @return The tag to be used for the top level DOM element generated for * @return The tag to be used for the top level DOM element generated for this type of Widget.
* this type of Widget.
*/ */
protected String getElementTag() { protected String getElementTag() {
return BEBOP_FORMWIDGET; return BEBOP_FORMWIDGET;
@ -605,7 +588,7 @@ public abstract class Widget extends DescriptiveComponent
widget.addAttribute("type", getType()); widget.addAttribute("type", getType());
widget.addAttribute("name", getName()); widget.addAttribute("name", getName());
widget.addAttribute("class", getName().replace(".", " ")); widget.addAttribute("class", getName().replace(".", " "));
generateDescriptionXML(state,widget); generateDescriptionXML(state, widget);
// if (m_label != null) { // if (m_label != null) {
// widget.addAttribute("label", // widget.addAttribute("label",
// (String) m_label.localize(state.getRequest())); // (String) m_label.localize(state.getRequest()));
@ -625,8 +608,7 @@ public abstract class Widget extends DescriptiveComponent
/** /**
* Generates the XML for the given widget. * Generates the XML for the given widget.
* <p> * <p>
* Generates XML fragment: * Generates XML fragment: <code>&lt;bebop:formErrors message=... id=name>
* <code>&lt;bebop:formErrors message=... id=name>
* &lt;/bebop:formErrors></code> * &lt;/bebop:formErrors></code>
* </p> * </p>
* *
@ -646,15 +628,15 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Get the value associated with this widget in the request described by * Get the value associated with this widget in the request described by <code>ps</code>. The
* <code>ps</code>. * type of the returned object depends on the <code>ParameterModel</code> underlying this
* The type of the returned object depends on the <code>ParameterModel</code> * widget. This method is typically called in a FormProcessListener to access the value that was
* underlying this widget. This method is typically called in a * submitted for a Widget in the Form.
* FormProcessListener to access the value that was submitted for a Widget
* in the Form.
* *
* @param ps describes the request currently being processed * @param ps describes the request currently being processed
*
* @return * @return
*
* @pre ps != null * @pre ps != null
* @post may return null * @post may return null
*/ */
@ -676,19 +658,19 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Set the value of the parameter associated with this widget to a new value. * Set the value of the parameter associated with this widget to a new value. The exact type of
* The exact type of <code>value</code> depends on the * <code>value</code> depends on the <code>ParameterModel</code> underlying the widget. This
* <code>ParameterModel</code> underlying the widget. This method is typically * method is typically called in a FormInitListener to initialize the value of a Widget in the
* called in a FormInitListener to initialize the value of a Widget in the
* Form at request time. * Form at request time.
* *
* @param ps * @param ps
* @param value * @param value
*
* @pre ps != null * @pre ps != null
* @post value == getValue(ps) * @post value == getValue(ps)
* *
* @throws IllegalStateException the form to which the widget belongs has * @throws IllegalStateException the form to which the widget belongs has not been processed
* not been processed yet. * yet.
*/ */
public void setValue(PageState ps, Object value) public void setValue(PageState ps, Object value)
throws IllegalStateException { throws IllegalStateException {
@ -724,7 +706,9 @@ public abstract class Widget extends DescriptiveComponent
/** /**
* *
* @param ps * @param ps
*
* @return the parameter value for this widget * @return the parameter value for this widget
*
* @post returns null if the FormData are missing * @post returns null if the FormData are missing
*/ */
protected ParameterData getParameterData(PageState ps) { protected ParameterData getParameterData(PageState ps) {
@ -737,11 +721,10 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Respond to an incoming request by calling <code>respond</code> on the * Respond to an incoming request by calling <code>respond</code> on the form to which the
* form to which the widget belongs. This method is called by the Bebop * widget belongs. This method is called by the Bebop framework and should not be invoked by
* framework and should not be invoked by application developers. It is * application developers. It is somewhat questionable that this method should ever be called,
* somewhat questionable that this method should ever be called, rather * rather than having {@link Form#respond Form.respond()} called directly.
* than having {@link Form#respond Form.respond()} called directly.
* *
* @throws javax.servlet.ServletException * @throws javax.servlet.ServletException
* @pre state != null * @pre state != null
@ -759,8 +742,8 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Specify a Widget. ValidationGuard implementation to use to determine if * Specify a Widget. ValidationGuard implementation to use to determine if this widget should
* this widget should run its validation listeners. * run its validation listeners.
* *
* @param guard the Widget.ValidationGuard. * @param guard the Widget.ValidationGuard.
*/ */
@ -770,12 +753,13 @@ public abstract class Widget extends DescriptiveComponent
} }
/** /**
* Inner interface used to determine if the validation listeners should be * Inner interface used to determine if the validation listeners should be run for this widget
* run for this widget or not. * or not.
*/ */
public interface ValidationGuard { public interface ValidationGuard {
boolean shouldValidate(PageState ps); boolean shouldValidate(PageState ps);
} }
/** /**
@ -792,6 +776,7 @@ public abstract class Widget extends DescriptiveComponent
* Adds an error to be displayed with this parameter. * Adds an error to be displayed with this parameter.
* *
* @param error A string showing the error to the user. * @param error A string showing the error to the user.
*
* @deprecated refactor to use addError(GlobalizedMessage) instead. * @deprecated refactor to use addError(GlobalizedMessage) instead.
*/ */
public void addError(String error) { public void addError(String error) {
@ -802,4 +787,5 @@ public abstract class Widget extends DescriptiveComponent
public String toString() { public String toString() {
return super.toString() + " [" + getName() + "]"; return super.toString() + " [" + getName() + "]";
} }
} }

View File

@ -443,7 +443,7 @@ div#left {
width: 25%; width: 25%;
} }
div#left, div#right{ div#left, div#right {
top: 0 !important; top: 0 !important;
bottom: 0; bottom: 0;
} }
@ -1482,9 +1482,11 @@ input#draft_search:active {
#content form fieldset { #content form fieldset {
border: none; border: none;
margin: 0.5em 0em 1em 0.3em; margin: 0.5em 0em 1em 0.3em;
border-top: 1px dotted #0776A0; /*border-top: 1px dotted #0776A0; */
border-bottom: 1px dotted #0776A0; /*border-bottom: 1px dotted #0776A0; */
padding: 0.3em 0em; border: 1px dotted #0776A0;
/*padding: 0.3em 0em;*/
padding: 1em;
color: #0776A0; color: #0776A0;
font-weight: bold; font-weight: bold;
} }
@ -1570,6 +1572,10 @@ div.bebopGridPanel{
margin-top: 15px; margin-top: 15px;
} }
.hint {
font-size: 1.6em;
}
.hint:hover:after { .hint:hover:after {
position: absolute; position: absolute;
box-shadow: 0 0 5px #4a4a4a; box-shadow: 0 0 5px #4a4a4a;
@ -1579,7 +1585,9 @@ div.bebopGridPanel{
top: auto; top: auto;
right: auto; right: auto;
width: 30%; width: 30%;
background-image: inear-gradient(top, #eeeeee, #cccccc); font-size: 0.63em;
z-index: 65535;
background-image: linear-gradient(top, #eeeeee, #cccccc);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc)); background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc); background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);

View File

@ -164,13 +164,16 @@
editor_<xsl:value-of select="@name"/>._wordClean(); editor_<xsl:value-of select="@name"/>._wordClean();
} }
</script> </script>
<!-- <!--
<style type="text/css"> <style type="text/css">
textarea { background-color: #fff; border: 1px solid 00f; } textarea { background-color: #fff; border: 1px solid 00f; }
</style> </style>
--> -->
</xsl:if> </xsl:if>
<xsl:call-template name="processLabel">
<xsl:with-param name="widget" select="."/>
</xsl:call-template>
<div style="width:560px; border:1px outset #666;"> <div style="width:560px; border:1px outset #666;">
<textarea id="ta_{@name}" name="{@name}" rows="{@rows}" cols="{@cols}" wrap="{@wrap}" style="width:100%"> <textarea id="ta_{@name}" name="{@name}" rows="{@rows}" cols="{@cols}" wrap="{@wrap}" style="width:100%">
<xsl:value-of disable-output-escaping="no" select="text()"/> <xsl:value-of disable-output-escaping="no" select="text()"/>
@ -237,14 +240,17 @@
</script> </script>
<!-- <!--
<style type="text/css"> <style type="text/css">
textarea { background-color: #fff; border: 1px solid 00f; } textarea { background-color: #fff; border: 1px solid 00f; }
</style> </style>
--> -->
</xsl:if> </xsl:if>
<!-- EN End of FCKeditor setup --> <!-- EN End of FCKeditor setup -->
<xsl:call-template name="processLabel">
<xsl:with-param name="widget" select="."/>
</xsl:call-template>
<textarea id="ta_{@name}" name="{@name}" style="width:100%" rows="{@rows}" cols="{@cols}" wrap="{@wrap}"> <textarea id="ta_{@name}" name="{@name}" style="width:100%" rows="{@rows}" cols="{@cols}" wrap="{@wrap}">
<xsl:value-of disable-output-escaping="no" select="text()"/> <xsl:value-of disable-output-escaping="no" select="text()"/>
</textarea> </textarea>
@ -264,7 +270,7 @@
<script type="text/javascript"> <script type="text/javascript">
_editor_url = "<xsl:value-of select="@editor_url"/>"; _editor_url = "<xsl:value-of select="@editor_url"/>";
_editor_lang ="<xsl:value-of select="$lang"/>"; _editor_lang ="<xsl:value-of select="$lang"/>";
<!-- _editor_skin = "silva";--> <!-- _editor_skin = "silva";-->
<!-- DE Definiere, welche Textareas zu Xinha-Editoren werden sollen --> <!-- DE Definiere, welche Textareas zu Xinha-Editoren werden sollen -->
<!-- EN Define all textares which should become xinha editors --> <!-- EN Define all textares which should become xinha editors -->
@ -305,6 +311,9 @@
</xsl:if> </xsl:if>
<xsl:call-template name="processLabel">
<xsl:with-param name="widget" select="."/>
</xsl:call-template>
<textarea id="ta_{@name}" name="{@name}" rows="{@rows}" cols="{@cols}" wrap="{@wrap}" style="width:100%"> <textarea id="ta_{@name}" name="{@name}" rows="{@rows}" cols="{@cols}" wrap="{@wrap}" style="width:100%">
<xsl:value-of disable-output-escaping="no" select="text()"/> <xsl:value-of disable-output-escaping="no" select="text()"/>
</textarea> </textarea>

View File

@ -112,6 +112,18 @@
<img alt="{$alt}" title="{$title}" src="{$src}"/> <img alt="{$alt}" title="{$title}" src="{$src}"/>
</xsl:if> </xsl:if>
<xsl:apply-templates/> <xsl:apply-templates/>
<xsl:if test="string-length(./@hint) &gt; 0">
<span class="hint">
<xsl:attribute name="content">
<xsl:value-of select="@hint"/>
</xsl:attribute>
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="module" select="'bebop'"/>
<xsl:with-param name="setting" select="'hintSymbol'"/>
<xsl:with-param name="default" select="'(?)'"/>
</xsl:call-template>
</span>
</xsl:if>
</a> </a>
</xsl:template> </xsl:template>

View File

@ -208,15 +208,45 @@
<fieldset class="date"> <fieldset class="date">
<legend> <legend>
<xsl:value-of select="@label"/> <xsl:value-of select="@label"/>
<xsl:if test="string-length(./@hint) &gt; 0">
<span class="hint">
<xsl:attribute name="content">
<xsl:value-of select="@hint"/>
</xsl:attribute>
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="module" select="'bebop'"/>
<xsl:with-param name="setting" select="'hintSymbol'"/>
<xsl:with-param name="default" select="'(?)'"/>
</xsl:call-template>
</span>
</xsl:if>
</legend> </legend>
<xsl:apply-templates/> <xsl:apply-templates/>
</fieldset> </fieldset>
</xsl:template> </xsl:template>
<xsl:template match="bebop:time"> <xsl:template match="bebop:time">
<span class="time"> <!--<span class="time">
<xsl:apply-templates/> <xsl:apply-templates/>
</span>-->
<fieldset>
<legend>
<xsl:value-of select="@label"/>
<xsl:if test="string-length(./@hint) &gt; 0">
<span class="hint">
<xsl:attribute name="content">
<xsl:value-of select="@hint"/>
</xsl:attribute>
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="module" select="'bebop'"/>
<xsl:with-param name="setting" select="'hintSymbol'"/>
<xsl:with-param name="default" select="'(?)'"/>
</xsl:call-template>
</span> </span>
</xsl:if>
</legend>
<xsl:apply-templates/>
</fieldset>
</xsl:template> </xsl:template>
<xsl:template match="bebop:fieldset"> <xsl:template match="bebop:fieldset">

View File

@ -24,8 +24,9 @@
<setting id="padding/showPadding">false</setting> <setting id="padding/showPadding">false</setting>
<setting id="padding/borderColor">cccccc</setting> <setting id="padding/borderColor">cccccc</setting>
<!--<setting id="hintSymbol">(?)</setting>-->
<!--<setting id="hintSymbol">&#x2753;</setting>--> <!--<setting id="hintSymbol">&#x2753;</setting>-->
<setting id="hintSymbol">(?)</setting> <setting id="hintSymbol">&#x24d8;</setting>
<setting id="table/setImage/checkboxChecked">/images/bebop/checkBoxChecked.gif</setting> <setting id="table/setImage/checkboxChecked">/images/bebop/checkBoxChecked.gif</setting>
<setting id="table/setImage/checkboxUnchecked">/images/bebop/checkBoxUnchecked.gif</setting> <setting id="table/setImage/checkboxUnchecked">/images/bebop/checkBoxUnchecked.gif</setting>