Author: vbaranov
Date: 2008-04-28 11:02:17 -0400 (Mon, 28 Apr 2008)
New Revision: 8237
Modified:
trunk/ui/gmap/src/main/config/component/gmap.xml
trunk/ui/gmap/src/main/java/org/richfaces/component/UIGmap.java
trunk/ui/gmap/src/main/templates/gmap.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1902
Modified: trunk/ui/gmap/src/main/config/component/gmap.xml
===================================================================
--- trunk/ui/gmap/src/main/config/component/gmap.xml 2008-04-28 14:02:27 UTC (rev 8236)
+++ trunk/ui/gmap/src/main/config/component/gmap.xml 2008-04-28 15:02:17 UTC (rev 8237)
@@ -73,6 +73,12 @@
<defaultvalue>"-122.0424842834"</defaultvalue>
</property>
<property>
+ <name>locale</name>
+ <classname>java.lang.Object</classname>
+ <description>Used for locale definition. Default value is
"getDefaultLocale()".</description>
+ <defaultvalue>getDefaultLocale()</defaultvalue>
+ </property>
+ <property>
<name>zoom</name>
<classname>java.lang.String</classname>
<description>
Modified: trunk/ui/gmap/src/main/java/org/richfaces/component/UIGmap.java
===================================================================
--- trunk/ui/gmap/src/main/java/org/richfaces/component/UIGmap.java 2008-04-28 14:02:27
UTC (rev 8236)
+++ trunk/ui/gmap/src/main/java/org/richfaces/component/UIGmap.java 2008-04-28 15:02:17
UTC (rev 8237)
@@ -21,7 +21,11 @@
package org.richfaces.component;
+import java.util.Locale;
+
import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
/**
* JSF component class
@@ -32,5 +36,24 @@
public static final String COMPONENT_TYPE = "org.richfaces.Gmap";
private static final String COMPONENT_FAMILY = "org.richfaces.Gmap";
-
+
+ /**
+ * Returns default <code>Locale</code>.
+ * @return default <code>Locale</code>
+ */
+ protected Locale getDefaultLocale() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ if (facesContext != null) {
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (viewRoot != null) {
+ Locale locale = viewRoot.getLocale();
+ if (locale != null) {
+ return locale;
+ }
+ }
+ }
+
+ return Locale.US;
+ }
}
Modified: trunk/ui/gmap/src/main/templates/gmap.jspx
===================================================================
--- trunk/ui/gmap/src/main/templates/gmap.jspx 2008-04-28 14:02:27 UTC (rev 8236)
+++ trunk/ui/gmap/src/main/templates/gmap.jspx 2008-04-28 15:02:17 UTC (rev 8237)
@@ -10,7 +10,7 @@
component="org.richfaces.component.UIGmap">
<f:clientid var="clientId"/>
-
+ <c:set var="locale"
value="#{component.attributes['locale']}"/>
<c:set var="key"
value="#{component.attributes['gmapKey']}"/>
<c:set var="zoom"
value="#{component.attributes['zoom']}"/>
<c:set var="map"
value="#{component.attributes['gmapVar']}"/>
@@ -31,7 +31,7 @@
<div id="#{clientId}" class="dr-gmap rich-gmap
#{component.attributes['styleClass']}"
x:passThruWithExclusions="id,class,styleClass">
-<script type="text/javascript"
src="http://maps.google.com/maps?file=api&v=2&key=#{... />
+<script type="text/javascript"
src="http://maps.google.com/maps?file=api&v=2&key=#{...
/>
<script type="text/javascript">
//<![CDATA[