-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding HTML representation for collections page
- Loading branch information
Showing
16 changed files
with
803 additions
and
59 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/community/wfs3/src/main/java/org/geoserver/wfs3/response/AbstractDocument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
/* | |||
* (c) 2018 Open Source Geospatial Foundation - all rights reserved | |||
* * This code is licensed under the GPL 2.0 license, available at the root | |||
* * application directory. | |||
* | |||
*/ | |||
|
|||
package org.geoserver.wfs3.response; | |||
|
|||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; | |||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
|
|||
public class AbstractDocument { | |||
protected final List<Link> links = new ArrayList<>(); | |||
|
|||
public void addLink(Link link) { | |||
links.add(link); | |||
} | |||
|
|||
@JacksonXmlProperty(namespace = Link.ATOM_NS, localName = "link") | |||
@JacksonXmlElementWrapper(useWrapping = false) | |||
public List<Link> getLinks() { | |||
return links; | |||
} | |||
|
|||
public String getLinkUrl(String classification, String type) { | |||
return links.stream() | |||
.filter(l -> Objects.equals(classification, l.getClassification())) | |||
.filter(l -> type.equals(l.getType())) | |||
.map(l -> l.getHref()) | |||
.findFirst() | |||
.orElse(null); | |||
} | |||
|
|||
public List<Link> getLinksExcept(String classification, String excludedType) { | |||
return links.stream() | |||
.filter( | |||
l -> | |||
classification == null | |||
|| Objects.equals(classification, l.getClassification())) | |||
.filter(l -> excludedType == null || !excludedType.equals(l.getType())) | |||
.collect(Collectors.toList()); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/community/wfs3/src/main/java/org/geoserver/wfs3/response/CollectionsHTMLResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
/* | |||
* (c) 2018 Open Source Geospatial Foundation - all rights reserved | |||
* * This code is licensed under the GPL 2.0 license, available at the root | |||
* * application directory. | |||
* | |||
*/ | |||
package org.geoserver.wfs3.response; | |||
|
|||
import java.io.IOException; | |||
import org.geoserver.catalog.ResourceInfo; | |||
import org.geoserver.config.GeoServer; | |||
import org.geoserver.platform.GeoServerResourceLoader; | |||
|
|||
public class CollectionsHTMLResponse extends AbstractHTMLResponse { | |||
|
|||
public CollectionsHTMLResponse(GeoServerResourceLoader loader, GeoServer geoServer) | |||
throws IOException { | |||
super(CollectionsDocument.class, loader, geoServer); | |||
} | |||
|
|||
@Override | |||
protected String getTemplateName(Object value) { | |||
return "collections.ftl"; | |||
} | |||
|
|||
@Override | |||
protected ResourceInfo getResource(Object value) { | |||
return null; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/community/wfs3/src/main/resources/org/geoserver/wfs3/response/collections.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
<#setting locale="en_US"> | |||
<html> | |||
<head> | |||
<link rel="stylesheet" href="${baseURL}wfs3css/blueprint/screen.css" type="text/css" media="screen, projection" /> | |||
<link rel="stylesheet" href="${baseURL}wfs3css/blueprint/print.css" type="text/css" media="print" /> | |||
<link rel="stylesheet" href="${baseURL}wfs3css/geoserver.css" type="text/css" media="screen, projection" /> | |||
<link rel="stylesheet" href="${baseURL}wfs3css/blueprint/ie.css" type="text/css" media="screen, projection" /> | |||
</head> | |||
<body> | |||
<div id="header"> | |||
<a href="${baseURL}"></a> | |||
</div> | |||
<div id="content"> | |||
<h2>GeoServer WFS3 collections</h2> | |||
<p>This document lists all the collections available in the WFS 3 service.<br/> | |||
This document is also available as <#list model.getLinksExcept(null, "text/html") as link><a href="${link.href}">${link.type}</a><#if link_has_next>, </#if></#list>.</p> | |||
|
|||
<#list model.collections as collection> | |||
<a id="html_${collection.name}_link" href="${collection.getLinkUrl('items', 'text/html')!}&limit=${service.maxNumberOfFeaturesForPreview}"><h4>${collection.name}</h4></a> | |||
<p> | |||
<#if collection.title??> | |||
<span id="${collection.name}_title">${collection.title}</span><br/> | |||
</#if> | |||
<#if collection.description??> | |||
<span id="${collection.name}_description">${collection.description!}</span><br/> | |||
</#if> | |||
<#assign se = collection.extent.spatial> | |||
Geographic extents: ${se.getMinX()}, ${se.getMinY()}, ${se.getMaxX()}, ${se.getMaxY()}.<br/> | |||
Collection items are also available in the following formats: | |||
<select onchange="window.open(this.options[this.selectedIndex].value + '&limit=${service.maxNumberOfFeaturesForPreview}');this.selectedIndex=0" > | |||
<option value="none" selected>--Please choose an option--</option> | |||
<#list collection.getLinksExcept("items", "text/html") as link> | |||
<option value="${link.href}">${link.type}</option> | |||
</#list> | |||
</select> | |||
</ul> | |||
</#list> | |||
</div> | |||
</body> | |||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/community/wfs3/src/main/resources/wfs3css/blueprint/AUTHORS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
Blueprint CSS Framework Authors and Contributors | |||
---------------------------------------------------------------- | |||
|
|||
Blueprint is based on the work of many talented people. It is | |||
through their good intentions we are allowed to use many of the | |||
techniques found in the framework. | |||
|
|||
(However, remember that the original authors are not maintaing | |||
the framework, so please don't waste their or your time on | |||
asking them for help or support.) | |||
|
|||
|
|||
Original CSS authors | |||
---------------------------------------------------------------- | |||
|
|||
The grid and typography is based on work by: | |||
* Jeff Croft [jeffcroft.com] | |||
* Nathan Borror [playgroundblues.com] | |||
* Christian Metts [mintchaos.com] | |||
* Wilson Miner [wilsonminer.com] | |||
|
|||
The CSS reset is based on work by: | |||
* Eric Meyer [meyerweb.com/eric] | |||
|
|||
The Fancy Type plugin is based on work by: | |||
* Mark Boulton [markboulton.co.uk] | |||
* Typogrify [typogrify.googlecode.com] | |||
|
|||
|
|||
Current team | |||
---------------------------------------------------------------- | |||
|
|||
Admin: | |||
* Olav Bjorkoy [bjorkoy.com] | |||
|
|||
Contributors: | |||
* Josh Clayton [jdclayton.com] | |||
* Kim Joar Bekkelund [kimjoar.net] | |||
* Glenn Rempe | |||
|
|||
Also, thanks to the many of people who have pitched in on | |||
the development of Blueprint through our mailing list: | |||
* groups.google.com/group/blueprintcss |
Oops, something went wrong.