-
1. Re: GMap inside modalpanel not align center
ilya_shaikovsky Jun 24, 2009 6:38 AM (in response to moiselo)at first GMap should not be reRendered. It has it's own api with could be checked in google docs and used in order to update. check richfaces-demo sample.
-
2. Re: GMap inside modalpanel not align center
moiselo Jun 24, 2009 6:49 AM (in response to moiselo)Now it is the same as the example but in a modalpanel. I tried without rerender and nothing has changed.
Thanks! -
3. Re: GMap inside modalpanel not align center
ilya_shaikovsky Jun 24, 2009 6:54 AM (in response to moiselo)sorry forgot to ask from the beggining.. which RF version used?
-
4. Re: GMap inside modalpanel not align center
moiselo Jun 24, 2009 7:03 AM (in response to moiselo)I'm using version 3.3.1GA
-
5. Re: GMap inside modalpanel not align center
ilya_shaikovsky Jun 24, 2009 7:26 AM (in response to moiselo)please provide the code the check.
-
6. Re: GMap inside modalpanel not align center
moiselo Jun 24, 2009 10:19 AM (in response to moiselo)The code is
a4j:commandButton:
<a4j:commandButton image="/images/toolBar/Globe.png" styleClass="picActionLittle"
id="btnLocRU"
oncomplete="#{rich:component('modMap')}.show()">
</a4j:commandButton>
modal panel:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:panelGrid columns="1">
<rich:modalPanel id="modMap" autosized="true" height="400" width="400" >
<rich:gmap gmapVar="map" zoom="#{gmBean.zoom}" style="width:400px;height:400px" gmapKey="#{gmBean.gmapkey}" id="gmap"/>
</rich:modalPanel>
</h:panelGrid>
</ui:composition>
Bean:
@Controller
@Scope("session")
public class GmBean {
private List point;
private String currentId;
private int zoom;
private String gmapkey;
public String getCurrentId() {
return currentId;
}
public void setCurrentId(String currentId) {
this.currentId = currentId;
}
public List getPoint() {
return point;
}
public void setPoint(List point) {
this.point = point;
}
public Place getCurrentPlace() {
Iterator it = point.iterator();
while (it.hasNext()) {
Place pl = it.next();
if (currentId.equals(pl.getId())) {
zoom = pl.getZoom(); //sync with zoom of new place
return pl;
}
}
return (Place)point.get(0);
}
public int getZoom() {
return zoom;
}
public void setZoom(int zoom) {
this.zoom = zoom;
}
public String getGmapkey() {
if (gmapkey == null) {
gmapkey = createKey();
}
return gmapkey;
}
private String createKey() {
HashMap<String,String> hosts = new HashMap<String,String>();
hosts.put("localhost", "MYKEY");
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
String host = (String)ec.getRequestHeaderMap().get("host");
String key = (String)hosts.get(host);
if (key != null)
return key;
else
return "get the key for your domain at http://www.google.com/apis/maps/signup.html";
}
public void setGmapkey(String gmapkey) {
this.gmapkey = gmapkey;
}
}