Added Validations button

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@94656 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-09 17:05:19 +00:00
parent c0cdda94d2
commit 7981ddcbc3
1 changed files with 62 additions and 35 deletions

View File

@ -8,6 +8,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.informationwidget.client.util.InfoMessageBox;
import org.gcube.portlets.user.td.metadatawidget.client.TRMetadataAccordionPanel;
import org.gcube.portlets.user.td.metadatawidget.client.TableMetadataAccordionPanel;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
@ -34,6 +36,7 @@ public class TabularResourceProperties extends FramedPanel {
protected HashMap<String, String> tabularResourcePropertiesMap;
protected VerticalLayoutContainer vl;
protected EventBus eventBus;
protected TRId trId;
protected FieldSet trFieldSet;
protected FieldSet tableFieldSet;
@ -53,6 +56,8 @@ public class TabularResourceProperties extends FramedPanel {
protected TableMetadataAccordionPanel tableMetadataPanel;
protected VerticalLayoutContainer layoutTable;
protected TextButton saveButton;
protected TextButton validationsButton;
public TabularResourceProperties(String name, EventBus eventBus) {
super();
@ -114,7 +119,6 @@ public class TabularResourceProperties extends FramedPanel {
layoutTabularResource.add(new FieldLabel(rightField, "Rights"),
new VerticalLayoutData(1, -1));
// Save Button
saveButton = new TextButton("Save");
SelectHandler saveHandler = new SelectHandler() {
@ -125,8 +129,8 @@ public class TabularResourceProperties extends FramedPanel {
}
};
saveButton.addSelectHandler(saveHandler);
layoutTabularResource.add(saveButton,
new VerticalLayoutData(-1, -1,new Margins(2)));
layoutTabularResource.add(saveButton, new VerticalLayoutData(-1, -1,
new Margins(2)));
vl.add(trFieldSet);
@ -160,16 +164,41 @@ public class TabularResourceProperties extends FramedPanel {
layoutTable.add(new FieldLabel(tableTypeNameField, "Type"),
new VerticalLayoutData(1, -1));
// Validation Button
validationsButton = new TextButton("Validations");
SelectHandler validationsHandler = new SelectHandler() {
public void onSelect(SelectEvent event) {
openValidations();
}
};
validationsButton.addSelectHandler(validationsHandler);
layoutTable.add(validationsButton, new VerticalLayoutData(-1, -1,
new Margins(2)));
vl.add(tableFieldSet);
}
protected void openValidations() {
Log.debug("Request Validations Tab");
if (trId != null) {
WidgetRequestEvent e = new WidgetRequestEvent(
WidgetRequestType.VALIDATIONSTABLEPANEL);
e.setTrId(trId);
eventBus.fireEvent(e);
} else {
Log.error("TRId is null");
}
}
protected void updateTable(TableData tableData) {
tableTypeNameField.setValue(tableData.getTypeName());
if (tableMetadataPanel != null) {
tableFieldSet.remove(layoutTable);
layoutTable.remove(tableMetadataPanel);
}
TRId trId = tableData.getTrId();
trId = tableData.getTrId();
tableMetadataPanel = new TableMetadataAccordionPanel(
"TableInformation", trId, eventBus);
@ -241,14 +270,14 @@ public class TabularResourceProperties extends FramedPanel {
update();
}
protected void onSave() {
if (nameField.getValue() == null || nameField.getValue().isEmpty()) {
alert("Attention", "Fill name field");
return;
}
if(descriptionField.getValue()==null || descriptionField.getValue().isEmpty() ){
if (descriptionField.getValue() == null
|| descriptionField.getValue().isEmpty()) {
alert("Attention", "Fill description field");
return;
}
@ -263,8 +292,6 @@ public class TabularResourceProperties extends FramedPanel {
tabResource.setAgency(agencyField.getValue());
tabResource.setRight(rightField.getValue());
TDGWTServiceAsync.INSTANCE.setTabResourceInformation(tabResource,
new AsyncCallback<Void>() {