JBoss Rich Faces SVN: r11793 - trunk/ui/pickList/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-12-15 14:48:41 -0500 (Mon, 15 Dec 2008)
New Revision: 11793
Modified:
trunk/ui/pickList/src/main/templates/htmlPickList.jspx
Log:
https://jira.jboss.org/jira/browse/RF-2239
Modified: trunk/ui/pickList/src/main/templates/htmlPickList.jspx
===================================================================
--- trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2008-12-15 19:39:52 UTC (rev 11792)
+++ trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2008-12-15 19:48:41 UTC (rev 11793)
@@ -160,9 +160,7 @@
<script type="text/javascript">
- var clientId = '#{clientId}';
- RichShuttleUtils.execOnLoad(
- function(){
+ var clientId = '#{clientId}';
new Richfaces.PickList(
new Richfaces.PickList.Target('#{clientId}', '#{clientId}tlInternal_tab', '#{clientId}tlInternal_header_tab', '#{clientId}tlFocusKeeper', undefined, Richfaces.PickList.Target.SelectItem, #{this:getColumnClassesAsJSArray(context, component)}, #{this:getRowClassesAsJSArray(context, component)}),
new Richfaces.PickList.Source('#{clientId}', '#{clientId}internal_tab', '#{clientId}internal_header_tab', '#{clientId}focusKeeper', undefined, Richfaces.PickList.Source.SelectItem, #{this:getColumnClassesAsJSArray(context, component)}, #{this:getRowClassesAsJSArray(context, component)}),
@@ -171,9 +169,6 @@
onfocus:#{this:getAsEventHandler(context, component, "onfocus")},
onblur:#{this:getAsEventHandler(context, component, "onblur")}},
"#{clientId}valueKeeper");
- },
- RichShuttleUtils.Condition.ElementPresent("#{clientId}"), 100
- );
</script>
</span>
</f:root>
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r11792 - trunk/samples/dragDropDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-15 14:39:52 -0500 (Mon, 15 Dec 2008)
New Revision: 11792
Modified:
trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp
Log:
https://jira.jboss.org/jira/browse/RF-5388
https://jira.jboss.org/jira/browse/RF-961
Modified: trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp 2008-12-15 19:39:23 UTC (rev 11791)
+++ trunk/samples/dragDropDemo/src/main/webapp/pages/index.jsp 2008-12-15 19:39:52 UTC (rev 11792)
@@ -109,7 +109,7 @@
<h:panelGrid styleClass="dropzoneDecoration" id="drag2">
<h:outputText value="#{type} - drag" />
- <dnd:dragSupport ajaxSingle="true" dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
+ <dnd:dragSupport dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
<a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
</dnd:dragSupport>
</h:panelGrid>
@@ -124,6 +124,7 @@
<h:outputText value="#{type} - drop" />
<dnd:dropSupport ajaxSingle="true" reRender="regionsDragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ <a4j:actionparam value="#{type} - test drop param" assignTo="#{bean.testParam}" />
</dnd:dropSupport>
</h:panelGrid>
</a4j:region>
@@ -161,7 +162,7 @@
<h:panelGrid styleClass="dropzoneDecoration" id="drag3">
<h:outputText value="#{type} - drag" />
- <dnd:dragSupport ajaxSingle="true" dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
+ <dnd:dragSupport dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
<a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
</dnd:dragSupport>
</h:panelGrid>
@@ -176,6 +177,7 @@
<h:outputText value="#{type} - drop" />
<dnd:dropSupport ajaxSingle="true" reRender="formsDragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
+ <a4j:actionparam value="#{type} - test drop param" assignTo="#{bean.testParam}" />
</dnd:dropSupport>
</h:panelGrid>
</h:form>
17 years, 5 months
JBoss Rich Faces SVN: r11791 - trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-15 14:39:23 -0500 (Mon, 15 Dec 2008)
New Revision: 11791
Removed:
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java
Modified:
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
Log:
https://jira.jboss.org/jira/browse/RF-5388
https://jira.jboss.org/jira/browse/RF-961
Deleted: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java 2008-12-15 19:36:12 UTC (rev 11790)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DnDValidator.java 2008-12-15 19:39:23 UTC (rev 11791)
@@ -1,67 +0,0 @@
-/**
- * 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.richfaces.renderkit;
-
-import java.text.MessageFormat;
-import java.util.Set;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.richfaces.component.Draggable;
-import org.richfaces.component.Dropzone;
-import org.richfaces.component.util.MessageUtil;
-
-/**
- * @author Nick - mailto:nbelaevski@exadel.com
- * created 06.02.2007
- *
- */
-class DnDValidator {
- private final static String MESSAGE_FORMAT = "Dropzone [{0}] with accepted types {1} cannot accept Draggable [{2}] with dragType [{3}]";
-
- static boolean validateAcceptTypes(FacesContext context, Draggable draggable, Dropzone dropzone, String dragType, Object acceptedTypes) {
- Set<String> set = AjaxRendererUtils.asSet(acceptedTypes);
- if (set == null || !set.contains(dragType)) {
- UIComponent component = (UIComponent) dropzone;
- String text = MessageFormat.format(
- MESSAGE_FORMAT,
- new Object[] {
- MessageUtil.getLabel(context, component),
- set,
- MessageUtil.getLabel(context, (UIComponent) draggable),
- dragType});
-
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, text, text);
-
- context.addMessage(component.getClientId(context), message);
-
- context.renderResponse();
-
- return false;
- }
-
- return true;
- }
-}
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2008-12-15 19:36:12 UTC (rev 11790)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2008-12-15 19:39:23 UTC (rev 11791)
@@ -21,6 +21,7 @@
package org.richfaces.renderkit;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -107,17 +108,14 @@
DraggableOptions options = new DraggableOptions(draggable);
- Map eventOptions = AjaxRendererUtils.buildEventOptions(context, component);
+ Map eventOptions = AjaxRendererUtils.buildEventOptions(context, component,
+ Collections.singletonMap(DRAG_SOURCE_ID, (Object) component.getClientId(context)));
Map parameters = (Map) eventOptions.get("parameters");
if (parameters == null) {
parameters = new HashMap();
}
- String clientId = component.getClientId(context);
-
- parameters.put(DRAG_SOURCE_ID, clientId);
-
options.addOption("parameters", parameters);
String indicatorId = draggable.getResolvedDragIndicator(context);
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2008-12-15 19:36:12 UTC (rev 11790)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2008-12-15 19:39:23 UTC (rev 11791)
@@ -21,9 +21,12 @@
package org.richfaces.renderkit;
+import java.text.MessageFormat;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -38,6 +41,7 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.Draggable;
import org.richfaces.component.Dropzone;
+import org.richfaces.component.util.MessageUtil;
import org.richfaces.event.DragEvent;
import org.richfaces.event.DropEvent;
import org.richfaces.json.JSONCollection;
@@ -143,39 +147,79 @@
private Dropzone dropzone;
- public DraggableDecoderContextCallback(Dropzone dropzone) {
+ private Draggable draggable;
+
+ private String dragType;
+
+ private Object dragValue;
+
+ private Object acceptedTypes;
+
+ private Object dropValue;
+
+ private boolean valid = true;
+
+ private Object draggableLabel;
+
+ public DraggableDecoderContextCallback(Dropzone dropzone, Object acceptedTypes, Object dropValue) {
super();
this.dropzone = dropzone;
+ this.acceptedTypes = acceptedTypes;
+ this.dropValue = dropValue;
}
+ private boolean validateAcceptTypes(String dragType, Object acceptedTypes) {
+ Set<String> set = AjaxRendererUtils.asSet(acceptedTypes);
+ return (set != null && set.contains(dragType));
+ }
+
public void invokeContextCallback(FacesContext context,
UIComponent target) {
- Draggable draggable = (Draggable) target;
+ this.draggable = (Draggable) target;
- String dragType = draggable.getDragType();
- Object acceptedTypes = dropzone.getAcceptedTypes();
+ this.dragType = draggable.getDragType();
+ this.dragValue = draggable.getDragValue();
+
+ if (validateAcceptTypes(dragType, acceptedTypes)) {
- if (DnDValidator.validateAcceptTypes(context,
- draggable, dropzone,
- dragType, acceptedTypes)) {
-
DragEvent dragEvent = new DragEvent((UIComponent) draggable);
dragEvent.setDropTarget(dropzone);
dragEvent.setAcceptedTypes(acceptedTypes);
- dragEvent.setDropValue(dropzone.getDropValue());
+ dragEvent.setDropValue(dropValue);
- DropEvent dropEvent = new DropEvent((UIComponent) dropzone);
- dropEvent.setDraggableSource(draggable);
- dropEvent.setDragType(dragType);
- dropEvent.setDragValue(draggable.getDragValue());
-
dragEvent.queue();
- dropEvent.queue();
+ } else {
+ //invalidate
+ this.valid = false;
+ //store label for message output
+ this.draggableLabel = MessageUtil.getLabel(context, (UIComponent) draggable);
}
}
+
+ public Draggable getDraggable() {
+ return draggable;
+ }
+
+ public String getDragType() {
+ return dragType;
+ }
+
+ public Object getDragValue() {
+ return dragValue;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public Object getDraggableLabel() {
+ return draggableLabel;
+ }
}
+
+ private final static String MISTYPED_DND_MESSAGE = "Dropzone [{0}] with accepted types {1} cannot accept Draggable [{2}] with dragType [{3}]";
public void decode(FacesContext context, UIComponent component, CompositeRenderer compositeRenderer) {
String clientId = component.getClientId(context);
@@ -185,11 +229,42 @@
String dragSourceId = (String) paramMap.get(DraggableRendererContributor.DRAG_SOURCE_ID);
if (dragSourceId != null && dragSourceId.length() != 0) {
+ Dropzone dropzone = (Dropzone) component;
+ Object acceptedTypes = dropzone.getAcceptedTypes();
+ Object dropValue = dropzone.getDropValue();
+
DraggableDecoderContextCallback draggableDecoderContextCallback =
- new DraggableDecoderContextCallback((Dropzone) component);
+ new DraggableDecoderContextCallback(dropzone,
+ acceptedTypes, dropValue);
context.getViewRoot().invokeOnComponent(context, dragSourceId,
new ContextCallbackWrapper(draggableDecoderContextCallback));
+
+ Draggable draggable = draggableDecoderContextCallback.getDraggable();
+ if (draggable != null) {
+ if (draggableDecoderContextCallback.isValid()) {
+ DropEvent dropEvent = new DropEvent(component);
+ dropEvent.setDraggableSource(draggable);
+ dropEvent.setDragType(draggableDecoderContextCallback.getDragType());
+ dropEvent.setDragValue(draggableDecoderContextCallback.getDragValue());
+
+ dropEvent.queue();
+ } else {
+ String text = MessageFormat.format(
+ MISTYPED_DND_MESSAGE,
+ new Object[] {
+ MessageUtil.getLabel(context, component),
+ acceptedTypes,
+ draggableDecoderContextCallback.getDraggableLabel(),
+ draggableDecoderContextCallback.getDragType()});
+
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, text, text);
+
+ context.addMessage(component.getClientId(context), message);
+
+ context.renderResponse();
+ }
+ }
}
}
}
@@ -207,7 +282,7 @@
definition.addToBody("var options = ").addToBody(ScriptUtils.toScript(requestOpts)).addToBody(";");
definition.addToBody("options.parameters['" + DROP_TARGET_ID + "'] = '" + component.getClientId(context) + "';");
//TODO nick - remove as legacy
- definition.addToBody("Richfaces.mergeObjects(options.parameters, drag.getParameters());");
+ definition.addToBody("Object.extend(options.parameters, drag.getParameters());");
definition.addToBody("var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
17 years, 5 months
JBoss Rich Faces SVN: r11790 - trunk/ui/listShuttle/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-12-15 14:36:12 -0500 (Mon, 15 Dec 2008)
New Revision: 11790
Modified:
trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
https://jira.jboss.org/jira/browse/RF-2239
Modified: trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2008-12-15 19:36:08 UTC (rev 11789)
+++ trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2008-12-15 19:36:12 UTC (rev 11790)
@@ -185,8 +185,6 @@
<script type="text/javascript">
var clientId = '#{clientId}';
- RichShuttleUtils.execOnLoad(
- function(){
new Richfaces.ListShuttle(
new Richfaces.ListShuttle.Target(
'#{clientId}',
@@ -225,8 +223,6 @@
onblur:#{this:getAsEventHandler(context, component, "onblur")}
}
);
- },
- RichShuttleUtils.Condition.ElementPresent("#{clientId}"), 100);
</script>
</td>
</tr>
17 years, 5 months
JBoss Rich Faces SVN: r11789 - in trunk/ui/orderingList/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-12-15 14:36:08 -0500 (Mon, 15 Dec 2008)
New Revision: 11789
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js
trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
https://jira.jboss.org/jira/browse/RF-2239
Modified: trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
===================================================================
--- trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2008-12-15 19:35:06 UTC (rev 11788)
+++ trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2008-12-15 19:36:08 UTC (rev 11789)
@@ -5,6 +5,7 @@
this.contentDiv = this.contentTable.parentNode;
Event.observe(this.contentDiv, "scroll", this.scrollHandler.bindAsEventListener(this));
+
}
LayoutManager.SCROLL_WIDTH = 17;
Modified: trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
--- trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-12-15 19:35:06 UTC (rev 11788)
+++ trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-12-15 19:36:08 UTC (rev 11789)
@@ -77,7 +77,10 @@
}
}
//---
- this.layoutManager.widthSynchronization();
+ var synch = function() {this.layoutManager.widthSynchronization()}.bindAsEventListener(this);
+ RichShuttleUtils.execOnLoad(
+ synch, RichShuttleUtils.Condition.ElementPresent(this.container), 100
+ );
},
imageLoadListener: function (evt){
Modified: trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js
===================================================================
--- trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js 2008-12-15 19:35:06 UTC (rev 11788)
+++ trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js 2008-12-15 19:36:08 UTC (rev 11789)
@@ -16,9 +16,9 @@
}
};
RichShuttleUtils.Condition = {
- ElementPresent : function(element) {
+ ElementPresent : function(el) {
return function () {
- var el = $(element);
+ //var el = $(element);
return el && el.offsetHeight > 0;
};
}
@@ -32,4 +32,4 @@
} else {
this.splice(index, 1);
}
-}
\ No newline at end of file
+};
\ No newline at end of file
Modified: trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
--- trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2008-12-15 19:35:06 UTC (rev 11788)
+++ trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2008-12-15 19:36:08 UTC (rev 11789)
@@ -117,8 +117,7 @@
<f:clientId var="cId"/>
<script type="text/javascript">
- var clientId = '#{cId}';
- RichShuttleUtils.execOnLoad(function(){
+ var clientId = '#{cId}';
new Richfaces.OrderingList('#{cId}', '#{cId}internal_tab',
'#{cId}internal_header_tab', '#{cId}focusKeeper',
[['up', 'disup'], ['down', 'disdown'], ['last', 'dislast'], ['first','disfirst']],
@@ -131,8 +130,6 @@
Richfaces.OrderingListSelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)});
- }, RichShuttleUtils.Condition.ElementPresent("#{cId}"), 100);
- //setTimeout(init, 0);
</script>
</div>
</f:root>
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r11788 - trunk/ui/simpleTogglePanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-12-15 14:35:06 -0500 (Mon, 15 Dec 2008)
New Revision: 11788
Modified:
trunk/ui/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
Log:
fix switch test
Modified: trunk/ui/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2008-12-15 19:14:13 UTC (rev 11787)
+++ trunk/ui/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2008-12-15 19:35:06 UTC (rev 11788)
@@ -243,8 +243,8 @@
HtmlPage page = renderView();
//System.out.println(page.asXml());
- externalContext.addRequestParameterMap(stp1.getClientId(facesContext), "");
-
+ externalContext.addRequestParameterMap(stp1.getClientId(facesContext), "false");
+ stp1.setSwitchType(UISimpleTogglePanel.CLIENT_SWITCH_TYPE);
stp1.processDecodes(facesContext);
stp1.processValidators(facesContext);
stp1.processUpdates(facesContext);
17 years, 5 months
JBoss Rich Faces SVN: r11787 - in trunk/ui/simpleTogglePanel/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-12-15 14:14:13 -0500 (Mon, 15 Dec 2008)
New Revision: 11787
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:
https://jira.jboss.org/jira/browse/RF-5293
Modified: trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-12-15 17:15:11 UTC (rev 11786)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-12-15 19:14:13 UTC (rev 11787)
@@ -26,10 +26,13 @@
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
import org.ajax4jsf.component.AjaxActionComponent;
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.event.AjaxSource;
+import org.richfaces.event.SimpleToggleEvent;
/**
@@ -46,7 +49,7 @@
public static final boolean COLLAPSED = false;
public static final boolean EXPANDED = true;
- private transient Boolean openedSet = null;
+// private transient Boolean openedSet = null;
private transient Boolean wasOpened = null;
@@ -117,6 +120,14 @@
}
}
+ @Override
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if(event instanceof SimpleToggleEvent) {
+ SimpleToggleEvent simpleToggleEvent = (SimpleToggleEvent) event;
+ setOpened(simpleToggleEvent.isIsOpen());
+ }
+ super.broadcast(event);
+ }
/**
@@ -136,10 +147,10 @@
if (isWasOpened()) {
// Process all the facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = kids.next();
- kid.processValidators(context);
- }
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processValidators(context);
+ }
}
}
@@ -158,7 +169,7 @@
return;
}
- updateModel();
+// updateModel();
if (isWasOpened()) {
// Process all facets and children of this component
@@ -170,25 +181,22 @@
}
}
- private void updateModel () {
- if (openedSet != null) {
- setOpened(openedSet);
- }
- }
+// private void updateModel () {
+// if (openedSet != null) {
+// setOpened(openedSet);
+// }
+// }
+
+// public boolean isOpenedSet() {
+// return openedSet;
+// }
- /**
- * @return the openedSet
- */
- public boolean isOpenedSet() {
- return openedSet;
- }
-
- /**
- * @param openedSet the openedSet to set
- */
- public void setOpenedSet(boolean openedSet) {
- this.openedSet = openedSet;
- }
+// /**
+// * @param openedSet the openedSet to set
+// */
+// public void setOpenedSet(boolean openedSet) {
+// this.openedSet = openedSet;
+// }
/*
* public void setValueBinding(String arg0, ValueBinding arg1) { if
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-12-15 17:15:11 UTC (rev 11786)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2008-12-15 19:14:13 UTC (rev 11787)
@@ -30,7 +30,6 @@
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseId;
import org.ajax4jsf.component.AjaxSupport;
import org.ajax4jsf.javascript.JSFunction;
@@ -43,22 +42,14 @@
//public class SimpleTogglePanelRenderer extends AjaxCommandLinkRenderer {
public class SimpleTogglePanelRenderer extends org.ajax4jsf.renderkit.HeaderResourcesRendererBase {
- //XXXX by nick - denis - seems there is a lot of code common to org.richfaces.renderkit.html.ToggleControlRenderer. Please commonize!
- //private InternetResource[] _scripts = {new PrototypeScript(), getResource("scripts/simpleTogglePanel.js") };
- final static String NONE = "none";
+ final static String NONE = "none";
final static String EMPTY = "";
protected Class getComponentClass() {
return UISimpleTogglePanel.class;
}
- //XXXX by nick - denis - move scripts to template
- //protected InternetResource[] getAdditionalScripts() {
- // return _scripts;
- //}
-
-
public boolean getRendersChildren() {
return true;
}
@@ -67,83 +58,87 @@
UIComponent component, String eventName) throws IOException {
RendererUtils.writeEventHandlerFunction(context, component, eventName);
}
-
+
+
public void doDecode(FacesContext context, UIComponent component) {
- super.doDecode(context, component);
+ super.doDecode(context, component);
+ ExternalContext exCtx = context.getExternalContext();
+ Map <String, String> rqMap = exCtx.getRequestParameterMap();
+ Object clnId = rqMap.get(component.getClientId(context));
+ UISimpleTogglePanel panel = (UISimpleTogglePanel) component;
- ExternalContext exCtx = context.getExternalContext();
+ if (clnId != null) {
+ // enqueue event here for this component or for component with Id
+ // taken fro forId attribute
- Map rqMap = exCtx.getRequestParameterMap();
- Object clnId = rqMap.get(component.getClientId(context));
- UISimpleTogglePanel panel = (UISimpleTogglePanel) component;
+ String switchType = panel.getSwitchType();
+ if (!(UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType))) {
- if (clnId != null) {
- // enqueue event here for this component or for component with Id
- // taken fro forId attribute
-
- String switchType = panel.getSwitchType();
- if (!(UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType))) {
+ // xxxx by nick - denis - use constants, please!
+ SimpleToggleEvent event;
+ if (panel.isOpened()) {
+ event = new SimpleToggleEvent(panel, UISimpleTogglePanel.COLLAPSED);
+ // panel.setOpened(UISimpleTogglePanel.COLLAPSED);
+ // panel.setOpenedSet(UISimpleTogglePanel.COLLAPSED);
+ } else {
+ event = new SimpleToggleEvent(panel, UISimpleTogglePanel.EXPANDED);
+ // xxxx by nick - denis - use constants, please!
+ // panel.setOpened(UISimpleTogglePanel.EXPANDED);
+ // panel.setOpenedSet(UISimpleTogglePanel.EXPANDED);
+ }
+ // if (panel.isImmediate()) {
+ // event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ // } else {
+ // event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ // }
+ event.queue();
- //xxxx by nick - denis - use constants, please!
- if ((panel.isOpened() == UISimpleTogglePanel.EXPANDED)) {
- //panel.setOpened(UISimpleTogglePanel.COLLAPSED);
- panel.setOpenedSet(UISimpleTogglePanel.COLLAPSED);
- } else {
- //xxxx by nick - denis - use constants, please!
- //panel.setOpened(UISimpleTogglePanel.EXPANDED);
- panel.setOpenedSet(UISimpleTogglePanel.EXPANDED);
- }
- SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
- if (panel.isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
- event.queue();
-
- } else {
- boolean submittedState = Boolean.parseBoolean((String) clnId);
- if (panel.isOpened() != submittedState){
- //panel.setAjaxSingle(false);
- SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
- if (panel.isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
- event.queue();
- }
- if (null == panel.getValueBinding("value"))
- panel.setOpened(submittedState);
- panel.setOpenedSet(submittedState);
- }
-
- // in case of "ajax" request and "ajax" switch mode of toggle panel
- // set the regions to be rendered (reRendered) after operating this "ajax" request
- if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
- // add toggle panel itself to rendered list of components
- AjaxRendererUtils.addRegionByName(context,
- panel,
- panel.getId());
- // add regions specified in the "reRender" attribute of toggle panel
- // to rendered list of components
- AjaxRendererUtils.addRegionsFromComponent(panel, context);
- }
+ } else {
+ boolean submittedState = Boolean.parseBoolean((String) clnId);
+ if (panel.isOpened() != submittedState) {
+ // panel.setAjaxSingle(false);
+ SimpleToggleEvent event = new SimpleToggleEvent(panel, submittedState);
+ // if (panel.isImmediate()) {
+ // event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ // } else {
+ // event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ // }
+ event.queue();
+ }
+// TODO: should we remove it ??
+ if (null == panel.getValueBinding("value"))
+ panel.setOpened(submittedState);
+ // panel.setOpenedSet(submittedState);
+ }
- }
- }
+ // in case of "ajax" request and "ajax" switch mode of toggle panel
+ // set the regions to be rendered (reRendered) after operating this
+ // "ajax" request
+ if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
+ // add toggle panel itself to rendered list of components
+ AjaxRendererUtils.addRegionByName(context, panel, panel.getId());
+ // add regions specified in the "reRender" attribute of toggle
+ // panel
+ // to rendered list of components
+ AjaxRendererUtils.addRegionsFromComponent(panel, context);
+ }
- public String getdivdisplay(FacesContext context, UIComponent component) {
+ }
+ }
- String Switch = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
- if (Switch == null || Switch.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
- {
- //xxxx by nick - denis - do not set "block" explicitly - that can break some elements, set "" for display. See Element.show() in prototype.js
- return "";
- }
- return "none";
+ public String getdivdisplay(FacesContext context, UIComponent component) {
+ UISimpleTogglePanel simpleTogglePanel = (UISimpleTogglePanel) component;
+ return simpleTogglePanel.isOpened() ? EMPTY : NONE;
+// String Switch = Boolean.toString(((UISimpleTogglePanel)
+// component).isOpened());
+// if (Switch == null || Switch.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
+// {
+// //xxxx by nick - denis - do not set "block" explicitly - that can break some elements, set "" for display. See Element.show() in prototype.js
+// return "";
+// }
+// return "none";
}
public String getOnClick(FacesContext context, UIComponent component) {
@@ -200,9 +195,7 @@
}
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
- // TODO Auto-generated method stub
UISimpleTogglePanel comp = (UISimpleTogglePanel) component;
- //xxxx by nick - denis - use constants, please!
if (!(((comp.getSwitchType() == null) || (comp.getSwitchType().equals(UISimpleTogglePanel.CLIENT_SWITCH_TYPE) != true)) && (comp.isOpened() == UISimpleTogglePanel.COLLAPSED)))
{
super.encodeChildren(context, component);
@@ -210,17 +203,23 @@
}
public String getSwitchOnStatus(FacesContext context, UIComponent component) {
- String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
- if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
- return EMPTY;
- else return NONE;
+ UISimpleTogglePanel simpleTogglePanel = (UISimpleTogglePanel) component;
+ return simpleTogglePanel.isOpened() ? EMPTY : NONE;
+// String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
+// if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
+// return EMPTY;
+// else return NONE;
}
public String getSwitchOffStatus(FacesContext context, UIComponent component) {
- String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
- if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
- return NONE;
- else return EMPTY;
+ UISimpleTogglePanel simpleTogglePanel = (UISimpleTogglePanel) component;
+ return simpleTogglePanel.isOpened() ? NONE : EMPTY ;
+
+// String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
+// if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
+// return NONE;
+// else return EMPTY;
+
}
}
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r11786 - trunk/ui/editor/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-12-15 12:15:11 -0500 (Mon, 15 Dec 2008)
New Revision: 11786
Modified:
trunk/ui/editor/src/main/config/component/editor.xml
Log:
https://jira.jboss.org/jira/browse/RF-5042
Corrected description for tabindex
Modified: trunk/ui/editor/src/main/config/component/editor.xml
===================================================================
--- trunk/ui/editor/src/main/config/component/editor.xml 2008-12-15 17:12:32 UTC (rev 11785)
+++ trunk/ui/editor/src/main/config/component/editor.xml 2008-12-15 17:15:11 UTC (rev 11786)
@@ -110,7 +110,11 @@
<name>tabindex</name>
<classname>java.lang.String</classname>
<description>
- Attribute enables you to specify an element ID to focus, when the user pressed the tab key inside the editor. You can also use the special ":prev" and ":next" values. It will then places the focus on either the previous or next input element placed before/after the TinyMCE instance in the DOM.
+ In visual mode the attribute works the same way as "tab_focus" TinyMCE's property the attribute enables
+ you to specify an element ID to focus, when the TAB key is pressed .
+ You can also use the special ":prev" and ":next" values that will then place the focus on
+ an input element placed before/after the TinyMCE instance in the DOM.
+ While in "source" mode the attribute works like standard HTML tabindex attribute.
</description>
</property>
<property>
17 years, 5 months
JBoss Rich Faces SVN: r11785 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-12-15 12:12:32 -0500 (Mon, 15 Dec 2008)
New Revision: 11785
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/layoutTests.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5350
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/layoutTests.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-15 16:26:35 UTC (rev 11784)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-15 17:12:32 UTC (rev 11785)
@@ -1316,11 +1316,37 @@
initIds(getParentId());
writeStatus("Check 'inputSize' attribute");
- String inputSizeCalendarInputId = calendarId + "InputSizeInputDate";
- String size = selenium.getAttribute(inputSizeCalendarInputId + "@size");
+ check(showPopupId, true);
+
+ String size = selenium.getAttribute(inputDateId + "@size");
Assert.assertEquals(size, "15", "Input size attribute is not applied");
}
+ @Test
+ public void testCellWidthAndCellHeightAttributes(Template template) {
+ renderPage(LAYOUT_TESTS_URL, template, null);
+ initIds(getParentId());
+
+ int expectedCellWidth = 31;
+ int expectedCellHeight = 33;
+
+ writeStatus("Check 'cellWidth' and 'cellHeight' attributes.");
+
+ writeStatus("Non-popup mode");
+ check(showPopupId, false);
+
+ writeStatus("Check size of arbitrary cell. Width must be 31px, height must be 33px");
+ Assert.assertEquals(selenium.getElementHeight(calendarId + "DayCell5").intValue(), expectedCellHeight);
+ Assert.assertEquals(selenium.getElementWidth(calendarId + "DayCell5").intValue(), expectedCellWidth);
+
+ writeStatus("Check the same for popup mode");
+ check(showPopupId, true);
+ showPopup();
+
+ Assert.assertEquals(selenium.getElementHeight(calendarId + "DayCell5").intValue(), expectedCellHeight);
+ Assert.assertEquals(selenium.getElementWidth(calendarId + "DayCell5").intValue(), expectedCellWidth);
+ }
+
private void setPopup(boolean isPopup) {
runScript("$('" + isPopupId + "').checked=" + isPopup);
}
17 years, 5 months
JBoss Rich Faces SVN: r11784 - in trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces: testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-12-15 11:26:35 -0500 (Mon, 15 Dec 2008)
New Revision: 11784
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
Log:
RF-5229
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2008-12-15 16:21:07 UTC (rev 11783)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2008-12-15 16:26:35 UTC (rev 11784)
@@ -144,7 +144,23 @@
checkUpdateModel(false);
}
+
+ public void testAjaxSingle(boolean checkListener) {
+ reset();
+ setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
+ clickLoad();
+ setExtrenalValidationFailed();
+ base.sendAjax();
+
+ if (checkListener) {
+ checkActionListener(true);
+ }
+ checkUpdateModel(false);
+
+ }
+
+
/**
* Important! Override
* {@link SeleniumTestBase#setInternalValidationFailed()} method if you use
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-15 16:21:07 UTC (rev 11783)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-15 16:26:35 UTC (rev 11784)
@@ -402,6 +402,26 @@
}
@Test
+ public void testAjaxSingle(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ calendarId = tester.getClientId(AutoTester.COMPONENT_ID, template);
+ calendarHeaderId = calendarId + "Header";
+
+ tester.testAjaxSingle(false);
+ }
+
+ @Test
+ public void testProcessAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ calendarId = tester.getClientId(AutoTester.COMPONENT_ID, template);
+ calendarHeaderId = calendarId + "Header";
+
+ tester.testProcessAttribute();
+ }
+
+ @Test
public void testNULLModel(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
17 years, 5 months