diff --git a/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java b/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java index 274efac..8630fc6 100644 --- a/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java +++ b/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java @@ -78,19 +78,19 @@ public class TabularResourceProperties extends FramedPanel { trFieldSet.add(layoutTabularResource); nameField = new TextField(); - nameField.setReadOnly(true); + //nameField.setReadOnly(true); nameField.setValue(""); layoutTabularResource.add(new FieldLabel(nameField, "Name"), new VerticalLayoutData(1, -1)); descriptionField = new TextArea(); - descriptionField.setReadOnly(true); + //descriptionField.setReadOnly(true); descriptionField.setValue(""); layoutTabularResource.add(new FieldLabel(descriptionField, "Description"), new VerticalLayoutData(1, -1)); agencyField = new TextField(); - agencyField.setReadOnly(true); + //agencyField.setReadOnly(true); agencyField.setValue(""); layoutTabularResource.add(new FieldLabel(agencyField, "Agency"), new VerticalLayoutData(1, -1)); @@ -102,7 +102,7 @@ public class TabularResourceProperties extends FramedPanel { new VerticalLayoutData(1, -1)); rightField = new TextArea(); - rightField.setReadOnly(true); + //rightField.setReadOnly(true); rightField.setValue(""); layoutTabularResource.add(new FieldLabel(rightField, "Rights"), new VerticalLayoutData(1, -1)); @@ -234,29 +234,49 @@ public class TabularResourceProperties extends FramedPanel { protected void onSave(){ + if(nameField.getValue()==null || nameField.getValue().isEmpty() ){ + alert("Attention","Fill name field"); + return; + } + + if(descriptionField.getValue()==null || descriptionField.getValue().isEmpty() ){ + alert("Attention","Fill description field"); + return; + } + + if(rightField.getValue()==null || rightField.getValue().isEmpty() ){ + alert("Attention","Fill rights field"); + return; + } + + tabResource.setName(nameField.getValue()); + tabResource.setDescription(descriptionField.getValue()); + tabResource.setAgency(agencyField.getValue()); + tabResource.setRight(rightField.getValue()); + + - /*TDGWTServiceAsync.INSTANCE.setTabResourceInfo(tabResource, + TDGWTServiceAsync.INSTANCE.setTabResourceInformation(tabResource, new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Share Error: " + Log.debug("Error Setting Tabular Resoruce Properties: " + caught.getLocalizedMessage()); - alert("Error sharing tabular resource", - "Error shareing tabular resource"); + alert("Error", + "Error setting tabular resource properties"); } public void onSuccess(Void result) { - Log.debug("Tabular Resource Shared: " - + shareInfo.getTabResource().getTrId() - .toString()); - info("Shared", - "Tabular Resource is shared"); + Log.debug("Tabular Resource properties are set: " + + tabResource); + info("Proprerties", + "Tabular Resource properties are set"); } }); - */ + } private void alert(String title, String message) {