JBoss Rich Faces SVN: r19767 - trunk/bom.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-10-29 09:16:42 -0400 (Fri, 29 Oct 2010)
New Revision: 19767
Modified:
trunk/bom/pom.xml
Log:
RF-9518 RF BOM contains non-existent dependency javax.faces:jsf-api:2.0.0
Modified: trunk/bom/pom.xml
===================================================================
--- trunk/bom/pom.xml 2010-10-29 12:45:39 UTC (rev 19766)
+++ trunk/bom/pom.xml 2010-10-29 13:16:42 UTC (rev 19767)
@@ -122,11 +122,6 @@
</dependency>
<!-- JSF 2 -->
<dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>2.0.0</version>
- </dependency>
- <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
14 years, 2 months
JBoss Rich Faces SVN: r19766 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-10-29 08:45:39 -0400 (Fri, 29 Oct 2010)
New Revision: 19766
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java
Log:
* fixed phases logging to page
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java 2010-10-29 12:35:47 UTC (rev 19765)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java 2010-10-29 12:45:39 UTC (rev 19766)
@@ -47,20 +47,20 @@
* {@inheritDoc}
*/
public void afterPhase(PhaseEvent event) {
- logger.debug("AFTER - " + new Phase(event.getPhaseId()).toString());
+ logger.debug("AFTER - " + event.getPhaseId());
}
/**
* {@inheritDoc}
*/
public void beforePhase(PhaseEvent event) {
- logger.debug("BEFORE - " + new Phase(event.getPhaseId()).toString());
+ logger.debug("BEFORE - " + event.getPhaseId());
FacesContext ctx = event.getFacesContext();
ExpressionFactory factory = ctx.getApplication().getExpressionFactory();
ValueExpression exp = factory.createValueExpression(ctx.getELContext(), "#{phasesBean.phases}", List.class);
List<String> phases = (List<String>) exp.getValue(ctx.getELContext());
- phases.add(event.getPhaseId().toString());
+ phases.add(new Phase(event.getPhaseId()).toString());
}
/**
14 years, 2 months
JBoss Rich Faces SVN: r19764 - trunk/examples.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-29 08:34:39 -0400 (Fri, 29 Oct 2010)
New Revision: 19764
Added:
trunk/examples/calendar-demo/
Log:
moved from sandbox
Copied: trunk/examples/calendar-demo (from rev 19762, sandbox/trunk/examples/calendar-demo)
14 years, 2 months
JBoss Rich Faces SVN: r19763 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-10-29 08:15:37 -0400 (Fri, 29 Oct 2010)
New Revision: 19763
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
Log:
* method assertPhases changed so that it works in both Mojarra and Myfaces
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-10-29 11:58:56 UTC (rev 19762)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-10-29 12:15:37 UTC (rev 19763)
@@ -38,6 +38,7 @@
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.EventFiredCondition;
+import org.richfaces.tests.metamer.Phase;
import org.richfaces.tests.metamer.TemplatesList;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Templates;
@@ -224,7 +225,7 @@
phase = selenium.getText(jq("div#phasesPanel li:eq(" + i + ")"));
// check that it is really name of a phase
if (!phase.startsWith("* ")) {
- assertEquals(phase, phases[phaseNumber - 1].toString(), "Phase nr. " + phaseNumber);
+ assertEquals(phase, new Phase(phases[phaseNumber - 1]).toString(), "Phase nr. " + phaseNumber);
phaseNumber++;
}
}
14 years, 2 months
JBoss Rich Faces SVN: r19762 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-10-29 07:58:56 -0400 (Fri, 29 Oct 2010)
New Revision: 19762
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Phase.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java
Log:
* loggin phases rewritten to be more portable
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Phase.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Phase.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Phase.java 2010-10-29 11:58:56 UTC (rev 19762)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer;
+
+import javax.faces.event.PhaseId;
+
+/**
+ * Representation of a JSF lifecycle phase.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class Phase {
+
+ private String name;
+ private int ordinal;
+
+ public Phase(PhaseId phase) {
+ ordinal = phase.getOrdinal();
+
+ switch (phase.getOrdinal()) {
+ case 1:
+ name = "RESTORE_VIEW";
+ break;
+ case 2:
+ name = "APPLY_REQUEST_VALUES";
+ break;
+ case 3:
+ name = "PROCESS_VALIDATIONS";
+ break;
+ case 4:
+ name = "UPDATE_MODEL_VALUES";
+ break;
+ case 5:
+ name = "INVOKE_APPLICATION";
+ break;
+ case 6:
+ name = "RENDER_RESPONSE";
+ break;
+ default:
+ name = "UNKNOWN_PHASE";
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getOrdinal() {
+ return ordinal;
+ }
+
+ @Override
+ public String toString() {
+ return name + " " + ordinal;
+ }
+}
Property changes on: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Phase.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java 2010-10-29 11:57:39 UTC (rev 19761)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/RichPhaseListener.java 2010-10-29 11:58:56 UTC (rev 19762)
@@ -47,14 +47,14 @@
* {@inheritDoc}
*/
public void afterPhase(PhaseEvent event) {
- logger.debug("AFTER - " + event.getPhaseId());
+ logger.debug("AFTER - " + new Phase(event.getPhaseId()).toString());
}
/**
* {@inheritDoc}
*/
public void beforePhase(PhaseEvent event) {
- logger.debug("BEFORE - " + event.getPhaseId());
+ logger.debug("BEFORE - " + new Phase(event.getPhaseId()).toString());
FacesContext ctx = event.getFacesContext();
ExpressionFactory factory = ctx.getApplication().getExpressionFactory();
14 years, 2 months
JBoss Rich Faces SVN: r19761 - in trunk/examples/richfaces-showcase/src/main: resources/org/richfaces/demo/data/common and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-10-29 07:57:39 -0400 (Fri, 29 Oct 2010)
New Revision: 19761
Added:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/samples/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/samples/tooltip-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml
Removed:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/simpleAjax-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/simpleAjax.xhtml
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBean.java
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/cachedAjax-sample.xhtml
Log:
https://jira.jboss.org/browse/RF-9583
https://jira.jboss.org/browse/RF-9305
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBean.java 2010-10-29 11:48:42 UTC (rev 19760)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBean.java 2010-10-29 11:57:39 UTC (rev 19761)
@@ -33,7 +33,12 @@
public List<String> autocomplete(String prefix) {
ArrayList<String> result = new ArrayList<String>();
- if (prefix.length() > 0) {
+ if ((prefix == null) || (prefix.length() == 0)) {
+ for (int i = 0; i < 10; i++) {
+ result.add(capitals.get(i).getState());
+ }
+
+ } else {
Iterator<Capital> iterator = capitals.iterator();
while (iterator.hasNext()) {
Capital elem = ((Capital) iterator.next());
@@ -42,11 +47,8 @@
result.add(elem.getState());
}
}
- }else{
- for (int i = 0; i < 10; i++) {
- result.add(capitals.get(i).getState());
- }
}
+
return result;
}
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-10-29 11:48:42 UTC (rev 19760)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -386,6 +386,16 @@
</sample>
</samples>
</demo>
+ <demo new="true">
+ <id>tooltip</id>
+ <name>rich:tooltip</name>
+ <samples>
+ <sample>
+ <id>tooltip</id>
+ <name>Simple tooltips</name>
+ </sample>
+ </samples>
+ </demo>
</demos>
</group>
<group>
@@ -399,6 +409,10 @@
<id>cachedAjax</id>
<name>Autocomplete in Cached Ajax mode</name>
</sample>
+ <sample>
+ <id>clientFilter</id>
+ <name>Custom client filter</name>
+ </sample>
</samples>
</demo>
<!--demo>
Copied: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml (from rev 19750, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/simpleAjax.xhtml)
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <p>Except the server-side <b>"autocomplete"</b> method which could
+ be used to collect suggestion strings according to entered prefix, <b>rich:autocomplete</b>
+ allows to define similar method for filtering at client side. It should
+ be defined using <b>clientFilter</b> attribute which accepts custom
+ filter function name. Function should accepts two parameters <b>subString</b>
+ and <b>value</b> and return boolean value which means if the value
+ satisfies the substring passed. The function will be called for every
+ available suggestion in order to construct new list of suggestions.</p>
+ <p>This sample shows how to change the client filtering to
+ <b>"contains"</b> instead of <b>"startsWith"</b></p>
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/cachedAjax-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/cachedAjax-sample.xhtml 2010-10-29 11:48:42 UTC (rev 19760)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/cachedAjax-sample.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -7,26 +7,29 @@
xmlns:rich="http://richfaces.org/rich">
<p>Default autocomplete in cachedAjax mode</p>
<h:form>
- <rich:autocomplete mode="cachedAjax"
+ <rich:autocomplete mode="cachedAjax" minChars="0"
autocompleteMethod="#{autocompleteBean.autocomplete}" />
</h:form>
- <p>Autocomplete without direct suggestions to input(<b>autoFill="false"</b>). Also in the sample comma and space are input <b>tokens</b>, so separate
+ <p>Autocomplete without direct suggestions to input(<b>autoFill="false"</b>).
+ Also in the sample comma and space are input <b>tokens</b>, so separate
autocompletion requests will be fired for different parts in input</p>
<h:form>
- <rich:autocomplete mode="cachedAjax" tokens=", " autofill="false"
+ <rich:autocomplete mode="cachedAjax" tokens=", " minChars="0"
+ autofill="false"
autocompleteMethod="#{autocompleteBean.autocomplete}" />
</h:form>
- <p>In that sample <b>selectFirst</b> set to false so pressing enter will not choose the value from list
- but just submit currently entered value.</p>
+ <p>In that sample <b>selectFirst</b> set to false so pressing enter
+ will not choose the value from list but just submit currently entered
+ value.</p>
<h:form>
- <rich:autocomplete mode="cachedAjax" tokens=", " autoFill="false" selectFirst="false"
+ <rich:autocomplete mode="cachedAjax" tokens=", " minChars="0"
+ autoFill="false" selectFirst="false"
autocompleteMethod="#{autocompleteBean.autocomplete}" />
- </h:form>
- <fieldset>
- <legend><b>NOTE:</b> </legend>
- The developer has full control under filtering on server side according to prefix.
- But in client and cachedAjax modes - just built-in startWith method used. In near future
- the component will be updated with one more attribute which will allow the developer
- to define client side comparator function to customize that behavior.
- </fieldset>
-</ui:composition>
+ </h:form>
+ <fieldset><legend><b>NOTE:</b> </legend> The developer has
+ full control under filtering on server side according to prefix. But in
+ client and cachedAjax modes - just built-in startWith method used. In
+ near future the component will be updated with one more attribute which
+ will allow the developer to define client side comparator function to
+ customize that behavior.</fieldset>
+</ui:composition>
Copied: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml (from rev 19750, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/simpleAjax-sample.xhtml)
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <h:form>
+ <rich:autocomplete mode="client" minChars="0" autofill="false"
+ clientFilter="if(subString.length>=1) if(value.indexOf(subString)!=-1) return true;"
+ autocompleteMethod="#{autocompleteBean.autocomplete}" />
+ </h:form>
+</ui:composition>
\ No newline at end of file
Deleted: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/simpleAjax-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/simpleAjax-sample.xhtml 2010-10-29 11:48:42 UTC (rev 19760)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/simpleAjax-sample.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -1,25 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
- <style>
-.outhello {
- font-weight: bold;
-}
-</style>
- <h:form>
- <h:panelGrid columns="3">
- <h:outputText value="Name:" />
- <h:inputText value="#{userBean.name}" />
- <a4j:commandButton value="Say Hello" render="out" execute="@form" />
- </h:panelGrid>
- </h:form>
- <br />
- <a4j:outputPanel id="out">
- <h:outputText value="Hello #{userBean.name} !"
- rendered="#{not empty userBean.name}" styleClass="outhello" />
- </a4j:outputPanel>
-</ui:composition>
\ No newline at end of file
Deleted: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/simpleAjax.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/simpleAjax.xhtml 2010-10-29 11:48:42 UTC (rev 19760)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/simpleAjax.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -1,26 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets">
-
-<ui:composition>
- <p>Autocomplete component - simple Input component which provides suggestions during input.</p>
- <p>Could works using three modes:
- <ul>
- <li>Client - preloads data to the client side and makes suggestions according to entered prefix on the client</li>
- <li>Ajax - fetches the data on every input change using ajax requests</li>
- <li>Cached Ajax - loads data via ajax to make suggestions when the prefix length satisfies minchars attribute. Then all the suggestions done at client side except the case when initial prefix changed or token entered. Then loads data again.</li>
- </ul>
- </p>
- <p>There you could see simple client side autocomplete:</p>
- <ui:include src="#{demoNavigator.sampleIncludeURI}" />
- <ui:include src="/templates/includes/source-view.xhtml">
- <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
- <ui:param name="sourceType" value="xhtml" />
- <ui:param name="openLabel" value="View Source" />
- <ui:param name="hideLabel" value="Hide Source" />
- </ui:include>
-</ui:composition>
-
-</html>
\ No newline at end of file
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/samples/tooltip-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/samples/tooltip-sample.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/samples/tooltip-sample.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -0,0 +1,95 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <style>
+.tooltip {
+ background-color: #{richSkin.generalBackgroundColor};
+ border-width:3px;
+ padding:10px;
+}
+.tooltip-text {
+ width: 350px;
+ height: 80px;
+ cursor: arrow;
+ border-width: 2px;
+ text-align: center;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+.tooltipData {
+ font-weight: bold;
+}
+</style>
+
+ <h:panelGrid columns="2">
+ <rich:panel id="sample1" styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>Here you can see <b>default client-side</b> tool-tip</p>
+ <rich:tooltip target="sample1" id="tt1" label="123123231">
+ <span style="white-space: nowrap"> This tool-tip content was
+ <strong>pre-rendered</strong> to the page.<br />
+ The look of this tool-tip is 100% defined by skin. </span>
+ </rich:tooltip>
+ </rich:panel>
+ <rich:panel id="sample2" styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>This tool-tip will <b>follow mouse</b>. Also this tool-tip has
+ a <b>delay 0.5 sec</b>, so be patient!</p>
+ <rich:tooltip followMouse="true"
+ showDelay="500" styleClass="tooltip">
+ <span style="white-space: nowrap"> This tool-tip content also
+ <strong>pre-rendered</strong> to the page.<br />
+ However, the look of this tool-tip is customized<br />
+ by styleClass attribute. </span>
+ </rich:tooltip>
+ </rich:panel>
+ <h:form>
+ <rich:panel id="sample3" styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>This tool-tip rendered on server <b>in separate request</b>.
+ </p>
+ <rich:tooltip mode="ajax" styleClass="tooltip"
+ layout="block">
+ <f:facet name="defaultContent">
+ <strong>Wait...</strong>
+ </f:facet>
+ <span style="white-space: nowrap">This tool-tip content was
+ <strong>rendered on server</strong> </span>
+ <h:panelGrid columns="2">
+ <h:outputText style="white-space:nowrap"
+ value="tooltips requested:" />
+ <h:outputText value="#{tooltipData.tooltipCounter}"
+ styleClass="tooltipData" />
+ </h:panelGrid>
+ </rich:tooltip>
+ </rich:panel>
+ </h:form>
+ <h:form>
+ <rich:panel id="sample4" styleClass="tooltip-text"
+ bodyClass="rich-laguna-panel-no-header">
+ <p>This tool-tip will be <b>activated on mouse click</b>. It
+ also has a <b>bottom-left</b> position.</p>
+ <rich:tooltip showEvent="click"
+ mode="ajax" styleClass="tooltip" layout="block">
+ <f:facet name="defaultContent">
+ <strong>Wait...</strong>
+ </f:facet>
+ <span style="white-space: nowrap">This tool-tip content was
+ <strong>rendered on server</strong><br />
+ </span>
+ <h:panelGrid columns="2">
+ <h:outputText style="white-space:nowrap"
+ value="tooltips requested:" />
+ <h:outputText value="#{tooltipData.tooltipCounter}"
+ styleClass="tooltipData" />
+ </h:panelGrid>
+ </rich:tooltip>
+ </rich:panel>
+ </h:form>
+ </h:panelGrid>
+</ui:composition>
\ No newline at end of file
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tooltip/tooltip.xhtml 2010-10-29 11:57:39 UTC (rev 19761)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <p>DESC</p>
+
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file
14 years, 2 months
JBoss Rich Faces SVN: r19760 - in trunk/ui: calendar and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-29 07:48:42 -0400 (Fri, 29 Oct 2010)
New Revision: 19760
Added:
trunk/ui/calendar/
trunk/ui/calendar/api/pom.xml
trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java
trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java
trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java
trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java
trunk/ui/calendar/pom.xml
trunk/ui/calendar/ui/
trunk/ui/calendar/ui/pom.xml
trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java
Removed:
trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java
trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java
trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java
trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java
trunk/ui/calendar/pom.xml
trunk/ui/calendar/ui/
trunk/ui/calendar/ui/pom.xml
trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/events/
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java
Log:
moved from sandbox
Copied: trunk/ui/calendar (from rev 19724, sandbox/trunk/ui/calendar)
Copied: trunk/ui/calendar/api/pom.xml (from rev 19758, sandbox/trunk/ui/calendar/api/pom.xml)
===================================================================
--- trunk/ui/calendar/api/pom.xml (rev 0)
+++ trunk/ui/calendar/api/pom.xml 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.calendar</groupId>
+ <artifactId>richfaces-ui-calendar-api</artifactId>
+ <name>Richfaces UI Components: Calendar API</name>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- runtime -->
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.common</groupId>
+ <artifactId>richfaces-ui-common-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Deleted: trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java
===================================================================
--- sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java 2010-10-28 12:08:05 UTC (rev 19724)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,69 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.event;
-
-import java.util.Date;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-public class CurrentDateChangeEvent extends FacesEvent {
-
-
- private static final long serialVersionUID = -8169207286087810907L;
- private Date currentDate = null;
- private String currentDateString = null;
-
- @Deprecated
- public CurrentDateChangeEvent(UIComponent component, Date curentDate) {
- super(component);
- this.currentDate = curentDate;
-
- }
-
- public CurrentDateChangeEvent(UIComponent component, String curentDateString) {
- super(component);
- this.currentDateString = curentDateString;
- }
-
- public boolean isAppropriateListener(FacesListener listener) {
- return false;
- }
-
- public void processListener(FacesListener listener) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
- public Date getCurrentDate() {
- return currentDate;
- }
-
- public void setCurrentDate(Date currentDate) {
- this.currentDate = currentDate;
- }
-
- public String getCurrentDateString() {
- return currentDateString;
- }
-
-}
Copied: trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java (from rev 19756, sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java)
===================================================================
--- trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java (rev 0)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import java.util.Date;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class CurrentDateChangeEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -8169207286087810907L;
+ private Date currentDate = null;
+ private String currentDateString = null;
+
+ public CurrentDateChangeEvent(UIComponent component, String curentDateString) {
+ super(component);
+ this.currentDateString = curentDateString;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return (listener instanceof CurrentDateChangeListener);
+ }
+
+ public void processListener(FacesListener listener) {
+ ((CurrentDateChangeListener)listener).processCurrentDateChange(this);
+ }
+
+ public Date getCurrentDate() {
+ return currentDate;
+ }
+
+ public void setCurrentDate(Date currentDate) {
+ this.currentDate = currentDate;
+ }
+
+ public String getCurrentDateString() {
+ return currentDateString;
+ }
+
+}
Deleted: trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java
===================================================================
--- sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java 2010-10-28 12:08:05 UTC (rev 19724)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,36 +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.event;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author Alexej Kushunin - akushunin(a)exadel.com
- * created 28.08.2007
- *
- * Base calendar events interface
- */
-public interface CurrentDateChangeListener extends FacesListener {
-
- public void processCurrentDateChange(CurrentDateChangeEvent event);
-
-}
\ No newline at end of file
Copied: trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java (from rev 19756, sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java)
===================================================================
--- trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java (rev 0)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/event/CurrentDateChangeListener.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Alexej Kushunin - akushunin(a)exadel.com
+ *
+ */
+public interface CurrentDateChangeListener extends FacesListener {
+
+ public void processCurrentDateChange(CurrentDateChangeEvent event);
+
+}
\ No newline at end of file
Deleted: trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java
===================================================================
--- sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java 2010-10-28 12:08:05 UTC (rev 19724)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,44 +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.model;
-
-import java.util.Date;
-/**
- * @author Alexej Kushunin
- * created 19.06.2007
- *
- */
-public interface CalendarDataModel {
-
- /**
- * @return array of CalendarDataModelItems for selected dates.
- * This method will be called every time when components will need next block of CalendarDataItems.
- * That may happens when calendar rendered, or when user navigate to next(previous) month or in any other case when calendar renders.
- * This method will be called in Ajax mode when Calendar renders new page.
- * */
- public CalendarDataModelItem[] getData(Date[] dateArray);
-
- /**
- * @return tool tip when it's used in "single" mode
- * This method used when tool tips are displayed in "single" mode
- * */
- public Object getToolTip(Date date);
-}
Copied: trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java (from rev 19755, sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java)
===================================================================
--- trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java (rev 0)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModel.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,46 @@
+/**
+ * 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.model;
+
+import java.util.Date;
+
+/**
+ * @author Alexej Kushunin created 19.06.2007
+ *
+ */
+public interface CalendarDataModel {
+
+ /**
+ * @return array of CalendarDataModelItems for selected dates. This method
+ * will be called every time when components will need next block of
+ * CalendarDataItems. That may happens when calendar rendered, or
+ * when user navigate to next(previous) month or in any other case
+ * when calendar renders. This method will be called in Ajax mode
+ * when Calendar renders new page.
+ * */
+ public CalendarDataModelItem[] getData(Date[] dateArray);
+
+ /**
+ * @return tool tip when it's used in "single" mode This method used when
+ * tool tips are displayed in "single" mode
+ * */
+ public Object getToolTip(Date date);
+}
Deleted: trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java
===================================================================
--- sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java 2010-10-28 12:08:05 UTC (rev 19724)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,68 +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.model;
-
-
-
-/**
- * @author Alexej Kushunin
- * created 19.06.2007
- *
- */
-
-public interface CalendarDataModelItem {
-
- /**
- *@return true if date is �selectable� on calendar, default implementation return true
- **/
- public boolean isEnabled();
-
- /**
- * @return String that will be appended to style class for that date span.
- * For example it may be �relevant holyday� � that mean class will be like �rich-cal-day relevant holyday�.
- * Default implementation return empty string.
- * */
- public String getStyleClass();
-
- /**
- * @return any additional payload that must be JSON-serialazable object.
- * May be used in custom date representation on calendar (inside custom facet).*/
- public Object getData();
-
- /**
- * @return true if given date has an associated with it tooltip data.
- * Default implementation return false.*/
- public boolean hasToolTip();
-
- /**
- *@return tool tip data that will be used in �batch� tooltip loading mode.
- **/
- public Object getToolTip();
-
- /**
- *@return day of the month on which data must be shown.
- **/
- public int getDay();
-
-}
-
-
-
Copied: trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java (from rev 19755, sandbox/trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java)
===================================================================
--- trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java (rev 0)
+++ trunk/ui/calendar/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,68 @@
+/**
+ * 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.model;
+
+/**
+ * @author Alexej Kushunin created 19.06.2007
+ *
+ */
+
+public interface CalendarDataModelItem {
+
+ /**
+ * @return true if date is �selectable� on calendar, default
+ * implementation return true
+ **/
+ public boolean isEnabled();
+
+ /**
+ * @return String that will be appended to style class for that date span.
+ * For example it may be �relevant holyday� � that mean class
+ * will be like �rich-cal-day relevant holyday�. Default
+ * implementation return empty string.
+ * */
+ public String getStyleClass();
+
+ /**
+ * @return any additional payload that must be JSON-serialazable object. May
+ * be used in custom date representation on calendar (inside custom
+ * facet).
+ */
+ public Object getData();
+
+ /**
+ * @return true if given date has an associated with it tooltip data.
+ * Default implementation return false.
+ */
+ public boolean hasToolTip();
+
+ /**
+ * @return tool tip data that will be used in �batch� tooltip loading
+ * mode.
+ **/
+ public Object getToolTip();
+
+ /**
+ * @return day of the month on which data must be shown.
+ **/
+ public int getDay();
+
+}
Deleted: trunk/ui/calendar/pom.xml
===================================================================
--- sandbox/trunk/ui/calendar/pom.xml 2010-10-28 12:08:05 UTC (rev 19724)
+++ trunk/ui/calendar/pom.xml 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
- Inc. and individual contributors by the @authors tag. See the
- copyright.txt in the distribution for a full listing of
- individual contributors. This is free software; you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License as published by the Free Software
- Foundation; either version 2.1 of the License, or (at your
- option) any later version. This software 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 software; if not,
- write to the Free Software Foundation, Inc., 51 Franklin St,
- Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
- http://www.fsf.org.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.richfaces</groupId>
- <artifactId>richfaces-root-parent</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.richfaces.ui.calendar</groupId>
- <artifactId>richfaces-ui-calendar-aggregator</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Richfaces UI Components: Calendar Aggregator</name>
-
- <modules>
- <module>ui</module>
- </modules>
-</project>
Copied: trunk/ui/calendar/pom.xml (from rev 19755, sandbox/trunk/ui/calendar/pom.xml)
===================================================================
--- trunk/ui/calendar/pom.xml (rev 0)
+++ trunk/ui/calendar/pom.xml 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-root-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.calendar</groupId>
+ <artifactId>richfaces-ui-calendar-aggregator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Richfaces UI Components: Calendar Aggregator</name>
+
+ <modules>
+ <module>api</module>
+ <module>ui</module>
+ </modules>
+</project>
Copied: trunk/ui/calendar/ui (from rev 19754, sandbox/trunk/ui/calendar/ui)
Deleted: trunk/ui/calendar/ui/pom.xml
===================================================================
--- sandbox/trunk/ui/calendar/ui/pom.xml 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/pom.xml 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
- Inc. and individual contributors by the @authors tag. See the
- copyright.txt in the distribution for a full listing of
- individual contributors. This is free software; you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License as published by the Free Software
- Foundation; either version 2.1 of the License, or (at your
- option) any later version. This software 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 software; if not,
- write to the Free Software Foundation, Inc., 51 Franklin St,
- Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
- http://www.fsf.org.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-ui-parent</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.richfaces.ui.calendar</groupId>
- <artifactId>richfaces-ui-calendar-ui</artifactId>
- <name>Richfaces UI Components: Input UI</name>
- <packaging>jar</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>maven-cdk-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <!-- runtime -->
- <dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui.common</groupId>
- <artifactId>richfaces-ui-common-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui.input</groupId>
- <artifactId>richfaces-ui-input-ui</artifactId>
- </dependency>
- </dependencies>
-</project>
Copied: trunk/ui/calendar/ui/pom.xml (from rev 19755, sandbox/trunk/ui/calendar/ui/pom.xml)
===================================================================
--- trunk/ui/calendar/ui/pom.xml (rev 0)
+++ trunk/ui/calendar/ui/pom.xml 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.calendar</groupId>
+ <artifactId>richfaces-ui-calendar-ui</artifactId>
+ <name>Richfaces UI Components: Input UI</name>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- runtime -->
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.common</groupId>
+ <artifactId>richfaces-ui-common-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.input</groupId>
+ <artifactId>richfaces-ui-input-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.calendar</groupId>
+ <artifactId>richfaces-ui-calendar-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,349 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.DateTimeConverter;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.events.CurrentDateChangeEvent;
-import org.richfaces.events.CurrentDateChangeListener;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.utils.CalendarHelper;
-
-/**
- * @author amarkhel
- *
- */
-
-@JsfComponent(type = AbstractCalendar.COMPONENT_TYPE, family = AbstractCalendar.COMPONENT_FAMILY, generate = "org.richfaces.component.UICalendar", renderer = @JsfRenderer(type = "org.richfaces.CalendarRenderer"), tag = @Tag(name = "calendar"))
-public abstract class AbstractCalendar extends UIInput {
-
- public static final String COMPONENT_TYPE = "org.richfaces.Calendar";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.Calendar";
-
- public static final String SUB_TIME_PATTERN = "\\s*[hHkKma]+[\\W&&\\S]+[hHkKma]+\\s*";
-
- public static final String TIME_PATTERN = "HH:mm";
-
- public static final String DEFAULT_DATE_PATTERN = "MMM d, yyyy";
-
- Logger log = RichfacesLogger.COMPONENTS.getLogger();
-
- protected enum PropertyKeys {
- locale
- };
-
-
- @Attribute(defaultValue = "MMM d, yyyy")
- public abstract String getDatePattern();
-
- @Attribute(defaultValue = "TimeZone.getDefault()")
- public abstract TimeZone getTimeZone();
-
- @Attribute(defaultValue = "Integer.MIN_VALUE")
- public abstract int getFirstWeekDay();
-
- @Attribute(defaultValue = "Integer.MIN_VALUE")
- public abstract int getMinDaysInFirstWeek();
-
- @Attribute(defaultValue = "select")
- public abstract String getTodayControlMode();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowWeekDaysBar();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowWeeksBar();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowFooter();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowHeader();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowInput();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isPopup();
-
- @Attribute(defaultValue = "true")
- public abstract String getHidePopupOnScroll();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isDisable();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isEnableManualInput();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isDayEnabled();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isShowApplyButton();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isResetTimeOnDateSelect();
-
- @Attribute(defaultValue = "AA")
- public abstract String getJointPoint();
-
- @Attribute(defaultValue = "AA")
- public abstract String getDirection();
-
- @Attribute(defaultValue = "inactive")
- public abstract String getBoundaryDatesMode();
-
- @Attribute(defaultValue = "0")
- public abstract String getHorizontalOffset();
-
- @Attribute(defaultValue = "0")
- public abstract String getVerticalOffsetOffset();
-
- @Attribute(defaultValue = "3")
- public abstract int getZindex();
-
- @Attribute
- public abstract String getStyle();
-
- @Attribute
- public abstract Object getMonthLabels();
-
- @Attribute
- public abstract Object getMonthLabelsShort();
-
- @Attribute
- public abstract Object getWeekDayLabelsShort();
-
- @Attribute
- public abstract Object getWeekDayLabels();
-
- @Attribute
- public abstract String getDayStyleClass();
-
- @Attribute
- public abstract String getTabindex();
-
- @Attribute
- public abstract String getInputStyle();
-
- @Attribute
- public abstract String getButtonClass();
-
- @Attribute
- public abstract String getInputClass();
-
- @Attribute
- public abstract String getButtonLabel();
-
- @Attribute
- public abstract String getInputSize();
-
- @Attribute
- public abstract Object getCurrentDate();
-
- public abstract void setCurrentDate(Object date);
-
- @Attribute
- public abstract String getButtonIcon();
-
- @Attribute
- public abstract String getButtonIconDisabled();
-
- @Attribute
- public abstract Object getDefaultTime();
-
- @Attribute(events = @EventName("inputclick"))
- public abstract String getOninputclick();
-
- @Attribute(events = @EventName("inputdblclick"))
- public abstract String getOninputdblclick();
-
- @Attribute(events = @EventName("inputchange"))
- public abstract String getOninputchange();
-
- @Attribute(events = @EventName("inputselect"))
- public abstract String getOninputselect();
-
- @Attribute(events = @EventName("inputmousedown"))
- public abstract String getOninputmousedown();
-
- @Attribute(events = @EventName("inputmousemove"))
- public abstract String getOninputmousemove();
-
- @Attribute(events = @EventName("inputmouseout"))
- public abstract String getOninputmouseout();
-
- @Attribute(events = @EventName("inputmouseover"))
- public abstract String getOninputmouseover();
-
- @Attribute(events = @EventName("inputmouseup"))
- public abstract String getOninputmouseup();
-
- @Attribute(events = @EventName("inputkeydown"))
- public abstract String getOninputkeydown();
-
- @Attribute(events = @EventName("inputkeypress"))
- public abstract String getOninputkeypress();
-
- @Attribute(events = @EventName("inputkeyup"))
- public abstract String getOninputkeypup();
-
- @Attribute(events = @EventName("inputfocus"))
- public abstract String getOninputfocus();
-
- @Attribute(events = @EventName("inputblur"))
- public abstract String getOninputblur();
-
- @Attribute
- public Object getLocale() {
- Object locale = getStateHelper().eval(PropertyKeys.locale);
- if (locale == null) {
- FacesContext facesContext = getFacesContext();
- UIViewRoot viewRoot = facesContext.getViewRoot();
- if (viewRoot != null) {
- locale = viewRoot.getLocale();
- }
- }
- return locale != null ? locale : Locale.US;
- }
-
- public void setLocale(Object locale) {
- getStateHelper().put(PropertyKeys.locale, locale);
- }
-
- public void updateCurrentDate(FacesContext facesContext, Object currentDate) {
- if (facesContext == null) {
- throw new NullPointerException();
- }
- // RF-1073
- try {
- ValueExpression ve = getValueExpression("currentDate");
- if (ve != null) {
- ELContext elContext = facesContext.getELContext();
- if (ve.getType(elContext).equals(String.class)) {
- DateTimeConverter convert = new DateTimeConverter();
- convert.setLocale(CalendarHelper.getAsLocale(facesContext, this, getLocale()));
- convert.setPattern(getDatePattern());
- ve.setValue(facesContext.getELContext(), convert.getAsString(facesContext, this, currentDate));
- return;
- } else if (ve.getType(elContext).equals(Calendar.class)) {
- Calendar c = Calendar.getInstance();
- c.setTime((Date) currentDate);
- ve.setValue(elContext, c);
- return;
- } else {
- ve.setValue(elContext, currentDate);
- return;
- }
- } else {
- setCurrentDate(currentDate);
- }
-
- } catch (Exception e) {
- setValid(false);
- if (log.isDebugEnabled()) {
- log.debug(" updateCurrentDate method throws exception: " + e.toString(), e);
- }
-
- String messageString = e.toString();
- FacesMessage message = new FacesMessage(messageString);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- facesContext.addMessage(getClientId(facesContext), message);
- }
- }
-
- public void addCurrentDateChangeListener(CurrentDateChangeListener listener) {
- addFacesListener(listener);
- }
-
- public void removeToggleListener(CurrentDateChangeListener listener) {
- removeFacesListener(listener);
- }
-
- public CurrentDateChangeListener[] getCurrentDateChangeListeners() {
- return (CurrentDateChangeListener[]) getFacesListeners(CurrentDateChangeListener.class);
- }
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (event instanceof CurrentDateChangeEvent) {
- FacesContext facesContext = getFacesContext();
- CurrentDateChangeEvent currentDateChangeEvent = (CurrentDateChangeEvent) event;
- String currentDateString = currentDateChangeEvent.getCurrentDateString();
-
- try {
- // we should use datePattern attribute-based converter only for
- // selectedDate
- // current date string always has predefined format: m/y
- Date currentDate = CalendarHelper.getAsDate(facesContext, this, getCurrentDate());
- Date submittedCurrentDate = CalendarHelper.convertCurrentDate(currentDateString);
- currentDateChangeEvent.setCurrentDate(submittedCurrentDate);
-
- if (!submittedCurrentDate.equals(currentDate)) {
- updateCurrentDate(facesContext, submittedCurrentDate);
- }
-
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug(" currentDate convertion fails with following exception: " + e.toString(), e);
- }
- setValid(false);
- String messageString = e.toString();
- FacesMessage message = new FacesMessage(messageString);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- }
- } else {
- super.broadcast(event);
- }
- }
-
- @Override
- public void queueEvent(FacesEvent event) {
- super.queueEvent(event);
- if (event instanceof CurrentDateChangeEvent) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- }
- }
-}
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java (from rev 19755, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,351 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.DateTimeConverter;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.utils.CalendarHelper;
+
+import org.richfaces.event.CurrentDateChangeEvent;
+import org.richfaces.event.CurrentDateChangeListener;
+
+
+/**
+ * @author amarkhel
+ *
+ */
+
+@JsfComponent(type = AbstractCalendar.COMPONENT_TYPE, family = AbstractCalendar.COMPONENT_FAMILY, generate = "org.richfaces.component.UICalendar", renderer = @JsfRenderer(type = "org.richfaces.CalendarRenderer"), tag = @Tag(name = "calendar"))
+public abstract class AbstractCalendar extends UIInput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Calendar";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Calendar";
+
+ public static final String SUB_TIME_PATTERN = "\\s*[hHkKma]+[\\W&&\\S]+[hHkKma]+\\s*";
+
+ public static final String TIME_PATTERN = "HH:mm";
+
+ public static final String DEFAULT_DATE_PATTERN = "MMM d, yyyy";
+
+ Logger log = RichfacesLogger.COMPONENTS.getLogger();
+
+ protected enum PropertyKeys {
+ locale
+ };
+
+
+ @Attribute(defaultValue = "MMM d, yyyy")
+ public abstract String getDatePattern();
+
+ @Attribute(defaultValue = "TimeZone.getDefault()")
+ public abstract TimeZone getTimeZone();
+
+ @Attribute(defaultValue = "Integer.MIN_VALUE")
+ public abstract int getFirstWeekDay();
+
+ @Attribute(defaultValue = "Integer.MIN_VALUE")
+ public abstract int getMinDaysInFirstWeek();
+
+ @Attribute(defaultValue = "select")
+ public abstract String getTodayControlMode();
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isShowWeekDaysBar();
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isShowWeeksBar();
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isShowFooter();
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isShowHeader();
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isShowInput();
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isPopup();
+
+ @Attribute(defaultValue = "true")
+ public abstract String getHidePopupOnScroll();
+
+ @Attribute(defaultValue = "false")
+ public abstract boolean isDisable();
+
+ @Attribute(defaultValue = "false")
+ public abstract boolean isEnableManualInput();
+
+ @Attribute(defaultValue = "false")
+ public abstract boolean isDayEnabled();
+
+ @Attribute(defaultValue = "false")
+ public abstract boolean isShowApplyButton();
+
+ @Attribute(defaultValue = "false")
+ public abstract boolean isResetTimeOnDateSelect();
+
+ @Attribute(defaultValue = "AA")
+ public abstract String getJointPoint();
+
+ @Attribute(defaultValue = "AA")
+ public abstract String getDirection();
+
+ @Attribute(defaultValue = "inactive")
+ public abstract String getBoundaryDatesMode();
+
+ @Attribute(defaultValue = "0")
+ public abstract String getHorizontalOffset();
+
+ @Attribute(defaultValue = "0")
+ public abstract String getVerticalOffsetOffset();
+
+ @Attribute(defaultValue = "3")
+ public abstract int getZindex();
+
+ @Attribute
+ public abstract String getStyle();
+
+ @Attribute
+ public abstract Object getMonthLabels();
+
+ @Attribute
+ public abstract Object getMonthLabelsShort();
+
+ @Attribute
+ public abstract Object getWeekDayLabelsShort();
+
+ @Attribute
+ public abstract Object getWeekDayLabels();
+
+ @Attribute
+ public abstract String getDayStyleClass();
+
+ @Attribute
+ public abstract String getTabindex();
+
+ @Attribute
+ public abstract String getInputStyle();
+
+ @Attribute
+ public abstract String getButtonClass();
+
+ @Attribute
+ public abstract String getInputClass();
+
+ @Attribute
+ public abstract String getButtonLabel();
+
+ @Attribute
+ public abstract String getInputSize();
+
+ @Attribute
+ public abstract Object getCurrentDate();
+
+ public abstract void setCurrentDate(Object date);
+
+ @Attribute
+ public abstract String getButtonIcon();
+
+ @Attribute
+ public abstract String getButtonIconDisabled();
+
+ @Attribute
+ public abstract Object getDefaultTime();
+
+ @Attribute(events = @EventName("inputclick"))
+ public abstract String getOninputclick();
+
+ @Attribute(events = @EventName("inputdblclick"))
+ public abstract String getOninputdblclick();
+
+ @Attribute(events = @EventName("inputchange"))
+ public abstract String getOninputchange();
+
+ @Attribute(events = @EventName("inputselect"))
+ public abstract String getOninputselect();
+
+ @Attribute(events = @EventName("inputmousedown"))
+ public abstract String getOninputmousedown();
+
+ @Attribute(events = @EventName("inputmousemove"))
+ public abstract String getOninputmousemove();
+
+ @Attribute(events = @EventName("inputmouseout"))
+ public abstract String getOninputmouseout();
+
+ @Attribute(events = @EventName("inputmouseover"))
+ public abstract String getOninputmouseover();
+
+ @Attribute(events = @EventName("inputmouseup"))
+ public abstract String getOninputmouseup();
+
+ @Attribute(events = @EventName("inputkeydown"))
+ public abstract String getOninputkeydown();
+
+ @Attribute(events = @EventName("inputkeypress"))
+ public abstract String getOninputkeypress();
+
+ @Attribute(events = @EventName("inputkeyup"))
+ public abstract String getOninputkeypup();
+
+ @Attribute(events = @EventName("inputfocus"))
+ public abstract String getOninputfocus();
+
+ @Attribute(events = @EventName("inputblur"))
+ public abstract String getOninputblur();
+
+ @Attribute
+ public Object getLocale() {
+ Object locale = getStateHelper().eval(PropertyKeys.locale);
+ if (locale == null) {
+ FacesContext facesContext = getFacesContext();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (viewRoot != null) {
+ locale = viewRoot.getLocale();
+ }
+ }
+ return locale != null ? locale : Locale.US;
+ }
+
+ public void setLocale(Object locale) {
+ getStateHelper().put(PropertyKeys.locale, locale);
+ }
+
+ public void updateCurrentDate(FacesContext facesContext, Object currentDate) {
+ if (facesContext == null) {
+ throw new NullPointerException();
+ }
+ // RF-1073
+ try {
+ ValueExpression ve = getValueExpression("currentDate");
+ if (ve != null) {
+ ELContext elContext = facesContext.getELContext();
+ if (ve.getType(elContext).equals(String.class)) {
+ DateTimeConverter convert = new DateTimeConverter();
+ convert.setLocale(CalendarHelper.getAsLocale(facesContext, this, getLocale()));
+ convert.setPattern(getDatePattern());
+ ve.setValue(facesContext.getELContext(), convert.getAsString(facesContext, this, currentDate));
+ return;
+ } else if (ve.getType(elContext).equals(Calendar.class)) {
+ Calendar c = Calendar.getInstance();
+ c.setTime((Date) currentDate);
+ ve.setValue(elContext, c);
+ return;
+ } else {
+ ve.setValue(elContext, currentDate);
+ return;
+ }
+ } else {
+ setCurrentDate(currentDate);
+ }
+
+ } catch (Exception e) {
+ setValid(false);
+ if (log.isDebugEnabled()) {
+ log.debug(" updateCurrentDate method throws exception: " + e.toString(), e);
+ }
+
+ String messageString = e.toString();
+ FacesMessage message = new FacesMessage(messageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ facesContext.addMessage(getClientId(facesContext), message);
+ }
+ }
+
+ public void addCurrentDateChangeListener(CurrentDateChangeListener listener) {
+ addFacesListener(listener);
+ }
+
+ public void removeToggleListener(CurrentDateChangeListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public CurrentDateChangeListener[] getCurrentDateChangeListeners() {
+ return (CurrentDateChangeListener[]) getFacesListeners(CurrentDateChangeListener.class);
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof CurrentDateChangeEvent) {
+ FacesContext facesContext = getFacesContext();
+ CurrentDateChangeEvent currentDateChangeEvent = (CurrentDateChangeEvent) event;
+ String currentDateString = currentDateChangeEvent.getCurrentDateString();
+
+ try {
+ // we should use datePattern attribute-based converter only for
+ // selectedDate
+ // current date string always has predefined format: m/y
+ Date currentDate = CalendarHelper.getAsDate(facesContext, this, getCurrentDate());
+ Date submittedCurrentDate = CalendarHelper.convertCurrentDate(currentDateString);
+ currentDateChangeEvent.setCurrentDate(submittedCurrentDate);
+
+ if (!submittedCurrentDate.equals(currentDate)) {
+ updateCurrentDate(facesContext, submittedCurrentDate);
+ }
+
+ } catch (Exception e) {
+ if (log.isDebugEnabled()) {
+ log.debug(" currentDate convertion fails with following exception: " + e.toString(), e);
+ }
+ setValid(false);
+ String messageString = e.toString();
+ FacesMessage message = new FacesMessage(messageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ }
+ } else {
+ super.broadcast(event);
+ }
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ super.queueEvent(event);
+ if (event instanceof CurrentDateChangeEvent) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ }
+ }
+}
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,609 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.text.DateFormatSymbols;
-import java.text.Format;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.TimeZone;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.convert.DateTimeConverter;
-
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSReference;
-import org.richfaces.component.AbstractCalendar;
-import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.component.util.MessageUtil;
-import org.richfaces.component.util.SelectUtils;
-import org.richfaces.component.util.ViewUtil;
-import org.richfaces.events.CurrentDateChangeEvent;
-import org.richfaces.utils.CalendarHelper;
-
-/**
- * @author amarkhel
- *
- */
-
-@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "jquery.position.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "richfaces-event.js"),
- @ResourceDependency(library = "org.richfaces", name = "json-dom.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery.effects.core.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery.effects.highlight.js"),
- @ResourceDependency(library = "org.richfaces", name = "JQuerySpinBtn.js.js"),
- @ResourceDependency(library = "org.richfaces", name = "calendar-utils.js"),
- @ResourceDependency(library = "org.richfaces", name = "calendar.js"),
- @ResourceDependency(library = "org.richfaces", name = "calendar.ecss") })
-public class CalendarRendererBase extends InputRendererBase {
-
- public static final String CALENDAR_BUNDLE = "org.richfaces.renderkit.calendar";
-
- public static final String OPTION_ENABLE_MANUAL_INPUT = "enableManualInput";
-
- public static final String OPTION_DISABLED = "disabled";
-
- public static final String OPTION_READONLY = "readonly";
-
- public static final String OPTION_RESET_TIME_ON_DATE_SELECT = "resetTimeOnDateSelect";
-
- public static final String OPTION_SHOW_APPLY_BUTTON = "showApplyButton";
-
- public static final String OPTION_MIN_DAYS_IN_FIRST_WEEK = "minDaysInFirstWeek";
-
- public static final String OPTION_POPUP = "popup";
-
- public static final String OPTION_SHOW_INPUT = "showInput";
-
- public static final String OPTION_SHOW_HEADER = "showHeader";
-
- public static final String OPTION_SHOW_FOOTER = "showFooter";
-
- public static final String OPTION_SHOW_WEEKS_BAR = "showWeeksBar";
-
- public static final String OPTION_TODAY_CONTROL_MODE = "todayControlMode";
-
- public static final String OPTION_DATE_PATTERN = "datePattern";
-
- public static final String OPTION_JOINT_POINT = "jointPoint";
-
- public static final String OPTION_DIRECTION = "direction";
-
- public static final String OPTION_BOUNDARY_DATES_MODE = "boundaryDatesMode";
-
- public static final String OPTION_HORIZONTAL_OFFSET = "horizontalOffset";
-
- public static final String OPTION_VERTICAL_OFFSET = "verticalOffset";
-
- public static final String OPTION_CURRENT_DATE = "currentDate";
-
- public static final String OPTION_SELECTED_DATE = "selectedDate";
-
- public static final String OPTION_DAY_CELL_CLASS = "dayCellClass";
-
- public static final String OPTION_DAY_STYLE_CLASS = "dayStyleClass";
-
- public static final String OPTION_LABELS = "labels";
-
- public static final String OPTION_DEFAULT_TIME = "defaultTime";
-
- public static final String OPTION_HIDE_POPUP_ON_SCROLL = "hidePopupOnScroll";
-
- public static final String OPTION_SHOW_WEEK_DAYS_BAR = "showWeekDaysBar";
-
- public static final String MONTH_LABELS_SHORT = "monthLabelsShort";
-
- public static final String MONTH_LABELS = "monthLabels";
-
- public static final String WEEK_DAY_LABELS_SHORT = "weekDayLabelsShort";
-
- public static final String WEEK_DAY_LABELS = "weekDayLabels";
-
- public static final String FIRST_DAY_WEEK = "firstWeekDay";
-
- public static final String MIN_DAYS_IN_FIRST_WEEK = "minDaysInFirstWeek";
-
- public static final String CALENDAR_ICON_RESOURCE_NAME = "calendarIcon.png";
-
- public static final String CALENDAR_DISABLE_ICON_RESOURCE_NAME = "disabledCalendarIcon.png";
-
- public static final String CURRENT_DATE_INPUT = "InputCurrentDate";
-
-
-
-
-
- protected static final Map<String, ComponentAttribute> CALENDAR_INPUT_HANDLER_ATTRIBUTES = Collections.unmodifiableMap(ComponentAttribute.createMap(
- new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
- .setEventNames("inputclick")
- .setComponentAttributeName("oninputclick"),
- new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
- .setEventNames("inputdblclick")
- .setComponentAttributeName("oninputdblclick"),
- new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
- .setEventNames("inputmousedown")
- .setComponentAttributeName("oninputmousedown"),
- new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
- .setEventNames("inputmouseup")
- .setComponentAttributeName("oninputmouseup"),
- new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
- .setEventNames("inputmouseover")
- .setComponentAttributeName("oninputmouseover"),
- new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
- .setEventNames("inputmousemove")
- .setComponentAttributeName("oninputmousemove"),
- new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
- .setEventNames("inputmouseout")
- .setComponentAttributeName("oninputmouseout"),
- new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
- .setEventNames("inputkeypress")
- .setComponentAttributeName("oninputkeypress"),
- new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
- .setEventNames("inputkeydown")
- .setComponentAttributeName("oninputkeydown"),
- new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
- .setEventNames("inputkeyup")
- .setComponentAttributeName("oninputkeyup"),
- new ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE)
- .setEventNames("inputblur")
- .setComponentAttributeName("oninputblur"),
- new ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE)
- .setEventNames("inputfocus")
- .setComponentAttributeName("oninputfocus"),
- new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
- .setEventNames("inputchange")
- .setComponentAttributeName("oninputchange"),
- new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
- .setEventNames("inputselect")
- .setComponentAttributeName("oninputselect")));
-
- private static final String HOURS_VALUE = "hours";
-
- private static final String MINUTES_VALUE = "minutes";
-
- protected void doDecode(FacesContext context, UIComponent component) {
- if(!(component instanceof AbstractCalendar)) {
- return;
- }
-
- AbstractCalendar calendar = (AbstractCalendar)component;
- if (calendar.isDisable()){
- return;
- }
-
- Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();
-
- String clientId = calendar.getClientId(context);
- String currentDateString = (String) requestParameterMap.get(clientId + CURRENT_DATE_INPUT);
- if (currentDateString != null) {
- calendar.queueEvent(new CurrentDateChangeEvent(calendar, currentDateString));
- }
-
- String selectedDateString = (String) requestParameterMap.get(clientId + "InputDate");
- if (selectedDateString != null) {
- calendar.setSubmittedValue(selectedDateString);
- }
- }
-
- public void renderInputHandlers(FacesContext facesContext, UIComponent component) throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, CALENDAR_INPUT_HANDLER_ATTRIBUTES);
- }
-
- @Override
- public Object getConvertedValue(FacesContext facesContext, UIComponent component, Object submittedValue) throws ConverterException {
- if ((facesContext == null) || (component == null)) {
- throw new NullPointerException();
- }
-
- // skip conversion of already converted date
- if (submittedValue instanceof Date) {
- return (Date)submittedValue;
- }
-
- // Store submitted value in the local variable as a string
- String newValue = (String) submittedValue;
- // if we have no local value, try to get the valueExpression.
- AbstractCalendar calendar = (AbstractCalendar) component;
- Converter converter = SelectUtils.getConverterForProperty(facesContext, calendar, "value");
-
- // in case the converter hasn't been set, try to use default
- // DateTimeConverter
- if (converter == null) {
- converter = createDefaultConverter();
- }
- setupConverter(facesContext, converter, calendar);
- return converter.getAsObject(facesContext, component, newValue);
- }
-
- @Override
- public String getInputValue(FacesContext facesContext, UIComponent component) {
- if(!(component instanceof AbstractCalendar)) {
- return null;
- }
-
- AbstractCalendar calendar = (AbstractCalendar) component;
- String value = (String) calendar.getSubmittedValue();
- if (value == null) {
- Object curVal = calendar.getValue();
- Converter converter = SelectUtils.getConverterForProperty(facesContext, calendar, "value");
-
- if(converter == null) {
- converter = createDefaultConverter();
- setupConverter(facesContext, converter, calendar);
- }
-
- if (converter != null) {
- value = converter.getAsString(facesContext, calendar, curVal);
- } else {
- value = curVal !=null ? curVal.toString() : "";
- }
- }
-
- if (value == null) {
- value = "";
- }
-
- return value;
-
- }
-
- public String getButtonIcon(FacesContext facesContext, UIComponent component) {
- boolean disable = (Boolean)component.getAttributes().get("disable");
- String buttonIcon = (String)component.getAttributes().get("buttonIcon");
- if(disable) {
- buttonIcon = (String)component.getAttributes().get("buttonIconDisabled");
- }
-
- if(buttonIcon != null && buttonIcon.trim().length() != 0) {
- buttonIcon = ViewUtil.getResourceURL(buttonIcon, facesContext);
- } else {
- buttonIcon = disable ? CALENDAR_ICON_RESOURCE_NAME: CALENDAR_ICON_RESOURCE_NAME;
- buttonIcon = RenderKitUtils.getResourcePath(facesContext, "org.richfaces.images",buttonIcon);
- }
-
- return buttonIcon;
- }
-
- public Object getSelectedDate(FacesContext facesContext, UIComponent component) throws IOException {
- Object returnValue = null;
- AbstractCalendar calendar = (AbstractCalendar)component;
- if(calendar.isValid()) {
- Date date;
- Object value = calendar.getValue();
- date = CalendarHelper.getAsDate(facesContext, calendar, value);
- if(date != null) {
- returnValue = formatSelectedDate(calendar.getTimeZone(), date);
- }
- }
- return returnValue;
- }
-
- public static Object formatSelectedDate(TimeZone timeZone, Date date) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeZone(timeZone);
- calendar.setTime(date);
-
- JSFunction result = new JSFunction("new Date");
- result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.HOUR_OF_DAY)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.MINUTE)));
- result.addParameter(new Integer(0));
-
- return result;
- }
-
- public Object getCurrentDate(FacesContext facesContext, AbstractCalendar calendar) throws IOException {
- Date date = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
- return formatDate(date);
- }
-
- public String getCurrentDateAsString(FacesContext facesContext, UIComponent component) throws IOException {
- AbstractCalendar calendar = (AbstractCalendar)component;
- Format formatter = new SimpleDateFormat("MM/yyyy");
-
- Date currentDate = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
- return formatter.format(currentDate);
- }
-
- public static Object formatDate(Date date) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(date);
- JSFunction result = new JSFunction("new Date");
- result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
-
- return result;
- }
-
- public String getDayCellClass(FacesContext facesContext, AbstractCalendar calendar) {
- //TODO: refactor this
- /*
- String cellwidth = (String) component.getAttributes().get("cellWidth");
- String cellheight = (String) component.getAttributes().get("cellHeight");
- if (cellwidth != null && cellwidth.length() != 0 || cellheight != null
- && cellheight.length() != 0) {
- String clientId = component.getClientId(context);
- String value = clientId.replace(':', '_') + "DayCell";
- return value;
- }
- */
- return null;
- }
-
- public JSReference getIsDayEnabled(FacesContext facesContext, AbstractCalendar calendar) {
- return calendar.isDayEnabled() ? JSReference.TRUE : JSReference.FALSE;
- }
-
- public JSReference getDayStyleClass(FacesContext context, AbstractCalendar calendar) {
- String dayStyleClass = calendar.getDayStyleClass();
- return ((dayStyleClass != null && dayStyleClass.trim().length() != 0)) ? new JSReference(dayStyleClass) : null;
- }
-
-
- public Map<String, Object> getLabels(FacesContext facesContext, AbstractCalendar calendar) {
- ResourceBundle bundle1 = null;
- ResourceBundle bundle2 = null;
-
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- String messageBundle = facesContext.getApplication().getMessageBundle();
- Locale locale = CalendarHelper.getAsLocale(facesContext, calendar);
- if (null != messageBundle) {
- bundle1 = ResourceBundle.getBundle(messageBundle,locale , loader);
- }
-
- try {
- bundle2 = ResourceBundle.getBundle(CALENDAR_BUNDLE, locale, loader);
- } catch (MissingResourceException e) {
- //No external bundle was found, ignore this exception.
- }
-
- ResourceBundle [] bundles = {bundle1, bundle2};
- String[] names = {"apply", "today", "clean", "cancel", "ok", "close"};
-
- return getCollectedLabels(bundles, names);
- }
-
- protected Map<String, Object> getCollectedLabels(ResourceBundle [] bundles , String[] names) {
- Map<String, Object> labels = new HashMap<String, Object>();
- if(bundles != null && names != null) {
- for (String name: names) {
- String label = null;
- String bundleKey = "RICH_CALENDAR_" + name.toUpperCase() + "_LABEL";
- for(ResourceBundle bundle: bundles) {
- if (bundle != null) {
- try {
- label = bundle.getString(bundleKey);
- } catch (MissingResourceException mre) {
- // Current key was not found, ignore this exception;
- }
- }
- if(label != null) {
- break;
- }
- }
- RenderKitUtils.addToScriptHash(labels, name, label);
- }
- }
- return labels;
- }
-
- public Map<String, Object> getPreparedDefaultTime(FacesContext facesContext, AbstractCalendar abstractCalendar) {
- Date date = CalendarHelper.getFormattedDefaultTime(abstractCalendar);
- Map<String, Object> result = new HashMap<String, Object>();
- if (date != null) {
- Calendar calendar = CalendarHelper.getCalendar(facesContext, abstractCalendar);
- calendar.setTime(date);
- int hours = calendar.get(Calendar.HOUR_OF_DAY);
- int minutes = calendar.get(Calendar.MINUTE);
-
- if (hours != 12 || minutes != 0) {
- result.put(HOURS_VALUE, hours);
- result.put(MINUTES_VALUE, minutes);
- }
- }
- return result;
- }
-
- private static String[] shiftDates(int minimum, int maximum, String[] labels) {
- if (minimum == 0 && (maximum - minimum == labels.length - 1)) {
- return labels;
- }
-
- String[] shiftedLabels = new String[maximum - minimum + 1];
- System.arraycopy(labels, minimum, shiftedLabels, 0, maximum - minimum
- + 1);
-
- return shiftedLabels;
- }
-
- protected Map<String, Object> getLocaleOptions(FacesContext facesContext, AbstractCalendar calendarComponent) {
- Map<String, Object> map = new HashMap<String, Object>();
-
- Locale locale = CalendarHelper.getAsLocale(facesContext, calendarComponent);
- DateFormatSymbols dateFormat = new DateFormatSymbols(locale);
-
- Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarComponent);
- int maximum = calendar.getActualMaximum(Calendar.DAY_OF_WEEK);
- int minimum = calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
-
- int monthMax = calendar.getActualMaximum(Calendar.MONTH);
- int monthMin = calendar.getActualMinimum(Calendar.MONTH);
-
- String [] weekDayLabels = RenderKitUtils.asArray(calendarComponent.getWeekDayLabels());
- if(weekDayLabels == null) {
- weekDayLabels = dateFormat.getWeekdays();
- weekDayLabels = shiftDates(minimum, maximum, weekDayLabels);
- }
- RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS, weekDayLabels);
-
- String [] weekDayLabelsShort = RenderKitUtils.asArray(calendarComponent.getWeekDayLabelsShort());
- if(weekDayLabelsShort == null) {
- weekDayLabelsShort = dateFormat.getShortWeekdays();
- weekDayLabelsShort = shiftDates(minimum, maximum, weekDayLabelsShort);
- }
- RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);
-
- String [] monthLabels = RenderKitUtils.asArray(calendarComponent.getMonthLabels());
- if(monthLabels == null) {
- monthLabels = dateFormat.getMonths();
- monthLabels = shiftDates(monthMin, monthMax, monthLabels);
- }
- RenderKitUtils.addToScriptHash(map, MONTH_LABELS, monthLabels);
-
-
- String [] monthLabelsShort = RenderKitUtils.asArray(calendarComponent.getMonthLabelsShort());
- if(monthLabelsShort == null) {
- monthLabelsShort = dateFormat.getShortMonths();
- monthLabelsShort = shiftDates(monthMin, monthMax, monthLabelsShort);
- }
- RenderKitUtils.addToScriptHash(map, MONTH_LABELS_SHORT, monthLabelsShort);
-
- int minDaysInFirstWeek = calendarComponent.getMinDaysInFirstWeek();
- if(minDaysInFirstWeek == Integer.MIN_VALUE) {
- minDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
- }
-
- if (0 <= minDaysInFirstWeek && minDaysInFirstWeek <= 7) {
- RenderKitUtils.addToScriptHash(map, MIN_DAYS_IN_FIRST_WEEK, minDaysInFirstWeek);
- }
-
- int day = calendarComponent.getFirstWeekDay();
- if(day == Integer.MIN_VALUE) {
- day = calendar.getFirstDayOfWeek();
- day = calendar.getFirstDayOfWeek() - calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
- }
-
- if (0 <= day && day <= 6) {
- RenderKitUtils.addToScriptHash(map, FIRST_DAY_WEEK, day);
- } else if (day != Integer.MIN_VALUE) {
- facesContext.getExternalContext().log(day + " value of firstWeekDay attribute is not a legal one for component: " + MessageUtil.getLabel(facesContext, calendarComponent) + ". Default value was applied.");
- }
-
- return map;
- }
-
- public ScriptOptions createCalendarScriptOption(FacesContext facesContext, UIComponent component) throws IOException {
- AbstractCalendar calendar = (AbstractCalendar)component;
- ScriptOptions scriptOptions = new ScriptOptions(component);
- scriptOptions.addOption(OPTION_ENABLE_MANUAL_INPUT);
- scriptOptions.addOption(OPTION_DISABLED);
- scriptOptions.addOption(OPTION_READONLY);
- scriptOptions.addOption(OPTION_RESET_TIME_ON_DATE_SELECT);
- scriptOptions.addOption(OPTION_SHOW_APPLY_BUTTON);
- scriptOptions.addOption(OPTION_POPUP);
- scriptOptions.addOption(OPTION_SHOW_INPUT);
- scriptOptions.addOption(OPTION_SHOW_HEADER);
- scriptOptions.addOption(OPTION_SHOW_FOOTER);
- scriptOptions.addOption(OPTION_SHOW_WEEKS_BAR);
- scriptOptions.addOption(OPTION_TODAY_CONTROL_MODE);
- scriptOptions.addOption(OPTION_DATE_PATTERN);
- scriptOptions.addOption(OPTION_JOINT_POINT);
- scriptOptions.addOption(OPTION_DIRECTION);
- scriptOptions.addOption(OPTION_BOUNDARY_DATES_MODE);
- scriptOptions.addOption(OPTION_HORIZONTAL_OFFSET);
- scriptOptions.addOption(OPTION_VERTICAL_OFFSET);
- scriptOptions.addOption(OPTION_CURRENT_DATE, getCurrentDate(facesContext, calendar));
- scriptOptions.addOption(OPTION_SELECTED_DATE, getSelectedDate(facesContext, calendar));
- scriptOptions.addOption(OPTION_DAY_CELL_CLASS, getDayCellClass(facesContext, calendar));
- scriptOptions.addOption(OPTION_DAY_STYLE_CLASS, getDayStyleClass(facesContext, calendar));
- /*
- *add to script option
- *<cdk:scriptOption attributes="ondateselected, ondateselect, ontimeselect, ontimeselected, onchanged, ondatemouseover, ondatemouseout, onexpand, oncollapse, oncurrentdateselect, oncurrentdateselected" wrapper="eventHandler" />
- * */
- scriptOptions.addOption(OPTION_LABELS, getLabels(facesContext, calendar));
- scriptOptions.addOption(OPTION_DEFAULT_TIME, getPreparedDefaultTime(facesContext, calendar));
- scriptOptions.addOption(OPTION_HIDE_POPUP_ON_SCROLL);
- scriptOptions.addOption("showWeekDaysBar");
-
- scriptOptions.addOption("styleClass");
- scriptOptions.addOption("style", HtmlUtil.concatStyles("z-index: " + calendar.getZindex(), calendar.getStyle()));
-
- return scriptOptions;
- }
-
- public void buildAddLocaleScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
- if(component instanceof AbstractCalendar) {
- AbstractCalendar calendar = (AbstractCalendar)component;
- JSFunction function = new JSFunction("RichFaces.ui.Calendar.addLocale", CalendarHelper.getAsLocale(facesContext, calendar), getLocaleOptions(facesContext, calendar));
- writer.write(function.toScript());
- writer.write(";");
- }
- }
-
- public void buildCalendarScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
- if(component instanceof AbstractCalendar) {
- AbstractCalendar calendar = (AbstractCalendar)component;
- ScriptOptions scriptOptions = createCalendarScriptOption(facesContext, calendar);
- JSFunction function = new JSFunction("new RichFaces.ui.Calendar", calendar.getClientId(facesContext), CalendarHelper.getAsLocale(facesContext, calendar), scriptOptions, "");
- StringBuffer scriptBuffer = new StringBuffer();
- scriptBuffer.append(function.toScript()).append(".load();");
- writer.write(scriptBuffer.toString());
- }
- }
-
- public boolean isUseIcons(FacesContext facesContext, UIComponent component) {
- Object label = component.getAttributes().get("buttonLabel");
- return (label == null || ((String)label).trim().length() == 0);
- }
-
- protected Converter createDefaultConverter() {
- return new DateTimeConverter();
- }
-
- protected Converter setupConverter(FacesContext facesContext, Converter converter, AbstractCalendar calendar) {
- if(converter == null || calendar == null) {
- return null;
- }
-
- if(converter instanceof DateTimeConverter) {
- DateTimeConverter defaultConverter = (DateTimeConverter) converter;
- defaultConverter.setPattern(calendar.getDatePattern());
- defaultConverter.setLocale( CalendarHelper.getAsLocale(facesContext, calendar));
- defaultConverter.setTimeZone(calendar.getTimeZone());
- }
- return converter;
- }
-
-}
\ No newline at end of file
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java (from rev 19755, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,609 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.text.DateFormatSymbols;
+import java.text.Format;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.TimeZone;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.DateTimeConverter;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSReference;
+import org.richfaces.component.AbstractCalendar;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.component.util.MessageUtil;
+import org.richfaces.component.util.SelectUtils;
+import org.richfaces.component.util.ViewUtil;
+import org.richfaces.event.CurrentDateChangeEvent;
+import org.richfaces.utils.CalendarHelper;
+
+/**
+ * @author amarkhel
+ *
+ */
+
+@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(library = "org.richfaces", name = "json-dom.js"),
+ @ResourceDependency(library = "org.richfaces", name = "jquery.effects.core.js"),
+ @ResourceDependency(library = "org.richfaces", name = "jquery.effects.highlight.js"),
+ @ResourceDependency(library = "org.richfaces", name = "JQuerySpinBtn.js.js"),
+ @ResourceDependency(library = "org.richfaces", name = "calendar-utils.js"),
+ @ResourceDependency(library = "org.richfaces", name = "calendar.js"),
+ @ResourceDependency(library = "org.richfaces", name = "calendar.ecss") })
+public class CalendarRendererBase extends InputRendererBase {
+
+ public static final String CALENDAR_BUNDLE = "org.richfaces.renderkit.calendar";
+
+ public static final String OPTION_ENABLE_MANUAL_INPUT = "enableManualInput";
+
+ public static final String OPTION_DISABLED = "disabled";
+
+ public static final String OPTION_READONLY = "readonly";
+
+ public static final String OPTION_RESET_TIME_ON_DATE_SELECT = "resetTimeOnDateSelect";
+
+ public static final String OPTION_SHOW_APPLY_BUTTON = "showApplyButton";
+
+ public static final String OPTION_MIN_DAYS_IN_FIRST_WEEK = "minDaysInFirstWeek";
+
+ public static final String OPTION_POPUP = "popup";
+
+ public static final String OPTION_SHOW_INPUT = "showInput";
+
+ public static final String OPTION_SHOW_HEADER = "showHeader";
+
+ public static final String OPTION_SHOW_FOOTER = "showFooter";
+
+ public static final String OPTION_SHOW_WEEKS_BAR = "showWeeksBar";
+
+ public static final String OPTION_TODAY_CONTROL_MODE = "todayControlMode";
+
+ public static final String OPTION_DATE_PATTERN = "datePattern";
+
+ public static final String OPTION_JOINT_POINT = "jointPoint";
+
+ public static final String OPTION_DIRECTION = "direction";
+
+ public static final String OPTION_BOUNDARY_DATES_MODE = "boundaryDatesMode";
+
+ public static final String OPTION_HORIZONTAL_OFFSET = "horizontalOffset";
+
+ public static final String OPTION_VERTICAL_OFFSET = "verticalOffset";
+
+ public static final String OPTION_CURRENT_DATE = "currentDate";
+
+ public static final String OPTION_SELECTED_DATE = "selectedDate";
+
+ public static final String OPTION_DAY_CELL_CLASS = "dayCellClass";
+
+ public static final String OPTION_DAY_STYLE_CLASS = "dayStyleClass";
+
+ public static final String OPTION_LABELS = "labels";
+
+ public static final String OPTION_DEFAULT_TIME = "defaultTime";
+
+ public static final String OPTION_HIDE_POPUP_ON_SCROLL = "hidePopupOnScroll";
+
+ public static final String OPTION_SHOW_WEEK_DAYS_BAR = "showWeekDaysBar";
+
+ public static final String MONTH_LABELS_SHORT = "monthLabelsShort";
+
+ public static final String MONTH_LABELS = "monthLabels";
+
+ public static final String WEEK_DAY_LABELS_SHORT = "weekDayLabelsShort";
+
+ public static final String WEEK_DAY_LABELS = "weekDayLabels";
+
+ public static final String FIRST_DAY_WEEK = "firstWeekDay";
+
+ public static final String MIN_DAYS_IN_FIRST_WEEK = "minDaysInFirstWeek";
+
+ public static final String CALENDAR_ICON_RESOURCE_NAME = "calendarIcon.png";
+
+ public static final String CALENDAR_DISABLE_ICON_RESOURCE_NAME = "disabledCalendarIcon.png";
+
+ public static final String CURRENT_DATE_INPUT = "InputCurrentDate";
+
+
+
+
+
+ protected static final Map<String, ComponentAttribute> CALENDAR_INPUT_HANDLER_ATTRIBUTES = Collections.unmodifiableMap(ComponentAttribute.createMap(
+ new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
+ .setEventNames("inputclick")
+ .setComponentAttributeName("oninputclick"),
+ new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
+ .setEventNames("inputdblclick")
+ .setComponentAttributeName("oninputdblclick"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
+ .setEventNames("inputmousedown")
+ .setComponentAttributeName("oninputmousedown"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
+ .setEventNames("inputmouseup")
+ .setComponentAttributeName("oninputmouseup"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
+ .setEventNames("inputmouseover")
+ .setComponentAttributeName("oninputmouseover"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
+ .setEventNames("inputmousemove")
+ .setComponentAttributeName("oninputmousemove"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
+ .setEventNames("inputmouseout")
+ .setComponentAttributeName("oninputmouseout"),
+ new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
+ .setEventNames("inputkeypress")
+ .setComponentAttributeName("oninputkeypress"),
+ new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
+ .setEventNames("inputkeydown")
+ .setComponentAttributeName("oninputkeydown"),
+ new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
+ .setEventNames("inputkeyup")
+ .setComponentAttributeName("oninputkeyup"),
+ new ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE)
+ .setEventNames("inputblur")
+ .setComponentAttributeName("oninputblur"),
+ new ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE)
+ .setEventNames("inputfocus")
+ .setComponentAttributeName("oninputfocus"),
+ new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
+ .setEventNames("inputchange")
+ .setComponentAttributeName("oninputchange"),
+ new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
+ .setEventNames("inputselect")
+ .setComponentAttributeName("oninputselect")));
+
+ private static final String HOURS_VALUE = "hours";
+
+ private static final String MINUTES_VALUE = "minutes";
+
+ protected void doDecode(FacesContext context, UIComponent component) {
+ if(!(component instanceof AbstractCalendar)) {
+ return;
+ }
+
+ AbstractCalendar calendar = (AbstractCalendar)component;
+ if (calendar.isDisable()){
+ return;
+ }
+
+ Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();
+
+ String clientId = calendar.getClientId(context);
+ String currentDateString = (String) requestParameterMap.get(clientId + CURRENT_DATE_INPUT);
+ if (currentDateString != null) {
+ calendar.queueEvent(new CurrentDateChangeEvent(calendar, currentDateString));
+ }
+
+ String selectedDateString = (String) requestParameterMap.get(clientId + "InputDate");
+ if (selectedDateString != null) {
+ calendar.setSubmittedValue(selectedDateString);
+ }
+ }
+
+ public void renderInputHandlers(FacesContext facesContext, UIComponent component) throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, CALENDAR_INPUT_HANDLER_ATTRIBUTES);
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext facesContext, UIComponent component, Object submittedValue) throws ConverterException {
+ if ((facesContext == null) || (component == null)) {
+ throw new NullPointerException();
+ }
+
+ // skip conversion of already converted date
+ if (submittedValue instanceof Date) {
+ return (Date)submittedValue;
+ }
+
+ // Store submitted value in the local variable as a string
+ String newValue = (String) submittedValue;
+ // if we have no local value, try to get the valueExpression.
+ AbstractCalendar calendar = (AbstractCalendar) component;
+ Converter converter = SelectUtils.getConverterForProperty(facesContext, calendar, "value");
+
+ // in case the converter hasn't been set, try to use default
+ // DateTimeConverter
+ if (converter == null) {
+ converter = createDefaultConverter();
+ }
+ setupConverter(facesContext, converter, calendar);
+ return converter.getAsObject(facesContext, component, newValue);
+ }
+
+ @Override
+ public String getInputValue(FacesContext facesContext, UIComponent component) {
+ if(!(component instanceof AbstractCalendar)) {
+ return null;
+ }
+
+ AbstractCalendar calendar = (AbstractCalendar) component;
+ String value = (String) calendar.getSubmittedValue();
+ if (value == null) {
+ Object curVal = calendar.getValue();
+ Converter converter = SelectUtils.getConverterForProperty(facesContext, calendar, "value");
+
+ if(converter == null) {
+ converter = createDefaultConverter();
+ setupConverter(facesContext, converter, calendar);
+ }
+
+ if (converter != null) {
+ value = converter.getAsString(facesContext, calendar, curVal);
+ } else {
+ value = curVal !=null ? curVal.toString() : "";
+ }
+ }
+
+ if (value == null) {
+ value = "";
+ }
+
+ return value;
+
+ }
+
+ public String getButtonIcon(FacesContext facesContext, UIComponent component) {
+ boolean disable = (Boolean)component.getAttributes().get("disable");
+ String buttonIcon = (String)component.getAttributes().get("buttonIcon");
+ if(disable) {
+ buttonIcon = (String)component.getAttributes().get("buttonIconDisabled");
+ }
+
+ if(buttonIcon != null && buttonIcon.trim().length() != 0) {
+ buttonIcon = ViewUtil.getResourceURL(buttonIcon, facesContext);
+ } else {
+ buttonIcon = disable ? CALENDAR_ICON_RESOURCE_NAME: CALENDAR_ICON_RESOURCE_NAME;
+ buttonIcon = RenderKitUtils.getResourcePath(facesContext, "org.richfaces.images",buttonIcon);
+ }
+
+ return buttonIcon;
+ }
+
+ public Object getSelectedDate(FacesContext facesContext, UIComponent component) throws IOException {
+ Object returnValue = null;
+ AbstractCalendar calendar = (AbstractCalendar)component;
+ if(calendar.isValid()) {
+ Date date;
+ Object value = calendar.getValue();
+ date = CalendarHelper.getAsDate(facesContext, calendar, value);
+ if(date != null) {
+ returnValue = formatSelectedDate(calendar.getTimeZone(), date);
+ }
+ }
+ return returnValue;
+ }
+
+ public static Object formatSelectedDate(TimeZone timeZone, Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeZone(timeZone);
+ calendar.setTime(date);
+
+ JSFunction result = new JSFunction("new Date");
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.HOUR_OF_DAY)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.MINUTE)));
+ result.addParameter(new Integer(0));
+
+ return result;
+ }
+
+ public Object getCurrentDate(FacesContext facesContext, AbstractCalendar calendar) throws IOException {
+ Date date = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
+ return formatDate(date);
+ }
+
+ public String getCurrentDateAsString(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractCalendar calendar = (AbstractCalendar)component;
+ Format formatter = new SimpleDateFormat("MM/yyyy");
+
+ Date currentDate = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
+ return formatter.format(currentDate);
+ }
+
+ public static Object formatDate(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ JSFunction result = new JSFunction("new Date");
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
+
+ return result;
+ }
+
+ public String getDayCellClass(FacesContext facesContext, AbstractCalendar calendar) {
+ //TODO: refactor this
+ /*
+ String cellwidth = (String) component.getAttributes().get("cellWidth");
+ String cellheight = (String) component.getAttributes().get("cellHeight");
+ if (cellwidth != null && cellwidth.length() != 0 || cellheight != null
+ && cellheight.length() != 0) {
+ String clientId = component.getClientId(context);
+ String value = clientId.replace(':', '_') + "DayCell";
+ return value;
+ }
+ */
+ return null;
+ }
+
+ public JSReference getIsDayEnabled(FacesContext facesContext, AbstractCalendar calendar) {
+ return calendar.isDayEnabled() ? JSReference.TRUE : JSReference.FALSE;
+ }
+
+ public JSReference getDayStyleClass(FacesContext context, AbstractCalendar calendar) {
+ String dayStyleClass = calendar.getDayStyleClass();
+ return ((dayStyleClass != null && dayStyleClass.trim().length() != 0)) ? new JSReference(dayStyleClass) : null;
+ }
+
+
+ public Map<String, Object> getLabels(FacesContext facesContext, AbstractCalendar calendar) {
+ ResourceBundle bundle1 = null;
+ ResourceBundle bundle2 = null;
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ String messageBundle = facesContext.getApplication().getMessageBundle();
+ Locale locale = CalendarHelper.getAsLocale(facesContext, calendar);
+ if (null != messageBundle) {
+ bundle1 = ResourceBundle.getBundle(messageBundle,locale , loader);
+ }
+
+ try {
+ bundle2 = ResourceBundle.getBundle(CALENDAR_BUNDLE, locale, loader);
+ } catch (MissingResourceException e) {
+ //No external bundle was found, ignore this exception.
+ }
+
+ ResourceBundle [] bundles = {bundle1, bundle2};
+ String[] names = {"apply", "today", "clean", "cancel", "ok", "close"};
+
+ return getCollectedLabels(bundles, names);
+ }
+
+ protected Map<String, Object> getCollectedLabels(ResourceBundle [] bundles , String[] names) {
+ Map<String, Object> labels = new HashMap<String, Object>();
+ if(bundles != null && names != null) {
+ for (String name: names) {
+ String label = null;
+ String bundleKey = "RICH_CALENDAR_" + name.toUpperCase() + "_LABEL";
+ for(ResourceBundle bundle: bundles) {
+ if (bundle != null) {
+ try {
+ label = bundle.getString(bundleKey);
+ } catch (MissingResourceException mre) {
+ // Current key was not found, ignore this exception;
+ }
+ }
+ if(label != null) {
+ break;
+ }
+ }
+ RenderKitUtils.addToScriptHash(labels, name, label);
+ }
+ }
+ return labels;
+ }
+
+ public Map<String, Object> getPreparedDefaultTime(FacesContext facesContext, AbstractCalendar abstractCalendar) {
+ Date date = CalendarHelper.getFormattedDefaultTime(abstractCalendar);
+ Map<String, Object> result = new HashMap<String, Object>();
+ if (date != null) {
+ Calendar calendar = CalendarHelper.getCalendar(facesContext, abstractCalendar);
+ calendar.setTime(date);
+ int hours = calendar.get(Calendar.HOUR_OF_DAY);
+ int minutes = calendar.get(Calendar.MINUTE);
+
+ if (hours != 12 || minutes != 0) {
+ result.put(HOURS_VALUE, hours);
+ result.put(MINUTES_VALUE, minutes);
+ }
+ }
+ return result;
+ }
+
+ private static String[] shiftDates(int minimum, int maximum, String[] labels) {
+ if (minimum == 0 && (maximum - minimum == labels.length - 1)) {
+ return labels;
+ }
+
+ String[] shiftedLabels = new String[maximum - minimum + 1];
+ System.arraycopy(labels, minimum, shiftedLabels, 0, maximum - minimum
+ + 1);
+
+ return shiftedLabels;
+ }
+
+ protected Map<String, Object> getLocaleOptions(FacesContext facesContext, AbstractCalendar calendarComponent) {
+ Map<String, Object> map = new HashMap<String, Object>();
+
+ Locale locale = CalendarHelper.getAsLocale(facesContext, calendarComponent);
+ DateFormatSymbols dateFormat = new DateFormatSymbols(locale);
+
+ Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarComponent);
+ int maximum = calendar.getActualMaximum(Calendar.DAY_OF_WEEK);
+ int minimum = calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
+
+ int monthMax = calendar.getActualMaximum(Calendar.MONTH);
+ int monthMin = calendar.getActualMinimum(Calendar.MONTH);
+
+ String [] weekDayLabels = RenderKitUtils.asArray(calendarComponent.getWeekDayLabels());
+ if(weekDayLabels == null) {
+ weekDayLabels = dateFormat.getWeekdays();
+ weekDayLabels = shiftDates(minimum, maximum, weekDayLabels);
+ }
+ RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS, weekDayLabels);
+
+ String [] weekDayLabelsShort = RenderKitUtils.asArray(calendarComponent.getWeekDayLabelsShort());
+ if(weekDayLabelsShort == null) {
+ weekDayLabelsShort = dateFormat.getShortWeekdays();
+ weekDayLabelsShort = shiftDates(minimum, maximum, weekDayLabelsShort);
+ }
+ RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);
+
+ String [] monthLabels = RenderKitUtils.asArray(calendarComponent.getMonthLabels());
+ if(monthLabels == null) {
+ monthLabels = dateFormat.getMonths();
+ monthLabels = shiftDates(monthMin, monthMax, monthLabels);
+ }
+ RenderKitUtils.addToScriptHash(map, MONTH_LABELS, monthLabels);
+
+
+ String [] monthLabelsShort = RenderKitUtils.asArray(calendarComponent.getMonthLabelsShort());
+ if(monthLabelsShort == null) {
+ monthLabelsShort = dateFormat.getShortMonths();
+ monthLabelsShort = shiftDates(monthMin, monthMax, monthLabelsShort);
+ }
+ RenderKitUtils.addToScriptHash(map, MONTH_LABELS_SHORT, monthLabelsShort);
+
+ int minDaysInFirstWeek = calendarComponent.getMinDaysInFirstWeek();
+ if(minDaysInFirstWeek == Integer.MIN_VALUE) {
+ minDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
+ }
+
+ if (0 <= minDaysInFirstWeek && minDaysInFirstWeek <= 7) {
+ RenderKitUtils.addToScriptHash(map, MIN_DAYS_IN_FIRST_WEEK, minDaysInFirstWeek);
+ }
+
+ int day = calendarComponent.getFirstWeekDay();
+ if(day == Integer.MIN_VALUE) {
+ day = calendar.getFirstDayOfWeek();
+ day = calendar.getFirstDayOfWeek() - calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
+ }
+
+ if (0 <= day && day <= 6) {
+ RenderKitUtils.addToScriptHash(map, FIRST_DAY_WEEK, day);
+ } else if (day != Integer.MIN_VALUE) {
+ facesContext.getExternalContext().log(day + " value of firstWeekDay attribute is not a legal one for component: " + MessageUtil.getLabel(facesContext, calendarComponent) + ". Default value was applied.");
+ }
+
+ return map;
+ }
+
+ public ScriptOptions createCalendarScriptOption(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractCalendar calendar = (AbstractCalendar)component;
+ ScriptOptions scriptOptions = new ScriptOptions(component);
+ scriptOptions.addOption(OPTION_ENABLE_MANUAL_INPUT);
+ scriptOptions.addOption(OPTION_DISABLED);
+ scriptOptions.addOption(OPTION_READONLY);
+ scriptOptions.addOption(OPTION_RESET_TIME_ON_DATE_SELECT);
+ scriptOptions.addOption(OPTION_SHOW_APPLY_BUTTON);
+ scriptOptions.addOption(OPTION_POPUP);
+ scriptOptions.addOption(OPTION_SHOW_INPUT);
+ scriptOptions.addOption(OPTION_SHOW_HEADER);
+ scriptOptions.addOption(OPTION_SHOW_FOOTER);
+ scriptOptions.addOption(OPTION_SHOW_WEEKS_BAR);
+ scriptOptions.addOption(OPTION_TODAY_CONTROL_MODE);
+ scriptOptions.addOption(OPTION_DATE_PATTERN);
+ scriptOptions.addOption(OPTION_JOINT_POINT);
+ scriptOptions.addOption(OPTION_DIRECTION);
+ scriptOptions.addOption(OPTION_BOUNDARY_DATES_MODE);
+ scriptOptions.addOption(OPTION_HORIZONTAL_OFFSET);
+ scriptOptions.addOption(OPTION_VERTICAL_OFFSET);
+ scriptOptions.addOption(OPTION_CURRENT_DATE, getCurrentDate(facesContext, calendar));
+ scriptOptions.addOption(OPTION_SELECTED_DATE, getSelectedDate(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DAY_CELL_CLASS, getDayCellClass(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DAY_STYLE_CLASS, getDayStyleClass(facesContext, calendar));
+ /*
+ *add to script option
+ *<cdk:scriptOption attributes="ondateselected, ondateselect, ontimeselect, ontimeselected, onchanged, ondatemouseover, ondatemouseout, onexpand, oncollapse, oncurrentdateselect, oncurrentdateselected" wrapper="eventHandler" />
+ * */
+ scriptOptions.addOption(OPTION_LABELS, getLabels(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DEFAULT_TIME, getPreparedDefaultTime(facesContext, calendar));
+ scriptOptions.addOption(OPTION_HIDE_POPUP_ON_SCROLL);
+ scriptOptions.addOption("showWeekDaysBar");
+
+ scriptOptions.addOption("styleClass");
+ scriptOptions.addOption("style", HtmlUtil.concatStyles("z-index: " + calendar.getZindex(), calendar.getStyle()));
+
+ return scriptOptions;
+ }
+
+ public void buildAddLocaleScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
+ if(component instanceof AbstractCalendar) {
+ AbstractCalendar calendar = (AbstractCalendar)component;
+ JSFunction function = new JSFunction("RichFaces.ui.Calendar.addLocale", CalendarHelper.getAsLocale(facesContext, calendar), getLocaleOptions(facesContext, calendar));
+ writer.write(function.toScript());
+ writer.write(";");
+ }
+ }
+
+ public void buildCalendarScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
+ if(component instanceof AbstractCalendar) {
+ AbstractCalendar calendar = (AbstractCalendar)component;
+ ScriptOptions scriptOptions = createCalendarScriptOption(facesContext, calendar);
+ JSFunction function = new JSFunction("new RichFaces.ui.Calendar", calendar.getClientId(facesContext), CalendarHelper.getAsLocale(facesContext, calendar), scriptOptions, "");
+ StringBuffer scriptBuffer = new StringBuffer();
+ scriptBuffer.append(function.toScript()).append(".load();");
+ writer.write(scriptBuffer.toString());
+ }
+ }
+
+ public boolean isUseIcons(FacesContext facesContext, UIComponent component) {
+ Object label = component.getAttributes().get("buttonLabel");
+ return (label == null || ((String)label).trim().length() == 0);
+ }
+
+ protected Converter createDefaultConverter() {
+ return new DateTimeConverter();
+ }
+
+ protected Converter setupConverter(FacesContext facesContext, Converter converter, AbstractCalendar calendar) {
+ if(converter == null || calendar == null) {
+ return null;
+ }
+
+ if(converter instanceof DateTimeConverter) {
+ DateTimeConverter defaultConverter = (DateTimeConverter) converter;
+ defaultConverter.setPattern(calendar.getDatePattern());
+ defaultConverter.setLocale( CalendarHelper.getAsLocale(facesContext, calendar));
+ defaultConverter.setTimeZone(calendar.getTimeZone());
+ }
+ return converter;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,164 +0,0 @@
-package org.richfaces.renderkit.html.images;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.RoundRectangle2D;
-import java.awt.image.BufferedImage;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.DynamicResource;
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.PostConstructResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author amarkhel
- *
- */
-@DynamicResource
-public class CalendarIcon implements Java2DUserResource, StateHolderResource{
-
- private static final Dimension DIMENSION = new Dimension(20, 20);
-
- private Integer headerTextColor;
-
- private Integer headerBackgroundColor;
-
-
- @PostConstructResource
- public final void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- this.headerTextColor = skin.getColorParameter(context, Skin.HEADER_BACKGROUND_COLOR);
- this.headerBackgroundColor = skin.getColorParameter(context, Skin.SELECT_CONTROL_COLOR);
- }
-
-
- public boolean isTransient() {
- return false;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
- dataOutput.writeInt(this.headerTextColor);
- dataOutput.writeInt(this.headerBackgroundColor);
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException {
- this.headerTextColor = dataInput.readInt();
- this.headerBackgroundColor = dataInput.readInt();
- }
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- public ImageType getImageType() {
- return ImageType.PNG;
- }
-
- public Dimension getDimension() {
- return DIMENSION;
- }
-
- protected BufferedImage createImage(int width, int height) {
- return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
- }
-
- public void paint(Graphics2D graphics2d, Dimension dimension) {
- BufferedImage image = paintImage();
- graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- graphics2d.drawImage(image, 0, 0, dimension.width, dimension.height, null);
- }
-
- public BufferedImage paintImage() {
-
- BufferedImage image = createImage(16, 16);
-
- Graphics2D g2d = image.createGraphics();
-
- Color borderColor = new Color(this.headerTextColor);
- Color activeColor = new Color(this.headerBackgroundColor);
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
-
- g2d.setStroke(new BasicStroke(1));
-
- int w = 16;
- int h = 16;
-
- //Draw Border
- g2d.setColor(borderColor);
- Rectangle2D border = new Rectangle2D.Double(1, 1, w - 3, h - 3);
- RoundRectangle2D round = new RoundRectangle2D.Double(1, 1, w- 3, h - 3, 2, 2);
- g2d.draw(round);
-
- Color lightBlue = new Color(216, 226, 240);
- Paint gradient1 = new GradientPaint(w-4, h-4, lightBlue, 2, 2, Color.white);
- g2d.setPaint(gradient1);
- border = new Rectangle2D.Double(2, 2, w - 4, h - 4);
- g2d.fill(border);
-
- border = new Rectangle2D.Double(3, 3, w - 6, h - 6);
- gradient1 = new GradientPaint(3, 3, lightBlue , w - 6, h - 6, borderColor);
- g2d.setPaint(gradient1);
- g2d.fill(border);
-
- g2d.setColor(Color.white);
- g2d.drawLine(3, 6, 3, 11);
- g2d.drawLine(5, 6, 5, 11);
- g2d.drawLine(7, 6, 7, 11);
- g2d.drawLine(9, 6, 9, 11);
- g2d.drawLine(11, 6, 11, 11);
-
- //Draw orange rectangle
- border = new Rectangle2D.Double(3, 3, 10, 3);
- g2d.setColor(Color.white);
- g2d.fill(border);
-
- Color c = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 100);
- Color c2 = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 200);
-
- gradient1 = new GradientPaint(12, 4, activeColor, 4, 7, c2);
- g2d.setPaint(gradient1);
- g2d.fill(border);
- //g2d.setColor(activeColor);
-
- c = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 150);
- c2 = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 200);
- border = new Rectangle2D.Double(4, 4, 8, 1);
-
- g2d.setColor(Color.white);
- g2d.fill(border);
-
- gradient1 = new GradientPaint(4, 4, c, 10, 4, c2);
- //g2d.setPaint(gradient1);
- g2d.setColor(c);
- g2d.fill(border);
-
- g2d.dispose();
-
- return image;
- }
-}
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java (from rev 19756, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.awt.RenderingHints;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author amarkhel
+ *
+ */
+@DynamicResource
+public class CalendarIcon implements Java2DUserResource, StateHolderResource{
+
+ private static final Dimension DIMENSION = new Dimension(20, 20);
+
+ private Integer headerTextColor;
+
+ private Integer headerBackgroundColor;
+
+
+ @PostConstructResource
+ public final void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+
+ this.headerTextColor = skin.getColorParameter(context, Skin.HEADER_BACKGROUND_COLOR);
+ this.headerBackgroundColor = skin.getColorParameter(context, Skin.SELECT_CONTROL_COLOR);
+ }
+
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ dataOutput.writeInt(this.headerTextColor);
+ dataOutput.writeInt(this.headerBackgroundColor);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ this.headerTextColor = dataInput.readInt();
+ this.headerBackgroundColor = dataInput.readInt();
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return null;
+ }
+
+ public Date getLastModified() {
+ return null;
+ }
+
+ public ImageType getImageType() {
+ return ImageType.PNG;
+ }
+
+ public Dimension getDimension() {
+ return DIMENSION;
+ }
+
+ protected BufferedImage createImage(int width, int height) {
+ return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
+ }
+
+ public void paint(Graphics2D graphics2d, Dimension dimension) {
+ BufferedImage image = paintImage();
+ graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ graphics2d.drawImage(image, 0, 0, dimension.width, dimension.height, null);
+ }
+
+ public BufferedImage paintImage() {
+
+ BufferedImage image = createImage(16, 16);
+
+ Graphics2D g2d = image.createGraphics();
+
+ Color borderColor = new Color(this.headerTextColor);
+ Color activeColor = new Color(this.headerBackgroundColor);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+
+ g2d.setStroke(new BasicStroke(1));
+
+ int w = 16;
+ int h = 16;
+
+ //Draw Border
+ g2d.setColor(borderColor);
+ Rectangle2D border = new Rectangle2D.Double(1, 1, w - 3, h - 3);
+ RoundRectangle2D round = new RoundRectangle2D.Double(1, 1, w- 3, h - 3, 2, 2);
+ g2d.draw(round);
+
+ Color lightBlue = new Color(216, 226, 240);
+ Paint gradient1 = new GradientPaint(w-4, h-4, lightBlue, 2, 2, Color.white);
+ g2d.setPaint(gradient1);
+ border = new Rectangle2D.Double(2, 2, w - 4, h - 4);
+ g2d.fill(border);
+
+ border = new Rectangle2D.Double(3, 3, w - 6, h - 6);
+ gradient1 = new GradientPaint(3, 3, lightBlue , w - 6, h - 6, borderColor);
+ g2d.setPaint(gradient1);
+ g2d.fill(border);
+
+ g2d.setColor(Color.white);
+ g2d.drawLine(3, 6, 3, 11);
+ g2d.drawLine(5, 6, 5, 11);
+ g2d.drawLine(7, 6, 7, 11);
+ g2d.drawLine(9, 6, 9, 11);
+ g2d.drawLine(11, 6, 11, 11);
+
+ //Draw orange rectangle
+ border = new Rectangle2D.Double(3, 3, 10, 3);
+ g2d.setColor(Color.white);
+ g2d.fill(border);
+
+ Color c = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 100);
+ Color c2 = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 200);
+
+ gradient1 = new GradientPaint(12, 4, activeColor, 4, 7, c2);
+ g2d.setPaint(gradient1);
+ g2d.fill(border);
+ //g2d.setColor(activeColor);
+
+ c = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 150);
+ c2 = new Color(activeColor.getRed(), activeColor.getGreen(), activeColor.getBlue(), 200);
+ border = new Rectangle2D.Double(4, 4, 8, 1);
+
+ g2d.setColor(Color.white);
+ g2d.fill(border);
+
+ gradient1 = new GradientPaint(4, 4, c, 10, 4, c2);
+ //g2d.setPaint(gradient1);
+ g2d.setColor(c);
+ g2d.fill(border);
+
+ g2d.dispose();
+
+ return image;
+ }
+}
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,84 +0,0 @@
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.PostConstructResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author amarkhel
- *
- */
-public class CalendarSeparator implements Java2DUserResource, StateHolderResource {
-
- private static final Dimension DIMENSION = new Dimension(1, 15);
-
- private Integer headerTextColor;
-
- @PostConstructResource
- public void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- this.headerTextColor = skin.getColorParameter(context, Skin.HEAD_TEXT_COLOR);
- }
-
- public boolean isTransient() {
- return false;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
- dataOutput.writeInt(this.headerTextColor);
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException {
- this.headerTextColor = dataInput.readInt();
- }
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- public ImageType getImageType() {
- return ImageType.PNG;
- }
-
- public Dimension getDimension() {
- return DIMENSION;
- }
-
- public void paint(Graphics2D graphics2d, Dimension dimension) {
- graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
- graphics2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
- graphics2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- graphics2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
- graphics2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- graphics2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- Color color = new Color(this.headerTextColor);
- graphics2d.setColor(color);
-
- for (int i = 0;i < DIMENSION.getHeight(); i += 2 ) {
- graphics2d.drawLine(0, i, 0, i);
- }
- }
-}
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java (from rev 19756, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class CalendarSeparator implements Java2DUserResource, StateHolderResource {
+
+ private static final Dimension DIMENSION = new Dimension(1, 15);
+
+ private Integer headerTextColor;
+
+ @PostConstructResource
+ public void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+
+ this.headerTextColor = skin.getColorParameter(context, Skin.HEAD_TEXT_COLOR);
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ dataOutput.writeInt(this.headerTextColor);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ this.headerTextColor = dataInput.readInt();
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return null;
+ }
+
+ public Date getLastModified() {
+ return null;
+ }
+
+ public ImageType getImageType() {
+ return ImageType.PNG;
+ }
+
+ public Dimension getDimension() {
+ return DIMENSION;
+ }
+
+ public void paint(Graphics2D graphics2d, Dimension dimension) {
+ graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ graphics2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ graphics2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ graphics2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ graphics2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ graphics2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ Color color = new Color(this.headerTextColor);
+ graphics2d.setColor(color);
+
+ for (int i = 0;i < DIMENSION.getHeight(); i += 2 ) {
+ graphics2d.drawLine(0, i, 0, i);
+ }
+ }
+}
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,46 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Transparency;
-import java.awt.color.ColorSpace;
-import java.awt.image.BufferedImage;
-import java.awt.image.ComponentColorModel;
-import java.awt.image.DataBuffer;
-import java.awt.image.WritableRaster;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class DisabledCalendarIcon extends CalendarIcon {
-
- @Override
- protected BufferedImage createImage(int width, int height) {
- ColorSpace gsColorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY);
- ComponentColorModel ccm = new ComponentColorModel(gsColorSpace, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
- WritableRaster raster = ccm.createCompatibleWritableRaster(width, height);
-
- return new BufferedImage(ccm, raster, ccm.isAlphaPremultiplied(), null);
- }
-
-}
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java (from rev 19756, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.WritableRaster;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class DisabledCalendarIcon extends CalendarIcon {
+
+ @Override
+ protected BufferedImage createImage(int width, int height) {
+ ColorSpace gsColorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+ ComponentColorModel ccm = new ComponentColorModel(gsColorSpace, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
+ WritableRaster raster = ccm.createCompatibleWritableRaster(width, height);
+
+ return new BufferedImage(ccm, raster, ccm.isAlphaPremultiplied(), null);
+ }
+
+}
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,54 +0,0 @@
-package org.richfaces.taglib;
-
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-
-import org.richfaces.component.AbstractCalendar;
-
-public class CalendarHandler extends ComponentHandler{
-
- private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
-
-
- public CalendarHandler(ComponentConfig config) {
- super(config);
- }
-
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(METARULE);
- return m;
- }
-
- static class CalendarHandlerMetaRule extends MetaRule {
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
- return new CalendarMapper(attribute);
- }
- return null;
- }
-
- }
-
- static class CalendarMapper extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] { org.richfaces.events.CurrentDateChangeListener.class };
-
- private final TagAttribute attribute;
-
- public CalendarMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
- }
- }
-}
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java (from rev 19756, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.richfaces.taglib;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractCalendar;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class CalendarHandler extends ComponentHandler {
+
+ private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
+
+ public CalendarHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class CalendarHandlerMetaRule extends MetaRule {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
+ return new CalendarMapper(attribute);
+ }
+ return null;
+ }
+
+ }
+
+ static class CalendarMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.CurrentDateChangeListener.class };
+
+ private final TagAttribute attribute;
+
+ public CalendarMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(
+ this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+}
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java 2010-10-29 09:58:54 UTC (rev 19754)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.taglib;
-
-import javax.el.MethodExpression;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.events.CurrentDateChangeEvent;
-import org.richfaces.events.CurrentDateChangeListener;
-
-public class MethodExpressionCurrentDateChangeListener implements CurrentDateChangeListener {
-
- private MethodExpression methodExpression;
-
- public MethodExpressionCurrentDateChangeListener() {
- super();
- }
-
- MethodExpressionCurrentDateChangeListener(MethodExpression methodExpression) {
- super();
- this.methodExpression = methodExpression;
- }
-
- public void processCurrentDateChange(CurrentDateChangeEvent event) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
- }
-}
Copied: trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java (from rev 19756, sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java)
===================================================================
--- trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java (rev 0)
+++ trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java 2010-10-29 11:48:42 UTC (rev 19760)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.taglib;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.event.CurrentDateChangeEvent;
+import org.richfaces.event.CurrentDateChangeListener;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class MethodExpressionCurrentDateChangeListener implements CurrentDateChangeListener {
+
+ private MethodExpression methodExpression;
+
+ public MethodExpressionCurrentDateChangeListener() {
+ super();
+ }
+
+ MethodExpressionCurrentDateChangeListener(MethodExpression methodExpression) {
+ super();
+ this.methodExpression = methodExpression;
+ }
+
+ public void processCurrentDateChange(CurrentDateChangeEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
+ }
+}
14 years, 2 months
JBoss Rich Faces SVN: r19759 - in trunk: ui/output/ui/src/main/java/org/richfaces/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-29 07:39:19 -0400 (Fri, 29 Oct 2010)
New Revision: 19759
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
Log:
RF-9474 Tooltip component
small fixes
Modified: trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-10-29 11:37:52 UTC (rev 19758)
+++ trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-10-29 11:39:19 UTC (rev 19759)
@@ -46,11 +46,11 @@
<p>Page</p>
<h:form id="f" style="border:blue solid thin;">
- <div id="div" style="border: 2px solid red; background-color: #adff2f; width:300px; height:300px">
- Hello
+ <div id="myRectangle" style="border: 2px solid red; background-color: #adff2f; width:300px; height:300px">
+ Tooltip apeared under green rectangle.
- <pn:tooltip id="tooltip" target="div">
- ToolTip Yo!!!
+ <pn:tooltip id="tooltip" target="myRectangle" mode="ajax">
+ New ToolTip Yo!!!
</pn:tooltip>
</div>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-10-29 11:37:52 UTC (rev 19758)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-10-29 11:39:19 UTC (rev 19759)
@@ -25,6 +25,7 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.TooltipMode;
import org.richfaces.component.AbstractTooltip;
import org.richfaces.component.html.HtmlTooltip;
import org.richfaces.renderkit.HtmlConstants;
@@ -34,6 +35,7 @@
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.util.HashMap;
@@ -105,7 +107,10 @@
writer.writeAttribute("id", component.getClientId(context) + ":cntr", null);
writer.writeAttribute("class", "rf-tt-cntr", null);
- encodeLoading(writer, context, tooltip);
+ if (tooltip.getMode() == TooltipMode.ajax) {
+ encodeLoading(writer, context, tooltip);
+ }
+
encodeContentBegin(writer, context, tooltip);
}
@@ -197,13 +202,16 @@
public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) throws IOException {
if (AbstractTooltip.CONTENT_META_COMPONENT_ID.equals(metaComponentId)) {
AbstractTooltip tooltip = (AbstractTooltip) component;
- ResponseWriter writer = context.getResponseWriter();
-
+ PartialResponseWriter writer = context.getPartialViewContext().getPartialResponseWriter();
+ writer.startUpdate(((AbstractTooltip) component).getContentClientId(context));
+
encodeContentBegin(writer, context, tooltip);
for (UIComponent child : tooltip.getChildren()) {
child.encodeAll(context);
}
encodeContentEnd(writer, context, tooltip);
+
+ writer.endUpdate();
}
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-10-29 11:37:52 UTC (rev 19758)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-10-29 11:39:19 UTC (rev 19759)
@@ -120,7 +120,7 @@
this.options = $.extend({}, DEFAULT_OPTIONS, this.options || {}, options || {});
this.attachToDom.call(this, componentId);
- this.mode = TooltipMode.ajax;
+ this.mode = this.options.mode;
this.target = this.options.target;
this.__addUserEventHandler("hide");
@@ -140,19 +140,19 @@
tooltip.popup.show(event);
}
- $(this.options.target).bind(this.options.showEvent, function (event) {
+ $(document.getElementById(this.target)).bind(this.options.showEvent, function (event) {
tooltip.show(event);
if (tooltip.options.followMouse) {
- $(tooltip.target).bind("mousemove", mouseMoveHandler);
+ $(document.getElementById(tooltip.target)).bind("mousemove", mouseMoveHandler);
}
});
- $(tooltip.target).bind(this.options.hideEvent, function (event) {
+ $(document.getElementById(tooltip.target)).bind(this.options.hideEvent, function (event) {
tooltip.hide();
if (tooltip.options.followMouse) {
- $(tooltip.target).unbind("mousemove", mouseMoveHandler);
+ $(document.getElementById(tooltip.target)).unbind("mousemove", mouseMoveHandler);
}
});
@@ -207,8 +207,8 @@
},
onCompleteHandler : function () {
+ this.__content().show();
this.__loading().hide();
- this.__content().show();
return this.__fireShow();
},
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-10-29 11:37:52 UTC (rev 19758)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-10-29 11:39:19 UTC (rev 19759)
@@ -25,7 +25,7 @@
}
.rf-tt-loading {
-
+ display:none;
}
.rf-tt-cnt {
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2010-10-29 11:37:52 UTC (rev 19758)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2010-10-29 11:39:19 UTC (rev 19759)
@@ -1,6 +1,5 @@
<span id="f:tooltip" class="rf-tt">
<span id="f:tooltip:cntr" class="rf-tt-cntr">
- <span id="f:tooltip:loading" class="rf-tt-loading">Loading...</span>
<span id="f:tooltip@content" class="rf-tt-cnt"></span>
</span>
<script type="text/javascript">
14 years, 2 months
JBoss Rich Faces SVN: r19758 - sandbox/trunk/ui/calendar/api.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-29 07:37:52 -0400 (Fri, 29 Oct 2010)
New Revision: 19758
Added:
sandbox/trunk/ui/calendar/api/pom.xml
Log:
add api pom.xml
Added: sandbox/trunk/ui/calendar/api/pom.xml
===================================================================
--- sandbox/trunk/ui/calendar/api/pom.xml (rev 0)
+++ sandbox/trunk/ui/calendar/api/pom.xml 2010-10-29 11:37:52 UTC (rev 19758)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.calendar</groupId>
+ <artifactId>richfaces-ui-calendar-api</artifactId>
+ <name>Richfaces UI Components: Calendar API</name>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- runtime -->
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.common</groupId>
+ <artifactId>richfaces-ui-common-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
14 years, 2 months