Updated at version 1.5.0
[Feature #13074] Trying to integrate with 'openlayer-basic-widgets' git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@177210 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b3e9a91388
commit
de030a6c65
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link type="text/css" rel="stylesheet" href="CKanMetadataPublisher.css">
|
||||
<script type="text/javascript"
|
||||
src="CKanMetadataPublisher/CKanMetadataPublisher.nocache.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
|
||||
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div
|
||||
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled in order for this
|
||||
application to display correctly.</div>
|
||||
</noscript>
|
||||
<div id="ckan-metadata-publisher-div"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link type="text/css" rel="stylesheet" href="CKanMetadataPublisher.css">
|
||||
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="CKanMetadataPublisher/css/ol.css">
|
||||
<script type="text/javascript" src="CKanMetadataPublisher/js/jquery-1.11.1.min.js"></script>
|
||||
<script type="text/javascript" src="CKanMetadataPublisher/js/ol.js"></script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="CKanMetadataPublisher/CKanMetadataPublisher.nocache.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
|
||||
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div
|
||||
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled in order for this
|
||||
application to display correctly.</div>
|
||||
</noscript>
|
||||
<div id="ckan-metadata-publisher-div"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>ckanpublisherservices</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.ckandatapublisherwidget.server.CKANPublisherServicesImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>ckanpublisherservices</servlet-name>
|
||||
<url-pattern>/CKanMetadataPublisher/ckanservices</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>CKanMetadataPublisher.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="${webappDirectory}/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry including="**/*.java" kind="src" output="target/ckan-metadata-publisher-widget-1.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="${webappDirectory}/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/ckan-metadata-publisher-widget-1.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -32,5 +32,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="${webappDirectory}/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/ckan-metadata-publisher-widget-1.5.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/home/costantino/workspace/ckan-metadata-publisher-widget/target/ckan-metadata-publisher-widget-1.0.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francesco-mangiacrapa/wseclipseluna/ckan-metadata-publisher-widget-TRUNK/${webappDirectory}
|
||||
launchConfigExternalUrlPrefix=
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-5-0"
|
||||
date="${buildDate}">
|
||||
<Change>[Feature #13074] Integrated with 'openlayer-basic-widgets'</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-4-1"
|
||||
date="2018-11-20">
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -12,7 +12,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>ckan-metadata-publisher-widget</artifactId>
|
||||
<version>1.4.1-SNAPSHOT</version>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<name>gCube Ckan metadata publisher widget</name>
|
||||
|
||||
<description>
|
||||
|
@ -27,6 +27,7 @@
|
|||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
@ -82,6 +83,11 @@
|
|||
<artifactId>gwt-bootstrap</artifactId>
|
||||
<version>2.3.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>openlayer-basic-widgets</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='CKanMetadataPublisher'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
<!-- Specify the application specific style sheet. -->
|
||||
<stylesheet src='CKanMetadataPublisher.css' />
|
||||
|
||||
</module>
|
|
@ -3,16 +3,20 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection.TwinColumnSelectionMainPanel;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.SelectElement;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
|
@ -40,15 +44,34 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
|
||||
// remove comment to the below line for testing the widget
|
||||
// startExample();
|
||||
// testMetadata();
|
||||
testMetadata();
|
||||
// testSelectionPanel();
|
||||
// testHideOption();
|
||||
// startTwinColumn();
|
||||
|
||||
//testSpatialWidget();
|
||||
|
||||
}
|
||||
|
||||
private void testSpatialWidget(){
|
||||
//Use AreaSelectionDialog(GeometryType.Point)
|
||||
//for specific Geometry
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
@Override
|
||||
public void execute() {
|
||||
GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//RootPanel.get("ckan-metadata-publisher-div").add(listBox);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void testHideOption() {
|
||||
|
||||
|
||||
ListBox listBox = new ListBox(true);
|
||||
listBox.addItem("A");
|
||||
listBox.addItem("B");
|
||||
|
@ -56,14 +79,14 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
listBox.addItem("D");
|
||||
listBox.addItem("E");
|
||||
listBox.addItem("F");
|
||||
|
||||
|
||||
List<String> toHide = new ArrayList<String>();
|
||||
toHide.add("A");
|
||||
toHide.add("D");
|
||||
|
||||
|
||||
RootPanel.get("ckan-metadata-publisher-div").add(listBox);
|
||||
SelectElement se = listBox.getElement().cast();
|
||||
|
||||
|
||||
// hide
|
||||
for (int i = 0; i < listBox.getItemCount(); i++) {
|
||||
if(toHide.contains(listBox.getItemText(i))){
|
||||
|
@ -71,7 +94,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
se.getOptions().getItem(i).getStyle().setProperty("display", "none");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -89,9 +112,9 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
// listLeft.add(new ResourceElementBean(null, "File I", false, null, "File I"));
|
||||
//
|
||||
// // test with folder and childs
|
||||
// ArrayList<ResourceElementBean> childrenOfA = new ArrayList<ResourceElementBean>();
|
||||
// ArrayList<ResourceElementBean> childrenOfA = new ArrayList<ResourceElementBean>();
|
||||
// ArrayList<ResourceElementBean> childrenOfW = new ArrayList<ResourceElementBean>();
|
||||
//
|
||||
//
|
||||
// ResourceElementBean elementA = new ResourceElementBean(null, "Folder A", true, childrenOfA, "Folder A");
|
||||
// childrenOfA.add(new ResourceElementBean(elementA, "File X", false, null, "Folder A:File X"));
|
||||
// childrenOfA.add(new ResourceElementBean(elementA, "File Y", false, null, "Folder A:File Y"));
|
||||
|
@ -101,7 +124,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
// childrenOfA.add(elementW);
|
||||
// childrenOfW.add(new ResourceElementBean(elementW, "File J", false, null, "Folder A:File W: File J"));
|
||||
// listLeft.add(elementA);
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
// String folderId = "e87bfc7d-4fb0-4795-9c79-0c495500ca9c";
|
||||
|
@ -137,8 +160,12 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
// checkbox
|
||||
//fields.add(new MetadataFieldWrapper("CheckBox", true, DataType.Boolean, "false", "Checkbox example", null, null));
|
||||
|
||||
|
||||
// spatial
|
||||
fields.add(new MetadataFieldWrapper("GeoJson", true, DataTypeWrapper.GeoJSON, "", "", null, null, null));
|
||||
|
||||
// number
|
||||
//fields.add(new MetadataFieldWrapper("Number", true, DataType.Number, "52", "Number example", null, null));
|
||||
fields.add(new MetadataFieldWrapper("Number", true, DataTypeWrapper.Number, "52", "Number example", null, null, null));
|
||||
|
||||
// other number
|
||||
//fields.add(new MetadataFieldWrapper("Number2", true, DataType.Number, null, "Number example 2", null, "[0-9]+"));
|
||||
|
@ -194,7 +221,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
public void onClick(ClickEvent event) {
|
||||
|
||||
for (MetaDataFieldSkeleton field : widgetsList) {
|
||||
String error = field.isFieldValueValid();
|
||||
String error = field.isFieldValueValid();
|
||||
if(error != null)
|
||||
Window.alert(field.getFieldNameOriginal() + " is not valid. Suggestion: " + error);
|
||||
else
|
||||
|
@ -213,7 +240,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
public void onClick(ClickEvent event) {
|
||||
for (MetaDataFieldSkeleton field : widgetsList)
|
||||
field.freeze();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -225,13 +252,13 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(eventBus));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// test resources
|
||||
@SuppressWarnings("unused")
|
||||
private void startTwinColumn() {
|
||||
|
||||
|
||||
TwinColumnSelectionMainPanel resourcesTwinPanel;
|
||||
|
||||
|
||||
Modal m = new Modal();
|
||||
m.setTitle("Title ......");
|
||||
m.setWidth("1200px");
|
||||
|
@ -241,10 +268,10 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
r.setName("Root");
|
||||
r.setParent(null);
|
||||
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();
|
||||
|
||||
|
||||
// random strings
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
|
||||
ResourceElementBean child = new ResourceElementBean();
|
||||
child.setFolder(false);
|
||||
child.setName("BLUE_ECONOMY_WP6_TECHNO_ECONOMIC_ANALYSIS_MODEL.CITE.PPTX" + i);
|
||||
|
@ -252,15 +279,15 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
child.setParent(r);
|
||||
child.setFullPath("/" + "BLUE_ECONOMY_WP6_TECHNO_ECONOMIC_ANALYSIS_MODEL.CITE.PPTX" + + i);
|
||||
children.add(child);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
r.setChildren(children);
|
||||
|
||||
|
||||
// create random childs
|
||||
resourcesTwinPanel = new TwinColumnSelectionMainPanel(r);
|
||||
m.add(resourcesTwinPanel);
|
||||
m.show();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget;
|
||||
|
||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEvent;
|
||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEvent.SelectAreaDialogEventHandler;
|
||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.AreaSelectionDialog;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsonUtils;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.user.client.Command;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class GeoJsonAreaSelectionDialog.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 20, 2019
|
||||
*/
|
||||
public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
||||
|
||||
|
||||
private String wktArea;
|
||||
private Command onResponseCommand;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo json area selection dialog.
|
||||
*/
|
||||
public GeoJsonAreaSelectionDialog() {
|
||||
|
||||
//THE HANDLER
|
||||
SelectAreaDialogEventHandler handler = new SelectAreaDialogEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onResponse(SelectAreaDialogEvent event) {
|
||||
GWT.log("SelectAreaDialog Response: "+event);
|
||||
wktArea = event.getArea();
|
||||
onResponseCommand.execute();
|
||||
}
|
||||
};
|
||||
|
||||
addSelectAreaDialogEventHandler(handler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fire command on response.
|
||||
*
|
||||
* @param command the command
|
||||
*/
|
||||
public void fireCommandOnResponse(Command command){
|
||||
this.onResponseCommand = command;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert wkt to geo json.
|
||||
*
|
||||
* @param wktData the wkt data
|
||||
* @return the string
|
||||
*/
|
||||
private static native String convertWKTToGeoJSON(String wktData) /*-{
|
||||
var ol = $wnd.ol;
|
||||
var geojson_options = {};
|
||||
var wkt_format = new ol.format.WKT();
|
||||
var testFeature = wkt_format.readFeature(wktData);
|
||||
var wkt_options = {};
|
||||
var geojson_format = new ol.format.GeoJSON(wkt_options);
|
||||
var out = geojson_format.writeFeature(testFeature);
|
||||
//window.getELementById("my-id").innerhtml(out);
|
||||
//alert(out);
|
||||
//console.log(out)
|
||||
return out;
|
||||
}-*/;
|
||||
|
||||
|
||||
/**
|
||||
* Wkt to geo json.
|
||||
*
|
||||
* @param wktTxt the wkt txt
|
||||
* @return the string
|
||||
*/
|
||||
public String wktToGeoJSON(String wktTxt){
|
||||
String geoJSON = convertWKTToGeoJSON(wktTxt);
|
||||
//Window.alert("geoJSON: "+geoJSON);
|
||||
GWT.log("geoJSON: "+geoJSON);
|
||||
JavaScriptObject toJSON = JsonUtils.safeEval(geoJSON);
|
||||
JSONObject objJson = new JSONObject(toJSON);
|
||||
return objJson.get("geometry").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WKT to geo json.
|
||||
*
|
||||
* @return the WKT to geo json
|
||||
*/
|
||||
public String getWKTToGeoJSON(){
|
||||
|
||||
return wktToGeoJSON(wktArea);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the wkt area.
|
||||
*
|
||||
* @return the wktArea
|
||||
*/
|
||||
public String getWktArea() {
|
||||
|
||||
return wktArea;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEventHandler;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.timeandreanges.DataTimeBox;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.GcubeDialogExtended;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.FieldAsGroup;
|
||||
|
@ -18,6 +19,7 @@ import com.github.gwtbootstrap.client.ui.ControlGroup;
|
|||
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||
import com.github.gwtbootstrap.client.ui.Controls;
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.InputAddOn;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
|
@ -37,6 +39,7 @@ import com.google.gwt.event.shared.HandlerManager;
|
|||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
|
@ -111,7 +114,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
switch(field.getType()){
|
||||
|
||||
case Boolean :
|
||||
case Boolean :
|
||||
|
||||
// its a checkbox
|
||||
holder = new CheckBox();
|
||||
|
@ -120,7 +123,44 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
break;
|
||||
|
||||
case GeoJSON:
|
||||
case Text:
|
||||
//MANAGED By FRANCESCO
|
||||
InputAddOn addOn = new InputAddOn();
|
||||
final TextArea textArea = new TextArea();
|
||||
|
||||
if(field.getDefaultValue() != null)
|
||||
textArea.setText(field.getDefaultValue());
|
||||
|
||||
addOn.add(textArea);
|
||||
Button butt = new Button();
|
||||
butt.setIcon(IconType.MAP_MARKER);
|
||||
butt.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
final GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog();
|
||||
|
||||
Command fillGeoJSONArea = new Command() {
|
||||
public void execute() {
|
||||
textArea.setText(dialog.getWKTToGeoJSON());
|
||||
}
|
||||
};
|
||||
|
||||
dialog.fireCommandOnResponse(fillGeoJSONArea);
|
||||
|
||||
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
addOn.add(butt);
|
||||
holder = addOn;
|
||||
|
||||
break;
|
||||
|
||||
case Text:
|
||||
|
||||
holder = new TextArea();
|
||||
|
||||
|
@ -150,7 +190,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
rangesList.add(rangeBox);
|
||||
break;
|
||||
|
||||
case Times_ListOf:
|
||||
case Times_ListOf:
|
||||
|
||||
holder = new FlowPanel();
|
||||
|
||||
|
@ -161,7 +201,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
SimplePanel panelFirstRange = new SimplePanel();
|
||||
DataTimeBox rangeBoxFirst = new DataTimeBox(true);
|
||||
setRangeTimeInTimeBox(field.getDefaultValue(), rangeBoxFirst);
|
||||
((SimplePanel)panelFirstRange).add(rangeBoxFirst);
|
||||
panelFirstRange.add(rangeBoxFirst);
|
||||
rangesList.add(rangeBoxFirst);
|
||||
|
||||
// Add more button
|
||||
|
@ -350,12 +390,12 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
switch(field.getType()){
|
||||
|
||||
case Boolean :
|
||||
case Boolean :
|
||||
|
||||
// nothing to validate
|
||||
return null;
|
||||
|
||||
case Text:
|
||||
case Text:
|
||||
case GeoJSON: // validation for geojson will be performed at server side as well TODO
|
||||
|
||||
String textAreaValue = getFieldCurrentValue().get(0);
|
||||
|
@ -368,7 +408,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
else return checkValidator(textAreaValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
|
||||
else return MANDATORY_ATTRIBUTE_MISSING;
|
||||
|
||||
}else{
|
||||
}else{
|
||||
|
||||
if(textAreaValue.trim().isEmpty())
|
||||
return null;
|
||||
|
@ -403,7 +443,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
return null;
|
||||
|
||||
case Times_ListOf:
|
||||
case Times_ListOf:
|
||||
|
||||
for(DataTimeBox el: rangesList){
|
||||
|
||||
|
@ -447,7 +487,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
case String:
|
||||
|
||||
// just handle the case of textbox
|
||||
// just handle the case of textbox
|
||||
if(holder.getClass().equals(TextBox.class)){
|
||||
|
||||
String textBoxValue = getFieldCurrentValue().get(0);
|
||||
|
@ -458,7 +498,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
else return checkValidator(textBoxValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
|
||||
else return MANDATORY_ATTRIBUTE_MISSING;
|
||||
|
||||
}else{
|
||||
}else{
|
||||
if(textBoxValue.trim().isEmpty())
|
||||
return null;
|
||||
else return checkValidator(textBoxValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
|
||||
|
@ -467,7 +507,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
else{
|
||||
|
||||
List<String> listboxValues = getFieldCurrentValue();
|
||||
|
||||
|
||||
if(listboxValues.isEmpty() && field.getMandatory())
|
||||
return MANDATORY_ATTRIBUTE_MISSING;
|
||||
|
||||
|
@ -476,7 +516,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
if(field.getValidator() == null || field.getValidator().isEmpty())
|
||||
continue;
|
||||
else
|
||||
else
|
||||
if(checkValidator(value, field.getValidator()))
|
||||
continue;
|
||||
else return MALFORMED_ATTRIBUTE;
|
||||
|
@ -533,12 +573,12 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
switch(field.getType()){
|
||||
|
||||
case Boolean :
|
||||
case Boolean :
|
||||
|
||||
toReturn.add(((CheckBox)holder).getValue().toString());
|
||||
toReturn.add(((CheckBox)holder).getValue().toString());
|
||||
break;
|
||||
|
||||
case Text:
|
||||
case Text:
|
||||
case GeoJSON:
|
||||
|
||||
toReturn.add(((TextArea)holder).getText());
|
||||
|
@ -563,7 +603,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
toReturn.add(manipulatedTemp);
|
||||
break;
|
||||
|
||||
case Times_ListOf:
|
||||
case Times_ListOf:
|
||||
|
||||
manipulatedTemp = "";
|
||||
for (DataTimeBox elem : rangesList) {
|
||||
|
@ -574,9 +614,9 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
String[] splitted = currentRange.split(DataTimeBox.RANGE_SEPARATOR_START_END);
|
||||
if(splitted[0].equals(splitted[1]))
|
||||
manipulatedTemp += (manipulatedTemp.isEmpty()) ? splitted[0] : RANGE_SEPARATOR + splitted[0];
|
||||
manipulatedTemp += manipulatedTemp.isEmpty() ? splitted[0] : RANGE_SEPARATOR + splitted[0];
|
||||
else
|
||||
manipulatedTemp += (manipulatedTemp.isEmpty()) ? splitted[0] + DataTimeBox.RANGE_SEPARATOR_START_END + splitted[1] :
|
||||
manipulatedTemp += manipulatedTemp.isEmpty() ? splitted[0] + DataTimeBox.RANGE_SEPARATOR_START_END + splitted[1] :
|
||||
RANGE_SEPARATOR + splitted[0] + DataTimeBox.RANGE_SEPARATOR_START_END + splitted[1];
|
||||
|
||||
}
|
||||
|
@ -607,7 +647,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
toReturn.clear();
|
||||
toReturn.add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -647,13 +687,13 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
switch(field.getType()){
|
||||
|
||||
case Boolean :
|
||||
case Boolean :
|
||||
|
||||
((CheckBox)holder).setEnabled(false);
|
||||
break;
|
||||
|
||||
case GeoJSON:
|
||||
case Text:
|
||||
case Text:
|
||||
|
||||
((TextArea)holder).setEnabled(false);
|
||||
break;
|
||||
|
@ -668,7 +708,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
rangesList.get(0).freeze();
|
||||
break;
|
||||
|
||||
case Times_ListOf:
|
||||
case Times_ListOf:
|
||||
|
||||
for(DataTimeBox el : rangesList)
|
||||
el.freeze();
|
||||
|
@ -684,7 +724,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
|
||||
if(holder.getClass().equals(ListBox.class))
|
||||
((ListBox)holder).setEnabled(false);
|
||||
else
|
||||
else
|
||||
((TextBox)holder).setEnabled(false);
|
||||
break;
|
||||
|
||||
|
@ -782,7 +822,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the propagateUp is set
|
||||
* @return
|
||||
|
|
|
@ -5,13 +5,17 @@
|
|||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link type="text/css" rel="stylesheet" href="CKanMetadataPublisher.css">
|
||||
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="CKanMetadataPublisher/css/ol.css">
|
||||
<script type="text/javascript" src="CKanMetadataPublisher/js/jquery-1.11.1.min.js"></script>
|
||||
<script type="text/javascript" src="CKanMetadataPublisher/js/ol.js"></script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="CKanMetadataPublisher/CKanMetadataPublisher.nocache.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
|
||||
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div
|
||||
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled in order for this
|
||||
application to display correctly.</div>
|
||||
</noscript>
|
||||
<div id="ckan-metadata-publisher-div"></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue