From d0162b8fdc01daa56245005af5904b2a720c22ef Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 23 May 2014 14:16:27 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@96048 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/TabularResourceProperties.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) 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 b64e2e4..7de250a 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 @@ -17,6 +17,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestTyp import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.event.logical.shared.ValueChangeEvent; +import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.web.bindery.event.shared.EventBus; import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; @@ -128,11 +130,21 @@ public class TabularResourceProperties extends FramedPanel { new VerticalLayoutData(1, -1)); finalizedField = new CheckBox(); - //finalizedField.setBoxLabel(""); + // finalizedField.setBoxLabel(""); finalizedField.setValue(false); + finalizedField.addValueChangeHandler(new ValueChangeHandler() { + + @Override + public void onValueChange(ValueChangeEvent event) { + if (event.getValue()) { + info("Attention", + "Attention, a tabular resource set to finalize can not be modified!"); + } + } + }); layoutTabularResource.add(new FieldLabel(finalizedField, "Finalized"), new VerticalLayoutData(1, -1)); - + // Save Button saveButton = new TextButton("Save"); saveButton.setIcon(ResourceBundle.INSTANCE.save()); @@ -182,7 +194,7 @@ public class TabularResourceProperties extends FramedPanel { dateField.setValue(tabResource.getDate()); typeField.setValue(tabResource.getTrId().getTabularResourceType()); rightField.setValue(tabResource.getRight()); - if(tabResource.isFinalized()){ + if (tabResource.isFinalized()) { finalizedField.setEnabled(false); finalizedField.setValue(true); } else { @@ -331,7 +343,7 @@ public class TabularResourceProperties extends FramedPanel { tabResource.setAgency(agencyField.getValue()); tabResource.setRight(rightField.getValue()); tabResource.setFinalized(finalizedField.getValue()); - + TDGWTServiceAsync.INSTANCE.setTabResourceInformation(tabResource, new AsyncCallback() { @@ -353,6 +365,10 @@ public class TabularResourceProperties extends FramedPanel { + tabResource); info("Proprerties", "Tabular Resource properties are set"); + if(finalizedField.getValue()){ + finalizedField.setEnabled(false); + finalizedField.setValue(true); + } }