Skip to content

Commit

Permalink
Merge pull request #1 from wicketstuff/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
bitstorm committed Jan 5, 2013
2 parents 8793573 + 57d131e commit f0cd197
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wicket="http://wicket.sourceforge.net/">
<body>
<wicket:panel>
<div wicket:id="map" style="margin-left: auto; margin-right: auto; width: 600px; height: 400px;">Map</div>
</wicket:panel>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.wicketstuff.examples.gmap.simple.ajax;

import org.apache.wicket.markup.html.panel.Panel;
import org.wicketstuff.gmap.GMap;
import org.wicketstuff.gmap.api.GLatLng;

public class MapPanel extends Panel
{
public MapPanel(String id)
{
super(id);
GMap map = new GMap("map");
map.setStreetViewControlEnabled(false);
map.setScaleControlEnabled(true);
map.setScrollWheelZoomEnabled(true);
map.setCenter(new GLatLng(52.47649, 13.228573));
add(map);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* $Id: GMapExampleApplication.java 1722 2007-02-02 10:03:45Z syca $
* $Revision: 1722 $
* $Date: 2007-02-02 11:03:45 +0100 (Fr, 02 Feb 2007) $
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wicketstuff.examples.gmap.simple.ajax;

import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;

public class SimpleGMapApplication extends WebApplication
{


@Override
public Class<? extends Page> getHomePage()
{
return SimplePage.class;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wicket="http://wicket.sourceforge.net/">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Wicket Examples - GMap Panel</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<span wicket:id="mainNavigation" />

<p>
As Simple as it may get.
</p>

<div wicket:id="map" style="margin-left: auto; margin-right: auto; width: 600px; height: 400px;">Map</div>
<a href="#" wicket:id="show">Show</a>
<a href="#" wicket:id="hide">hide</a>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.wicketstuff.examples.gmap.simple.ajax;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.link.Link;
import org.wicketstuff.examples.gmap.WicketExamplePage;

/**
* SimplePage for the wicket-contrib-gmap3 project
*/
public class SimplePage extends WicketExamplePage
{

public SimplePage()
{
final MapPanel p = new MapPanel("map");
p.setVisible(false);
p.setOutputMarkupId(true);
p.setOutputMarkupPlaceholderTag(true);

add(p);
add(new AjaxLink<Void>("show")
{
@Override
public void onClick(AjaxRequestTarget target)
{
p.setVisible(true);
target.add(p);
}
});

add(new AjaxLink<Void>("hide")
{
@Override
public void onClick(AjaxRequestTarget target)
{
p.setVisible(false);
target.add(p);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@
<param-value>org.wicketstuff.examples.gmap.polygones.PolygonesGMapApplication</param-value>
</init-param>
</filter>

<filter>
<filter-name>SimpleAjaxGMapApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>org.wicketstuff.examples.gmap.simple.ajax.SimpleGMapApplication</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>GeoCodeGMapApplication</filter-name>
Expand Down Expand Up @@ -201,7 +210,12 @@
<filter-name>PolygonesGMapApplication</filter-name>
<url-pattern>/polygones/*</url-pattern>
</filter-mapping>


<filter-mapping>
<filter-name>SimpleAjaxGMapApplication</filter-name>
<url-pattern>/simple/ajax/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,14 +783,15 @@ private String getJSzoomIn()
*/
public void update()
{
final Request request = RequestCycle.get().getRequest();

// Attention: don't use setters as this will result in an endless
// AJAX request loop
bounds = GLatLngBounds.parse(request.getRequestParameters().getParameterValue("bounds").toString());
center = GLatLng.parse(request.getRequestParameters().getParameterValue("center").toString());
zoom = Integer.parseInt(request.getRequestParameters().getParameterValue("zoom").toString());
mapType = GMapType.valueOf(request.getRequestParameters().getParameterValue("currentMapType").toString());
final Request request = RequestCycle.get().getRequest();

// Attention: don't use setters as this will result in an endless
// AJAX request loop
bounds = GLatLngBounds.parse(request.getRequestParameters().getParameterValue("bounds").toString());
center = GLatLng.parse(request.getRequestParameters().getParameterValue("center").toString());
zoom = request.getRequestParameters().getParameterValue("zoom").toInt(zoom);
String requestMapType = request.getRequestParameters().getParameterValue("currentMapType").toString();
mapType = requestMapType != null ? GMapType.valueOf(request.getRequestParameters().getParameterValue("currentMapType").toString()) : mapType;
}

public void setOverlays(final List<GOverlay> overlays)
Expand Down

0 comments on commit f0cd197

Please sign in to comment.