You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/09/22 00:42:25 UTC
svn commit: r448722 - in /myfaces/tomahawk/trunk/core/src/main:
java/org/apache/myfaces/custom/datascroller/
resources/org/apache/myfaces/custom/datascroller/ tld/tomahawk-entities/
Author: mmarinschek
Date: Thu Sep 21 15:42:23 2006
New Revision: 448722
URL: http://svn.apache.org/viewvc?view=rev&rev=448722
Log:
fix for TOMAHAWK-443 : thanks to Michael Heinen for providing this patch
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTag.java
myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/datascroller/HtmlDataScroller.xml
myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_data_scroller_attributes.xml
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java?view=diff&rev=448722&r1=448721&r2=448722
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java Thu Sep 21 15:42:23 2006
@@ -32,6 +32,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.component.html.ext.HtmlPanelGroup;
+import org.apache.myfaces.shared_tomahawk.util._ComponentUtils;
/**
* A component which works together with a UIData component to allow a
@@ -505,6 +506,8 @@
private String _paginatorActiveColumnStyle = null;
private Boolean _renderFacetsIfSinglePage = null;
private Boolean _immediate;
+ private String _onclick;
+ private String _ondblclick;
public static final String FACET_FIRST = "first".intern();
public static final String FACET_PREVIOUS = "previous".intern();
@@ -788,9 +791,43 @@
return v != null ? v.booleanValue() : DEFAULT_IMMEDIATE;
}
+ public void setOnclick(String onclick)
+ {
+ _onclick = onclick;
+ }
+
+ public String getOnclick()
+ {
+ if(_onclick != null)
+ {
+ return _onclick;
+ } else
+ {
+ javax.faces.el.ValueBinding vb = getValueBinding("onclick");
+ return vb == null ? null : _ComponentUtils.getStringValue(getFacesContext(), vb);
+ }
+ }
+
+ public void setOndblclick(String ondblclick)
+ {
+ _ondblclick = ondblclick;
+ }
+
+ public String getOndblclick()
+ {
+ if(_ondblclick != null)
+ {
+ return _ondblclick;
+ } else
+ {
+ javax.faces.el.ValueBinding vb = getValueBinding("ondblclick");
+ return vb == null ? null : _ComponentUtils.getStringValue(getFacesContext(), vb);
+ }
+ }
+
public Object saveState(FacesContext context)
{
- Object values[] = new Object[23];
+ Object values[] = new Object[25];
values[0] = super.saveState(context);
values[1] = _for;
values[2] = _fastStep;
@@ -813,7 +850,9 @@
values[19] = _paginatorActiveColumnStyle;
values[20] = _renderFacetsIfSinglePage;
values[21] = _immediate;
- values[22] = saveAttachedState(context, _actionListener);
+ values[22] = _onclick;//mh
+ values[23] = _ondblclick;//mh
+ values[24] = saveAttachedState(context, _actionListener);
return values;
}
@@ -842,7 +881,9 @@
_paginatorActiveColumnStyle = (String) values[19];
_renderFacetsIfSinglePage = (Boolean) values[20];
_immediate = (Boolean) values[21];
- _actionListener = (MethodBinding)restoreAttachedState(context, values[22]);
+ _onclick = (String)values[22];
+ _ondblclick = (String)values[23];
+ _actionListener = (MethodBinding)restoreAttachedState(context, values[24]);
}
//------------------ GENERATED CODE END ---------------------------------------
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java?view=diff&rev=448722&r1=448721&r2=448722
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java Thu Sep 21 15:42:23 2006
@@ -282,7 +282,17 @@
protected void renderFacet(FacesContext facesContext, HtmlDataScroller scroller,
UIComponent facetComp, String facetName) throws IOException
{
- UIComponent link = getLink(facesContext, scroller, facetName);
+ String onclick = scroller.getOnclick();
+ String ondblclick = scroller.getOndblclick();
+
+ HtmlCommandLink link = getLink(facesContext, scroller, facetName);
+ if(onclick != null){
+ link.setOnclick(onclick);
+ }
+ if(ondblclick != null){
+ link.setOndblclick(ondblclick);
+ }
+
link.encodeBegin(facesContext);
facetComp.encodeBegin(facesContext);
if (facetComp.getRendersChildren())
@@ -345,6 +355,9 @@
writer.startElement("tr", scroller);
+ String onclick = scroller.getOnclick();
+ String ondblclick = scroller.getOndblclick();
+
for (int i = start, size = start + pages; i < size; i++)
{
int idx = i + 1;
@@ -371,6 +384,13 @@
}
HtmlCommandLink link = getLink(facesContext, scroller, Integer.toString(idx), idx);
+ if(onclick != null){
+ link.setOnclick(onclick);
+ }
+ if(ondblclick != null){
+ link.setOndblclick(ondblclick);
+ }
+
link.encodeBegin(facesContext);
link.encodeChildren(facesContext);
link.encodeEnd(facesContext);
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTag.java?view=diff&rev=448722&r1=448721&r2=448722
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTag.java Thu Sep 21 15:42:23 2006
@@ -73,8 +73,11 @@
private String _renderFacetsIfSinglePage;
private String _immediate;
+ private String _onclick;
+ private String _ondblclick;
private String _actionListener;
+
// User Role support
private String _enabledOnUserRole;
private String _visibleOnUserRole;
@@ -103,6 +106,8 @@
_enabledOnUserRole=null;
_visibleOnUserRole=null;
_immediate=null;
+ _onclick = null;
+ _ondblclick=null;
_actionListener=null;
}
@@ -142,6 +147,8 @@
setBooleanProperty(component, JSFAttr.IMMEDIATE_ATTR, _immediate);
setActionListenerProperty(component, _actionListener);
+ setStringProperty(component, "onclick", _onclick);
+ setStringProperty(component, "ondblclick", _ondblclick);
setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
@@ -263,4 +270,13 @@
{
_visibleOnUserRole = visibleOnUserRole;
}
+
+ public void setOnclick(String onclick) {
+ this._onclick = onclick;
+ }
+
+
+ public void setOndblclick(String ondblclick) {
+ this._ondblclick = ondblclick;
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/datascroller/HtmlDataScroller.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/datascroller/HtmlDataScroller.xml?view=diff&rev=448722&r1=448721&r2=448722
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/datascroller/HtmlDataScroller.xml (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/datascroller/HtmlDataScroller.xml Thu Sep 21 15:42:23 2006
@@ -77,4 +77,12 @@
<type>boolean</type>
<default-value>false</default-value>
</field>
+ <field>
+ <name>onclick</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ondblclick</name>
+ <type>String</type>
+ </field>
</component>
Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_data_scroller_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_data_scroller_attributes.xml?view=diff&rev=448722&r1=448721&r2=448722
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_data_scroller_attributes.xml (original)
+++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_data_scroller_attributes.xml Thu Sep 21 15:42:23 2006
@@ -176,3 +176,15 @@
<type>java.lang.String</type>
<description>MethodBinding pointing at method acception an ActionEvent with return type void.</description>
</attribute>
+ <attribute>
+ <name>onclick</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>HTML: Script to be invoked when the element is clicked.</description>
+ </attribute>
+ <attribute>
+ <name>ondblclick</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <description>HTML: Script to be invoked when the element is double-clicked.</description>
+ </attribute>