JBoss Rich Faces SVN: r10084 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-08-14 04:46:44 -0400 (Thu, 14 Aug 2008)
New Revision: 10084
Modified:
trunk/docs/userguide/en/src/main/docbook/included/beanValidator.xml
Log:
https://jira.jboss.org/jira/browse/RF-3903
Added info about beanValidator
Modified: trunk/docs/userguide/en/src/main/docbook/included/beanValidator.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/beanValidator.xml 2008-08-14 08:32:44 UTC (rev 10083)
+++ trunk/docs/userguide/en/src/main/docbook/included/beanValidator.xml 2008-08-14 08:46:44 UTC (rev 10084)
@@ -194,5 +194,5 @@
</section>
</section>
+</section>
-
16 years, 4 months
JBoss Rich Faces SVN: r10083 - in trunk/ui/simpleTogglePanel/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-08-14 04:32:44 -0400 (Thu, 14 Aug 2008)
New Revision: 10083
Modified:
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
Log:
RF-3583
Modified: trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-08-14 00:57:45 UTC (rev 10082)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-08-14 08:32:44 UTC (rev 10083)
@@ -31,6 +31,8 @@
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.event.AjaxSource;
+import com.sun.org.apache.xpath.internal.operations.Bool;
+
/**
* JSF component class
*/
@@ -38,12 +40,14 @@
//public abstract class UISimpleTogglePanel extends UIInput implements AjaxComponent, AjaxSource, ActionSource
{
- public static final String COMPONENT_FAMILY = "javax.faces.Command";
+ public static final String COMPONENT_FAMILY = "javax.faces.Command";
public static final String SERVER_SWITCH_TYPE = "server";
public static final String CLIENT_SWITCH_TYPE = "client";
public static final String AJAX_SWITCH_TYPE = "ajax";
public static final boolean COLLAPSED = false;
public static final boolean EXPANDED = true;
+
+ private transient Boolean openedSet = null;
private transient Boolean wasOpened = null;
@@ -154,6 +158,8 @@
if (!isRendered()) {
return;
}
+
+ updateModel();
if (isWasOpened()) {
// Process all facets and children of this component
@@ -165,8 +171,26 @@
}
}
+ private void updateModel () {
+ if (openedSet != null) {
+ setOpened(openedSet);
+ }
+ }
+
+ /**
+ * @return the openedSet
+ */
+ public boolean isOpenedSet() {
+ return openedSet;
+ }
+
+ /**
+ * @param openedSet the openedSet to set
+ */
+ public void setOpenedSet(boolean openedSet) {
+ this.openedSet = openedSet;
+ }
-
/*
* public void setValueBinding(String arg0, ValueBinding arg1) { if
* ("opened".equals(arg0)) super.setValueBinding("value", arg1);
Modified: trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2008-08-14 00:57:45 UTC (rev 10082)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2008-08-14 08:32:44 UTC (rev 10083)
@@ -88,10 +88,12 @@
//xxxx by nick - denis - use constants, please!
if ((panel.isOpened() == UISimpleTogglePanel.EXPANDED)) {
- panel.setOpened(UISimpleTogglePanel.COLLAPSED);
+ //panel.setOpened(UISimpleTogglePanel.COLLAPSED);
+ panel.setOpenedSet(UISimpleTogglePanel.COLLAPSED);
} else {
//xxxx by nick - denis - use constants, please!
- panel.setOpened(UISimpleTogglePanel.EXPANDED);
+ //panel.setOpened(UISimpleTogglePanel.EXPANDED);
+ panel.setOpenedSet(UISimpleTogglePanel.EXPANDED);
}
SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
if (panel.isImmediate()) {
@@ -115,6 +117,7 @@
}
if (null == panel.getValueBinding("value"))
panel.setOpened(submittedState);
+ panel.setOpenedSet(submittedState);
}
// in case of "ajax" request and "ajax" switch mode of toggle panel
16 years, 4 months
JBoss Rich Faces SVN: r10082 - in trunk/ui/core/src: main/java/org/ajax4jsf/taglib/html/jsp and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-13 20:57:45 -0400 (Wed, 13 Aug 2008)
New Revision: 10082
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/taglib/
trunk/ui/core/src/test/java/org/ajax4jsf/taglib/html/
trunk/ui/core/src/test/java/org/ajax4jsf/taglib/html/KeepAliveTagsTest.java
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
Log:
https://jira.jboss.org/jira/browse/RF-4166
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2008-08-14 00:56:49 UTC (rev 10081)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2008-08-14 00:57:45 UTC (rev 10082)
@@ -74,7 +74,8 @@
String beanExpression = "#{"+name+"}";
ValueBinding valueBinding = facesContext.getApplication().createValueBinding(beanExpression);
Object bean = valueBinding.getValue(facesContext);
- String beanAttributeName = isAjaxOnly?AjaxPhaseListener.AJAX_BEAN_PREFIX:AjaxPhaseListener.VIEW_BEAN_PREFIX+name;
+ String beanAttributeName = (isAjaxOnly ? AjaxPhaseListener.AJAX_BEAN_PREFIX : AjaxPhaseListener.VIEW_BEAN_PREFIX)
+ + name;
// Put bean instance to ViewRoot.
facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2008-08-14 00:56:49 UTC (rev 10081)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2008-08-14 00:57:45 UTC (rev 10082)
@@ -112,7 +112,8 @@
factory.createValueExpression(elContext, beanExpression, Object.class);
Object bean = valueExpression.getValue(elContext);
// Put bean instance to ViewRoot.
- String beanAttributeName = isAjaxOnly?AjaxPhaseListener.AJAX_BEAN_PREFIX:AjaxPhaseListener.VIEW_BEAN_PREFIX+beanName;
+ String beanAttributeName = (isAjaxOnly ? AjaxPhaseListener.AJAX_BEAN_PREFIX : AjaxPhaseListener.VIEW_BEAN_PREFIX)
+ + beanName;
facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);
return Tag.SKIP_BODY;
}
Added: trunk/ui/core/src/test/java/org/ajax4jsf/taglib/html/KeepAliveTagsTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/taglib/html/KeepAliveTagsTest.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/taglib/html/KeepAliveTagsTest.java 2008-08-14 00:57:45 UTC (rev 10082)
@@ -0,0 +1,145 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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.ajax4jsf.taglib.html;
+
+import java.util.Map;
+import java.util.Random;
+
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.ajax4jsf.event.AjaxPhaseListener;
+import org.ajax4jsf.taglib.html.facelets.KeepAliveHandler;
+import org.ajax4jsf.taglib.html.jsp.KeepAliveTag;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockFaceletContext;
+import org.ajax4jsf.tests.MockPageContext;
+import org.ajax4jsf.tests.MockValueExpression;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletHandler;
+import com.sun.facelets.tag.Location;
+import com.sun.facelets.tag.Tag;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagAttributes;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.tag.TagHandler;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.2.2
+ */
+
+public class KeepAliveTagsTest extends AbstractAjax4JsfTestCase {
+
+ public KeepAliveTagsTest(String name) {
+ super(name);
+ }
+
+ private void setupBean(String beanName, Object bean) {
+ externalContext.getRequestMap().put(beanName, bean);
+ }
+
+ private TagSupport setupTag(String beanName, Object bean, boolean ajaxOnly) {
+ setupBean(beanName, bean);
+
+ MockPageContext pageContext = new MockPageContext();
+
+ KeepAliveTag tag = new KeepAliveTag();
+ tag.setAjaxOnly(new MockValueExpression(ajaxOnly));
+ tag.setPageContext(pageContext);
+ tag.setBeanName(beanName);
+
+ return tag;
+ }
+
+ private TagHandler setupTagHandler(final String beanName, Object bean, final boolean ajaxOnly) {
+ setupBean(beanName, bean);
+
+ KeepAliveHandler handler = new KeepAliveHandler(new TagConfig() {
+
+ private Tag tag;
+ private String tagId;
+
+ {
+ tagId = "_tagId0";
+ Location location = new Location("cdr", 1, 2);
+ String ns = "urn:unk";
+ tag = new Tag(location,
+ ns, "tag", null,
+ new TagAttributes(new TagAttribute[] {
+ new TagAttribute(location, "", "beanName", null, beanName),
+ new TagAttribute(location, "", "ajaxOnly", null, String.valueOf(ajaxOnly))
+ }));
+ }
+
+ public FaceletHandler getNextHandler() {
+ return null;
+ }
+
+ public Tag getTag() {
+ return tag;
+ }
+
+ public String getTagId() {
+ return null;
+ }
+
+ });
+
+ return handler;
+ }
+
+ public void testJSPTag() throws Exception {
+ Map<String, Object> attributes = facesContext.getViewRoot().getAttributes();
+
+ Object ajaxBean = new Object();
+ TagSupport ajaxTag = setupTag("coolBean", ajaxBean, true);
+
+ ajaxTag.doStartTag();
+ assertSame(ajaxBean, attributes.get(AjaxPhaseListener.AJAX_BEAN_PREFIX + "coolBean"));
+
+ Object bean = new Object();
+ TagSupport tag = setupTag("beBean", bean, false);
+
+ tag.doStartTag();
+ assertSame(bean, attributes.get(AjaxPhaseListener.VIEW_BEAN_PREFIX + "beBean"));
+ }
+
+ public void testFaceletsTag() throws Exception {
+ FaceletContext ctx = new MockFaceletContext(facesContext);
+ Map<String, Object> attributes = facesContext.getViewRoot().getAttributes();
+
+ Object ajaxBean = new Object();
+ TagHandler ajaxTag = setupTagHandler("ajaxAliveBean", ajaxBean, true);
+
+ ajaxTag.apply(ctx , null);
+ assertSame(ajaxBean, attributes.get(AjaxPhaseListener.AJAX_BEAN_PREFIX + "ajaxAliveBean"));
+
+ Object bean = new Object();
+ TagHandler tag = setupTagHandler("thatBean", bean, false);
+
+ tag.apply(ctx, null);
+ assertSame(bean, attributes.get(AjaxPhaseListener.VIEW_BEAN_PREFIX + "thatBean"));
+ }
+}
16 years, 5 months
JBoss Rich Faces SVN: r10081 - trunk/framework/test/src/main/java/org/ajax4jsf/tests.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-13 20:56:49 -0400 (Wed, 13 Aug 2008)
New Revision: 10081
Added:
trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockFaceletContext.java
Log:
MockFaceletContext added
Added: trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockFaceletContext.java
===================================================================
--- trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockFaceletContext.java (rev 0)
+++ trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockFaceletContext.java 2008-08-14 00:56:49 UTC (rev 10081)
@@ -0,0 +1,191 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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.ajax4jsf.tests;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+import com.sun.facelets.TemplateClient;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.2.2
+ */
+
+public class MockFaceletContext extends FaceletContext {
+
+ private FacesContext context;
+ private FunctionMapper functionMapper;
+ private VariableMapper variableMapper;
+ private ELResolver elResolver;
+
+ private List<TemplateClient> templateClients;
+ private Map<String, Integer> ids = new HashMap<String, Integer>();
+
+ public List<TemplateClient> getTemplateClients() {
+ return templateClients;
+ }
+
+ public void setTemplateClients(List<TemplateClient> templateClients) {
+ this.templateClients = templateClients;
+ }
+
+ public MockFaceletContext(FacesContext context) {
+ super();
+ this.context = context;
+ this.templateClients = new ArrayList<TemplateClient>();
+
+ ELContext elContext = context.getELContext();
+ this.elResolver = elContext.getELResolver();
+ this.functionMapper = elContext.getFunctionMapper();
+ this.variableMapper = elContext.getVariableMapper();
+ }
+
+ @Override
+ public String generateUniqueId(String base) {
+ Integer cnt = (Integer) this.ids .get(base);
+ if (cnt == null) {
+ this.ids.put(base, new Integer(0));
+ return base;
+ } else {
+ int i = cnt.intValue() + 1;
+ this.ids.put(base, new Integer(i));
+ return base + "_" + i;
+ }
+ }
+
+ @Override
+ public ExpressionFactory getExpressionFactory() {
+ return context.getApplication().getExpressionFactory();
+ }
+
+ @Override
+ public FacesContext getFacesContext() {
+ return context;
+ }
+
+ @Override
+ public boolean includeDefinition(UIComponent parent, String name)
+ throws IOException, FaceletException, FacesException, ELException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void includeFacelet(UIComponent parent, String relativePath)
+ throws IOException, FaceletException, FacesException, ELException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void includeFacelet(UIComponent parent, URL absolutePath)
+ throws IOException, FaceletException, FacesException, ELException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void popClient(TemplateClient client) {
+ if (this.templateClients.isEmpty()) {
+ throw new IllegalArgumentException();
+ }
+
+ this.templateClients.remove(client);
+ }
+
+ @Override
+ public void pushClient(TemplateClient client) {
+ this.templateClients.add(0, client);
+ }
+
+ @Override
+ public void extendClient(TemplateClient client) {
+ this.templateClients.add(client);
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ if (this.variableMapper != null) {
+ ValueExpression ve = this.variableMapper.resolveVariable(name);
+ if (ve != null) {
+ return ve.getValue(this);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String name, Object value) {
+ if (this.variableMapper != null) {
+ if (value == null) {
+ this.variableMapper.setVariable(name, null);
+ } else {
+ this.variableMapper.setVariable(name, this.getExpressionFactory()
+ .createValueExpression(value, Object.class));
+ }
+ }
+ }
+
+ @Override
+ public void setFunctionMapper(FunctionMapper fnMapper) {
+ this.functionMapper = fnMapper;
+ }
+
+ @Override
+ public void setVariableMapper(VariableMapper varMapper) {
+ this.variableMapper = varMapper;
+ }
+
+ @Override
+ public ELResolver getELResolver() {
+ return this.elResolver;
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper() {
+ return this.functionMapper;
+ }
+
+ @Override
+ public VariableMapper getVariableMapper() {
+ return this.variableMapper;
+ }
+
+}
16 years, 5 months
JBoss Rich Faces SVN: r10080 - in trunk/ui/tooltip/src: main/resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-13 20:11:26 -0400 (Wed, 13 Aug 2008)
New Revision: 10080
Modified:
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4087
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-08-14 00:11:20 UTC (rev 10079)
+++ trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-08-14 00:11:26 UTC (rev 10080)
@@ -74,13 +74,11 @@
return stylesAll;
}
private final InternetResource[] scripts = {
- new org.ajax4jsf.javascript.PrototypeScript()
- ,
- new org.ajax4jsf.javascript.AjaxScript()
- ,
- getResource("/org/richfaces/renderkit/html/scripts/utils.js")
- ,
- getResource("/org/richfaces/renderkit/html/scripts/tooltip.js")
+ new org.ajax4jsf.javascript.PrototypeScript(),
+ new org.ajax4jsf.javascript.AjaxScript(),
+ getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js"),
+ getResource("/org/richfaces/renderkit/html/scripts/utils.js"),
+ getResource("/org/richfaces/renderkit/html/scripts/tooltip.js")
};
private InternetResource[] scriptsAll = null;
Modified: trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
--- trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-08-14 00:11:20 UTC (rev 10079)
+++ trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-08-14 00:11:26 UTC (rev 10080)
@@ -4,25 +4,6 @@
Richfaces.ToolTip = {};
-Richfaces.ToolTip.cumulativeOffset = function(element)
-{
- var valueT = 0, valueL = 0;
- do {
- if (window.opera && Richfaces.getComputedStyle(element, 'position') == 'fixed')
- {
- valueT += Richfaces.getComputedStyleSize(element,"top");
- valueL += Richfaces.getComputedStyleSize(element,"left");
- }
- else
- {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- }
- element = element.offsetParent;
- } while (element);
- return Element._returnOffset(valueL, valueT);
-};
-
ToolTip = Class.create();
ToolTip.prototype = {
@@ -233,8 +214,6 @@
}
if (this.activationTimerHandle) return;
- this.setScrollDelta();
-
var obj;
if (!e) var e = window.event;
@@ -326,8 +305,6 @@
this.onhide(e);
}
-
- this.scrollDelta = undefined;
},
doHide: function(e){
@@ -427,33 +404,10 @@
this.doDisable(e);
},
- setScrollDelta: function() {
- if (!this.scrollDelta) {
- this.scrollDelta = [0, 0];
- }
- var parentNode = this.parent;
- while (parentNode && !/^body$/i.test(parentNode.tagName)) {
- if (/^absolute$/i.test(Richfaces.getComputedStyle(parentNode, "position"))) {
- if (parentNode.scrollLeft) {
- this.scrollDelta[0] = parentNode.scrollLeft;
- }
- if (parentNode.scrollTop) {
- this.scrollDelta[1] = parentNode.scrollTop;
- }
- }
- parentNode = parentNode.parentNode;
- }
- },
-
/*
* we can pass here not event only, but also object {'clientX':XXX, 'clientY':XXX}
*/
setToolTipPosition: function(e){
- var toolTipX=0;
- var toolTipY=0;
-
- var x = Event.pointerX(e);
- var y = Event.pointerY(e);
//
// var toolTipDim = Element.getDimensions(this.toolTip);
// this.toolTipW = toolTipDim.width;
@@ -466,60 +420,55 @@
var _visibility = this.toolTip.style.visibility;
this.toolTip.style.visibility = "hidden";
this.toolTip.style.display = "block";
+
this.toolTip.style.top = "0px";
this.toolTip.style.left = "0px";
- var offsets = Richfaces.ToolTip.cumulativeOffset(this.toolTip);
+ var event = jQuery.event.fix(e);
var offsetWidth = this.toolTip.offsetWidth;
var offsetHeight = this.toolTip.offsetHeight;
- this.toolTip.style.visibility = _visibility;
- this.toolTip.style.display = _display;
-
- offsets[0] -= this.toolTip.offsetLeft || 0;
- offsets[1] -= this.toolTip.offsetTop || 0;
-
- toolTipX = x - offsets[0];
- toolTipY = y - offsets[1];
-
-// var windowDim = this.windowSize();
-
var regExpression = /^(top|bottom)-(left|right)$/;
var match = this.direction.match(regExpression);
var horizontalDirection = match[2];
var verticalDirection = match[1];
+
+ var coords = this.fitToolTip(e.clientX, e.clientY, elementDim, horizontalDirection, verticalDirection,
+ {'x':this.horizontalOffset, 'y':this.verticalOffset});
- this.prePosition({'x':toolTipX, 'y':toolTipY}, elementDim, horizontalDirection, verticalDirection, {'x':this.horizontalOffset, 'y':this.verticalOffset});
+ var offsets = jQuery(this.toolTip).offset();
+
+ var event = jQuery.event.fix(e);
+
+ var x = coords.x - offsets.left + (event.pageX - event.clientX);
+ var y = coords.y - offsets.top + (event.pageY - event.clientY);
- var coords = this.fitToolTip(e.clientX, e.clientY, {'x':toolTipX , 'y':toolTipY},elementDim, horizontalDirection, verticalDirection, {'x':this.horizontalOffset, 'y':this.verticalOffset});
-
- if (this.scrollDelta) {
- coords.x += this.scrollDelta[0];
- coords.y += this.scrollDelta[1];
- }
-
- Element.setStyle(this.toolTip, {"left": coords.x + "px", "top": coords.y + "px"});
+ Element.setStyle(this.toolTip, {"left": x + "px", "top": y + "px"});
if(this.iframe)
{
- this.iframe.style.top = (coords.y - this.toolTipBorderHeight) + 'px';
- this.iframe.style.left = (coords.x - this.toolTipBorderWidth) + 'px';
+ this.iframe.style.top = (y - this.toolTipBorderHeight) + 'px';
+ this.iframe.style.left = (x - this.toolTipBorderWidth) + 'px';
this.iframe.style.width = offsetWidth + 'px';
this.iframe.style.height = offsetHeight + 'px';
}
+
+ this.toolTip.style.visibility = _visibility;
+ this.toolTip.style.display = _display;
+
this.eventCopy = A4J.AJAX.CloneObject(e, false);
},
- prePosition: function(basePoint, elementDim, horizontalDirection, verticalDirection, offset){
+ prePosition: function(x, y, elementDim, horizontalDirection, verticalDirection, offset){
var returnX, returnY;
- returnX = horizontalDirection=='left' ? basePoint.x - elementDim.width - offset.x : basePoint.x += offset.x;
- returnY = verticalDirection == 'top' ? basePoint.y - elementDim.height - offset.y : basePoint.y + offset.y;
+ returnX = horizontalDirection=='left' ? x - elementDim.width - offset.x : x + offset.x;
+ returnY = verticalDirection == 'top' ? y - elementDim.height - offset.y : y + offset.y;
return {'x':returnX, 'y':returnY};
},
- fitToolTip: function(clientX, clientY,basePoint,elementDim, horizontalDirection, verticalDirection, offset){
+ fitToolTip: function(clientX, clientY, elementDim, horizontalDirection, verticalDirection, offset){
var winDim = Richfaces.Position.getWindowDimensions();
var deltaLeft = clientX - offset.x - elementDim.width;
var deltaRight = winDim.width - (clientX + offset.x + elementDim.width);
@@ -528,7 +477,6 @@
if(deltaLeft < 0){
// in this case new direction will be right
- this.prePosition({'x':basePoint.x , 'y':basePoint.y},elementDim, 'right', verticalDirection, offset);
var newDeltaRight = winDim.width - (clientX + offset.x + elementDim.width);
if(newDeltaRight > 0){
horizontalDirection = 'right';
@@ -539,7 +487,6 @@
}
} else if(deltaRight < 0){
// in this case new direction will be left
- this.prePosition({'x':basePoint.x , 'y':basePoint.y},elementDim, 'left', verticalDirection, offset);
var newDeltaLeft = clientX - offset.x - elementDim.width;
if(newDeltaLeft > 0){
horizontalDirection = 'left';
@@ -552,7 +499,6 @@
if(deltaTop < 0){
// in this case new direction will be right
- this.prePosition({'x':basePoint.x , 'y':basePoint.y},elementDim, horizontalDirection, 'bottom', offset);
var newDeltaBottom = winDim.height - (clientY + offset.y + elementDim.height);
if(newDeltaBottom > 0){
verticalDirection = 'bottom';
@@ -562,7 +508,6 @@
}
}
} else if(deltaBottom < 0){
- this.prePosition({'x':basePoint.x , 'y':basePoint.y},elementDim, horizontalDirection, 'top', offset);
var newDeltaTop = clientY - offset.y - elementDim.height;
if(newDeltaTop > 0){
verticalDirection = 'top';
@@ -572,7 +517,7 @@
}
}
}
- var coords = this.prePosition({'x':basePoint.x , 'y':basePoint.y},elementDim, horizontalDirection, verticalDirection, offset);
+ var coords = this.prePosition(clientX, clientY, elementDim, horizontalDirection, verticalDirection, offset);
return coords;
},
Modified: trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java
===================================================================
--- trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java 2008-08-14 00:11:20 UTC (rev 10079)
+++ trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java 2008-08-14 00:11:26 UTC (rev 10080)
@@ -54,6 +54,7 @@
javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/jquery/jquery.js");
javaScripts.add("org/richfaces/renderkit/html/scripts/tooltip.js");
javaScripts.add("prototype.js");
}
16 years, 5 months
JBoss Rich Faces SVN: r10079 - trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-13 20:11:20 -0400 (Wed, 13 Aug 2008)
New Revision: 10079
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
Log:
https://jira.jboss.org/jira/browse/RF-4087
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-08-14 00:06:11 UTC (rev 10078)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-08-14 00:11:20 UTC (rev 10079)
@@ -94,6 +94,10 @@
right: 3px;
}
+ .rich-modalpanel {
+ left: 0px;
+ top: 0px;
+ }
</f:verbatim>
<u:selector name=".dr-mpnl-spacer, .dr-mpnl-resizer">
16 years, 5 months
JBoss Rich Faces SVN: r10078 - in trunk/ui/suggestionbox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-13 20:06:11 -0400 (Wed, 13 Aug 2008)
New Revision: 10078
Modified:
trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
https://jira.jboss.org/jira/browse/RF-2543
https://jira.jboss.org/jira/browse/RF-3834
Modified: trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2008-08-13 17:36:11 UTC (rev 10077)
+++ trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2008-08-14 00:06:11 UTC (rev 10078)
@@ -87,9 +87,11 @@
*/
private final InternetResource[] additionalScripts = {
new org.ajax4jsf.javascript.PrototypeScript(),
+ getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js"),
getResource("/org/richfaces/renderkit/html/scripts/available.js"),
new org.ajax4jsf.javascript.SmartPositionScript(),
getResource("/org/richfaces/renderkit/html/scripts/browser_info.js"),
+ getResource("/org/richfaces/renderkit/html/scripts/utils.js"),
getResource("/org/richfaces/renderkit/html/scripts/scriptaculous/effects.js"),
getResource("scripts/suggestionbox.js")};
Modified: trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-08-13 17:36:11 UTC (rev 10077)
+++ trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-08-14 00:06:11 UTC (rev 10078)
@@ -116,6 +116,21 @@
this.onBlurListener = this.onBlur.bindAsEventListener(this);
Event.observe(this.element, "blur", this.onBlurListener);
+ //IE only
+ if (RichFaces.navigatorType() == RichFaces.MSIE) {
+ Event.observe(this.element, "focusout", function(event) {
+ var elt = event.toElement;
+ while (elt) {
+ if (elt == this.update) {
+ this.element.keepFocus = true;
+ elt = undefined;
+ } else {
+ elt = elt.parentNode;
+ }
+ }
+ }.bindAsEventListener(this));
+ }
+
this.onKeyDownListener = this.onKeyDown.bindAsEventListener(this);
Event.observe(this.element, "keydown", this.onKeyDownListener);
@@ -431,32 +446,17 @@
},
onBlur: function(event) {
- if (this.isUnloaded()) return;
+ if (this.isUnloaded()) return;
this.wasBlur = true;
if (!this.active) return;
- var offsets = RichFaces.Position.calcOffsets(this.update);
- if (RichFaces.navigatorType() != RichFaces.MSIE) {
- offsets["x"] = 0;
- offsets["y"] = 0;
+ if (this.element.keepFocus) {
+ this.element.keepFocus = false;
+ this.element.focus();
+ } else {
+ // needed to make click events working
+ setTimeout(this.hide.bind(this), 250);
}
-
- var x = event.clientX +
- document.body.scrollLeft +
- document.documentElement.scrollLeft;
-
- var y = event.clientY +
- document.body.scrollTop+
- document.documentElement.scrollTop;
-
- if (x > offsets["x"] && x < (this.update.clientWidth + offsets["x"])) {
- if (y > (offsets["y"] - this.update.clientHeight) && y < offsets["y"]) {
- this.element.focus();
- return;
- }
- }
- // needed to make click events working
- setTimeout(this.hide.bind(this), 250);
},
onScroll: function(event) {
@@ -998,7 +998,6 @@
this.source = $(source);
this.target = $(target);
- var targetStyle = {};
/*
http://jira.exadel.com/browse/RFA-236
@@ -1012,15 +1011,11 @@
}
*/
- var offsets = this.calcOffsets(this.source);
+ this.clonePosition(this.target, this.source, this.source.offsetHeight);
- Element.setStyle(this.target, Object.extend({"left": (offsets["x"])
- + "px", "top": (offsets["y"]) + "px"}, targetStyle));
-
if (options.iframeId) {
var iframe = $(options.iframeId);
var zindexVar = options.zindex ? options.zindex : 200 ;
- Position.clone(this.target, iframe);
Element.setStyle(this.target, {zIndex: zindexVar + 1});
Element.setStyle(iframe, {zIndex: zindexVar});
@@ -1032,93 +1027,36 @@
}
},
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- var fixedFlag = false;
- do {
- if (fixedFlag) {
- fixedFlag = false;
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- }
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- var position = element.style['position'];
- if (!position && element.currentStyle) {
- position = element.currentStyle['position'];
- }
- else if (!position && document.defaultView && document.defaultView.getComputedStyle) {
- var css = document.defaultView.getComputedStyle(element, null);
- position = css ? css['position'] : null;
- }
- if (position == 'fixed') {
- fixedFlag= true;
- }
-
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- calcOffsets : function(element) {
- var offsetBase = this.cumulativeOffset(element);
- return {x: offsetBase[0], y: element.offsetHeight + offsetBase[1]};
+ PX_REGEX: /px$/,
+
+ parseToPx: function(value) {
+ var v = value.strip();
+ if (v == 'auto') {
+ return 0;
+ } else {
+ return parseFloat(v.replace(this.PX_REGEX, ""));
+ }
},
+
+ clonePosition: function(target, source, vOffset) {
+ var jqt = jQuery(target);
+
+ var visibility = jqt.css('visibility');
+ var display = jqt.css('display');
+
+ var so = jQuery(source).offset();
+ var to = jqt.css({left: '0px', top: '0px', visibility: 'hidden', display: ''}).offset();
- _removePx : function(str) {
- str += "";
- if (str.indexOf("px") != -1) {
- return str.substr(0, str.indexOf("px"));
- }
- return str;
+ var l = so.left - to.left;
+ var p = so.top - to.top + vOffset;
+
+ // set position
+ target.style.left = l + 'px';
+ target.style.top = p + 'px';
+
+ jqt.css({visibility: visibility, display: display});
},
-
- calcHeight: function() {
- return this.options.height == "auto" ? "" :this.options.height;
- },
-
- calcTop: function(targetHeight) {
- var sourceOffset = Position.cumulativeOffset(this.source);
- var sourceTop = sourceOffset[1];
- var sourceHeight = this.source.offsetHeight;
- var body = this.getBody();
- // if (sourceTop + sourceHeight + targetHeight <= body.clientHeight) {
- return sourceTop + sourceHeight - 1;
- },
-
- calcWidth: function() {
- if (this.options.width == "auto") {
- return "";
- } else {
- if (this.options.width.indexOf("%") >= 0) {
- // Count persents to pixels
- var percent = parseInt(this.options.width.substring(0, this.options.width.indexOf("%")));
- var sizeInPixels = parseInt(this.source.offsetWidth) * percent
- / 100;
- this.options.width = sizeInPixels + "px";
- }
-
- return this.options.width;
- }
- // return this.source.offsetWidth;
- },
-
- calcLeft: function(targetWidth) {
- // Position.prepare();
- var sourceOffset = Position.cumulativeOffset(this.source);
- var sourceLeft = sourceOffset[0];
- var sourceWidth = this.source.offsetWidth;
- var body = this.getBody();
- var width = parseInt(sourceLeft) + parseInt(sourceWidth)
- + parseInt(targetWidth);
- if (width <= parseInt(body.clientWidth)) {
- return sourceLeft;
- } else {
- return width;
- }
- },
-
+
getBody: function() {
return this.source.ownerDocument.body;
}
16 years, 5 months
JBoss Rich Faces SVN: r10077 - trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-13 13:36:11 -0400 (Wed, 13 Aug 2008)
New Revision: 10077
Modified:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
Log:
Remove bad utility methods
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2008-08-13 15:35:50 UTC (rev 10076)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2008-08-13 17:36:11 UTC (rev 10077)
@@ -401,94 +401,4 @@
parentNode.removeChild(node);
}
}
-};
-
-//patched for 'fixed' positioning & 9.5 opera version of prototype.js
-//viewportOffset()
-//FIXME: seem to not work well when starting elements have margins
-Richfaces.getViewPortOffset = function(forElement) {
- var valueT = 0, valueL = 0;
-
- var startElement = forElement;
-
- if (Richfaces.getComputedStyle(startElement, 'position') == 'absolute') {
- startElement = Element.getOffsetParent(startElement);
- }
-
- var element = startElement;
-
- do {
- valueT += (element.offsetTop || 0);
- valueL += (element.offsetLeft || 0);
-
- var position = Richfaces.getComputedStyle(element, 'position');
-
- if (element != forElement || position != 'relative') {
- valueT += (element.clientTop || 0);
- valueL += (element.clientLeft || 0);
- }
-
- if (position == 'fixed') {
- break;
- }
-
- // Safari fix
- if (element.offsetParent == document.body &&
- position == 'absolute') {
- break;
- }
-
- } while (element = element.offsetParent);
-
- element = startElement;
- do {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
-
- if (Richfaces.getComputedStyle(element, 'position') == 'fixed') {
- break;
- }
-
- } while (element = element.parentNode);
-
- return [valueL, valueT];
-};
-
-Richfaces.clonePosition = function(element, source, opts) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, opts || { });
-
- // find page position of source
- source = $(source);
- var p = Richfaces.getViewPortOffset(source);
-
- // find coordinate system to use
- element = $(element);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Richfaces.getComputedStyle(element, 'position') == 'absolute') {
- parent = element.getOffsetParent();
- delta = Richfaces.getViewPortOffset(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if (options.setWidth) element.style.width = source.offsetWidth + 'px';
- if (options.setHeight) element.style.height = source.offsetHeight + 'px';
- return element;
-};
+};
\ No newline at end of file
16 years, 5 months
JBoss Rich Faces SVN: r10076 - trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-08-13 11:35:50 -0400 (Wed, 13 Aug 2008)
New Revision: 10076
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
RF-4168
Modified: trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-08-13 15:34:15 UTC (rev 10075)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-08-13 15:35:50 UTC (rev 10076)
@@ -382,6 +382,14 @@
this.isDisabled = false;
},
+ doDisable : function() {
+ this.disable();
+ },
+
+ doNormal : function() {
+ this.enable();
+ },
+
getCurrentWidth : function() {
return this.combobox.firstChild.offsetWidth;
},
16 years, 5 months
JBoss Rich Faces SVN: r10075 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/tabPanel/examples.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-08-13 11:34:15 -0400 (Wed, 13 Aug 2008)
New Revision: 10075
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/tabPanel/examples/custom.xhtml
Log:
Bug fixing(RF-4171).
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tabPanel/examples/custom.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tabPanel/examples/custom.xhtml 2008-08-13 15:19:26 UTC (rev 10074)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tabPanel/examples/custom.xhtml 2008-08-13 15:34:15 UTC (rev 10075)
@@ -9,7 +9,7 @@
cursor: pointer;
}
.rich-tabpanel-content {
- border-width: 1px 0px 0px 0px;
+ border-width: 1px 1px 1px 1px;
background-color: transparent;
}
</style>
16 years, 5 months