JBoss Rich Faces SVN: r7578 - trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-02 08:53:55 -0400 (Wed, 02 Apr 2008)
New Revision: 7578
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
RF-2935
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-04-02 12:44:05 UTC (rev 7577)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-04-02 12:53:55 UTC (rev 7578)
@@ -106,6 +106,8 @@
if (_MULTIPART_REQUEST_CLASS_NAME.equals(requestClazz.getName())
|| "org.jboss.seam.web.MultipartRequest".equals(requestClazz
+ .getName())
+ ||"org.apache.myfaces.webapp.filter.MultipartRequestWrapper".equals(requestClazz
.getName())) {
HttpSession session = (HttpSession) context.getExternalContext()
17 years, 5 months
JBoss Rich Faces SVN: r7577 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-04-02 08:44:05 -0400 (Wed, 02 Apr 2008)
New Revision: 7577
Added:
trunk/docs/userguide/en/src/main/resources/images/inplaceInputChanged.png
Log:
http://jira.jboss.com/jira/browse/RF-1226
Images were improved
Added: trunk/docs/userguide/en/src/main/resources/images/inplaceInputChanged.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inplaceInputChanged.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months
JBoss Rich Faces SVN: r7576 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-04-02 08:43:55 -0400 (Wed, 02 Apr 2008)
New Revision: 7576
Added:
trunk/docs/userguide/en/src/main/resources/images/inplaceInput_init.png
Log:
http://jira.jboss.com/jira/browse/RF-1226
Images were improved
Added: trunk/docs/userguide/en/src/main/resources/images/inplaceInput_init.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inplaceInput_init.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months
JBoss Rich Faces SVN: r7575 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-04-02 08:43:39 -0400 (Wed, 02 Apr 2008)
New Revision: 7575
Added:
trunk/docs/userguide/en/src/main/resources/images/inplaceInputEdit.png
Log:
http://jira.jboss.com/jira/browse/RF-1226
Images were improved
Added: trunk/docs/userguide/en/src/main/resources/images/inplaceInputEdit.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inplaceInputEdit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months
JBoss Rich Faces SVN: r7574 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-04-02 08:43:28 -0400 (Wed, 02 Apr 2008)
New Revision: 7574
Added:
trunk/docs/userguide/en/src/main/resources/images/inplaceInputView.png
Modified:
trunk/docs/userguide/en/src/main/resources/images/inplaceInputMyClass.png
trunk/docs/userguide/en/src/main/resources/images/inplaceInputRich-inplace-field.png
trunk/docs/userguide/en/src/main/resources/images/inplaceInputShowControls.png
trunk/docs/userguide/en/src/main/resources/images/inplaceInputShowControlsAlignLeft.png
trunk/docs/userguide/en/src/main/resources/images/inplaceInputShowControlsCustom.png
Log:
http://jira.jboss.com/jira/browse/RF-1226
Images were improved
Modified: trunk/docs/userguide/en/src/main/resources/images/inplaceInputMyClass.png
===================================================================
(Binary files differ)
Modified: trunk/docs/userguide/en/src/main/resources/images/inplaceInputRich-inplace-field.png
===================================================================
(Binary files differ)
Modified: trunk/docs/userguide/en/src/main/resources/images/inplaceInputShowControls.png
===================================================================
(Binary files differ)
Modified: trunk/docs/userguide/en/src/main/resources/images/inplaceInputShowControlsAlignLeft.png
===================================================================
(Binary files differ)
Modified: trunk/docs/userguide/en/src/main/resources/images/inplaceInputShowControlsCustom.png
===================================================================
(Binary files differ)
Added: trunk/docs/userguide/en/src/main/resources/images/inplaceInputView.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inplaceInputView.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months
JBoss Rich Faces SVN: r7573 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-04-02 08:42:55 -0400 (Wed, 02 Apr 2008)
New Revision: 7573
Modified:
trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.xml
Log:
http://jira.jboss.com/jira/browse/RF-1226
Images were improved
Modified: trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.desc.xml 2008-04-02 12:27:11 UTC (rev 7572)
+++ trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.desc.xml 2008-04-02 12:42:55 UTC (rev 7573)
@@ -15,7 +15,7 @@
<title><emphasis role="bold"><property><rich:inplaceInput></property></emphasis> component</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/inplaceInput1.png"/>
+ <imagedata fileref="images/inplaceInput_init.png"/>
</imageobject>
</mediaobject>
</figure>
Modified: trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.xml 2008-04-02 12:27:11 UTC (rev 7572)
+++ trunk/docs/userguide/en/src/main/docbook/included/inplaceInput.xml 2008-04-02 12:42:55 UTC (rev 7573)
@@ -84,7 +84,7 @@
<title>View state</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/inplaceInputViewState_shadow.png"/>
+ <imagedata fileref="images/inplaceInputView.png"/>
</imageobject>
</mediaobject>
</figure>
@@ -95,7 +95,7 @@
<title>Edit state</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/inplaceInputEditState_shadow.png"/>
+ <imagedata fileref="images/inplaceInputEdit.png"/>
</imageobject>
</mediaobject>
</figure>
@@ -106,7 +106,7 @@
<title>Changed state</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/inplaceInputChangedState_shadow.png"/>
+ <imagedata fileref="images/inplaceInputChanged.png"/>
</imageobject>
</mediaobject>
</figure>
17 years, 5 months
JBoss Rich Faces SVN: r7572 - branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-04-02 08:27:11 -0400 (Wed, 02 Apr 2008)
New Revision: 7572
Modified:
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
http://jira.jboss.com/jira/browse/RF-2724
Modified: branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-04-02 11:22:13 UTC (rev 7571)
+++ branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-04-02 12:27:11 UTC (rev 7572)
@@ -335,54 +335,51 @@
}
},
- processAllFocusElements: function(root) {
+ processAllFocusElements: function(root, callback) {
if (root.focus &&
// Many not visible elements have focus method, we is had to avoid processing them.
- /^a|input|select|button|textarea$/i.test(root.tagName) &&
+ /^(?:a|input|select|button|textarea)$/i.test(root.tagName) &&
!root.disabled && !/^hidden$/.test(root.type) &&
- !/^none$/.test(root.style.display)) {
- this.execute(root);
+ Element.visible(root)) {
+
+ callback.call(this, root);
} else {
- if (root.id && root.id==this.cdiv)
- this.inModalPanel = true;
- var child = root.firstChild;
- while (child) {
- this.processAllFocusElements(child);
- child = child.nextSibling;
+ if (root != this.id) {
+ var child = root.firstChild;
+ while (child) {
+ if (!child.style || Element.visible(child)) {
+ this.processAllFocusElements(child, callback);
+ }
+ child = child.nextSibling;
+ }
}
- if (root.id && root.id==this.cdiv)
- this.inModalPanel = false;
}
},
processTabindexes: function(input) {
- if (!this.inModalPanel) {
- if (!this.firstOutside)
- this.firstOutside = input;
- this.lastOutside = input;
- if (input.tabIndex) {
- input.prevTabIndex = input.tabIndex;
- }
- input.tabIndex = undefined;
- if (input.accesskey) {
- input.prevAccesskey = input.accesskey;
- }
- input.accesskey = undefined;
+ if (!this.firstOutside && !(/^select$/i.test(input.tagName) && ModalPanel.disableSelects)) {
+ this.firstOutside = input;
}
+ this.lastOutside = input;
+ if (input.tabIndex) {
+ input.prevTabIndex = input.tabIndex;
+ }
+ input.tabIndex = undefined;
+ if (input.accesskey) {
+ input.prevAccesskey = input.accesskey;
+ }
+ input.accesskey = undefined;
},
restoreTabindexes: function(input) {
- if (!this.inModalPanel) {
- if (input.prevTabIndex)
- input.tabIndex = input.prevTabIndex;
- if (input.prevAccesskey)
- input.accesskey = input.prevAccesskey;
- }
+ if (input.prevTabIndex)
+ input.tabIndex = input.prevTabIndex;
+ if (input.prevAccesskey)
+ input.accesskey = input.prevAccesskey;
},
preventFocus: function() {
- this.execute = this.processTabindexes;
- this.processAllFocusElements(document);
+ this.processAllFocusElements(document, this.processTabindexes);
if (this.firstOutside) {
Event.observe(this.firstOutside, "focus", this.eventFirstOnfocus);
@@ -393,8 +390,7 @@
},
restoreFocus: function() {
- this.execute = this.restoreTabindexes;
- this.processAllFocusElements(document);
+ this.processAllFocusElements(document, this.restoreTabindexes);
if (this.firstOutside) {
Event.stopObserving(this.firstOutside, "focus", this.eventFirstOnfocus);
17 years, 5 months
JBoss Rich Faces SVN: r7571 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-02 07:22:13 -0400 (Wed, 02 Apr 2008)
New Revision: 7571
Modified:
trunk/docs/userguide/en/src/main/docbook/included/fileUpload.desc.xml
Log:
wrong key feature hide
Modified: trunk/docs/userguide/en/src/main/docbook/included/fileUpload.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/fileUpload.desc.xml 2008-04-02 11:21:46 UTC (rev 7570)
+++ trunk/docs/userguide/en/src/main/docbook/included/fileUpload.desc.xml 2008-04-02 11:22:13 UTC (rev 7571)
@@ -31,7 +31,6 @@
<listitem><para>Multiple files upload support</para></listitem>
<listitem><para>Possibility to cancel the request</para></listitem>
<listitem><para>One request for every upload component</para></listitem>
- <listitem><para>Different submit modes (Server/Client)</para></listitem>
<listitem><para>Asynchronous mode</para></listitem>
<listitem><para>Disablement support</para></listitem>
</itemizedlist>
17 years, 5 months
JBoss Rich Faces SVN: r7570 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-02 07:21:46 -0400 (Wed, 02 Apr 2008)
New Revision: 7570
Modified:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
Log:
http://jira.jboss.com/jira/browse/RF-2880 - attribute inputSize changed to width
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-04-02 11:02:30 UTC (rev 7569)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-04-02 11:21:46 UTC (rev 7570)
@@ -230,15 +230,11 @@
specify popup list sizes with values in pixels
</listitem>
<listitem>
- <emphasis><property> "inputSize"</property></emphasis> attribute customizes the size of input element with values in symbols as for standard input field.
+ <emphasis><property> "width"</property></emphasis> attribute customizes the size of input element with values in pixels.
</listitem>
</itemizedlist>
</para>
-
-
-
-
</section>
<section>
<title>JavaScript API</title>
17 years, 5 months
JBoss Rich Faces SVN: r7569 - in branches/3.1.x: ui/toolBar/src/main/config/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-04-02 07:02:30 -0400 (Wed, 02 Apr 2008)
New Revision: 7569
Modified:
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
branches/3.1.x/ui/toolBar/src/main/config/component/toolBar.xml
branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java
branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-2731
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-04-02 09:22:20 UTC (rev 7568)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-04-02 11:02:30 UTC (rev 7569)
@@ -350,7 +350,7 @@
}
public void encodePassThruWithExclusionsArray(FacesContext context,
- UIComponent component, String[] exclusions) throws IOException {
+ UIComponent component, Object[] exclusions) throws IOException {
ResponseWriter writer = context.getResponseWriter();
Map attributes = component.getAttributes();
Arrays.sort(exclusions);
Modified: branches/3.1.x/ui/toolBar/src/main/config/component/toolBar.xml
===================================================================
--- branches/3.1.x/ui/toolBar/src/main/config/component/toolBar.xml 2008-04-02 09:22:20 UTC (rev 7568)
+++ branches/3.1.x/ui/toolBar/src/main/config/component/toolBar.xml 2008-04-02 11:02:30 UTC (rev 7569)
@@ -89,7 +89,58 @@
</property>
&ui_component_attributes;
- &html_style_attributes;
+ &html_style_attributes;
+
+ <property>
+ <name>onitemkeydown</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a key is pressed down on an item</description>
+ </property>
+ <property>
+ <name>onitemkeypress</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a key is pressed and released on an item</description>
+ </property>
+ <property>
+ <name>onitemkeyup</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a key is released on an item</description>
+ </property>
+ <property>
+ <name>onitemclick</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a pointer button is clicked on an item</description>
+ </property>
+ <property>
+ <name>onitemdblclick</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a pointer button is double-clicked on an item</description>
+ </property>
+ <property>
+ <name>onitemmousedown</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+ </property>
+ <property>
+ <name>onitemmousemove</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a pointer is moved on an item</description>
+ </property>
+ <property>
+ <name>onitemmouseover</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a pointer is moved onto an item</description>
+ </property>
+ <property>
+ <name>onitemmouseout</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: a script expression; a pointer is moved away from an item</description>
+ </property>
+ <property>
+ <name>onitemmouseup</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: script expression; a pointer button is released on an item</description>
+ </property>
</component>
<component>
Modified: branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java
===================================================================
--- branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java 2008-04-02 09:22:20 UTC (rev 7568)
+++ branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java 2008-04-02 11:02:30 UTC (rev 7569)
@@ -26,20 +26,14 @@
import java.util.Iterator;
import java.util.List;
-import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.renderkit.RendererBase;
-
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIToolBarGroup;
-import org.richfaces.renderkit.html.images.DotSeparatorImage;
-import org.richfaces.renderkit.html.images.GridSeparatorImage;
-import org.richfaces.renderkit.html.images.LineSeparatorImage;
-import org.richfaces.renderkit.html.images.SquareSeparatorImage;
-public class ToolBarGroupRenderer extends RendererBase {
+public class ToolBarGroupRenderer extends ToolBarRendererBase {
protected Class getComponentClass() {
return UIToolBarGroup.class;
@@ -52,13 +46,24 @@
public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
UIToolBarGroup toolBarGroup = (UIToolBarGroup) component;
ResponseWriter writer = facesContext.getResponseWriter();
- String style = (String) toolBarGroup.getAttributes().get("style");
- String styleClass = (String) toolBarGroup.getAttributes().get("styleClass");
- if (null == styleClass) styleClass = "";
- String contentClass = (String) toolBarGroup.getToolBar().getAttributes().get("contentClass");
- if (null == contentClass) contentClass = "";
- String contentStyle = (String) toolBarGroup.getToolBar().getAttributes().get("contentStyle");
+ String styleClass = (String) toolBarGroup.getAttributes().get(HTML.STYLE_CLASS_ATTR);
+ String contentClass = (String) getParentToolBar(component).getAttributes().get("contentClass");
+ String style = (String) toolBarGroup.getAttributes().get(HTML.style_ATTRIBUTE);
+ String contentStyle = (String) getParentToolBar(component).getAttributes().get("contentStyle");
+ if (null == contentClass) {
+ contentClass = "";
+ }
+ if (null == styleClass) {
+ styleClass = "";
+ }
+ if (null == contentStyle) {
+ contentStyle = "";
+ }
+ if (null == style) {
+ style = "";
+ }
+
if (component.getChildCount() > 0) {
List children = component.getChildren();
for (Iterator iter = children.iterator(); iter.hasNext();) {
@@ -69,43 +74,16 @@
}
for (Iterator it = children.iterator(); it.hasNext();) {
UIComponent child = (UIComponent) it.next();
- writer.startElement("td", component);
- writer.writeAttribute("class", "dr-toolbar-int rich-toolbar-item " + contentClass +" "+styleClass, null);
- getUtils().writeAttribute(writer, "style", contentStyle);
- getUtils().writeAttribute(writer, "style", style);
- getUtils().encodePassThruWithExclusions(facesContext, component, "style,class");
+ writer.startElement(HTML.td_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-toolbar-int rich-toolbar-item " + contentClass + " " + styleClass, null);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, contentStyle + ";" + style);
+ encodeEventsAttributes(facesContext, toolBarGroup, writer);
renderChild(facesContext, child);
- writer.endElement("td");
+ writer.endElement(HTML.td_ELEM);
if (it.hasNext()) {
- insertSeparatorIfNeed(writer, facesContext, toolBarGroup);
- }
-
- }
- }
- }
-
- protected void insertSeparatorIfNeed(ResponseWriter writer,FacesContext context, UIToolBarGroup toolBarGroup) throws IOException {
- String itemSeparator = toolBarGroup.getItemSeparator();
- if (itemSeparator != null && itemSeparator.length()!=0 && ! itemSeparator.equalsIgnoreCase("none")){
- String uri = null;
- if (itemSeparator.equalsIgnoreCase("square")) {
- uri = getResource(SquareSeparatorImage.class.getName()).getUri(context, null);
- } else if (itemSeparator.equalsIgnoreCase("disc")) {
- uri = getResource(DotSeparatorImage.class.getName()).getUri(context, null);
- } else if (itemSeparator.equalsIgnoreCase("grid")) {
- uri = getResource(GridSeparatorImage.class.getName()).getUri(context, toolBarGroup);
- } else if (itemSeparator.equalsIgnoreCase("line")) {
- uri = getResource(LineSeparatorImage.class.getName()).getUri(context, toolBarGroup);
- } else throw new FacesException("Unknown type of separator - \""+itemSeparator+"\"");
- writer.startElement("td", toolBarGroup);
- getUtils().writeAttribute(writer, "class", toolBarGroup.getAttributes().get("separatorClass"));
- writer.writeAttribute("align", "center", null);
- writer.startElement("img", toolBarGroup);
- getUtils().writeAttribute(writer, "src", uri);
- getUtils().writeAttribute(writer, "alt", "");
- writer.endElement("img");
- writer.endElement("td");
+ insertSeparatorIfNeed(facesContext, toolBarGroup, writer);
}
}
-
+ }
+ }
}
Modified: branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
===================================================================
--- branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2008-04-02 09:22:20 UTC (rev 7568)
+++ branches/3.1.x/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2008-04-02 11:02:30 UTC (rev 7569)
@@ -23,9 +23,12 @@
import java.io.IOException;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
@@ -33,8 +36,10 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIToolBar;
import org.richfaces.component.UIToolBarGroup;
+import org.richfaces.component.util.ViewUtil;
import org.richfaces.renderkit.html.images.DotSeparatorImage;
import org.richfaces.renderkit.html.images.GridSeparatorImage;
import org.richfaces.renderkit.html.images.LineSeparatorImage;
@@ -42,7 +47,18 @@
public class ToolBarRendererBase extends HeaderResourcesRendererBase {
-
+ private final static String[] ON_ITEM_EVENTS = new String[] {
+ "onitemkeydown",
+ "onitemkeypress",
+ "onitemkeyup",
+ "onitemclick",
+ "onitemdblclick",
+ "onitemmousedown",
+ "onitemmousemove",
+ "onitemmouseover",
+ "onitemmouseout",
+ "onitemmouseup"
+ };
public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
UIToolBar toolBar = (UIToolBar) component;
@@ -77,13 +93,14 @@
writer.startElement("td", component);
writer.writeAttribute("class", "dr-toolbar-int rich-toolbar-item " + contentClass, null);
getUtils().writeAttribute(writer, "style", contentStyle);
+ encodeEventsAttributes(facesContext, child, writer);
}
renderChild(facesContext, child);
if (! (child instanceof UIToolBarGroup)) {
writer.endElement("td");
}
if (it.hasNext()) {
- insertSeparatorIfNeed(writer, facesContext, toolBar);
+ insertSeparatorIfNeed(facesContext, toolBar, writer);
}
}
@@ -98,34 +115,70 @@
UIComponent child = (UIComponent) it.next();
renderChild(facesContext, child);
if (it.hasNext()) {
- insertSeparatorIfNeed(writer, facesContext, toolBar);
+ insertSeparatorIfNeed(facesContext, toolBar, writer);
}
}
}
}
- protected void insertSeparatorIfNeed(ResponseWriter writer,FacesContext context, UIToolBar toolBar) throws IOException {
+ /**
+ * Inserts separator between toolbar items. Uses facet "itemSeparator" if it is set
+ * and default separator implementation if facet is not set.
+ * @param context - faces context
+ * @param component - component
+ * @param writer - response writer
+ * @throws IOException - in case of IOException during writing to the ResponseWriter
+ */
+ protected void insertSeparatorIfNeed(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
+ UIComponent separatorFacet = component.getFacet("itemSeparator");
+ boolean isSeparatorFacetRendered = (separatorFacet != null) ? separatorFacet.isRendered() : false;
+ if (isSeparatorFacetRendered) {
+ writer.startElement(HTML.td_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-toolbar-separator", null);
+ renderChild(context, separatorFacet);
+ writer.endElement(HTML.td_ELEM);
+ }
+ else {
+ insertDefaultSeparatorIfNeed(context, component, writer);
+ }
+ }
+
+ /**
+ * Inserts default separator. Possible values are:
+ * "square", "disc", "grid", "line" - for separators provided by component inplementation;
+ * "none" - for no separators between toolbar items;
+ * URI string value - for custom images specified by the page author.
+ *
+ * @param context - faces context
+ * @param component - component
+ * @param writer - response writer
+ * @throws IOException - in case of IOException during writing to the ResponseWriter
+ */
+ protected void insertDefaultSeparatorIfNeed(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- String itemSeparator = toolBar.getItemSeparator();
+ String itemSeparator = (String)component.getAttributes().get("itemSeparator");
if (itemSeparator != null && itemSeparator.length()!=0 && ! itemSeparator.equalsIgnoreCase("none")){
String uri = null;
if (itemSeparator.equalsIgnoreCase("square")) {
- uri = getResource(SquareSeparatorImage.class.getName()).getUri(context, null);
+ uri = getResource(SquareSeparatorImage.class.getName()).getUri(context, component);
} else if (itemSeparator.equalsIgnoreCase("disc")) {
- uri = getResource(DotSeparatorImage.class.getName()).getUri(context, null);
+ uri = getResource(DotSeparatorImage.class.getName()).getUri(context, component);
} else if (itemSeparator.equalsIgnoreCase("grid")) {
- uri = getResource(GridSeparatorImage.class.getName()).getUri(context, toolBar);
+ uri = getResource(GridSeparatorImage.class.getName()).getUri(context, component);
} else if (itemSeparator.equalsIgnoreCase("line")) {
- uri = getResource(LineSeparatorImage.class.getName()).getUri(context, toolBar);
- } else throw new FacesException("Unknown type of separator - \""+itemSeparator+"\"");
- writer.startElement("td", toolBar);
- writer.writeAttribute("align", "center", null);
- getUtils().writeAttribute(writer, "class", toolBar.getAttributes().get("separatorClass"));
- writer.startElement("img", toolBar);
- getUtils().writeAttribute(writer, "src", uri);
- getUtils().writeAttribute(writer, "alt", "");
- writer.endElement("img");
- writer.endElement("td");
+ uri = getResource(LineSeparatorImage.class.getName()).getUri(context, component);
+ } else {
+ // let the user specify URI to custom separator image in "itemSeparator" attribute
+ uri = ViewUtil.getResourceURL(itemSeparator);
+ }
+ writer.startElement(HTML.td_ELEM, component);
+ writer.writeAttribute(HTML.align_ATTRIBUTE, "center", null);
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, component.getAttributes().get("separatorClass"));
+ writer.startElement(HTML.IMG_ELEMENT, component);
+ getUtils().writeAttribute(writer, HTML.src_ATTRIBUTE, uri);
+ getUtils().writeAttribute(writer, HTML.alt_ATTRIBUTE, "");
+ writer.endElement(HTML.IMG_ELEMENT);
+ writer.endElement(HTML.td_ELEM);
}
}
@@ -136,5 +189,42 @@
public boolean getRendersChildren() {
return true;
}
+
+ protected void encodeEventsAttributes(FacesContext facesContext, UIComponent component, ResponseWriter writer)
+ throws IOException {
+ Map attributes = getParentToolBar(component).getAttributes();
+ Set encodedAttributes = new HashSet();
+
+ for (int i = 0; i < ON_ITEM_EVENTS.length; i++) {
+ Object value = attributes.get(ON_ITEM_EVENTS[i]);
+ if (null != value && !"".equals(value)) {
+ String eventName = ON_ITEM_EVENTS[i].replace("item", "");
+ encodedAttributes.add(eventName);
+ Object selfEvent = component.getAttributes().get(eventName);
+ if (null == selfEvent) {
+ selfEvent = "";
+ }
+ writer.writeAttribute(eventName, selfEvent + ";" + value, null);
+ }
+ }
+ encodedAttributes.add(HTML.class_ATTRIBUTE);
+ encodedAttributes.add(HTML.style_ATTRIBUTE);
+ getUtils().encodePassThruWithExclusionsArray(facesContext, component, encodedAttributes.toArray());
+ }
+ public UIToolBar getParentToolBar(UIComponent component) {
+ if (component instanceof UIToolBar) {
+ return (UIToolBar) component;
+ } else if (component instanceof UIToolBarGroup) {
+ return ((UIToolBarGroup)component).getToolBar();
+ } else {
+ UIComponent parent = component.getParent();
+ if (!(parent instanceof UIToolBar)) {
+ return null;
+ } else {
+ return (UIToolBar) parent;
+ }
+ }
+ }
+
}
17 years, 5 months