You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by al...@apache.org on 2010/07/31 00:37:34 UTC
svn commit: r980988 [2/8] - in /myfaces/gsoc/html5-comp-lib/trunk: ./
html5-comp-lib-core/ html5-comp-lib-core/src/ html5-comp-lib-core/src/main/
html5-comp-lib-core/src/main/java/
html5-comp-lib-core/src/main/java/META-INF/ html5-comp-lib-core/src/mai...
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputColor.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputColor.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputColor.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputColor.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.input;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ * Convenience component that targets HTML5 color input.
+ * <br/>
+ * Expects value to be set as defined in <a
+ * href="http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-simple-color">valid
+ * simple color definition</a>. A simple valid color is basically hex representation of the colors, likewise used in
+ * CSS. e.g: #FFAABB, #12ab3C.
+ * <br/>
+ * Extends the functionality of < h:inputText >.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:inputColor",
+ clazz = "org.apache.myfaces.html5.component.input.HtmlInputColor",
+ tagClass = "org.apache.myfaces.html5.tag.input.HtmlInputColorTag",
+ defaultRendererType = "org.apache.myfaces.html5.Color",
+ family = "javax.faces.Input",
+ type = "org.apache.myfaces.html5.HtmlInputColor",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder", //need to define it, or the events wont be rendered
+ defaultEventName="valueChange"
+ )
+public abstract class AbstractHtmlInputColor extends org.apache.myfaces.html5.component.input.Html5BaseInputText
+{
+
+ @JSFProperty(tagExcluded=true, defaultValue="false")
+ @Override
+ public boolean isReadonly()
+ {
+ //this attribute is not present in HTML5 color input
+ return false;
+ }
+
+ @JSFProperty(tagExcluded=true, defaultValue="Integer.MIN_VALUE")
+ @Override
+ public int getSize()
+ {
+ //this attribute is not present in HTML5 color input
+ return Integer.MIN_VALUE;
+ }
+
+ /**
+ * Text to be displayed to the user as an error message when input data is not a valid simple color during a
+ * postback. See <a
+ * href="http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-simple-color"
+ * >valid simple color definition</a>.
+ */
+ @JSFProperty
+ public abstract String getInvalidColorMessage();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputDateTime.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputDateTime.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputDateTime.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputDateTime.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.input;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ * Convenience component for Html5 date like inputs. <br/>
+ * Minimum and maximum date selectable is determined by using attached fx:validateDateTimeRange if any. Else, minimum
+ * and maximum are not rendered.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:inputDateTime",
+ clazz = "org.apache.myfaces.html5.component.input.HtmlInputDateTime",
+ tagClass = "org.apache.myfaces.html5.tag.input.HtmlInputDateTimeTag",
+ defaultRendererType = "org.apache.myfaces.html5.DateTime",
+ family = "javax.faces.Input",
+ type = "org.apache.myfaces.html5.HtmlDateTime",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder", //need to define it, or the events wont be rendered
+ defaultEventName="valueChange"
+ )
+public abstract class AbstractHtmlInputDateTime extends org.apache.myfaces.html5.component.input.Html5BaseInputText
+{
+
+ @JSFProperty(deferredValueType = "java.lang.String", defaultValue="datetime")
+ //TODO: doc
+ public abstract String getType();
+
+ /**
+ * Indicates the granularity of the value by limiting the allowed values. The limited values will be decided considering the
+ * step base which is defined by 'minimum' property of the attached fx:validateDateTimeRange. If not specified, 'any' will be
+ * rendered as the step value, thus browser will decide it.
+ * <br/>
+ * Specified value will be multiplied with the step scale factor which is different for each type.
+ * <br/>
+ * Information about the step for each type is:
+ *
+ * <table border="1">
+ * <tr>
+ * <th>type</th>
+ * <th>Description for step scale factor</th>
+ * <th>Default step value(what 'any' means)</th>
+ * <th>Applicable minimum value of step</th>
+ * <th>Applicable maximum value of step</th>
+ * <tr>
+ * <tr>
+ * <td>datetime</td>
+ * <td>Step should be expressed in seconds.</td>
+ * <td>1 minute</td>
+ * <td>0.01 (10 miliseconds)</td>
+ * <td>N/A</td> //TODO: test it again
+ * </tr>
+ * <tr>
+ * <td>date</td>
+ * <td>Step should be expressed in days.</td>
+ * <td>1 day</td>
+ * <td>1 (1 day)</td>
+ * <td>N/A</td> //TODO: test it again
+ * </tr>
+ * <tr>
+ * <td>time</td>
+ * <td>Step should be expressed in seconds. If the step is less than 1 second, browser should show the miliseconds input too.</td>
+ * <td>1 minute</td>
+ * <td>0.01 (10 miliseconds)</td>
+ * <td>N/A</td> //TODO: test it again
+ * </tr>
+ * <tr>
+ * <td>month</td>
+ * <td>Step should be expressed in months.</td>
+ * <td>1 month</td>
+ * <td>1 (1 month)</td>
+ * <td>N/A</td> //TODO: test it again
+ * </tr>
+ * <tr>
+ * <td>week</td>
+ * <td>Step should be expressed in weeks.</td>
+ * <td>1 week</td>
+ * <td>1 (1 week)</td>
+ * <td>N/A</td> //TODO: test it again
+ * </tr>
+ * <tr>
+ * <td>datetime-local</td>
+ * <td>Step should be expressed in seconds.</td>
+ * <td>1 minute</td>
+ * <td>0.01 (10 miliseconds)</td>
+ * <td>N/A</td> //TODO: test it again
+ * </tr>
+ * </table>
+ *
+ */
+ @JSFProperty(deferredValueType="java.lang.Double", defaultValue="Double.MIN_VALUE")
+ public abstract double getStep();
+
+
+ @JSFProperty(tagExcluded = true, defaultValue = "Integer.MIN_VALUE")
+ @Override
+ // this attribute is not present in HTML5 date like inputs, so exclude it
+ public int getMaxlength()
+ {
+ return Integer.MIN_VALUE;
+ }
+
+ @JSFProperty(tagExcluded = true, defaultValue = "Integer.MIN_VALUE")
+ @Override
+ // this attribute is not present in HTML5 date like inputs, so exclude it
+ public int getSize()
+ {
+ return Integer.MIN_VALUE;
+ }
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputEmail.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputEmail.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputEmail.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputEmail.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.input;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.html5.component.properties.PlaceHolderProperty;
+
+/**
+ * Convenience component that targets HTML5 email input.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:inputEmail",
+ clazz = "org.apache.myfaces.html5.component.HtmlInputEmail",
+ tagClass = "org.apache.myfaces.html5.tag.HtmlInputEmailTag",
+ defaultRendererType = "org.apache.myfaces.html5.Email",
+ family = "javax.faces.Input",
+ type = "org.apache.myfaces.html5.HtmlInputEmail",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
+ defaultEventName="valueChange")
+public abstract class AbstractHtmlInputEmail extends org.apache.myfaces.html5.component.input.Html5BaseInputText
+ implements PlaceHolderProperty
+{
+ /**
+ * This field defines the permission for multiple values for this input. Provided values must be separated with
+ * comma.
+ *
+ * @return
+ */
+ @JSFProperty(defaultValue = "false", deferredValueType = "java.lang.Boolean")
+ public abstract boolean isMultiple();
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSlider.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSlider.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSlider.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSlider.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.input;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ * Convenience component for Html5 input range. <br/>
+ * Minimum and maximum values for the component is rendered based on f:validateDoubleRange or f:validateLongRange if
+ * attached. If they are not attached, a default value of 0 is used for minimum and 100 is used for maximum.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:inputNumberSlider",
+ clazz = "org.apache.myfaces.html5.component.input.HtmlInputNumberSlider",
+ tagClass = "org.apache.myfaces.html5.tag.input.HtmlInputNumberSliderTag",
+ defaultRendererType = "org.apache.myfaces.html5.NumberSlider",
+ family = "javax.faces.Input",
+ type = "org.apache.myfaces.html5.HtmlNumberSlider",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder", //need to define it, or the events wont be rendered
+ defaultEventName="valueChange"
+ )
+public abstract class AbstractHtmlInputNumberSlider extends org.apache.myfaces.html5.component.input.Html5BaseInputText
+{
+
+ @JSFProperty(tagExcluded = true, defaultValue = "Integer.MIN_VALUE")
+ @Override
+ //not present in Html5 range input, so exclude it
+ public int getMaxlength()
+ {
+ return Integer.MIN_VALUE;
+ }
+
+ @JSFProperty(tagExcluded = true, defaultValue = "false")
+ @Override
+ //not present in Html5 range input, so exclude it
+ public boolean isReadonly()
+ {
+ return false;
+ }
+
+ @JSFProperty(tagExcluded = true, defaultValue = "Integer.MIN_VALUE")
+ @Override
+ //not present in Html5 range input, so exclude it
+ public int getSize()
+ {
+ return Integer.MIN_VALUE;
+ }
+
+ /**
+ * Gap between each segment. If both 'step' and 'segmentCount' is not defined, 'step' is default to (max-min)/(100).
+ */
+ @JSFProperty(deferredValueType="java.lang.Double", defaultValue="Double.MIN_VALUE")
+ public abstract double getStep();
+
+ /**
+ * Used to calculate step with minimum and maximum. Formula is: step ~= (max-min)/segmentCount.
+ * <br/>
+ * Defaults to 100, if step is not defined too. It is and error to define both 'step' and 'segmentCount'.
+ */
+ @JSFProperty(deferredValueType="java.lang.Integer", defaultValue="Integer.MIN_VALUE")
+ public abstract int getSegmentCount();
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSpinner.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSpinner.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSpinner.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputNumberSpinner.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.input;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ * Convenience component for Html5 number input. <br/>
+ * Just like hx:inputNumberSlider, minimum and maximum values for the component is rendered based on
+ * f:validateDoubleRange or f:validateLongRange if attached. If they are not attached, a default value of 0 is used for
+ * minimum and 100 is used for maximum.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:inputNumberSpinner",
+ clazz = "org.apache.myfaces.html5.component.input.HtmlInputNumberSpinner",
+ tagClass = "org.apache.myfaces.html5.tag.input.HtmlInputNumberSpinnerTag",
+ defaultRendererType = "org.apache.myfaces.html5.NumberSpinner",
+ family = "javax.faces.Input",
+ type = "org.apache.myfaces.html5.HtmlNumberSpinner",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder", //need to define it, or the events wont be rendered
+ defaultEventName="valueChange"
+ )
+public class AbstractHtmlInputNumberSpinner extends org.apache.myfaces.html5.component.input.HtmlInputNumberSlider
+{
+
+ @JSFProperty(defaultValue = "false", deferredValueType = "java.lang.Boolean")
+ @Override
+ public boolean isReadonly()
+ {
+ return false;
+ }
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputText.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputText.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputText.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/input/AbstractHtmlInputText.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.input;
+
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.html5.component.properties.PlaceHolderProperty;
+
+/**
+ * Extends standard inputText by new HTML5 capabilities.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:inputText",
+ clazz = "org.apache.myfaces.html5.component.input.HtmlInputText",
+ tagClass = "org.apache.myfaces.html5.tag.input.HtmlInputTextTag",
+ defaultRendererType = "org.apache.myfaces.html5.Text",
+ family = "javax.faces.Input",
+ type = "org.apache.myfaces.html5.HtmlInputText",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
+ defaultEventName="valueChange")
+public abstract class AbstractHtmlInputText extends org.apache.myfaces.html5.component.input.Html5BaseInputText implements ClientBehaviorHolder, PlaceHolderProperty
+{
+
+ public static final int ROWS_DEFAULT_VALUE = 1;
+
+ /**
+ * HTML type of the input.
+ * <br/>
+ * Possible values are "text"(default), "search", "url", "tel", "textarea" and "password".
+ * If this is set to "textarea", "pattern" property should not be set, and even if it is set, it is ignored.
+ * @see AbstractHtmlInputText#getPattern()
+ * @see AbstractHtmlInputText#getSuggestions()
+ * @see AbstractHtmlInputText#getList()
+ * @see AbstractHtmlInputText#getCols()
+ * @see AbstractHtmlInputText#getRows()
+ * @return
+ */
+ //default value not set with annotation because of some exceptional things
+ //default value is set manually in renderer
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getType();
+
+
+ /**
+ * Column count to set size, defaults to 10. Value of this property is used as size in "text", "search", "tel",
+ * "url" and "password" types. It is also used as cols in "textarea" type.
+ */
+ @JSFProperty(deferredValueType = "java.lang.Integer", defaultValue="10")
+ public abstract int getCols();
+
+
+ /**
+ * Number of rows to display, defaults to 1. Value of this property is used as rows in "textarea" type. It is
+ * ignored if the type is one of "text", "search", "tel", "url" and "password". If type is not set, and this
+ * property is set to a number larger than 1, type will be automatically set to "textarea".
+ */
+ @JSFProperty(defaultValue="ROWS_DEFAULT_VALUE", deferredValueType = "java.lang.Integer")
+ public abstract int getRows();
+
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractAudio.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractAudio.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractAudio.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractAudio.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.media;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+
+/**
+ * Component that represents HTML5 audio element.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:audio",
+ clazz = "org.apache.myfaces.html5.component.media.Audio",
+ tagClass = "org.apache.myfaces.html5.tag.media.AudioTag",
+ defaultRendererType = "org.apache.myfaces.html5.Audio",
+ family = "org.apache.myfaces.Media",
+ type = "org.apache.myfaces.html5.Audio",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
+ defaultEventName="play"
+ )
+public abstract class AbstractAudio extends org.apache.myfaces.html5.component.media.Media
+{
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractMedia.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractMedia.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractMedia.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractMedia.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.media;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.html5.component.properties.AccesskeyProperty;
+import org.apache.myfaces.html5.component.properties.GlobalEventProperties;
+import org.apache.myfaces.html5.component.properties.Html5GlobalProperties;
+import org.apache.myfaces.html5.component.properties.KeyEventProperties;
+import org.apache.myfaces.html5.component.properties.MediaEventProperties;
+import org.apache.myfaces.html5.component.properties.MouseEventProperties;
+import org.apache.myfaces.html5.component.properties.TabindexProperty;
+import org.apache.myfaces.html5.holder.MediaSourceHolder;
+import org.apache.myfaces.html5.model.MediaInfo;
+
+/**
+ * Base class for Video and Audio components.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ clazz = "org.apache.myfaces.html5.component.media.Media",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
+ defaultEventName="play",
+ configExcluded = true)
+public abstract class AbstractMedia extends javax.faces.component.html.HtmlOutputText implements MediaSourceHolder, Html5GlobalProperties,
+ AccesskeyProperty, TabindexProperty, MouseEventProperties, KeyEventProperties, MediaEventProperties,
+ GlobalEventProperties
+{
+ protected Set<MediaInfo> mediaInfoSet;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.html.HtmlOutputText#isEscape()
+ *
+ * This property is excluded since escape is meaningless on media elements.
+ */
+ @Override
+ @JSFProperty(tagExcluded = true)
+ public abstract boolean isEscape();
+
+ /**
+ * Returns the preloading behavior of the component. Default to null, which delegates preloading method selection to
+ * browser. Can be one of
+ * <ul>
+ * <li>"none": Do not preload the media from the server</li>
+ * <li>"metadata": Fetch metadata (length, quality, etc.)</li>
+ * <li>"auto": Load the data from the server, even if user have not choose to play it.</li>
+ * </ul>
+ *
+ * Browsers should use "metadata" preloading, if not specified.
+ *
+ */
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getPreload();
+
+ /**
+ * This property is to show/hide browser's media controls. If true, browser's media controls are shown (default). If
+ * false, controls are not shown and page author needs to provide controls explicitly.
+ */
+ @JSFProperty(deferredValueType = "java.lang.Boolean", defaultValue = "true")
+ public abstract boolean isShowControls();
+
+ /**
+ * If this property is set, media will seek back to start when it reaches the end.
+ *
+ * @return
+ */
+ @JSFProperty(deferredValueType = "java.lang.Boolean", defaultValue = "false")
+ public abstract boolean isLoop();
+
+ /**
+ * If this property is set, media will start playing as soon as the page loads.
+ *
+ * @return
+ */
+ @JSFProperty(deferredValueType = "java.lang.Boolean", defaultValue = "false")
+ public abstract boolean isAutoplay();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.myfaces.html5.component.holder.MediaSourceHolder#addMediaInfo(org.apache.myfaces.html5.model.MediaInfo
+ * )
+ */
+ public void addMediaInfo(MediaInfo... mediaInfo)
+ {
+ if (this.mediaInfoSet == null)
+ this.mediaInfoSet = new HashSet<MediaInfo>(5); // most likely, there wont be mediaInfo instances more than
+ // 5.
+
+ this.mediaInfoSet.addAll(Arrays.asList(mediaInfo));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.html5.component.holder.MediaSourceHolder#getMediaInfos()
+ */
+ public Set<MediaInfo> getMediaInfos()
+ {
+ return this.mediaInfoSet;
+ }
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractVideo.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractVideo.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractVideo.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/media/AbstractVideo.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.media;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ * Component that represents HTML5 video element.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:video",
+ clazz = "org.apache.myfaces.html5.component.media.Video",
+ tagClass = "org.apache.myfaces.html5.tag.media.VideoTag",
+ defaultRendererType = "org.apache.myfaces.html5.Video",
+ family = "org.apache.myfaces.Media",
+ type = "org.apache.myfaces.html5.Video",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
+ defaultEventName="play"
+ )
+public abstract class AbstractVideo extends org.apache.myfaces.html5.component.media.Media
+{
+
+ /**
+ * This property defines an image to show when no video data is available.
+ *
+ * @return
+ */
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getPoster();
+
+ /**
+ * Width of the video. Can be in pixels, or percent.
+ *
+ * @return
+ */
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getWidth();
+
+ /**
+ * Height of the video. Can be in pixels, or percent.
+ *
+ * @return
+ */
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getHeight();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/panel/AbstractDiv.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/panel/AbstractDiv.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/panel/AbstractDiv.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/panel/AbstractDiv.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.panel;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.html5.component.properties.AccesskeyProperty;
+import org.apache.myfaces.html5.component.properties.GlobalEventProperties;
+import org.apache.myfaces.html5.component.properties.Html5GlobalProperties;
+import org.apache.myfaces.html5.component.properties.KeyEventProperties;
+import org.apache.myfaces.html5.component.properties.MouseEventProperties;
+import org.apache.myfaces.html5.component.properties.TabindexProperty;
+
+/**
+ * Component that supports new functionality like Html5 DnD. <br/>
+ * The reason of having this component is, providing a way to use new functionality in old components. For example, to
+ * make a h:column of a h:dataTable draggable, the user can put a hx:div inside the h:column wrapping the column
+ * content; then putting a fx:dragSource in it.
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFComponent(
+ name = "hx:div",
+ clazz = "org.apache.myfaces.html5.component.panel.Div",
+ tagClass = "org.apache.myfaces.html5.tag.panel.DivTag",
+ defaultRendererType = "org.apache.myfaces.html5.Div",
+ family = "org.apache.myfaces.Div",
+ type = "org.apache.myfaces.html5.Div",
+ implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
+ defaultEventName="drop"
+)
+public abstract class AbstractDiv extends javax.faces.component.UIComponentBase implements
+ javax.faces.component.behavior.ClientBehaviorHolder, Html5GlobalProperties, AccesskeyProperty,
+ TabindexProperty, MouseEventProperties, KeyEventProperties, GlobalEventProperties
+{
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/AccesskeyProperty.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/AccesskeyProperty.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/AccesskeyProperty.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/AccesskeyProperty.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+//copy of MyFaces' javax.faces.component.html._AccesskeyProperty
+public interface AccesskeyProperty
+{
+ /**
+ * HTML: Sets the access key for this element.
+ *
+ */
+ @JSFProperty
+ public abstract String getAccesskey();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/GlobalEventProperties.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/GlobalEventProperties.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/GlobalEventProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/GlobalEventProperties.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface GlobalEventProperties
+{
+
+ /**
+ * HTML: Script to be invoked when the element is clicked.
+ *
+ */
+ @JSFProperty(clientEvent = "click")
+ public String getOnclick();
+
+ /**
+ * HTML: Script to be invoked when the element is double-clicked.
+ *
+ */
+ @JSFProperty(clientEvent = "dblclick")
+ public String getOndblclick();
+
+ /**
+ * HTML: Specifies a script to be invoked when the element loses focus.
+ *
+ */
+ @JSFProperty(clientEvent = "blur")
+ public String getOnblur();
+
+ /**
+ * HTML: Specifies a script to be invoked when the element receives focus.
+ *
+ */
+ @JSFProperty(clientEvent = "focus")
+ public String getOnfocus();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5GlobalProperties.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5GlobalProperties.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5GlobalProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5GlobalProperties.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.html5.component.api.Draggable;
+
+public interface Html5GlobalProperties extends Draggable //extends the Draggable to have a draggable attribute
+{
+
+ /* ********************** COMMON PROPS START HERE ******************** */
+
+ /**
+ * HTML: The direction of text display, either 'ltr' (left-to-right) or 'rtl' (right-to-left).
+ *
+ */
+ @JSFProperty
+ public abstract String getDir();
+
+ /**
+ * HTML: The base language of this document.
+ *
+ */
+ @JSFProperty
+ public abstract String getLang();
+
+ /**
+ * HTML: An advisory title for this element. Often used by the user agent as a tooltip.
+ *
+ */
+ @JSFProperty
+ public abstract String getTitle();
+
+ /**
+ * HTML: CSS styling instructions.
+ *
+ */
+ @JSFProperty
+ public abstract String getStyle();
+
+ /**
+ * The CSS class for this element. Corresponds to the HTML 'class' attribute.
+ *
+ */
+ @JSFProperty
+ public abstract String getStyleClass();
+
+ /* ********************** COMMON PROPS END HERE ******************** */
+
+ /* ********************** NEW HTML5 PROPS START HERE ******************** */
+
+ /**
+ * HTML: Whether the element is relevant.
+ */
+ @JSFProperty(defaultValue = "false")
+ public abstract boolean isHidden();
+
+ // ///DND PROPS
+
+ /**
+ * HTML: Specifies whether the element is draggable.
+ */
+ @JSFProperty(defaultValue = "false")
+ public abstract boolean isDraggable();
+
+ /**
+ * HTML: Handler for event that is fired when the element is dragged.
+ *
+ */
+ @JSFProperty(clientEvent = "drag")
+ public abstract String getOndrag();
+
+ /**
+ * HTML: Handler for event that is fired when the drag operation is ended. Successfully or not, this handler will
+ * run.
+ *
+ */
+ @JSFProperty(clientEvent = "dragend")
+ public abstract String getOndragend();
+
+ /**
+ * HTML: Handler for event that is fired when the element is dragged into a valid drop target.
+ *
+ */
+ @JSFProperty(clientEvent = "dragenter")
+ public abstract String getOndragenter();
+
+ /**
+ * HTML: Handler for event that is fired when the element leaves a valid drop target.
+ *
+ */
+ @JSFProperty(clientEvent = "dragleave")
+ public abstract String getOndragleave();
+
+ /**
+ * HTML: Handler for event that is fired when the element is being dragged over a valid drop target.
+ *
+ */
+ @JSFProperty(clientEvent = "dragover")
+ public abstract String getOndragover();
+
+ /**
+ * HTML: Handler for event that is fired when the drag operation starts.
+ *
+ */
+ @JSFProperty(clientEvent = "dragstart")
+ public abstract String getOndragstart();
+
+ /**
+ * HTML: Handler for event that is fired when the element is being dropped.
+ *
+ */
+ @JSFProperty(clientEvent = "drop")
+ public abstract String getOndrop();
+
+ // ///DND PROPS END
+
+ /**
+ * HTML: Script to be invoked when the pointing device is wheeled over this element.
+ *
+ */
+ @JSFProperty(clientEvent = "mousewheel")
+ public String getOnmousewheel();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5InputProperties.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5InputProperties.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5InputProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/Html5InputProperties.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface Html5InputProperties
+{
+ /**
+ * If this property is set to true, it will allow the user to just start typing without having to manually focus the
+ * main control when the page is loaded. Default to false.
+ *
+ */
+ @JSFProperty(defaultValue = "false", deferredValueType = "java.lang.Boolean")
+ public abstract boolean isAutoFocus();
+
+ /**
+ * Static(not Ajax) suggestion values. This attribute should not be defined if "list" is set.
+ *
+ * @see list property
+ */
+ @JSFProperty(deferredValueType = "java.lang.Object")
+ // since this property accepts both comma separated string and List<SelectItem>
+ public abstract Object getSuggestions();
+
+ /**
+ * Id of <hx:datalist> or HTML <datalist> for suggestions mechanism. By this way, suggestion options(datalist) can
+ * be shared across several input elements. If this attribute is set, other suggestion mechanisms(with
+ * f:selectItem(s) children or 'suggestions' attribute) should not be used
+ *
+ */
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getDataList();
+
+ /**
+ * HTML: Script to be invoked when the state of the owner form is changed.
+ *
+ */
+ @JSFProperty(clientEvent = "formchange")
+ public String getOnformchange();
+
+ /**
+ * HTML: Script to be invoked when the owner form gets user input.
+ *
+ */
+ @JSFProperty(clientEvent = "forminput")
+ public String getOnforminput();
+
+ /**
+ * HTML: Script to be invoked when the element gets user input.
+ *
+ */
+ @JSFProperty(clientEvent = "input")
+ public String getOninput();
+
+ /**
+ * HTML: Script to be invoked when the owner form is validated and this element could not pass the validation.
+ *
+ */
+ @JSFProperty(clientEvent = "invalid")
+ public String getOninvalid();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/KeyEventProperties.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/KeyEventProperties.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/KeyEventProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/KeyEventProperties.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface KeyEventProperties
+{
+
+ /**
+ * HTML: Script to be invoked when a key is pressed down over this element.
+ *
+ */
+ @JSFProperty(clientEvent = "keydown")
+ public String getOnkeydown();
+
+ /**
+ * HTML: Script to be invoked when a key is pressed over this element.
+ *
+ */
+ @JSFProperty(clientEvent = "keypress")
+ public String getOnkeypress();
+
+ /**
+ * HTML: Script to be invoked when a key is released over this element.
+ *
+ */
+ @JSFProperty(clientEvent = "keyup")
+ public String getOnkeyup();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MediaEventProperties.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MediaEventProperties.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MediaEventProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MediaEventProperties.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface MediaEventProperties
+{
+
+ /**
+ * HTML: Handler for event that is fired when the playback has stopped because the end of the media resource was
+ * reached.
+ *
+ */
+ @JSFProperty(clientEvent = "ended")
+ public abstract String getOnended();
+
+ /**
+ * HTML: Handler for event that is fired when an error occurs while fetching the media data.
+ *
+ */
+ @JSFProperty(clientEvent = "error")
+ public abstract String getOnerror();
+
+ /**
+ * HTML: Handler for event that is fired when browser can render the media data at the current playback position for
+ * the first time.
+ *
+ */
+ @JSFProperty(clientEvent = "loadeddata")
+ public abstract String getOnloadeddata();
+
+ /**
+ * HTML: Handler for event that is fired when browser has just determined the duration and dimensions of the media
+ * resource and the timed tracks are ready.
+ *
+ */
+ @JSFProperty(clientEvent = "loadedmetadata")
+ public abstract String getOnloadedmetadata();
+
+ /**
+ * HTML: Handler for event that is fired when browser begins looking for media data, as part of the resource
+ * selection algorithm.
+ *
+ */
+ @JSFProperty(clientEvent = "loadstart")
+ public abstract String getOnloadstart();
+
+ /**
+ * HTML: Handler for event that is fired when the playback has been paused. Fired after the pause() method has
+ * returned.
+ *
+ */
+ @JSFProperty(clientEvent = "pause")
+ public abstract String getOnpause();
+
+ /**
+ * HTML: Handler for event that is fired when the playback has begun. Fired after the play() method has returned, or
+ * when the autoplay attribute has caused playback to begin.
+ *
+ */
+ @JSFProperty(clientEvent = "play")
+ public abstract String getOnplay();
+
+ /**
+ * HTML: Handler for event that is fired when the playback has started.
+ *
+ */
+ @JSFProperty(clientEvent = "playing")
+ public abstract String getOnplaying();
+
+ /**
+ * HTML: Handler for event that is fired while browser is fetching media data.
+ *
+ */
+ @JSFProperty(clientEvent = "progress")
+ public abstract String getOnprogress();
+
+ /**
+ * HTML: Handler for event that is fired when a seek operation is finished.
+ *
+ */
+ @JSFProperty(clientEvent = "seeked")
+ public abstract String getOnseeked();
+
+ /**
+ * HTML: Handler for event that is fired if the seek operation is taking long enough that the browser has time to
+ * fire the event.
+ *
+ */
+ @JSFProperty(clientEvent = "seeking")
+ public abstract String getOnseeking();
+
+ /**
+ * HTML: Handler for event that is fired when either the volume attribute or the muted attribute has changed. Fired
+ * after the relevant attribute's setter has returned.
+ *
+ */
+ @JSFProperty(clientEvent = "volumechange")
+ public abstract String getOnvolumechange();
+
+ /**
+ * HTML: Handler for event that is fired when the playback has stopped because the next frame is not available, but
+ * the user agent expects that frame to become available in due course.
+ *
+ */
+ @JSFProperty(clientEvent = "waiting")
+ public abstract String getOnwaiting();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MouseEventProperties.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MouseEventProperties.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MouseEventProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MouseEventProperties.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface MouseEventProperties
+{
+
+ /**
+ * HTML: Script to be invoked when the element is clicked.
+ *
+ */
+ @JSFProperty(clientEvent = "click")
+ public String getOnclick();
+
+ /**
+ * HTML: Script to be invoked when the element is double-clicked.
+ *
+ */
+ @JSFProperty(clientEvent = "dblclick")
+ public String getOndblclick();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is pressed over this element.
+ *
+ */
+ @JSFProperty(clientEvent = "mousedown")
+ public String getOnmousedown();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moved while it is in this element.
+ *
+ */
+ @JSFProperty(clientEvent = "mousemove")
+ public String getOnmousemove();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moves out of this element.
+ *
+ */
+ @JSFProperty(clientEvent = "mouseout")
+ public String getOnmouseout();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moved into this element.
+ *
+ */
+ @JSFProperty(clientEvent = "mouseover")
+ public String getOnmouseover();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is released over this element.
+ *
+ */
+ @JSFProperty(clientEvent = "mouseup")
+ public String getOnmouseup();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is wheeled over this element.
+ *
+ */
+ // Redefinition of Html5GlobalProperties.getOnmousewheel.
+ // I had to do this, since myfaces-builder-plugin doesn't go 2 levels deep on interfaces
+ @JSFProperty(clientEvent = "mousewheel")
+ public String getOnmousewheel();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MultipleProperty.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MultipleProperty.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MultipleProperty.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/MultipleProperty.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface MultipleProperty
+{
+
+ /**
+ * This field defines the permission for multiple values for this input. Provided values must be separated with
+ * comma.
+ *
+ * @return
+ */
+ @JSFProperty(defaultValue = "false", deferredValueType = "java.lang.Boolean")
+ public abstract boolean isMultiple();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/PlaceHolderProperty.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/PlaceHolderProperty.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/PlaceHolderProperty.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/PlaceHolderProperty.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface PlaceHolderProperty
+{
+
+ /**
+ * Hint to show on the input, when nothing is typed.
+ */
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getPlaceHolder();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TabindexProperty.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TabindexProperty.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TabindexProperty.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TabindexProperty.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface TabindexProperty
+{
+
+ /**
+ * HTML: Specifies the position of this element within the tab order of the document.
+ *
+ */
+ @JSFProperty
+ public abstract String getTabindex();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropEvent.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropEvent.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropEvent.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropEvent.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.event;
+
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.BehaviorEvent;
+import javax.faces.event.FacesListener;
+
+import org.apache.myfaces.html5.behavior.DropTargetBehavior;
+
+//TODO: doc me
+public class DropEvent extends BehaviorEvent
+{
+ private static final long serialVersionUID = 1L;
+ private static final Logger log = Logger.getLogger(DropEvent.class.getName());
+
+ private final Map<String, String> _dropDataMap;
+ private final String _param;
+
+ //TODO: doc me
+ public DropEvent(UIComponent component, DropTargetBehavior behavior, Map<String, String> dropDataMap, String param)
+ {
+ super(component, behavior);
+ _dropDataMap = dropDataMap;
+ this._param = param;
+ }
+
+ @Override
+ public boolean isAppropriateListener(FacesListener faceslistener)
+ {
+ return faceslistener instanceof DropListener;
+ }
+
+ @Override
+ public void processListener(FacesListener faceslistener)
+ {
+ ((DropListener)faceslistener).processDropEvent(this);
+
+ }
+
+ //TODO: doc me
+ public Map<String, String> getDropDataMap()
+ {
+ return _dropDataMap;
+ }
+
+ //TODO: doc me
+ public String getParam()
+ {
+ return _param;
+ }
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropListener.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropListener.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropListener.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/event/DropListener.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.event;
+
+import java.util.logging.Logger;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.BehaviorListener;
+
+//TODO: doc me
+public class DropListener implements BehaviorListener
+{
+ private static final Logger log = Logger.getLogger(DropListener.class.getName());
+
+ private MethodExpression _expr;
+
+ public DropListener(MethodExpression expr)
+ {
+ _expr = expr;
+ }
+
+ public void processDropEvent(DropEvent event) throws AbortProcessingException
+ {
+ _expr.invoke(FacesContext.getCurrentInstance().getELContext(),
+ new Object[] { event });
+ }
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java?rev=980988&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/DragSourceBehaviorHandler.java Fri Jul 30 22:37:29 2010
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.html5.handler;
+
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.view.facelets.BehaviorConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagException;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.html5.behavior.DragSourceBehavior;
+import org.apache.myfaces.html5.component.api.Draggable;
+import org.apache.myfaces.html5.renderkit.util.ClientBehaviorEvents;
+import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
+
+/**
+ * Tag handler for {@link DragSourceBehavior}. Sets the "draggable" attribute of the parent and attaches the behavior to
+ * the parent. <br/>
+ *
+ * @author Ali Ok
+ *
+ */
+@JSFFaceletTag(name = "fx:dragSource")
+public class DragSourceBehaviorHandler extends javax.faces.view.facelets.BehaviorHandler
+{
+ private static final Logger log = Logger.getLogger(DragSourceBehaviorHandler.class.getName());
+
+ /**
+ * @see DragSourceBehavior#getAction()
+ */
+ @JSFFaceletAttribute(name = "action", className = "javax.el.ValueExpression", deferredValueType = "java.lang.String")
+ private final TagAttribute _action;
+
+ /**
+ * @see DragSourceBehavior#getDropTargetTypes()
+ */
+ @JSFFaceletAttribute(name = "dropTargetTypes", className = "javax.el.ValueExpression", deferredValueType = "java.lang.Object")
+ private final TagAttribute _dropTargetTypes;
+
+ /**
+ * @see DragSourceBehavior#getParam()
+ */
+ @JSFFaceletAttribute(name = "param", className = "javax.el.ValueExpression", deferredValueType = "java.lang.String")
+ private final TagAttribute _param;
+
+ public DragSourceBehaviorHandler(BehaviorConfig config)
+ {
+ super(config);
+ _action = getAttribute("action");
+ _dropTargetTypes = getAttribute("dropTargetTypes");
+ _param = getAttribute("param");
+ }
+
+ @Override
+ public void apply(FaceletContext faceletContext, UIComponent parent)
+ {
+
+ if (!ComponentHandler.isNew(parent))
+ {
+ if (log.isLoggable(Level.FINE))
+ log.fine("Component " + RendererUtils.getPathToComponent(parent)
+ + " is not new, thus return without any operation.");
+
+ return;
+ }
+
+ if (parent instanceof ClientBehaviorHolder)
+ {
+ ClientBehaviorHolder holder = _getClientBehaviorHolder(parent);
+
+ FacesContext context = faceletContext.getFacesContext();
+ Application app = context.getApplication();
+ String behaviorId = getBehaviorId();
+ Behavior behavior = app.createBehavior(behaviorId);
+
+ if (!(behavior instanceof DragSourceBehavior))
+ {
+ throw new FacesException("Behavior is not a DragSourceBehavior");
+ }
+
+ // manually added all of the properties, so no need for this:
+ // setAttributes(faceletContext, behavior);
+
+ // set parent as draggable
+ if (parent instanceof Draggable)
+ {
+ ((Draggable) parent).setDraggable(true);
+ }
+ else
+ {
+ if (log.isLoggable(Level.WARNING))
+ log.warning("Parent " + RendererUtils.getPathToComponent(parent)
+ + " does not implement Draggable interface, thus unable to set the draggable attribute. "
+ + "Renderer of the parent must handle the decision of being draggable manually.");
+ }
+
+ DragSourceBehavior dragSourceBehavior = (DragSourceBehavior) behavior;
+
+ // evaluating the _param's value expression doesn't this work if I put the dragSource in a datatable and try
+ // to set the valueexpression using the var of table.
+ // XXX: see https://issues.apache.org/jira/browse/MYFACES-2616
+ // see the thread http://www.mail-archive.com/dev@myfaces.apache.org/msg46764.html
+ // thus need to pass the valuexpression to the behavior, then the renderer can evaluate it. AjaxBehavior
+ // does this with a map.
+ // using the same approach in DropTargetBehavior too...
+ if (_action != null)
+ {
+ if (_action.isLiteral())
+ {
+ dragSourceBehavior.setAction(_action.getValue(faceletContext));
+ }
+ else
+ {
+ dragSourceBehavior.setValueExpression("action", _action.getValueExpression(faceletContext,
+ String.class));
+ }
+
+ }
+ if (_dropTargetTypes != null)
+ {
+ if (_action.isLiteral())
+ {
+ dragSourceBehavior.setDropTargetTypes(_dropTargetTypes.getObject(faceletContext));
+ }
+ else
+ {
+ dragSourceBehavior.setValueExpression("dropTargetTypes", _dropTargetTypes.getValueExpression(
+ faceletContext, Object.class));
+ }
+ }
+ if (_param != null)
+ {
+ if (_param.isLiteral())
+ {
+ dragSourceBehavior.setParam(_param.getValue(faceletContext));
+ }
+ else
+ {
+ dragSourceBehavior.setValueExpression("param", _param.getValueExpression(faceletContext,
+ String.class));
+ }
+
+ }
+
+ holder.addClientBehavior(ClientBehaviorEvents.DRAGSTART_EVENT, dragSourceBehavior);
+ }
+ else
+ {
+ if (log.isLoggable(Level.WARNING))
+ log.warning("Parent is not a ClientBehaviorHolder.");
+
+ }
+ }
+
+ private ClientBehaviorHolder _getClientBehaviorHolder(UIComponent parent)
+ {
+ if (!(parent instanceof ClientBehaviorHolder))
+ {
+ throw new TagException(getTag(),
+ "DragSourceBehavior must be attached to a ClientBehaviorHolder parent. Component "
+ + RendererUtils.getPathToComponent(parent) + "is not a ClientBehaviorHolder.");
+ }
+
+ ClientBehaviorHolder holder = (ClientBehaviorHolder) parent;
+
+ _checkEvent(holder, ClientBehaviorEvents.DRAGSTART_EVENT);
+
+ return holder;
+ }
+
+ private void _checkEvent(ClientBehaviorHolder holder, String eventName)
+ {
+ Collection<String> eventNames = holder.getEventNames();
+
+ if (!eventNames.contains(eventName))
+ {
+ StringBuilder message = new StringBuilder();
+ message.append("Unable to attach DragSourceBehavior. ");
+ message.append("DragSourceBehavior may only be attached to ");
+ message.append("ClientBehaviorHolders that support the '");
+ message.append(eventName);
+ message.append("' event. The parent ClientBehaviorHolder "
+ + RendererUtils.getPathToComponent((UIComponent) holder) + " only ");
+ message.append("supports the following events: ");
+
+ for (String supportedEventName : eventNames)
+ {
+ message.append(supportedEventName);
+ message.append(" ");
+ }
+
+ throw new TagException(getTag(), message.toString());
+ }
+ }
+
+}