Author: abelevich
Date: 2008-06-09 05:26:14 -0400 (Mon, 09 Jun 2008)
New Revision: 8949
Modified:
trunk/ui/tooltip/src/main/config/component/toolTip.xml
trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-1631,
http://jira.jboss.com/jira/browse/RF-3429
Modified: trunk/ui/tooltip/src/main/config/component/toolTip.xml
===================================================================
--- trunk/ui/tooltip/src/main/config/component/toolTip.xml 2008-06-07 12:49:04 UTC (rev
8948)
+++ trunk/ui/tooltip/src/main/config/component/toolTip.xml 2008-06-09 09:26:14 UTC (rev
8949)
@@ -42,6 +42,16 @@
<description>Block/inline mode flag. Possible value are: "inline"
or "block". Default value is "inline". Tooltip will contain
div/span elements respectively</description>
<defaultvalue><![CDATA["inline"]]></defaultvalue>
</property>
+
+ <property>
+ <name>ajaxSingle</name>
+ <classname>boolean</classname>
+ <description>
+ boolean attribute which provides possibility to limit JSF tree processing(decoding,
conversion/validation, value applying) to the component which send the request only.
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+
<property>
<name>showDelay</name>
<classname>int</classname>
@@ -87,13 +97,13 @@
<description>Id of the target component</description>
</property>
-
- <property>
+<!-- <property>
<name>value</name>
<classname>java.lang.String</classname>
<description>Label on the tooltip</description>
<defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
+ </property> -->
+
<property>
<name>mode</name>
<classname>java.lang.String</classname>
@@ -147,7 +157,8 @@
&ui_component_attributes;
&html_events;
-
+ &ui_command_attributes;
+
<property>
<name>onclick</name>
<classname>java.lang.String</classname>
Modified: trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
===================================================================
--- trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2008-06-07
12:49:04 UTC (rev 8948)
+++ trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2008-06-09
09:26:14 UTC (rev 8949)
@@ -3,7 +3,7 @@
import java.io.IOException;
import java.util.Set;
-import javax.faces.component.UIComponentBase;
+import javax.faces.component.UICommand;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
@@ -12,14 +12,14 @@
import org.ajax4jsf.event.AjaxEvent;
import org.richfaces.renderkit.html.ToolTipRenderer;
-public abstract class UIToolTip extends UIComponentBase implements
org.ajax4jsf.component.AjaxChildrenEncoder{
+public abstract class UIToolTip extends UICommand implements
org.ajax4jsf.component.AjaxChildrenEncoder{
public static final String COMPONENT_TYPE =
"org.richfaces.component.ToolTip";
public static final String CONTENT_FACET_NAME = "defaultContent";
- public abstract String getValue();
+// public abstract String getValue();
- public abstract void setValue(String value);
+// public abstract void setValue(String value);
public abstract String getLayout();
Modified:
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
---
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-06-07
12:49:04 UTC (rev 8948)
+++
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-06-09
09:26:14 UTC (rev 8949)
@@ -2,12 +2,15 @@
import java.io.IOException;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.event.ActionEvent;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
@@ -17,7 +20,6 @@
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIToolTip;
import org.richfaces.skin.Skin;
@@ -156,7 +158,7 @@
//enable ajaxSingle mode, i.e. we do not need to submit all form controls to get
tooltip content
eventOptions.put("control", JSReference.THIS);
-
+
if(eventOptions.containsKey("oncomplete")){
JSFunctionDefinition onComplete =
(JSFunctionDefinition)eventOptions.get("oncomplete");
onComplete.addToBody(oncompleteTooltip);
@@ -210,6 +212,18 @@
}
+ public Map <String, Object> getParamsMap(FacesContext context, UIToolTip toolTip)
{
+ List <UIComponent> children = toolTip.getChildren();
+ Map <String, Object> paramsMap = new HashMap<String, Object>();
+ for(UIComponent child: children ) {
+ if(child instanceof UIParameter) {
+ UIParameter param = (UIParameter)child;
+ paramsMap.put(param.getName(),param.getValue());
+ }
+ }
+ return paramsMap;
+ }
+
private String getTargetId(FacesContext context, UIComponent component) {
UIToolTip toolTip = (UIToolTip) component;
String forValue = toolTip.getFor();
@@ -253,6 +267,7 @@
String ajaxFunc = function.toScript();
Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip,
targetClientId);
+ ajaxOptions.putAll(getParamsMap(context, toolTip));
JSFunctionDefinition completeFunc = getUtils().getAsEventHandler(context, component,
"oncomplete", "; return true;");
JSFunctionDefinition hideFunc = getUtils().getAsEventHandler(context,
component,"onhide", "; return true;");
JSFunctionDefinition showFunc = getUtils().getAsEventHandler(context,
component,"onshow", "; return true;");
@@ -287,6 +302,7 @@
if(context.getExternalContext().getRequestParameterMap().containsKey(clientId)){
if("ajax".equals(tooltip.getMode())){
new AjaxEvent(component).queue();
+ new ActionEvent(component).queue();
}
}
}
@@ -299,12 +315,12 @@
// we want to avoid rendering toolTip content during initialy page displaying
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
if(ajaxContext != null &&
ajaxContext.getAjaxAreasToRender().contains(component.getClientId(context) +
"content")){
- responseWriter.write(component.getValue() != null ? component.getValue() :
"");
+ responseWriter.write(component.getValue() != null ? component.getValue().toString()
: "");
super.renderChildren(context, component);
}
} else {
// client mode
- responseWriter.write(component.getValue() != null ? component.getValue() :
"");
+ responseWriter.write(component.getValue() != null ? component.getValue().toString()
: "");
super.renderChildren(context, component);
}
responseWriter.endElement(component.getUsedElementType());