Author: alevkovsky
Date: 2008-12-24 11:34:15 -0500 (Wed, 24 Dec 2008)
New Revision: 12012
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-3418
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
===================================================================
---
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-12-24
16:33:36 UTC (rev 12011)
+++
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-12-24
16:34:15 UTC (rev 12012)
@@ -43,6 +43,7 @@
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIContextMenu;
import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.component.util.MessageUtil;
import org.richfaces.renderkit.TemplateEncoderRendererBase;
import org.xml.sax.ContentHandler;
@@ -107,6 +108,7 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
ensureParentPresent(component);
+ checkAttachTimingValidity(context, component);
writer.startElement(HTML.DIV_ELEM, component);
writer.writeAttribute(HTML.id_ATTRIBUTE, component.getClientId(context),
"id");
}
@@ -134,21 +136,18 @@
}
/**
- * Perform validation of the contextMenu configuration. Throws
- * FacesException in case validation fails.
+ * Perform validation of the contextMenu configuration.
*
- * @param clientId -
- * id of the component
- * @param name -
- * component name
- * @param attachTiming -
- * timing options
+ * @param component - menu component
*/
- protected void checkValidity(String clientId, String name, String attachTiming) {
+ protected void checkAttachTimingValidity(FacesContext context, UIComponent component) {
+ UIContextMenu menu = (UIContextMenu) component;
+ String attachTiming = menu.getAttachTiming();
if (!ON_LOAD.equals(attachTiming) && !IMMEDIATE.equals(attachTiming)
&& !ON_AVAILABLE.equals(attachTiming)) {
- throw new FacesException("The attachTiming attribute of the contextMenu
(id='" + clientId
- + "') has an invalid value:'" + attachTiming + "'. It may
have only the following values: '"
- + IMMEDIATE + "', '" + ON_LOAD + "', '" +
ON_AVAILABLE + "'");
+ context.getExternalContext().log(attachTiming + " value of attachTiming
attribute is not a legal one for component: "
+ + MessageUtil.getLabel(context, component)
+ + ". Default value was applied.");
+ menu.setAttachTiming(ON_AVAILABLE);
}
}