Author: nbelaevski
Date: 2007-09-02 21:12:17 -0400 (Sun, 02 Sep 2007)
New Revision: 2686
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/component/MediaOutputComponentBaseTest.java
Removed:
trunk/ui/drag-drop/src/main/java/org/richfaces/taglib/DropListenerTag.java
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates/componenttest.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm
trunk/framework/
trunk/samples/richfaces-ear-demo/ejb/
trunk/samples/richfaces-ear-demo/richfacesEAR/
trunk/samples/richfaces-ear-demo/webapp/
trunk/test-applications/
trunk/ui/core/src/main/config/component/actionParameter.xml
trunk/ui/core/src/main/config/component/commandButton.xml
trunk/ui/core/src/main/config/component/commandLink.xml
trunk/ui/core/src/main/config/component/form.xml
trunk/ui/core/src/main/config/component/function.xml
trunk/ui/core/src/main/config/component/include.xml
trunk/ui/core/src/main/config/component/loadBundle.xml
trunk/ui/core/src/main/config/component/loadScript.xml
trunk/ui/core/src/main/config/component/loadStyle.xml
trunk/ui/core/src/main/config/component/log.xml
trunk/ui/core/src/main/config/component/mediaOutput.xml
trunk/ui/core/src/main/config/component/outputPanel.xml
trunk/ui/core/src/main/config/component/page.xml
trunk/ui/core/src/main/config/component/poll.xml
trunk/ui/core/src/main/config/component/portlet.xml
trunk/ui/core/src/main/config/component/push.xml
trunk/ui/core/src/main/config/component/region.xml
trunk/ui/core/src/main/config/component/repeat.xml
trunk/ui/core/src/main/config/component/status.xml
Log:
generator: componenttest.vm - legacy renderView() to HtmlPage code removed
ui.core: test generation enabled & MediaOutputComponentBaseTest.java with test data
added
ui.drag-drop: extra DropListenerTag.java deleted
service file svn:ignored
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/componenttest.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/componenttest.vm 2007-09-02
23:44:02 UTC (rev 2685)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/componenttest.vm 2007-09-03
01:12:17 UTC (rev 2686)
@@ -12,8 +12,6 @@
import com.gargoylesoftware.htmlunit.Page;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.component.UIViewRoot;
@@ -91,13 +89,6 @@
assertEquals("${component.renderer.name}", component.getRendererType());
#end
-/*
- HtmlPage renderedView = renderView();
- assertNotNull(renderedView);
- System.out.println(renderedView.getWebResponse().getContentAsString());
- HtmlElement element = renderedView.getHtmlElementById(form.getId() + ":" +
component.getId());
- assertNotNull(element);
-*/
// values[0] = component.saveState(facesContext);
}
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm
===================================================================
---
trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm 2007-09-02
23:44:02 UTC (rev 2685)
+++
trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm 2007-09-03
01:12:17 UTC (rev 2686)
@@ -12,7 +12,6 @@
import com.gargoylesoftware.htmlunit.Page;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
@@ -94,13 +93,7 @@
#if(${component.renderer})
assertEquals("${component.renderer.name}", component.getRendererType());
#end
-/*
- HtmlPage renderedView = renderView();
- assertNotNull(renderedView);
- System.out.println(renderedView.getWebResponse().getContentAsString());
- HtmlElement element = renderedView.getHtmlElementById(form.getId() + ":" +
component.getId());
- assertNotNull(element);
-*/
+
// values[0] = component.saveState(facesContext);
}
Property changes on: trunk/framework
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/samples/richfaces-ear-demo/ejb
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/samples/richfaces-ear-demo/richfacesEAR
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/samples/richfaces-ear-demo/webapp
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/test-applications
___________________________________________________________________
Name: svn:ignore
+ target
Modified: trunk/ui/core/src/main/config/component/actionParameter.xml
===================================================================
--- trunk/ui/core/src/main/config/component/actionParameter.xml 2007-09-02 23:44:02 UTC
(rev 2685)
+++ trunk/ui/core/src/main/config/component/actionParameter.xml 2007-09-03 01:12:17 UTC
(rev 2686)
@@ -12,6 +12,7 @@
org.ajax4jsf.component.html.HtmlActionParameter
</classname>
<superclass>org.ajax4jsf.component.UIActionParameter</superclass>
+ <test />
<description>
<![CDATA[
A combination of the functionality of two JSF tags, <f:actionListener> and
<f:param>.
Modified: trunk/ui/core/src/main/config/component/commandButton.xml
===================================================================
--- trunk/ui/core/src/main/config/component/commandButton.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/commandButton.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -13,6 +13,7 @@
org.ajax4jsf.component.html.HtmlAjaxCommandButton
</classname>
<superclass>org.ajax4jsf.component.UIAjaxCommandButton</superclass>
+ <test />
<description><![CDATA[
Renders an HTML "input" element.
<br />
@@ -60,6 +61,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Ajax CommandButton</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/commandLink.xml
===================================================================
--- trunk/ui/core/src/main/config/component/commandLink.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/commandLink.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -13,6 +13,7 @@
org.ajax4jsf.component.html.HtmlAjaxCommandLink
</classname>
<superclass>org.ajax4jsf.component.UIAjaxCommandLink</superclass>
+ <test />
<description><![CDATA[
Renders an HTML "a" anchor element that acts like a form
submit button when clicked.
@@ -61,6 +62,7 @@
</superclass>
<displayname>Ajax commandLink</displayname>
<icon>icon</icon>
+ <test />
</tag>
<taghandler>
<classname>org.ajax4jsf.webapp.taglib.AjaxComponentHandler</classname>
Modified: trunk/ui/core/src/main/config/component/form.xml
===================================================================
--- trunk/ui/core/src/main/config/component/form.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/form.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>javax.faces.Form</family>
<classname>org.ajax4jsf.component.html.AjaxForm</classname>
<superclass>org.ajax4jsf.component.UIAjaxForm</superclass>
+ <test />
<description>
<![CDATA[
Ajax-related version of html form. Main difference with original component - all hidden
fields,
@@ -29,8 +30,10 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Ajax-related version of html form</displayname>
<icon>icon</icon>
+ <test />
</tag>
<taghandler>
<classname>org.ajax4jsf.webapp.taglib.AjaxComponentHandler</classname>
Modified: trunk/ui/core/src/main/config/component/function.xml
===================================================================
--- trunk/ui/core/src/main/config/component/function.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/function.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.components.AjaxFunction</family>
<classname>org.ajax4jsf.component.html.HtmlAjaxFunction</classname>
<superclass>org.ajax4jsf.component.UIAjaxFunction</superclass>
+ <test />
<description>
</description>
<displayname>Ajax JavaScript Function</displayname>
@@ -43,6 +44,7 @@
-->
<displayname>Ajax Function</displayname>
<icon>icon</icon>
+ <test />
</tag>
&ui_component_attributes;
&ui_command_attributes;
Modified: trunk/ui/core/src/main/config/component/include.xml
===================================================================
--- trunk/ui/core/src/main/config/component/include.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/include.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -11,6 +11,7 @@
<family>javax.faces.Output</family>
<classname>org.ajax4jsf.component.html.Include</classname>
<superclass>org.ajax4jsf.component.UIInclude</superclass>
+ <test />
<description>
<![CDATA[
include content of external view. Navigation cases in included file change only viewId
of included page,
@@ -29,6 +30,7 @@
org.ajax4jsf.taglib.html.jsp.HtmlIncludeTag
</classname>
<superclass>org.ajax4jsf.taglib.html.jsp.IncludeTag</superclass>
+ <test />
<displayname>include content of external view</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/loadBundle.xml
===================================================================
--- trunk/ui/core/src/main/config/component/loadBundle.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/loadBundle.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.Bundle</family>
<classname>org.ajax4jsf.component.html.AjaxLoadBundle</classname>
<superclass>org.ajax4jsf.component.UILoadBundle</superclass>
+ <test />
<description>
<![CDATA[ Load a resource bundle localized for the Locale of the current view, and
expose it (as a Map)
in the request attributes of the current request.
Modified: trunk/ui/core/src/main/config/component/loadScript.xml
===================================================================
--- trunk/ui/core/src/main/config/component/loadScript.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/loadScript.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -6,6 +6,7 @@
<family>org.ajax4jsf.LoadScript</family>
<classname>org.ajax4jsf.component.html.HtmlLoadScript</classname>
<superclass>org.ajax4jsf.component.UIResource</superclass>
+ <test />
<description>
<![CDATA[
]]>
@@ -20,6 +21,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
+ <test />
</tag>
<!--
<taghandler>
Modified: trunk/ui/core/src/main/config/component/loadStyle.xml
===================================================================
--- trunk/ui/core/src/main/config/component/loadStyle.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/loadStyle.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -6,6 +6,7 @@
<family>org.ajax4jsf.LoadStyle</family>
<classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>
<superclass>org.ajax4jsf.component.UIResource</superclass>
+ <test />
<description>
<![CDATA[
]]>
@@ -20,6 +21,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
+ <test />
</tag>
<!--
<taghandler>
Modified: trunk/ui/core/src/main/config/component/log.xml
===================================================================
--- trunk/ui/core/src/main/config/component/log.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/log.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.Log</family>
<classname>org.ajax4jsf.component.html.AjaxLog</classname>
<superclass>org.ajax4jsf.component.UIAjaxLog</superclass>
+ <test />
<description>
<![CDATA[
Encode javaScript to open popup window with client-side Log information.
@@ -26,6 +27,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>pop-up window with request log</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/mediaOutput.xml
===================================================================
--- trunk/ui/core/src/main/config/component/mediaOutput.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/mediaOutput.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -13,6 +13,11 @@
<superclass>
org.ajax4jsf.component.UIMediaOutput
</superclass>
+ <test>
+ <superclassname>
+ org.ajax4jsf.component.MediaOutputComponentBaseTest
+ </superclassname>
+ </test>
<description>
<![CDATA[Class for create any link-type elements to user-generated resources :
images, sounds, video, active objects, applets etc.
@@ -34,6 +39,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Link to user-generated resource</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/outputPanel.xml
===================================================================
--- trunk/ui/core/src/main/config/component/outputPanel.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/outputPanel.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -13,6 +13,7 @@
org.ajax4jsf.component.html.HtmlAjaxOutputPanel
</classname>
<superclass>org.ajax4jsf.component.UIAjaxOutputPanel</superclass>
+ <test />
<description>
<![CDATA[
Creates an AJAX-enabled part of the page. For a normal request,
@@ -48,6 +49,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Ajax OutputPanel</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/page.xml
===================================================================
--- trunk/ui/core/src/main/config/component/page.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/page.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.components.AjaxRegion</family>
<classname>org.ajax4jsf.component.html.HtmlPage</classname>
<superclass>org.ajax4jsf.component.UIAjaxRegion</superclass>
+ <test />
<description>
This component renders a full HTML page structure. It must
be the first (and only) child for the view root (JSP
@@ -56,6 +57,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
+ <test />
<displayname>Ajax Page</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/poll.xml
===================================================================
--- trunk/ui/core/src/main/config/component/poll.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/poll.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.components.AjaxPoll</family>
<classname>org.ajax4jsf.component.html.AjaxPoll</classname>
<superclass>org.ajax4jsf.component.UIPoll</superclass>
+ <test />
<description>
Periodically perform AJAX request to server, to simulate
'poll' data.
@@ -39,6 +40,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Ajax Poll</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/portlet.xml
===================================================================
--- trunk/ui/core/src/main/config/component/portlet.xml 2007-09-02 23:44:02 UTC (rev
2685)
+++ trunk/ui/core/src/main/config/component/portlet.xml 2007-09-03 01:12:17 UTC (rev
2686)
@@ -12,6 +12,7 @@
org.ajax4jsf.component.html.HtmlPortlet
</classname>
<superclass>org.ajax4jsf.component.UIPortlet</superclass>
+ <test />
<description>
<![CDATA[
]]>
Modified: trunk/ui/core/src/main/config/component/push.xml
===================================================================
--- trunk/ui/core/src/main/config/component/push.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/push.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.components.AjaxPush</family>
<classname>org.ajax4jsf.component.html.AjaxPush</classname>
<superclass>org.ajax4jsf.component.UIPush</superclass>
+ <test />
<description>
Periodically perform AJAX request to server, to simulate
'push' data.
@@ -39,6 +40,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Ajax Push</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/region.xml
===================================================================
--- trunk/ui/core/src/main/config/component/region.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/region.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>org.ajax4jsf.AjaxRegion</family>
<classname>org.ajax4jsf.component.html.HtmlAjaxRegion</classname>
<superclass>org.ajax4jsf.component.UIAjaxRegion</superclass>
+ <test />
<description>
<![CDATA[Root view for ajax areas on the page. It must either be a
nested tag inside the <body> tag inside of the
@@ -56,6 +57,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
+ <test />
<description>
<![CDATA[This tag defines a part of the JSF Tree that is to be decoded on the
server side during AJAX request processing]]>
Modified: trunk/ui/core/src/main/config/component/repeat.xml
===================================================================
--- trunk/ui/core/src/main/config/component/repeat.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/repeat.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>javax.faces.Data</family>
<classname>org.ajax4jsf.component.html.HtmlAjaxRepeat</classname>
<superclass>org.ajax4jsf.component.UIRepeat</superclass>
+ <test />
<description>
<![CDATA[
]]>
@@ -37,6 +38,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
<displayname>Ajax-enabled repeater</displayname>
<icon>icon</icon>
</tag>
Modified: trunk/ui/core/src/main/config/component/status.xml
===================================================================
--- trunk/ui/core/src/main/config/component/status.xml 2007-09-02 23:44:02 UTC (rev 2685)
+++ trunk/ui/core/src/main/config/component/status.xml 2007-09-03 01:12:17 UTC (rev 2686)
@@ -11,6 +11,7 @@
<family>javax.faces.Panel</family>
<classname>org.ajax4jsf.component.html.HtmlAjaxStatus</classname>
<superclass>org.ajax4jsf.component.UIAjaxStatus</superclass>
+ <test />
<description><![CDATA[
Renders area for indicating Ajax request status on the
client-side.
@@ -75,6 +76,7 @@
<superclass>
org.ajax4jsf.webapp.taglib.UIComponentTagBase
</superclass>
+ <test />
</tag>
&ui_panel_attributes;
&html_event_handler_attributes;
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/component/MediaOutputComponentBaseTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/MediaOutputComponentBaseTest.java
(rev 0)
+++
trunk/ui/core/src/test/java/org/ajax4jsf/component/MediaOutputComponentBaseTest.java 2007-09-03
01:12:17 UTC (rev 2686)
@@ -0,0 +1,71 @@
+/**
+ * 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.component;
+
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ *
+ * <br /><br />
+ *
+ * Created 03.09.2007
+ * @author Nick Belaevski
+ * @since 3.1
+ */
+
+public class MediaOutputComponentBaseTest extends
org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
+
+ public MediaOutputComponentBaseTest(String name) {
+ super(name);
+ }
+
+ protected Date createTestData_lastModified() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(Calendar.YEAR, 2007);
+ calendar.set(Calendar.MONTH, Calendar.SEPTEMBER);
+ calendar.set(Calendar.DATE, 3);
+ calendar.set(Calendar.HOUR, 22);
+ calendar.set(Calendar.MINUTE, 12);
+ calendar.set(Calendar.SECOND, 40);
+
+ return calendar.getTime();
+ }
+
+ protected Date createTestData_expires() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(Calendar.YEAR, 2007);
+ calendar.set(Calendar.MONTH, Calendar.SEPTEMBER);
+ calendar.set(Calendar.DATE, 8);
+ calendar.set(Calendar.HOUR, 11);
+ calendar.set(Calendar.MINUTE, 56);
+ calendar.set(Calendar.SECOND, 9);
+
+ return calendar.getTime();
+ }
+
+ public void testVoid() throws Exception {
+ //empty
+ }
+}
Deleted: trunk/ui/drag-drop/src/main/java/org/richfaces/taglib/DropListenerTag.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/taglib/DropListenerTag.java 2007-09-02
23:44:02 UTC (rev 2685)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/taglib/DropListenerTag.java 2007-09-03
01:12:17 UTC (rev 2686)
@@ -1,135 +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.taglib;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ReferenceSyntaxException;
-import javax.faces.el.ValueBinding;
-import javax.faces.webapp.UIComponentTag;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.Tag;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.richfaces.event.DropListener;
-import org.richfaces.event.DropListenerBinding;
-import org.richfaces.event.DropSource;
-
-
-/**
- * @author shura
- *
- * Custom tag for append AJAX request listeners to AjaxContainer.
- *
- */
-public class DropListenerTag extends TagSupport {
-
- /**
- *
- */
- private static final long serialVersionUID = 2576519366310474212L;
- /**
- * class name for ajax events listener.
- */
- private String type = null;
-
- private String binding = null;
-
- private String dragType = null;
-
- /**
- *
- */
- public DropListenerTag() {
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @param binding the binding to set
- */
- public void setBinding(String binding) {
- this.binding = binding;
- }
-
- /**
- * @param dragType the dragType to set
- */
- public void setDragType(String dragType) {
- this.dragType = dragType;
- }
-
- public int doStartTag() throws JspException {
- if (type == null && binding == null) {
- throw new JspException("dropListener tag must have one of 'type'
or 'binding' attribute");
- }
-
- //Find parent UIComponentTag
- UIComponentTag componentTag = UIComponentTag
- .getParentUIComponentTag(pageContext);
- if (componentTag == null) {
- throw new JspException(
- "Tag 'dropListener don't have any UIComponent provided
ancestor tag");
- }
-
- if (componentTag.getCreated()) {
- //Component was just created, so we add the Listener
- UIComponent component = componentTag.getComponentInstance();
- if (component instanceof DropSource) {
- DropListener listener;
- if(null != binding){
- ValueBinding valueBinding;
- try {
- valueBinding =
FacesContext.getCurrentInstance().getApplication().createValueBinding(binding);
- } catch (ReferenceSyntaxException e) {
- throw new JspException(e);
- }
- listener = new DropListenerBinding(valueBinding);
- } else {
- String className;
- if (UIComponentTag.isValueReference(type)) {
- FacesContext facesContext = FacesContext
- .getCurrentInstance();
- ValueBinding valueBinding = facesContext.getApplication()
- .createValueBinding(type);
- className = (String) valueBinding.getValue(facesContext);
- } else {
- className = type;
- }
- try {
- listener = (DropListener) Class.forName(className).newInstance();
- } catch (Exception e) {
- throw new JspException("Error for create instance of Drop listener
class "+ className, e);
- }
- }
- ((DropSource) component).addDropListener(listener);
- } else {
- throw new JspException("Parent component is not instance of
DropSource");
- }
- }
-
- return Tag.SKIP_BODY;
- }
-
-}