JBoss Rich Faces SVN: r7890 - trunk/test-applications/jsp/src/main/java/inplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: gmaksimenko
Date: 2008-04-17 08:11:15 -0400 (Thu, 17 Apr 2008)
New Revision: 7890
Modified:
trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java
Log:
Add tabbing and binding for test page
Modified: trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java 2008-04-17 12:09:54 UTC (rev 7889)
+++ trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java 2008-04-17 12:11:15 UTC (rev 7890)
@@ -1,6 +1,9 @@
package inplaceSelect;
import javax.faces.event.ValueChangeEvent;
+import org.richfaces.component.html.HtmlInplaceSelect;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
public class InplaceSelect {
private boolean applyFromControlsOnly;
@@ -22,6 +25,8 @@
private int tabindex;
private Object value;
private String valueCL;
+ private HtmlInplaceSelect myInplaceSelect;
+ private String bindLabel;
public InplaceSelect() {
valueCL = "---";
@@ -31,10 +36,10 @@
selectWidth = "170";
defaultLabel = "defaultLabel";
controlsVerticalPosition = "center";
- controlsHorizontalPosition = "left";
+ controlsHorizontalPosition = "center";
value = "errors";
listWidth = "200";
- listHeight = "150";
+ listHeight = "50";
selectOnEdit = false;
showControls = false;
applyFromControlsOnly = false;
@@ -42,8 +47,31 @@
openOnEdit = true;
rendered = true;
immediate = false;
+ myInplaceSelect = new HtmlInplaceSelect();
+ bindLabel = "default";
}
+ public HtmlInplaceSelect getMyInplaceSelect(){
+ return myInplaceSelect;
+ }
+
+ public void setMyInplaceSelect(HtmlInplaceSelect myInplaceSelect){
+ this.myInplaceSelect = myInplaceSelect;
+ }
+
+ public String getbindLabel(){
+ return bindLabel;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = myInplaceSelect.getClientId(context);
+ }
+
+ public void setbindLabel(String bindLabel){
+ this.bindLabel = bindLabel;
+ }
+
public void valueChangeListener(ValueChangeEvent event){
valueCL = "valueChangeListener work!";
}
16 years, 9 months
JBoss Rich Faces SVN: r7889 - trunk/test-applications/jsp/src/main/webapp/InplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: gmaksimenko
Date: 2008-04-17 08:09:54 -0400 (Thu, 17 Apr 2008)
New Revision: 7889
Modified:
trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp
Log:
Add tabbing and binding for test page
Modified: trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp 2008-04-17 12:07:30 UTC (rev 7888)
+++ trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp 2008-04-17 12:09:54 UTC (rev 7889)
@@ -4,6 +4,9 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="inplaceSelectSubviewID">
+
+<h:inputText value="For verify tabbing"/> <br/>
+
This is because such an error can easily be made at programming level, <br />
and while invisible for the user who does not understand or cannot <br />
acquire the source code, many of those
@@ -30,6 +33,7 @@
<f:selectItem itemLabel="infos" itemValue="infos" />
<f:selectItem itemLabel="passeds" itemValue="passeds" />
<f:selectItem itemLabel="warns" itemValue="warns" />
+ <f:selectItem itemLabel="name" itemValue="name" />
</rich:inplaceSelect>
are easy to exploit.
<h:panelGrid columns="2">
@@ -71,7 +75,6 @@
onchange="submit();">
<f:selectItem itemLabel="top" itemValue="top" />
<f:selectItem itemLabel="bottom" itemValue="bottom" />
- <f:selectItem itemLabel="center" itemValue="center" />
</h:selectOneRadio>
<h:outputText value="controlsHorizontalPosition"></h:outputText>
@@ -103,5 +106,10 @@
<h:outputText value="openOnEdit"></h:outputText>
<h:selectBooleanCheckbox value="#{inplaceSelect.openOnEdit}"
onchange="submit();"></h:selectBooleanCheckbox>
+
+ <h:commandButton actionListener="#{inplaceSelect.checkBinding}" value="Binding"></h:commandButton>
+ <h:outputText value = "#{inplaceSelect.bindLabel}"/>
</h:panelGrid>
+
+
</f:subview>
\ No newline at end of file
16 years, 9 months
JBoss Rich Faces SVN: r7888 - in trunk/ui/contextMenu/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-17 08:07:30 -0400 (Thu, 17 Apr 2008)
New Revision: 7888
Modified:
trunk/ui/contextMenu/src/main/config/component/contextMenu.xml
trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-1653
Modified: trunk/ui/contextMenu/src/main/config/component/contextMenu.xml
===================================================================
--- trunk/ui/contextMenu/src/main/config/component/contextMenu.xml 2008-04-17 11:07:47 UTC (rev 7887)
+++ trunk/ui/contextMenu/src/main/config/component/contextMenu.xml 2008-04-17 12:07:30 UTC (rev 7888)
@@ -46,7 +46,9 @@
<name>attached</name>
<classname>boolean</classname>
<description>
- DEPRECATED(use attachTo)If the value of the "attached" attribute is true, component is attached to parent component
+ If the value of the "attached" attribute is true, component is attached to component,
+ specified in the "attachTo" attribute or to the parent component,
+ if "attachTo" is not defined.
</description>
<defaultvalue>true</defaultvalue>
</property>
@@ -91,8 +93,8 @@
Client identifier of the component or id of the existing DOM element that is a source
for given event. If attachTo is defined, the event is attached on the client according
to the AttachTiming attribute.
- If attachTo is not defined, the event is attached on the server to the closest in the
- component tree parent component (deprecated "attached" attribute is used).
+ If both attached and attachTo attributes are defined, and attribute attached has value
+ 'false', it is considered to have higher priority.
</description>
<defaultvalue>""</defaultvalue>
</property>
Modified: trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
===================================================================
--- trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-04-17 11:07:47 UTC (rev 7887)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-04-17 12:07:30 UTC (rev 7888)
@@ -30,10 +30,8 @@
public abstract class UIContextMenu extends UIComponentBase implements MenuComponent {
public static final String COMPONENT_TYPE = "org.richfaces.ContextMenu";
- @Deprecated
public abstract boolean isAttached();
- @Deprecated
public abstract void setAttached(boolean b);
public abstract String getAttachTo();
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-04-17 11:07:47 UTC (rev 7887)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-04-17 12:07:30 UTC (rev 7888)
@@ -160,6 +160,11 @@
}
private String getClientAttachmentOptions(FacesContext context, UIContextMenu contextMenu) {
+ // if contextMenu is not attached (it can be called by JS API)
+ if(!contextMenu.isAttached()) {
+ return "";
+ }
+
String attachTo = contextMenu.getAttachTo();
String attachTiming = contextMenu.getAttachTiming();
@@ -182,13 +187,10 @@
}
}
- if((attachToIds.size() == 0) && !contextMenu.isAttached()) {
- return "";
- }
-
String baseJSFucntionName = "contextMenu.attachToElementById";
- // compatibility with @Deprecated attribute "attached"
+ // if attribute "attachTo" is not defined,
+ // attach contextMenu to the parent component
if(attachToIds.size() == 0) {
UIComponent parentComponent = contextMenu.getParent();
String clientId = parentComponent.getClientId(context);
16 years, 9 months
JBoss Rich Faces SVN: r7887 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-17 07:07:47 -0400 (Thu, 17 Apr 2008)
New Revision: 7887
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-2241
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml 2008-04-17 11:01:29 UTC (rev 7886)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml 2008-04-17 11:07:47 UTC (rev 7887)
@@ -19,7 +19,7 @@
<h:panelGroup id="picture">
<h:graphicImage value="/richfaces/jQuery/images/pic1.jpg" id="pic" style="border : 5px solid #E4EAEF"/>
- <rich:contextMenu event="oncontextmenu" attached="true" submitMode="none">
+ <rich:contextMenu event="oncontextmenu" attachTo="pic" submitMode="none">
<rich:menuItem value="Zoom In" onclick="enlarge();" id="zin"></rich:menuItem>
<rich:menuItem value="Zoom Out" onclick="decrease();" id="zout"></rich:menuItem>
</rich:contextMenu>
16 years, 9 months
JBoss Rich Faces SVN: r7886 - in trunk/ui/contextMenu/src/main: java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-17 07:01:29 -0400 (Thu, 17 Apr 2008)
New Revision: 7886
Modified:
trunk/ui/contextMenu/src/main/config/component/contextMenu.xml
trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
trunk/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js
Log:
http://jira.jboss.com/jira/browse/RF-1653
Modified: trunk/ui/contextMenu/src/main/config/component/contextMenu.xml
===================================================================
--- trunk/ui/contextMenu/src/main/config/component/contextMenu.xml 2008-04-16 23:00:41 UTC (rev 7885)
+++ trunk/ui/contextMenu/src/main/config/component/contextMenu.xml 2008-04-17 11:01:29 UTC (rev 7886)
@@ -46,7 +46,7 @@
<name>attached</name>
<classname>boolean</classname>
<description>
- If the value of the "attached" attribute is true, component is attached to parent component
+ DEPRECATED(use attachTo)If the value of the "attached" attribute is true, component is attached to parent component
</description>
<defaultvalue>true</defaultvalue>
</property>
@@ -83,6 +83,28 @@
Set minimal width for the all of the lists that will appear
</description>
</property>
+
+ <property>
+ <name>attachTo</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Client identifier of the component or id of the existing DOM element that is a source
+ for given event. If attachTo is defined, the event is attached on the client according
+ to the AttachTiming attribute.
+ If attachTo is not defined, the event is attached on the server to the closest in the
+ component tree parent component (deprecated "attached" attribute is used).
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <property>
+ <name>attachTiming</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Defines the timing when the menu is attached to the target element
+ </description>
+ <defaultvalue>"onavailable"</defaultvalue>
+ </property>
<!--
Modified: trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
===================================================================
--- trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-04-16 23:00:41 UTC (rev 7885)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-04-17 11:01:29 UTC (rev 7886)
@@ -30,9 +30,19 @@
public abstract class UIContextMenu extends UIComponentBase implements MenuComponent {
public static final String COMPONENT_TYPE = "org.richfaces.ContextMenu";
+ @Deprecated
public abstract boolean isAttached();
+ @Deprecated
public abstract void setAttached(boolean b);
+
+ public abstract String getAttachTo();
+
+ public abstract void setAttachTo(String attachTo);
+
+ public abstract String getAttachTiming();
+
+ public abstract void setAttachTiming(String attachTo);
public abstract String getEvent();
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-04-16 23:00:41 UTC (rev 7885)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-04-17 11:01:29 UTC (rev 7886)
@@ -23,7 +23,7 @@
import java.io.IOException;
import java.io.Writer;
-import java.util.Iterator;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -36,7 +36,9 @@
import org.ajax4jsf.component.JavaScriptParameter;
import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIContextMenu;
@@ -47,17 +49,35 @@
* @author Maksim Kaszynski
*
*/
-public class ContextMenuRendererBase extends
- TemplateEncoderRendererBase {
+public class ContextMenuRendererBase extends TemplateEncoderRendererBase {
- private final ContextMenuRendererDelegate delegate =
+ /**
+ * Constant for "immediate" attach timing option
+ */
+ private static final String IMMEDIATE = "immediate";
+
+ /**
+ * Constant for "onAvailable" attach timing option
+ */
+ private static final String ON_AVAILABLE = "onavailable";
+
+ /**
+ * Constant for "onload" attach timing option
+ */
+ private static final String ON_LOAD = "onload";
+
+ private final ContextMenuRendererDelegate delegate =
new ContextMenuRendererDelegate();
private final InternetResource[] ownScripts = {
getResource("/org/richfaces/renderkit/html/scripts/json/json-dom.js"),
getResource("/org/richfaces/renderkit/html/scripts/utils.js"),
- getResource("/org/richfaces/renderkit/html/scripts/context-menu.js")
-
+ getResource("/org/richfaces/renderkit/html/scripts/context-menu.js"),
+ new org.ajax4jsf.javascript.PrototypeScript(),
+ new org.ajax4jsf.javascript.AjaxScript(),
+ getResource("/org/richfaces/renderkit/html/scripts/available.js"),
+ getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js")
+
};
private final InternetResource[] scripts;
@@ -89,6 +109,19 @@
writer.writeAttribute(HTML.id_ATTRIBUTE, component.getClientId(context), "id");
}
+ /**
+ * Perform validation of the contextMenu configuration. Throws FacesException in case validation fails.
+ * @param clientId - id of the component
+ * @param name - component name
+ * @param attachTiming - timing options
+ */
+ protected void checkValidity(String clientId, String name, String attachTiming) {
+ 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 + "'");
+ }
+ }
public void renderChildren(FacesContext context, UIComponent component)
throws IOException {
@@ -108,14 +141,14 @@
}
writer.startElement("script", component);
- writer.writeText("new Richfaces.ContextMenu('", null);
+ writer.writeText("var contextMenu = new Richfaces.ContextMenu('", null);
writer.writeText(component.getClientId(context), null);
writer.writeText("', ", null);
writer.writeText(menu.getShowDelay() + ", ", null);
writeScriptBody(context, component, true);
writer.writeText(")", null);
+ writer.writeText(";", null);
writer.writeText(getClientAttachmentOptions(context, menu), null);
- writer.writeText(";", null);
if (menu.isDisableDefaultMenu()) {
writer.writeText("Richfaces.disableDefaultHandler('", null);
@@ -127,43 +160,90 @@
}
private String getClientAttachmentOptions(FacesContext context, UIContextMenu contextMenu) {
- String result = "";
- if (contextMenu.isAttached()) {
- JSFunction function = new JSFunction(".attachToParent");
- UIComponent parent = contextMenu.getParent();
- String parentId = parent.getClientId(context);
-
- function.addParameter(parentId);
+ String attachTo = contextMenu.getAttachTo();
+ String attachTiming = contextMenu.getAttachTiming();
- String event = contextMenu.getEvent();
-
- function.addParameter(event);
-
- Map params = new LinkedHashMap();
- List children = contextMenu.getChildren();
-
- for (Iterator iterator = children.iterator(); iterator.hasNext();) {
- UIComponent kid = (UIComponent) iterator.next();
-
- if (kid instanceof UIParameter) {
- UIParameter parameter = (UIParameter) kid;
- String name = parameter.getName();
- Object value = parameter.getValue();
-
- if (parameter instanceof JavaScriptParameter &&
- ((JavaScriptParameter) parameter).isNoEscape()) {
- value = new JSReference(String.valueOf(value));
- }
-
- params.put(name, value);
- }
-
- }
-
- function.addParameter(params);
- result = function.toScript();
+ boolean isImmediate = attachTiming.equals(IMMEDIATE);
+ boolean isOnLoad = attachTiming.equals(ON_LOAD);
+ boolean isOnAvailable = attachTiming.equals(ON_AVAILABLE);
+
+ if (!(isImmediate || isOnLoad || isOnAvailable)) {
+ // unknown value of property "attachTiming"
+ return "";
+ }
+
+ String pattern = "\\s*,\\s*";
+ // "attachTo" attribute may contain several ids split by ","
+ List<String> attachToIds = new ArrayList<String>();
+ String[] splitAttachTo = attachTo.split(pattern);
+ for (String tempId : splitAttachTo) {
+ if(tempId.length() > 0) {
+ attachToIds.add(tempId);
}
- return result;
+ }
+
+ if((attachToIds.size() == 0) && !contextMenu.isAttached()) {
+ return "";
+ }
+
+ String baseJSFucntionName = "contextMenu.attachToElementById";
+
+ // compatibility with @Deprecated attribute "attached"
+ if(attachToIds.size() == 0) {
+ UIComponent parentComponent = contextMenu.getParent();
+ String clientId = parentComponent.getClientId(context);
+ if (clientId != null) {
+ attachToIds.add(clientId);
+ baseJSFucntionName = "contextMenu.attachToParent";
+ }
+ }
+
+ StringBuilder attachContextMenuBuffer = new StringBuilder();
+
+ // collect parameters
+ Map<String, Object> params = new LinkedHashMap<String, Object>();
+ for (UIComponent kid : contextMenu.getChildren()) {
+ if (kid instanceof UIParameter) {
+ UIParameter parameter = (UIParameter) kid;
+ String name = parameter.getName();
+ Object value = parameter.getValue();
+
+ if ((parameter instanceof JavaScriptParameter) && ((JavaScriptParameter) parameter).isNoEscape()) {
+ value = new JSReference(String.valueOf(value));
+ }
+
+ params.put(name, value);
+ }
+ }
+
+ for (String attachToId : attachToIds) {
+ JSFunction attachContextMenuFunction = new JSFunction(baseJSFucntionName);
+ UIComponent target = RendererUtils.getInstance().findComponentFor(context, contextMenu, attachToId);
+ String clientId = (target != null) ? target.getClientId(context) : attachToId;
+
+ attachContextMenuFunction.addParameter(clientId);
+ attachContextMenuFunction.addParameter(contextMenu.getEvent());
+ attachContextMenuFunction.addParameter(params);
+
+ if (isImmediate) {
+ attachContextMenuBuffer.append(attachContextMenuFunction.toScript());
+ } else if (isOnAvailable) {
+ JSFunction availableFunction = new JSFunction("Richfaces.onAvailable");
+ availableFunction.addParameter(clientId);
+ availableFunction.addParameter(new JSFunctionDefinition().addToBody(attachContextMenuFunction));
+
+ attachContextMenuBuffer.append(availableFunction.toScript());
+ } else if (isOnLoad) {
+ JSFunction onloadFunction = new JSFunction("jQuery(document).ready");
+ onloadFunction.addParameter(new JSFunctionDefinition().addToBody(attachContextMenuFunction));
+
+ attachContextMenuBuffer.append(onloadFunction.toScript());
+ }
+
+ attachContextMenuBuffer.append(";");
+ }
+
+ return attachContextMenuBuffer.toString();
}
protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
Modified: trunk/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js
===================================================================
--- trunk/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js 2008-04-16 23:00:41 UTC (rev 7885)
+++ trunk/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js 2008-04-17 11:01:29 UTC (rev 7886)
@@ -23,6 +23,15 @@
this.menuContent = null;
},
+ // attach contextMenu to element specified by id
+ attachToElementById : function(id, event, context) {
+ var element = $(id);
+
+ this.attachToElement(element, event, context);
+ },
+
+ // attach contextMenu to element specified by id
+ // or to the parent fo the current element
attachToParent : function(id, event, context) {
var element = $(id);
if (!element) {
@@ -32,15 +41,20 @@
}
}
+ this.attachToElement(element, event, context);
+ },
+
+ // attach contextMenu to specified element
+ attachToElement : function(element, event, context) {
if (element) {
this.applyDecoration(element);
+
+ //Strip 'on' here
+ var evnName = event.substr(2);
+ var listener = this.show.bindAsEventListener(this, context);
+
+ Event.observe(element, evnName, listener);
}
-
- //Strip 'on' here
- var evnName = event.substr(2);
- var listener = this.show.bindAsEventListener(this, context);
-
- Event.observe(element, evnName, listener);
},
hide: function() {
16 years, 9 months
JBoss Rich Faces SVN: r7885 - in trunk: ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-16 19:00:41 -0400 (Wed, 16 Apr 2008)
New Revision: 7885
Modified:
trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js
trunk/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js
trunk/ui/togglePanel/src/main/templates/toggleControl.jspx
Log:
http://jira.jboss.com/jira/browse/RF-3081
http://jira.jboss.com/jira/browse/RF-3068
Modified: trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js 2008-04-16 17:06:59 UTC (rev 7884)
+++ trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js 2008-04-16 23:00:41 UTC (rev 7885)
@@ -3,8 +3,8 @@
if(!A4J.findForm){
-function _JSFFormSubmit(linkId,formName,target,parameters){
- var form = document.getElementById(formName);
+function _JSFFormSubmit(linkId, formName, target, parameters){
+ var form = (typeof formName == 'string' ? document.getElementById(formName) : formName);
if(form){
/*var hiddenField = form.elements[formName+":_idcl"];
if(hiddenField){
@@ -37,7 +37,21 @@
}
}
}
- form.submit();
+
+ var onsubmitResult;
+ if (form.fireEvent) {
+ onsubmitResult = form.fireEvent("onsubmit");
+ } else {
+ var event = document.createEvent("HTMLEvents");
+ event.initEvent("submit", true, true)
+
+ onsubmitResult = form.dispatchEvent(event);
+ }
+
+ if (onsubmitResult) {
+ form.submit();
+ }
+
_clearJSFFormParameters(formName,target,paramNames);
} else {
@@ -47,7 +61,7 @@
};
function _clearJSFFormParameters(formName,target,fields){
- var form = document.getElementById(formName);
+ var form = (typeof formName == 'string' ? document.getElementById(formName) : formName);
if(form){
if(target){
form.target = target;
@@ -88,7 +102,7 @@
// setup form to handle 'onclick' events, to detect input element.
A4J.setupForm = function(id){
- var element = window.document.getElementById(id);
+ var element = (typeof id == 'string' ? window.document.getElementById(id) : id);
var name = "click";
if (element.addEventListener) {
element.addEventListener(name, A4J._observer, false);
Modified: trunk/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js 2008-04-16 17:06:59 UTC (rev 7884)
+++ trunk/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js 2008-04-16 23:00:41 UTC (rev 7885)
@@ -112,29 +112,21 @@
var parentForm = A4J.findForm($(clientId + "_header"));
if(!parentForm || !parentForm.appendChild /* findForm returns surrogate form object */) return;
- var fInput = parentForm[clientId];
- if(!fInput) {
- fInput = document.createElement("input");
- fInput.type = "hidden";
- fInput.name = clientId;
- parentForm.appendChild(fInput);
- }
-
-
var thePanel = this.panels.get(clientId);
if (thePanel.status == "true") {
if (thePanel.invokeEvent("collapse",event,"true",fInput)) {
thePanel.status="false";
}
-
} else {
if (thePanel.invokeEvent("expand",event,"false",fInput)) {
thePanel.status="true";
}
}
- fInput.value = thePanel.status;
- parentForm.submit();
+ var params = {};
+ params[clientId] = thePanel.status;
+ _JSFFormSubmit(null, parentForm, null, params);
+
return false;
}
Modified: trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js
===================================================================
--- trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js 2008-04-16 17:06:59 UTC (rev 7884)
+++ trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js 2008-04-16 23:00:41 UTC (rev 7885)
@@ -43,15 +43,10 @@
var parentForm = document.forms[formId];
if(parentForm == null) return;
- var fInput = parentForm[clientId];
- if(fInput==null) {
- fInput = document.createElement("input");
- fInput.type = "hidden";
- fInput.name = clientId;
- parentForm.appendChild(fInput);
- }
- fInput.value = stateId;
- parentForm.submit();
+ var params = {};
+ params[clientId] = stateId;
+ _JSFFormSubmit(null, parentForm, null, params);
+
return false;
}
Modified: trunk/ui/togglePanel/src/main/templates/toggleControl.jspx
===================================================================
--- trunk/ui/togglePanel/src/main/templates/toggleControl.jspx 2008-04-16 17:06:59 UTC (rev 7884)
+++ trunk/ui/togglePanel/src/main/templates/toggleControl.jspx 2008-04-16 23:00:41 UTC (rev 7885)
@@ -13,6 +13,7 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
+ /org/ajax4jsf/javascript/scripts/form.js,
scripts/togglePanel.js
</h:scripts> <f:clientid var="clientId"/>
<a id="#{clientId}" href="#"
16 years, 9 months
JBoss Rich Faces SVN: r7884 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-16 13:06:59 -0400 (Wed, 16 Apr 2008)
New Revision: 7884
Modified:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
Log:
http://jira.jboss.com/jira/browse/RF-1216 - details of usage were edited
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-04-16 17:05:27 UTC (rev 7883)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-04-16 17:06:59 UTC (rev 7884)
@@ -97,7 +97,7 @@
<para>
Using the <emphasis role="bold"><property><f:selectItem /></property></emphasis> or <emphasis role="bold">
<property><f:selectItems /></property></emphasis> facets which considers only
- <emphasis role="bold"><property><value /></property></emphasis> attribute.
+ <emphasis><property>"value"</property></emphasis> attribute.
</para>
<para>
<emphasis role="bold">Example:</emphasis>
16 years, 9 months
JBoss Rich Faces SVN: r7883 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-16 13:05:27 -0400 (Wed, 16 Apr 2008)
New Revision: 7883
Modified:
trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml
Log:
http://jira.jboss.com/jira/browse/RF-3100 - "attachTiming" attribute was added
Modified: trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml 2008-04-16 17:05:16 UTC (rev 7882)
+++ trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml 2008-04-16 17:05:27 UTC (rev 7883)
@@ -3,6 +3,7 @@
<sectioninfo>
<keywordset>
<keyword>rich:componentControl</keyword>
+ <keyword>componentControl</keyword>
</keywordset>
</sectioninfo>
@@ -62,7 +63,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <rich:componentControl attachTo="doExpandCalendarID" for="ccCalendarID" event="onclick" operation="Expand" />
+<rich:componentControl attachTo="doExpandCalendarID" for="ccCalendarID" event="onclick" operation="Expand" />
...]]></programlisting>
</section>
@@ -74,55 +75,61 @@
</para>
<programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlComponentControl;
...
-HtmlComponentControl myCalendar = new HtmlComponentControl();
+HtmlComponentControl myComponentControl = new HtmlComponentControl();
...
]]></programlisting>
</section>
<section>
<title>Details of Usage</title>
- <para>There are three ways to use the <emphasis role="bold">
+ <para>
+ In order to use the <emphasis role="bold"><property><rich:componentControl></property></emphasis> with another components you need to take the following steps:
+
+ <!--
+ There are three ways to use the <emphasis role="bold">
<property><rich:componentControl></property>
- </emphasis> to another component.</para>
+ </emphasis> to another component.
+ -->
+ </para>
<itemizedlist>
- <listitem>Defining a name of a function that is generated (definition is similar to a
+ <listitem>Define a name of a function that is generated (definition is similar to a
definition of <emphasis role="bold">
<property><a4j:jsFunction></property>
</emphasis>). An "event" argument is passed to this function.</listitem>
</itemizedlist>
<para>An example is placed below:</para>
<programlisting role="XML"><![CDATA[...
- <rich:componentControl name="ffunction" for="comp_ID" operation="show"/>
+<rich:componentControl name="ffunction" for="comp_ID" operation="show"/>
...
]]></programlisting>
- <para>According to this code a function with name <property>"call"</property>
+ <para>According to this code a function with name <property>ffunction</property>
is generated. It is used in JavaScript code to trigger an operation on the target component
- with defined id=<property>"comp_ID"</property>.</para>
+ with defined <property>id</property>="comp_ID".</para>
<para>The generated function is shown below:</para>
<programlisting role="JAVA"><![CDATA[function ffunction (event) {
}
]]></programlisting>
<itemizedlist>
- <listitem>Attaching to a parent component (usage is similar to <emphasis role="bold">
+ <listitem>Attach to a parent component (usage is similar to <emphasis role="bold">
<property><a4j:support></property>
</emphasis> component).</listitem>
</itemizedlist>
<para>An example is placed below:</para>
<programlisting role="XML"><![CDATA[...
- <rich:modalPanel id="ccModalPanelID" onshow="alert(event.parameters.show)" onhide="alert(event.parameters.hide)">
- ...
- </rich:modalPanel>
- <h:commandButton value="Show Modal Panel">
- <rich:componentControl for="ccModalPanelID" event="onclick" disableDefault="true" operation="show">
- <f:param name="show" value="componentControl work(show)"/>
- <rich:componentControl/>
- </h:commandButton>
+<rich:modalPanel id="ccModalPanelID" onshow="alert(event.parameters.show)" onhide="alert(event.parameters.hide)">
+ <h:outputText value="#{bean.text}"/>
+</rich:modalPanel>
+<h:commandButton value="Show Modal Panel">
+ <rich:componentControl for="ccModalPanelID" event="onclick" disableDefault="true" operation="show">
+ <f:param name="show" value="componentControl work(show)"/>
+ <rich:componentControl/>
+</h:commandButton>
...
]]></programlisting>
<para>In the example the <emphasis>
<property>"for"</property>
- </emphasis> attribute contains value of an Id of <emphasis role="bold">
+ </emphasis> attribute contains value of an <property>id</property> of <emphasis role="bold">
<property><rich:modalPanel></property>
</emphasis> component. The <emphasis>
<property>"operation"</property>
@@ -143,27 +150,27 @@
<property><h:commandButton></property>
</emphasis> to avoid a problem with form submit and <property>modalPanel</property> showing.</para>
<itemizedlist>
- <listitem>Attaching with <emphasis>
+ <listitem>Attach with <emphasis>
<property>"attachTo"</property>
</emphasis> attribute.</listitem>
</itemizedlist>
<para>An example is placed below:</para>
<programlisting role="XML"><![CDATA[...
- <rich:calendar popup="#{componentControl.calendarPopup}" id="ccCalendarID" />
+<rich:calendar popup="#{componentControl.calendarPopup}" id="ccCalendarID" />
...
- <f:verbatim>
- <a href="#" id="doExpandCalendarID">Calendar (nextYear)</a>
- </f:verbatim>
- <rich:componentControl attachTo="doExpandCalendarID" for="ccCalendarID" event="onclick" disableDefault="true" operation="nextYear" />
+<f:verbatim>
+ <a href="#" id="doExpandCalendarID">Calendar (nextYear)</a>
+</f:verbatim>
+<rich:componentControl attachTo="doExpandCalendarID" for="ccCalendarID" event="onclick" disableDefault="true" operation="nextYear" />
...
]]></programlisting>
<para>In the example the <emphasis>
<property>"attachTo"</property>
- </emphasis> attribute contais a value of an Id of <property><a></property> tag.
+ </emphasis> attribute contais a value of an <property>id</property> of <emphasis role="bold"><property><a></property></emphasis> element.
The <emphasis>
<property>"for"</property>
- </emphasis> attribute contains value of an Id of <emphasis role="bold">
+ </emphasis> attribute contains value of an <property>id</property> of <emphasis role="bold">
<property><rich:calendar></property>
</emphasis> component. The <emphasis>
<property>"operation"</property>
@@ -171,11 +178,32 @@
represents the next year on the calendar.
</para>
<para>
+ With the help of the <emphasis><property>"attachTiming"</property></emphasis> attribute you can define the page loading phase when
+ <emphasis role="bold"><property><rich:componentControl></property></emphasis> is attached to source component. Possible values are:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ "immediate" - attached during execution of <emphasis role="bold"><property><rich:componentControl></property></emphasis> script
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ "onavailable" - attached after the target component is initialized
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ "onload" - attached after the page is loaded
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
<emphasis role="bold">
<property><rich:componentControl></property>
</emphasis> interacts with such components as:
- <itemizedlist>
- <listitem><emphasis role="bold">
+
+<emphasis role="bold">
<property><rich:contextMenu></property>
</emphasis>, <emphasis role="bold">
<property><rich:toolTip></property>
@@ -187,9 +215,8 @@
<property><rich:orderingList></property>
</emphasis>, <emphasis role="bold">
<property><rich:calendar></property>
- </emphasis></listitem>
-
- </itemizedlist>
+ </emphasis>
+
</para>
<para>In order to use <emphasis role="bold">
<property><rich:componentControl></property>
@@ -202,12 +229,11 @@
<programlisting role="XML"><![CDATA[...
<f:view>
<h:form>
- <br>
- <rich:toolTip id="toolTipFor" followMouse="false" direction="top-right" mode="ajax" value="This is button" horizontalOffset="5" verticalOffset="5" layout="block">
- </rich:toolTip>
+ <br />
+ <rich:toolTip id="toolTipFor" followMouse="false" direction="top-right" mode="ajax" value="This is button" horizontalOffset="5" verticalOffset="5" layout="block" />
</h:form>
<h:commandButton id="ButtonID" value="Button">
- <cc:componentControl for="toolTipFor" attachTo="ButtonID" operation="show" event="onclick"/>
+ <rich:componentControl for="toolTipFor" attachTo="ButtonID" operation="show" event="onclick"/>
</h:commandButton>
</f:view>
...]]></programlisting>
16 years, 9 months
JBoss Rich Faces SVN: r7882 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-16 13:05:16 -0400 (Wed, 16 Apr 2008)
New Revision: 7882
Modified:
trunk/docs/userguide/en/src/main/docbook/included/componentControl.desc.xml
Log:
http://jira.jboss.com/jira/browse/RF-3100 - Key features were added
Modified: trunk/docs/userguide/en/src/main/docbook/included/componentControl.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/componentControl.desc.xml 2008-04-16 16:59:08 UTC (rev 7881)
+++ trunk/docs/userguide/en/src/main/docbook/included/componentControl.desc.xml 2008-04-16 17:05:16 UTC (rev 7882)
@@ -3,24 +3,38 @@
<sectioninfo>
<keywordset>
<keyword>rich:componentControl</keyword>
+ <keyword>componentControl</keyword>
</keywordset>
</sectioninfo>
<section>
<title>Description</title>
<para>The <emphasis role="bold">
<property><rich:componentControl></property>
- </emphasis> allows to call JS API functions on components after defined events.</para>
-
+ </emphasis> allows to call JavaScript API functions on components after defined events.</para>
</section>
- <!--section>
+ <section>
<title>Key Features</title>
<itemizedlist>
- <listitem>Highly customizable look and feel</listitem>
- <listitem>Popup representation</listitem>
- <listitem>Disablement support</listitem>
- <listitem>Smart and user-defined positioning</listitem>
- <listitem>Cells customization</listitem>
- <listitem>Macro substitution based on tool bars customization</listitem>
+ <listitem>
+ <para>
+ Management of components JavaScript API
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Customizable initialization variants
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Customizable activation events
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Possibility to pass parameters to the target component
+ </para>
+ </listitem>
</itemizedlist>
- </section-->
+ </section>
</section>
16 years, 9 months
JBoss Rich Faces SVN: r7881 - trunk/cdk/generator/src/main/resources/META-INF/schema/entities.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-16 12:59:08 -0400 (Wed, 16 Apr 2008)
New Revision: 7881
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_output_attributes.ent
Log:
http://jira.jboss.com/jira/browse/RF-1226 - "value" attribute description for input components was rewritten
Modified: trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_output_attributes.ent
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_output_attributes.ent 2008-04-16 16:58:13 UTC (rev 7880)
+++ trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_output_attributes.ent 2008-04-16 16:59:08 UTC (rev 7881)
@@ -4,7 +4,7 @@
<name>value</name>
<classname>java.lang.Object</classname>
<description>
- The initial value to set when rendered for the first time
+ The current value of this component
</description>
</property>
<property attachedstate="true">
16 years, 9 months