JBoss Rich Faces SVN: r14542 - branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-05 14:29:50 -0400 (Fri, 05 Jun 2009)
New Revision: 14542
Modified:
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-7181
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java 2009-06-05 16:19:29 UTC (rev 14541)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java 2009-06-05 18:29:50 UTC (rev 14542)
@@ -27,7 +27,7 @@
//
import java.io.IOException;
import java.util.Collection;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -70,7 +70,7 @@
Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
.getProcess());
if (null != toProcess) {
- HashSet<String> componentIdsToProcess = new HashSet<String>();
+ Set<String> componentIdsToProcess = new LinkedHashSet<String>();
for (String componentId : toProcess) {
UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
if(null != component){
15 years, 7 months
JBoss Rich Faces SVN: r14541 - in branches/community/3.3.X/ui/menu-components/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-05 12:19:29 -0400 (Fri, 05 Jun 2009)
New Revision: 14541
Modified:
branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
https://jira.jboss.org/jira/browse/RF-7322
Modified: branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-06-05 16:18:59 UTC (rev 14540)
+++ branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-06-05 16:19:29 UTC (rev 14541)
@@ -23,7 +23,9 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -40,7 +42,9 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
import org.richfaces.component.MenuComponent;
import org.richfaces.component.UIMenuItem;
import org.richfaces.component.util.ViewUtil;
@@ -135,38 +139,35 @@
return params;
}
- public String encodeParamsAsObject(FacesContext context, UIMenuItem component) throws IOException {
+
+ public Map<String, Object> getParamsAsMap(FacesContext context, UIMenuItem component) throws IOException {
+ Map<String, Object> paramsMap = new LinkedHashMap<String, Object>();
- UIMenuItem menuItem = component;
- StringBuffer buff = new StringBuffer("{");
-
- List children = menuItem.getChildren();
- for (Iterator iterator = children.iterator(); iterator.hasNext();) {
- UIComponent child = (UIComponent) iterator.next();
-
- if(child instanceof UIParameter){
+ for (UIComponent child: component.getChildren()) {
+ if(child instanceof UIParameter) {
UIParameter param = (UIParameter)child;
String name = param.getName();
if (name != null) {
- Object value = param.getValue();
- buff.append(ScriptUtils.toScript(name));
- buff.append(":");
- buff.append(ScriptUtils.toScript(value));
- buff.append(",");
+ paramsMap.put(name, param.getValue());
}
}
}
- if (buff.length()>1) {
- buff.deleteCharAt(buff.length()-1);
- buff.append("}");
- return buff.toString();
- } else {
- return null;
- }
+
+ return paramsMap;
}
+ private boolean isNestedInMenu(UIComponent component) {
+ for (UIComponent c = component; c != null; c = c.getParent()) {
+ if (c instanceof MenuComponent) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public void initializeResources(FacesContext context, UIMenuItem menuItem)
throws IOException {
ComponentVariables variables =
@@ -181,61 +182,55 @@
}
variables.setVariable("icon", resource);
- // create attributes string for item without parent
- StringBuffer attr = new StringBuffer();
- String attrStr = "";
- if (!(menuItem.getParent() instanceof MenuComponent))
- {
- String styleClass = (String) menuItem.getAttributes().get(HTML.STYLE_CLASS_ATTR);
- String str = "";
- attr.append(",{");
- if (null!=styleClass && styleClass.length()>0) {
- attr.append("styleClass:");
- attr.append(ScriptUtils.toScript(styleClass));
- str = ",";
- }
- String onselect = (String) menuItem.getAttributes().get(HTML.onselect_ATTRIBUTE);
- if (null!=onselect && onselect.length()>0) {
- attr.append(str);
- attr.append("onselect:function(event){");
- attr.append(onselect);
- attr.append("}");
- }
- attr.append("}");
- if (attr.length()>3) attrStr = attr.toString();
- }
-
+ RendererUtils rendererUtils = getUtils();
+
if (menuItem.isDisabled()) {
variables.setVariable("iconDisabledClasses",
"rich-menu-item-icon-disabled");
} else {
+ Map<String, Object> menuItemAttributes = menuItem.getAttributes();
+ // create attributes string for item without parent
+ Map<String, Object> attrMap = new HashMap<String, Object>(3);
+ if (!isNestedInMenu(menuItem)) {
+ rendererUtils.addToScriptHash(attrMap, "styleClass", menuItemAttributes.get(HTML.STYLE_CLASS_ATTR),
+ null, ScriptHashVariableWrapper.DEFAULT);
+
+ rendererUtils.addToScriptHash(attrMap, "onselect", menuItemAttributes.get(HTML.onselect_ATTRIBUTE),
+ null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ }
+
variables.setVariable("onmouseoutInlineStyles",
collectInlineStyles(context, menuItem, false));
variables.setVariable("onmouseoverInlineStyles",
collectInlineStyles(context, menuItem, true));
//-----------------------------------
- StringBuffer scriptValue = new StringBuffer();
+ StringBuilder scriptValue = new StringBuilder();
String mode = resolveSubmitMode(menuItem);
if (MenuComponent.MODE_AJAX.equalsIgnoreCase(mode)) {
scriptValue.append("RichFaces.Menu.updateItem(event,this");
- scriptValue.append(attrStr);
+
+ if (!attrMap.isEmpty()) {
+ scriptValue.append(',');
+ scriptValue.append(ScriptUtils.toScript(attrMap));
+ }
+
scriptValue.append(");");
String event = null;
- Object onclick = menuItem.getAttributes().get(HTML.onclick_ATTRIBUTE);
+ Object onclick = menuItemAttributes.get(HTML.onclick_ATTRIBUTE);
if(onclick != null && onclick.toString().length()>0){
event = HTML.onclick_ATTRIBUTE;
}else{
- Object onselect = menuItem.getAttributes().get(HTML.onselect_ATTRIBUTE);
+ Object onselect = menuItemAttributes.get(HTML.onselect_ATTRIBUTE);
if(onselect != null && onselect.toString().length()>0){
event = HTML.onselect_ATTRIBUTE;
}
}
scriptValue.append(AjaxRendererUtils.buildOnEvent(
menuItem, context, event).toString());
- menuItem.getAttributes().put(HTML.onselect_ATTRIBUTE, null);
+ menuItemAttributes.put(HTML.onselect_ATTRIBUTE, null);
} else if (MenuComponent.MODE_SERVER.equalsIgnoreCase(mode)) {
/*
@@ -269,29 +264,35 @@
scriptValue.append(",");
scriptValue.append("params);return false;");
*/
- Object onclick = menuItem.getAttributes().get(HTML.onclick_ATTRIBUTE);
+ Object onclick = menuItemAttributes.get(HTML.onclick_ATTRIBUTE);
if(onclick != null && onclick.toString().length()>0){
scriptValue.append(onclick.toString());
scriptValue.append(";");
}
scriptValue.append("RichFaces.Menu.submitForm(event,this");
- String params = encodeParamsAsObject(context, menuItem);
- if (null!=params) {
- scriptValue.append(",");
- scriptValue.append(params);
+
+ Map<String, Object> scriptOptionsMap = new HashMap<String, Object>(5);
+ rendererUtils.addToScriptHash(scriptOptionsMap, "a", attrMap, null, ScriptHashVariableWrapper.DEFAULT);
+
+ Map<String, Object> paramsMap = getParamsAsMap(context, menuItem);
+ rendererUtils.addToScriptHash(scriptOptionsMap, "p", paramsMap, null, ScriptHashVariableWrapper.DEFAULT);
+
+ String target = (String) menuItemAttributes.get("target");
+ rendererUtils.addToScriptHash(scriptOptionsMap, "t", target, null, ScriptHashVariableWrapper.DEFAULT);
+
+ if (!scriptOptionsMap.isEmpty()) {
+ scriptValue.append(',');
+ scriptValue.append(ScriptUtils.toScript(scriptOptionsMap));
}
- String target = (String) menuItem.getAttributes().get("target");
- if (null != target && target.length()>0) {
- scriptValue.append(",");
- scriptValue.append(ScriptUtils.toScript(target));
- }
-
- scriptValue.append(attrStr);
+
scriptValue.append(")");
} else {
scriptValue.append("RichFaces.Menu.updateItem(event,this");
- scriptValue.append(attrStr);
+ if (!attrMap.isEmpty()) {
+ scriptValue.append(',');
+ scriptValue.append(ScriptUtils.toScript(attrMap));
+ }
scriptValue.append(");");
scriptValue.append(getStringAttributeOrEmptyString(menuItem, HTML.onclick_ATTRIBUTE));
}
Modified: branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-06-05 16:18:59 UTC (rev 14540)
+++ branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-06-05 16:19:29 UTC (rev 14541)
@@ -1500,13 +1500,19 @@
}
}
-RichFaces.Menu.submitForm = function (event, element, params, target, attr) {
- RichFaces.Menu.updateItem(event, element, attr);
- var form=A4J.findForm(element);
- if (!params) params={};
- if (!target) target='';
- params[element.id+':hidden']=element.id;
- Richfaces.jsFormSubmit(element.id,form.id,target,params);
+RichFaces.Menu.submitForm = function (event, element, options) {
+ if (!options) {
+ options = {};
+ }
+
+ RichFaces.Menu.updateItem(event, element, options.a);
+
+ var form = A4J.findForm(element);
+ var params = options.p || {};
+ var target = options.t || '';
+
+ params[element.id+':hidden'] = element.id;
+ Richfaces.jsFormSubmit(element.id, form.id, target, params);
return false;
}
15 years, 7 months
JBoss Rich Faces SVN: r14540 - in branches/community/3.3.X/ui/tooltip/src: main/resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-06-05 12:18:59 -0400 (Fri, 05 Jun 2009)
New Revision: 14540
Modified:
branches/community/3.3.X/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
branches/community/3.3.X/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
branches/community/3.3.X/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java
Log:
RF-7327
Modified: branches/community/3.3.X/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
--- branches/community/3.3.X/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2009-06-05 15:53:54 UTC (rev 14539)
+++ branches/community/3.3.X/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2009-06-05 16:18:59 UTC (rev 14540)
@@ -42,6 +42,7 @@
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIToolTip;
import org.richfaces.skin.Skin;
@@ -150,7 +151,7 @@
}
public Map<String, Object> buildEventOptions(FacesContext context,
- UIComponent component, String targetId) {
+ UIComponent component) {
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
context, component);
String jsVarName = "_toolTip";
@@ -254,62 +255,61 @@
UIToolTip toolTip = (UIToolTip) component;
String targetClientId = getTargetId(context, component);
+ Map<String, Object> options = new HashMap<String, Object>();
+ //Map<JSReference, Object> eventsMap = new HashMap<JSReference, Object>();
- Map<JSReference, Object> eventsMap = new HashMap<JSReference, Object>();
-
String eventShow = (toolTip.isAttached()) ? toolTip.getShowEvent() : "";
if (eventShow.startsWith("on")) {
eventShow = eventShow.substring(2);
}
- eventsMap.put(new JSReference("showEvent"), eventShow);
-
+ getUtils().addToScriptHash(options, "showEvent", eventShow, "mouseover", ScriptHashVariableWrapper.DEFAULT);
String eventHide = (toolTip.isAttached()) ? toolTip.getHideEvent() : "";
if (eventHide.startsWith("on")) {
eventHide = eventHide.substring(2);
}
- eventsMap.put(new JSReference("hideEvent"), eventHide);
+ getUtils().addToScriptHash(options, "hideEvent", eventHide, null, ScriptHashVariableWrapper.DEFAULT);
- eventsMap.put(new JSReference("delay"), new Integer(toolTip.getShowDelay()));
- eventsMap.put(new JSReference("hideDelay"), new Integer(toolTip.getHideDelay()));
+ getUtils().addToScriptHash(options, "delay", toolTip.getShowDelay(), "0", ScriptHashVariableWrapper.DEFAULT);
+ getUtils().addToScriptHash(options, "hideDelay", toolTip.getHideDelay(), "0", ScriptHashVariableWrapper.DEFAULT);
- JSFunctionDefinition ajaxFunc = null;
if (AJAX_MODE.equalsIgnoreCase(toolTip.getMode())) {
- ajaxFunc = new JSFunctionDefinition("event", "ajaxOptions");
+ JSFunctionDefinition ajaxFunc = new JSFunctionDefinition("event", "ajaxOptions");
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
JSReference ref = new JSReference("ajaxOptions");
function.addParameter(ref);
ajaxFunc.addToBody(function);
- }
+ getUtils().addToScriptHash(options, "ajaxFunction", ajaxFunc, null, ScriptHashVariableWrapper.DEFAULT);
+ Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip);
+ ajaxOptions.putAll(getParamsMap(context, toolTip));
+ getUtils().addToScriptHash(options, "ajaxOptions", ajaxOptions, null, ScriptHashVariableWrapper.DEFAULT);
+ }
- Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip, targetClientId);
- ajaxOptions.putAll(getParamsMap(context, toolTip));
- Map<JSReference, Object> funcMap = new HashMap<JSReference, Object>();
JSFunctionDefinition completeFunc = getUtils().getAsEventHandler(
context, component, "oncomplete", "; return true;");
- funcMap.put(new JSReference("oncomplete"), completeFunc);
+ getUtils().addToScriptHash(options, "oncomplete", completeFunc, null, ScriptHashVariableWrapper.DEFAULT);
JSFunctionDefinition hideFunc = getUtils().getAsEventHandler(
context, component, "onhide", "; return true;");
- funcMap.put(new JSReference("onhide"), hideFunc);
+ getUtils().addToScriptHash(options, "onhide", hideFunc, null, ScriptHashVariableWrapper.DEFAULT);
JSFunctionDefinition showFunc = getUtils().getAsEventHandler(
context, component, "onshow", "; return true;");
- funcMap.put(new JSReference("onshow"), showFunc);
+ getUtils().addToScriptHash(options, "onshow", showFunc, null, ScriptHashVariableWrapper.DEFAULT);
+ getUtils().addToScriptHash(options, "disabled", toolTip.isDisabled(), "false", ScriptHashVariableWrapper.DEFAULT);
+ getUtils().addToScriptHash(options, "direction", toolTip.getDirection(), "bottom-right", ScriptHashVariableWrapper.DEFAULT);
+ getUtils().addToScriptHash(options, "followMouse", toolTip.isFollowMouse(), "false", ScriptHashVariableWrapper.DEFAULT);
+ getUtils().addToScriptHash(options, "horizontalOffset", toolTip.getHorizontalOffset(), "10", ScriptHashVariableWrapper.DEFAULT);
+ getUtils().addToScriptHash(options, "verticalOffset", toolTip.getVerticalOffset(), "10", ScriptHashVariableWrapper.DEFAULT);
+
StringBuffer ret = new StringBuffer();
- ret.append("new ToolTip(").append(ScriptUtils.toScript(eventsMap)).append(COMMA)
- .append(ScriptUtils.toScript(funcMap)).append(COMMA)
- .append(QUOT).append(toolTip.getClientId(context)).append(QUOT_COMMA)
- .append(QUOT).append(targetClientId).append(QUOT_COMMA)
- .append(QUOT).append(toolTip.getMode()).append(QUOT_COMMA)
- .append(toolTip.isDisabled()).append(COMMA)
- .append(QUOT).append(toolTip.getDirection()).append(QUOT_COMMA)
- .append(toolTip.isFollowMouse()).append(COMMA)
- .append(toolTip.getHorizontalOffset()).append(COMMA)
- .append(toolTip.getVerticalOffset()).append(COMMA)
- .append(ajaxFunc == null ? "null" : ajaxFunc.toScript()).append(COMMA)
- .append(ScriptUtils.toScript(ajaxOptions)).append(");");
+ ret.append("new ToolTip(").append(QUOT).append(toolTip.getClientId(context)).append(QUOT_COMMA)
+ .append(QUOT).append(targetClientId).append(QUOT);
+ if (!options.isEmpty()) {
+ ret.append(COMMA).append(ScriptUtils.toScript(options));
+ }
+ ret.append(");");
return ret.toString();
}
Modified: branches/community/3.3.X/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
--- branches/community/3.3.X/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2009-06-05 15:53:54 UTC (rev 14539)
+++ branches/community/3.3.X/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2009-06-05 16:18:59 UTC (rev 14540)
@@ -7,30 +7,32 @@
ToolTip = Class.create();
ToolTip.prototype = {
- initialize:function(events,functions, id, parentId, mode, disabled, direction, followMouse, horizontalOffset, verticalOffset, ajaxFunction, ajaxOptions){
- this["rich:destructor"] = "destroy";
- this.showEvent = events.showEvent;
- this.hideEvent = events.hideEvent!=""?events.hideEvent:null;
- this.onshow = functions.onshow;
- this.oncomplete = functions.oncomplete;
- this.onhide = functions.onhide;
+ //default values of options
+ showEvent: "mouseover",
+ hideEvent: null,
+ delay: 0,
+ hideDelay: 0,
+ ajaxFunction: null,
+ ajaxOptions: null,
+ oncomplete: null,
+ onhide: null,
+ onshow: null,
+ disabled: false,
+ direction: "bottom-right",
+ followMouse: false,
+ horizontalOffset: 10,
+ verticalOffset: 10,
- this.delay = events.delay;
- this.hideDelay = events.hideDelay;
+ initialize:function(id, parentId, options){
+ this["rich:destructor"] = "destroy";
this.id = id;
this.parentId = parentId;
this.parent = $(this.parentId);
- this.mode = mode;
- this.direction = direction;
- this.disabled = disabled;
- this.followMouse = followMouse;
- this.horizontalOffset = horizontalOffset;
- this.verticalOffset = verticalOffset;
- if (ajaxFunction) this.ajaxExecuteFunction = (ajaxFunction) ? ajaxFunction : function() {};
- this.ajaxOptions = ajaxOptions;
+ Object.extend(this, options);
+
this.clientAjaxParams = {};
this.toolTip = $(id);
@@ -243,7 +245,7 @@
window.clearTimeout(this.hidingTimerHandle);
this.hidingTimerHandle = undefined;
}
- if(this.mode == 'ajax'){
+ if(this.ajaxFunction){
if(this.toolTipDefaultContent){
this.toolTipContent.innerHTML = this.toolTipDefaultContent.innerHTML;
@@ -274,13 +276,13 @@
{
this.setToolTipVisible(false);
}
- this.ajaxExecuteFunction(event, ajaxOptions);
+ this.ajaxFunction(event, ajaxOptions);
}.bind(this), this.delay);
}
else
{
this.setToolTipVisible(false);
- this.ajaxExecuteFunction(event, ajaxOptions);
+ this.ajaxFunction(event, ajaxOptions);
}
} else {
this.setToolTipPosition(e);
@@ -572,7 +574,7 @@
//this.toolTip.style.display = 'block';
if(this.isMouseOvered){
- if(this.mode == 'ajax'){
+ if(this.ajaxFunction){
this.toolTip.style.display = 'none';
if(this.clientAjaxParams){
/*
Modified: branches/community/3.3.X/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java
===================================================================
--- branches/community/3.3.X/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java 2009-06-05 15:53:54 UTC (rev 14539)
+++ branches/community/3.3.X/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java 2009-06-05 16:18:59 UTC (rev 14540)
@@ -110,8 +110,7 @@
public void testBuildEventOptions(){
- Map eventOptions = renderer.buildEventOptions(facesContext, toolTip,
- toolTip.getParent().getClientId(facesContext));
+ Map eventOptions = renderer.buildEventOptions(facesContext, toolTip);
assertNotNull(eventOptions);
assertNotNull(eventOptions.get("oncomplete"));
}
15 years, 7 months
JBoss Rich Faces SVN: r14539 - branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/includes.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-06-05 11:53:54 -0400 (Fri, 05 Jun 2009)
New Revision: 14539
Modified:
branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/includes/contextMenu.xml
Log:
https://jira.jboss.org/jira/browse/RF-5768
added content to the Context Menu section
Modified: branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/includes/contextMenu.xml
===================================================================
--- branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/includes/contextMenu.xml 2009-06-05 14:29:29 UTC (rev 14538)
+++ branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/includes/contextMenu.xml 2009-06-05 15:53:54 UTC (rev 14539)
@@ -1,5 +1,94 @@
<section id="contextMenu">
- <title>Context Menus</title>
- <para>Work in progress...</para>
+ <title>Context Menus TBR</title>
+ <para>Context menus are called when you right-click on a UI element. RichFaces library provides a special component <emphasis role="bold"><property><rich:contextMenu ></property></emphasis> to implement this type of functionality. </para>
+
+
+ <para>Context menu is made for the following UI controls:</para>
+
+ <itemizedlist>
+ <listitem><para>Album</para></listitem>
+ <listitem><para>Image</para></listitem>
+ <listitem><para>Self</para></listitem>
+ <listitem><para>User</para></listitem>
+ </itemizedlist>
+ <para>
+ Let's have a look at the context menu for single image is constructed.
+ </para>
+
+ <programlisting role="XML"><![CDATA[...
+ <rich:contextMenu disableDefaultMenu="false" style="text-align:left;" rendered="#{controller.isUserImage(image)}"
+ event="oncontextmenu" attached="true" submitMode="ajax" attachTo="#{mediaOutput}">
+ <rich:menuItem value="#{messages['image.delete']}" limitToList="true"
+ actionListener="#{confirmationPopupHelper.initImagePopup('deleteImage',messages['image.delete.confirm'],image)}"
+ oncomplete="#{rich:component('confirmation')}.show()"
+ reRender="confirmation">
+ </rich:menuItem>
+ <rich:menuItem value="#{messages['image.edit']}" limitToList="true"
+ actionListener="#{controller.startEditImage(image)}"
+ reRender="mainArea">
+ </rich:menuItem>
+ <rich:menuItem value="#{messages['image_show']}" limitToList="true"
+ actionListener="#{controller.showImage(image)}"
+ reRender="mainArea">
+ </rich:menuItem>
+ </rich:contextMenu>
+ ...]]></programlisting>
+ <para>
+ That is a listing from <code>\includes\contextMenu\CMForImage.xhtml</code>.
+ This code is included into the very bottom of imageList.xhtml file like this:
+ </para>
+
+ <programlisting role="XML"><![CDATA[...
+ <ui:include src="/includes/contextMenu/CMForImage.xhtml" >
+ <ui:param name="image" value="#{image}" />
+ <ui:param name="mediaOutput" value="#{rich:clientId('img')}"/>
+ </ui:include>
+ ...]]></programlisting>
+
+ <para>The context menu code is included with 2 parameters: <code>"image"</code> and <code>"mediaOutput"</code>. The first ( <code>"image"</code>) is the name of the current image. The <emphasis role="bold"><property><a4j:repeat></property></emphasis> iterates over a collection of images(see the next listing), the name of the current image is stored in the <code>"image"</code> variable. <code>"mediaOutput"</code> parameter is set with the help of <code>rich:clientId('id')</code> that returns client id by short id or null if the component with the id specified hasn't been found. </para>
+
+ <para>This is the block of code that displays each image: </para>
+
+ <programlisting role="XML"><![CDATA[...
+<a4j:repeat id="imageList" value="#{model.images}" var="image" rows="20">
+ <h:panelGroup layout="block" styleClass="#{imageSizeHelper.currentDimension.cssClass}">
+ <h:graphicImage styleClass="pr_photo_bg" style="#{imageSizeHelper.currentDimension.imageBgStyle}" value="#{imageSizeHelper.currentDimension.imageBg}" />
+ <h:panelGrid cellpadding="0">
+ <h:panelGroup>
+ <a4j:commandLink
+ actionListener="#{controller.showImage(image)}"
+ reRender="mainArea, treePanel">
+ <a4j:mediaOutput id="img" element="img"
+ createContent="#{imageLoader.paintImage}"
+ style="border : 1px solid #FFFFFF;"
+ value="#{fileManager.transformPath(image.fullPath, imageSizeHelper.currentDimension.filePostfix)}">
+ <f:param value="#{imageSizeHelper.currentDimension.x}" name="x" />
+ <rich:dragSupport rendered="#{controller.isUserImage(image)}" reRender="mainArea, treePanel" id="dragSource" dragIndicator="dragIndicator"
+ dragType="image" dragValue="#{image}">
+ <rich:dndParam id="dragParam" name="label" value="#{image.name}" />
+ </rich:dragSupport>
+ </a4j:mediaOutput>
+ </a4j:commandLink>
+ <br/>
+ </h:panelGroup>
+ </h:panelGrid>
+ <h:panelGroup layout="block" styleClass="photo_name">#{image.name}</h:panelGroup>
+ <h:panelGroup layout="block" styleClass="photo_data">
+ <h:outputText value="#{image.created}">
+ <f:convertDateTime />
+ </h:outputText>
+ </h:panelGroup>
+ </h:panelGroup>
+ <ui:include src="/includes/contextMenu/CMForImage.xhtml" >
+ <ui:param name="image" value="#{image}" />
+ <ui:param name="mediaOutput" value="#{rich:clientId('img')}"/>
+ </ui:include>
+ </a4j:repeat>
+
+ ...]]></programlisting>
+
+ <para>The key attribute of <emphasis role="bold"><property><contextMenu></property></emphasis> is <emphasis><property>"attachTo"</property></emphasis> that specifies for which control the context menu is displayed. As you can see this attribute has <code>#{mediaOutput}</code> as its value(<code> attachTo="#{mediaOutput}"</code> so this way the id of the current image is passed to <emphasis role="bold"><property><rich:contexMenu></property></emphasis> and this is how it know what photo is affected by user actions. </para>
+
+
</section>
15 years, 7 months
JBoss Rich Faces SVN: r14538 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-06-05 10:29:29 -0400 (Fri, 05 Jun 2009)
New Revision: 14538
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/calendar.xml
Log:
RF-7314: Describing Lazy loading of popup Calender component
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/calendar.xml 2009-06-05 14:21:24 UTC (rev 14537)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/calendar.xml 2009-06-05 14:29:29 UTC (rev 14538)
@@ -86,7 +86,11 @@
</emphasis> attribute defines calendar representation mode on a page.
If it's "true" the calendar is represented
on a page as an input field and a button. Clicking on the button calls
- the calendar popup as it's shown on the picture below. </para>
+ the calendar popup as it's shown on the picture below.
+ For popup rendering a "lazy" loading is implemented: after the request is completed a client side script method builds the popup.
+ Such improvement speeds up page loading time.
+
+ </para>
<figure>
<title>Using the <emphasis>
<property>"popup"</property>
15 years, 7 months
JBoss Rich Faces SVN: r14537 - branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-05 10:21:24 -0400 (Fri, 05 Jun 2009)
New Revision: 14537
Modified:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
Log:
BaseFilter: added MyFaces Extension filter misconfiguration diagnostic
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2009-06-05 13:18:55 UTC (rev 14536)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2009-06-05 14:21:24 UTC (rev 14537)
@@ -301,6 +301,26 @@
}
+ private static final String MYFACES_FILTER_CHECKED = BaseFilter.class.getName() + ":MyFacesFilterChecked";
+
+ private static final String MYFACES_DOFILTER_CALLED = "org.apache.myfaces.component.html.util.ExtensionFilter.doFilterCalled";
+
+ private boolean myfacesMessagePrinted = false;
+
+ private void checkMyFacesExtensionsFilter(HttpServletRequest request) {
+ if (request.getAttribute(MYFACES_FILTER_CHECKED) == null) {
+ if (request.getAttribute(MYFACES_DOFILTER_CALLED) != null) {
+ if (!this.myfacesMessagePrinted) {
+ log.warn("MyFaces Extensions Filter should be configured to execute *AFTER* RichFaces filter. Refer to SRV.6.2.4 section of Servlets specification on how to achieve that.");
+
+ this.myfacesMessagePrinted = true;
+ }
+ }
+
+ request.setAttribute(MYFACES_FILTER_CHECKED, Boolean.TRUE);
+ }
+ }
+
/**
* Method catches upload files request. Request parameter
* <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request
@@ -491,7 +511,7 @@
// first stage - detect/set encoding of request. Same as in
// Myfaces External Context.
setupRequestEncoding(httpServletRequest);
-
+ checkMyFacesExtensionsFilter(httpServletRequest);
processUploadsAndHandleRequest(httpServletRequest, httpServletResponse, chain);
}
} finally {
15 years, 7 months
JBoss Rich Faces SVN: r14536 - in branches/community/3.3.X/test-applications/regressionArea: regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341 and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2009-06-05 09:18:55 -0400 (Fri, 05 Jun 2009)
New Revision: 14536
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Bean.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Capital.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf3341/
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf3341/Test.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf3341.xhtml
Modified:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf6951/Test.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7064/Test.java
Log:
+RF-3341 selenium test + correction.
Added: branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Bean.java
===================================================================
--- branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Bean.java (rev 0)
+++ branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Bean.java 2009-06-05 13:18:55 UTC (rev 14536)
@@ -0,0 +1,103 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.regressionarea.issues.rf3341;
+
+import java.util.ArrayList;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+/**
+ * This test case for: <a href="https://jira.jboss.org/jira/browse/RF-3341">RF-3341 -
+ * rich:dataTable encodes its childs if this isn't nesessary</a>
+ *
+ * @author Mikhail Vitenkov
+ * @since 3.3.2
+ */
+
+@Name("rf3341")
+(a)Scope(ScopeType.SESSION)
+public class Bean {
+ private String name;
+ private String job;
+ private ArrayList<Capital> capitals;
+ private boolean rendered;
+ private int counter;
+
+ public int getCounter() {
+ return counter;
+ }
+
+ public void setCounter(int counter) {
+ this.counter = counter;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public String getName() {
+ System.out.println("getName()");
+ return name;
+ }
+
+ public void setName(String name) {
+ System.out.println("setName(String name)");
+ this.name = name;
+ }
+
+ public String getJob() {
+ System.out.println("getJob()");
+ return job;
+ }
+
+ public void setJob(String job) {
+ System.out.println("setJob(String job)");
+ this.job = job;
+ }
+
+ public ArrayList<Capital> getCapitals() {
+ System.out.println("getCapitals()");
+ counter++;
+ return capitals;
+ }
+
+ public void setCapitals(ArrayList<Capital> capitals) {
+ System.out.println("setCapitals(ArrayList<Capital> capitals)");
+ this.capitals = capitals;
+ }
+
+ public Bean(){
+ this.name = "name";
+ this.job = "job";
+
+ capitals = new ArrayList<Capital>();
+ String[] caps = {"Washington","Abu Dhabi","Antananarivo","Minsk"};
+ for(String s:caps){
+ capitals.add(new Capital(s));
+ }
+ }
+}
Added: branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Capital.java
===================================================================
--- branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Capital.java (rev 0)
+++ branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf3341/Capital.java 2009-06-05 13:18:55 UTC (rev 14536)
@@ -0,0 +1,18 @@
+package org.richfaces.regressionarea.issues.rf3341;
+
+public class Capital {
+ private String name;
+
+ public Capital(String name){
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Added: branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf3341/Test.java
===================================================================
--- branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf3341/Test.java (rev 0)
+++ branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf3341/Test.java 2009-06-05 13:18:55 UTC (rev 14536)
@@ -0,0 +1,82 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.testng.rf3341;
+
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+
+/**
+ * @author Mikhail Vitenkov
+ * @since 3.3.2
+ */
+public class Test extends SeleniumTestBase {
+ private static final String FORM = "form";
+ private static final String OUT1 = FORM + ":out1";
+ private static final String OUT2 = FORM + ":out2";
+ private static final String COUNTER1 = FORM + ":counter1";
+ private static final String COUNTER2 = FORM + ":counter2";
+
+ private String getIdSelector(String id) {
+ return "//*[@id='" + id + "']";
+ }
+
+ @org.testng.annotations.Test
+ public void testExecute() throws Exception {
+ renderPage();
+
+ Assert.assertEquals(selenium.getAttribute("//input[@type='text']@value"), "name");
+ AssertTextEquals(getIdSelector(OUT2), "name");
+ AssertTextEquals(getIdSelector(COUNTER2), "0");
+
+ type("//input[@type='text']", "test-1");
+ selenium.fireEvent("//input[@type='text']", "blur");
+ waitForAjaxCompletion();
+ selenium.submit("//form[@id='form']");
+ waitForPageToLoad();
+
+ Assert.assertEquals(selenium.getAttribute("//input[@type='text']@value"), "test-1");
+ AssertTextEquals(getIdSelector(OUT2), "test-1");
+ AssertTextEquals(getIdSelector(COUNTER2), "1");
+
+ selenium.check("//input[@type='checkbox']");
+ selenium.submit("//form[@id='form']");
+ waitForPageToLoad();
+
+ Assert.assertEquals(selenium.getAttribute("//input[@type='text']@value"), "test-1");
+ AssertTextEquals(getIdSelector(OUT1), "test-1");
+ AssertTextEquals(getIdSelector(COUNTER1), "1");
+
+ type("//input[@type='text']", "test-2");
+ selenium.fireEvent("//input[@type='text']", "blur");
+ waitForAjaxCompletion();
+ selenium.submit("//form[@id='form']");
+ waitForPageToLoad();
+
+ Assert.assertEquals(selenium.getAttribute("//input[@type='text']@value"), "test-2");
+ AssertTextEquals(getIdSelector(OUT1), "test-2");
+ AssertTextEquals(getIdSelector(COUNTER1), "1");
+ }
+
+ public String getTestUrl() {
+ return "pages/rf3341.xhtml";
+ }
+
+}
\ No newline at end of file
Modified: branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf6951/Test.java
===================================================================
--- branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf6951/Test.java 2009-06-05 13:14:15 UTC (rev 14535)
+++ branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf6951/Test.java 2009-06-05 13:18:55 UTC (rev 14536)
@@ -27,17 +27,20 @@
* @since 3.3.2
*/
public class Test extends SeleniumTestBase {
+ private static final String FORM = "form";
+ private static final String PANEL = FORM + ":panel";
+ private static final String LIST_SHUTTLE = FORM + ":LineConfigs";
@org.testng.annotations.Test
public void testExecute() throws Exception {
renderPage();
- selenium.doubleClick("//*[@id='form:LineConfigs:0']");
- selenium.click("//form[@id='form']/input[@type='button' and @value='Submit']");
+ selenium.doubleClick("//*[@id='"+ LIST_SHUTTLE +":0']");
+ selenium.click("//form[@id='"+ FORM +"']/input[@type='button' and @value='Submit']");
waitForAjaxCompletion();
- AssertTextEquals("//table[@id='form:panel']/tbody/tr[1]/td[2]", "[Line 2, Line 3]");
- AssertTextEquals("//table[@id='form:panel']/tbody/tr[2]/td[2]", "[Line 1]");
+ AssertTextEquals("//table[@id='"+ PANEL +"']/tbody/tr[1]/td[2]", "[Line 2, Line 3]");
+ AssertTextEquals("//table[@id='"+ PANEL +"']/tbody/tr[2]/td[2]", "[Line 1]");
}
@Override
Modified: branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7064/Test.java
===================================================================
--- branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7064/Test.java 2009-06-05 13:14:15 UTC (rev 14535)
+++ branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7064/Test.java 2009-06-05 13:18:55 UTC (rev 14536)
@@ -8,7 +8,8 @@
public void testExecute() throws Exception {
renderPage();
- selenium.assignId("form:toogleModes:1", "textArea");
+ selenium.assignId("form:toogleModes:1", "textArea");
+
clickAjaxCommandAndWait("textArea");
clickAjaxCommandAndWait("form:useSeamText");
Added: branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf3341.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf3341.xhtml (rev 0)
+++ branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf3341.xhtml 2009-06-05 13:18:55 UTC (rev 14536)
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition template="/layout/layout.xhtml">
+ <ui:define name="template">
+ <h:form id="form">
+ <rich:tabPanel switchType="ajax" selectedTab="Second" id="tabPanel">
+ <rich:tab label="First">
+ <h:inputText value="#{rf3341.job}">
+ <a4j:support event="onkeyup" reRender="out" />
+ </h:inputText>
+ <h:outputText id="out" value="#{rf3341.job}" />
+ <rich:dataTable value="#{rf3341.capitals}" var="cap">
+ <rich:column>
+ <h:outputText value="#{cap.name}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:tab>
+ <rich:tab label="Second" name="Second" >
+ <a4j:region renderRegionOnly="true" rendered="#{rf3341.rendered}">
+ <h:inputText value="#{rf3341.name}">
+ <a4j:support event="onblur" reRender="out1,counter1" />
+ </h:inputText>
+ <h:outputText id="out1" value="#{rf3341.name}" />
+ <br />
+ <h:outputText value="#{rf3341.counter}" id="counter1" />
+ </a4j:region>
+ <a4j:region renderRegionOnly="false" rendered="#{!rf3341.rendered}">
+ <h:inputText value="#{rf3341.name}">
+ <a4j:support event="onblur" reRender="out2,counter2" />
+ </h:inputText>
+ <h:outputText id="out2" value="#{rf3341.name}" />
+ <br />
+ <h:outputText value="#{rf3341.counter}" id="counter2" />
+ </a4j:region>
+ </rich:tab>
+ <rich:tab label="Third">
+Here is tab #3
+</rich:tab>
+ </rich:tabPanel>
+ <h:panelGrid columns="2">
+ <h:outputText value="a4j:region rendered:" />
+ <h:selectBooleanCheckbox value="#{rf3341.rendered}"
+ onclick="submit()">
+ </h:selectBooleanCheckbox>
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
15 years, 7 months
JBoss Rich Faces SVN: r14535 - branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-05 09:14:15 -0400 (Fri, 05 Jun 2009)
New Revision: 14535
Modified:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
https://jira.jboss.org/jira/browse/RF-7247
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-06-05 13:10:09 UTC (rev 14534)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-06-05 13:14:15 UTC (rev 14535)
@@ -573,7 +573,17 @@
return false;
}
+ /**
+ * Wrapper class around object value used to transform values into particular JS objects
+ *
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
public static enum ScriptHashVariableWrapper {
+
+ /**
+ * No-op default wrapper
+ */
DEFAULT {
@Override
@@ -583,6 +593,12 @@
},
+ /**
+ * Event handler functions wrapper. Wraps <pre>functionCode</pre> object into:
+ * <pre>function(event) {
+ * functionCode
+ * }</pre>
+ */
EVENT_HANDLER {
@Override
@@ -592,6 +608,12 @@
};
+ /**
+ * Method that does the wrapping
+ *
+ * @param o object to wrap
+ * @return wrapped object
+ */
abstract Object wrap(Object o);
}
15 years, 7 months
JBoss Rich Faces SVN: r14534 - branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-05 09:10:09 -0400 (Fri, 05 Jun 2009)
New Revision: 14534
Modified:
branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
Log:
https://jira.jboss.org/jira/browse/RF-7247
Modified: branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
--- branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2009-06-05 11:56:27 UTC (rev 14533)
+++ branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2009-06-05 13:10:09 UTC (rev 14534)
@@ -179,6 +179,14 @@
}
}
+ /**
+ * Convert any Java Object to JavaScript representation ( as possible ) and write it to
+ * writer immediately
+ *
+ * @param responseWriter
+ * @param obj
+ * @throws IOException
+ */
public static void writeToStream(final ResponseWriter responseWriter, Object obj) throws IOException {
writeScriptToStream(new ResponseWriterWrapper(responseWriter), obj);
}
15 years, 7 months
JBoss Rich Faces SVN: r14533 - in branches/community/3.3.X/ui/editor/src: test/java/org/richfaces/seamparser and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-06-05 07:56:27 -0400 (Fri, 05 Jun 2009)
New Revision: 14533
Modified:
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java
branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java
Log:
RF Problem with editor and Seam Text
https://jira.jboss.org/jira/browse/RF-7291
Modified: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java 2009-06-05 10:26:10 UTC (rev 14532)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java 2009-06-05 11:56:27 UTC (rev 14533)
@@ -47,26 +47,41 @@
return super.printPlain();
}
- private boolean isFirstChars = true;
+// private boolean isFirstChars = true;
@Override
public void appendBody(String str) {
- if (isFirstChars) {
- char text[] = str.toCharArray();
- int i = 0;
- while (i < text.length && (text[i] == '\r' || text[i] == '\n')) {
- i++;
+// if (isFirstChars) {
+// char text[] = str.toCharArray();
+// int firstNotNewLineChar = 0;
+// while (firstNotNewLineChar < text.length && (text[firstNotNewLineChar] == '\r' || text[firstNotNewLineChar] == '\n')) {
+// firstNotNewLineChar++;
+// }
+//
+// if (firstNotNewLineChar < text.length) {
+// super.appendBody(str.substring(firstNotNewLineChar));
+// isFirstChars = false;
+// } else {
+// return;
+// }
+// } else {
+ super.appendBody(removeNewLineChars(str));
+// }
+ }
+
+ private String removeNewLineChars(String str) {
+ char text[] = str.toCharArray();
+ char result[] = new char[text.length];
+ int resultSize = 0;
+
+ for (int textIndex = 0; textIndex < text.length; textIndex++) {
+ if (text[textIndex] != '\r' && text[textIndex] != '\n') {
+ result[resultSize] = text[textIndex];
+ resultSize++;
}
-
- if (i < text.length) {
- super.appendBody(str.substring(i));
- isFirstChars = false;
- } else {
- return;
- }
- } else {
- super.appendBody(str);
}
+
+ return new String(result, 0, resultSize);
}
@Override
Modified: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java 2009-06-05 10:26:10 UTC (rev 14532)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java 2009-06-05 11:56:27 UTC (rev 14533)
@@ -34,7 +34,34 @@
super(P);
}
+ private boolean isFirstChars = true;
+
@Override
+ public void appendBody(String str) {
+ if (isFirstChars) {
+ String substr = cutLeadBreaklines(str);
+ if (substr != null) {
+ body.add(substr);
+ isFirstChars = false;
+ } else {
+ return;
+ }
+ } else {
+ body.add(str);
+ }
+ }
+
+ private String cutLeadBreaklines(String str) {
+ char text[] = str.toCharArray();
+ int firstNotNewLineChar = 0;
+ while (firstNotNewLineChar < text.length && (text[firstNotNewLineChar] == '\r' || text[firstNotNewLineChar] == '\n')) {
+ firstNotNewLineChar++;
+ }
+
+ return firstNotNewLineChar < text.length ? str.substring(firstNotNewLineChar) : null;
+ }
+
+ @Override
public String printStart() {
return "";
}
Modified: branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java 2009-06-05 10:26:10 UTC (rev 14532)
+++ branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java 2009-06-05 11:56:27 UTC (rev 14533)
@@ -335,6 +335,21 @@
assertTrue(result.contains(content));
}
+ public void testRF7291() throws Exception {
+ final String content =
+ "<ul>" +
+ "<li>an item :\n" +
+ " <ul>\n" +
+ " <li>first</li>\n" +
+ " <li>second</li>\n" +
+ " </ul>\n" +
+ "</li>" +
+ "<li>another item</li>" +
+ "</ul>" ;
+
+ assertHtml2SeamConverting(content);
+ }
+
public void testUglyTextFromWord() throws Exception {
final String str = "<p><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\"/><meta content=\"Word.Document\" name=\"ProgId\"/><meta content=\"Microsoft Word 12\" name=\"Generator\"/><meta content=\"Microsoft Word 12\" name=\"Originator\"/><link href=\"file:///E:\\TEMP~1\\msohtmlclip1\\01\\clip_filelist.xml\" rel=\"File-List\"/><link href=\"file:///E:\\TEMP~1\\msohtmlclip1\\01\\clip_themedata.thmx\" rel=\"themeData\"/><link href=\"file:///E:\\TEMP~1\\msohtmlclip1\\01\\clip_colorschememapping.xml\" rel=\"colorSchemeMapping\"/>"
+ "<!--[if gte mso 9]><xml>\n"
15 years, 7 months