2013-10-24 16:07:25 +02:00
|
|
|
package org.gcube.portlets.user.td.informationwidget.client;
|
2013-10-24 12:16:53 +02:00
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2013-10-24 16:07:25 +02:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
2014-05-16 16:09:30 +02:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
2013-11-21 10:32:12 +01:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
2014-04-17 16:08:55 +02:00
|
|
|
import org.gcube.portlets.user.td.informationwidget.client.resources.ResourceBundle;
|
2014-03-10 18:12:44 +01:00
|
|
|
import org.gcube.portlets.user.td.informationwidget.client.util.InfoMessageBox;
|
2013-12-03 11:43:52 +01:00
|
|
|
import org.gcube.portlets.user.td.metadatawidget.client.TRMetadataAccordionPanel;
|
2013-12-02 17:18:33 +01:00
|
|
|
import org.gcube.portlets.user.td.metadatawidget.client.TableMetadataAccordionPanel;
|
2014-05-16 16:09:30 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
2014-04-09 19:05:19 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent;
|
2014-05-16 16:09:30 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
2014-04-09 19:05:19 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestType;
|
2013-12-05 15:21:06 +01:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
2013-10-24 16:07:25 +02:00
|
|
|
|
2013-10-24 18:40:24 +02:00
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
2014-05-23 16:16:27 +02:00
|
|
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
|
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
2013-10-24 12:16:53 +02:00
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
import com.google.web.bindery.event.shared.EventBus;
|
2014-04-17 16:08:55 +02:00
|
|
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
2014-02-14 11:33:17 +01:00
|
|
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
2014-03-10 18:12:44 +01:00
|
|
|
import com.sencha.gxt.core.client.util.Margins;
|
2013-10-24 12:16:53 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
|
|
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
2014-03-10 18:12:44 +01:00
|
|
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
2014-05-08 15:39:41 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
2013-10-24 12:16:53 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
2014-05-08 15:39:41 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
2013-10-24 12:16:53 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
2014-03-10 18:12:44 +01:00
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
2014-05-23 11:50:26 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.form.CheckBox;
|
2013-10-24 12:16:53 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
|
|
|
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
|
|
|
import com.sencha.gxt.widget.core.client.form.TextArea;
|
|
|
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
|
|
|
2013-11-19 18:20:52 +01:00
|
|
|
public class TabularResourceProperties extends FramedPanel {
|
2013-10-24 12:16:53 +02:00
|
|
|
protected String headingTitle;
|
|
|
|
protected HashMap<String, String> tabularResourcePropertiesMap;
|
|
|
|
protected VerticalLayoutContainer vl;
|
|
|
|
protected EventBus eventBus;
|
2014-04-09 19:05:19 +02:00
|
|
|
protected TRId trId;
|
2014-05-08 15:39:41 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
protected FieldSet trFieldSet;
|
|
|
|
protected FieldSet tableFieldSet;
|
|
|
|
|
2014-03-10 18:12:44 +01:00
|
|
|
protected TabResource tabResource;
|
2013-10-28 09:36:49 +01:00
|
|
|
protected TextField nameField;
|
|
|
|
protected TextArea descriptionField;
|
|
|
|
protected TextField agencyField;
|
|
|
|
protected TextField dateField;
|
|
|
|
protected TextArea rightField;
|
2014-05-23 11:50:26 +02:00
|
|
|
protected CheckBox finalizedField;
|
2014-03-20 14:56:26 +01:00
|
|
|
protected TextField typeField;
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2013-12-03 11:43:52 +01:00
|
|
|
protected TRMetadataAccordionPanel trMetadataPanel;
|
|
|
|
protected VerticalLayoutContainer layoutTabularResource;
|
2013-11-19 15:17:56 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
protected TextField tableTypeNameField;
|
2013-12-02 17:18:33 +01:00
|
|
|
protected TableMetadataAccordionPanel tableMetadataPanel;
|
2013-11-21 10:58:37 +01:00
|
|
|
protected VerticalLayoutContainer layoutTable;
|
2014-03-10 18:12:44 +01:00
|
|
|
protected TextButton saveButton;
|
2014-04-09 19:05:19 +02:00
|
|
|
protected TextButton validationsButton;
|
2013-10-24 12:16:53 +02:00
|
|
|
|
|
|
|
public TabularResourceProperties(String name, EventBus eventBus) {
|
|
|
|
super();
|
|
|
|
setId(name);
|
|
|
|
this.eventBus = eventBus;
|
2014-03-10 18:12:44 +01:00
|
|
|
forceLayoutOnResize = true;
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
vl = new VerticalLayoutContainer();
|
2014-02-14 11:33:17 +01:00
|
|
|
vl.setScrollMode(ScrollMode.AUTO);
|
|
|
|
vl.setAdjustForScroll(true);
|
|
|
|
|
2014-03-10 18:12:44 +01:00
|
|
|
initInformation();
|
2013-11-19 18:20:52 +01:00
|
|
|
this.add(vl);
|
2013-10-25 20:11:06 +02:00
|
|
|
|
2013-10-24 12:16:53 +02:00
|
|
|
}
|
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void addTabularResource() {
|
|
|
|
trFieldSet = new FieldSet();
|
|
|
|
trFieldSet.setHeadingText("Tabular Resource");
|
|
|
|
trFieldSet.setCollapsible(true);
|
2013-11-19 18:20:52 +01:00
|
|
|
trFieldSet.setResize(true);
|
2013-11-19 13:06:42 +01:00
|
|
|
|
2013-12-03 11:43:52 +01:00
|
|
|
layoutTabularResource = new VerticalLayoutContainer();
|
2013-11-19 13:06:42 +01:00
|
|
|
trFieldSet.add(layoutTabularResource);
|
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
nameField = new TextField();
|
2014-04-09 19:05:19 +02:00
|
|
|
// nameField.setReadOnly(true);
|
2013-11-19 13:06:42 +01:00
|
|
|
nameField.setValue("");
|
2013-10-24 12:16:53 +02:00
|
|
|
layoutTabularResource.add(new FieldLabel(nameField, "Name"),
|
|
|
|
new VerticalLayoutData(1, -1));
|
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
descriptionField = new TextArea();
|
2014-04-09 19:05:19 +02:00
|
|
|
// descriptionField.setReadOnly(true);
|
2013-11-19 13:06:42 +01:00
|
|
|
descriptionField.setValue("");
|
2013-10-24 12:16:53 +02:00
|
|
|
layoutTabularResource.add(new FieldLabel(descriptionField,
|
|
|
|
"Description"), new VerticalLayoutData(1, -1));
|
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
agencyField = new TextField();
|
2014-04-09 19:05:19 +02:00
|
|
|
// agencyField.setReadOnly(true);
|
2013-11-19 13:06:42 +01:00
|
|
|
agencyField.setValue("");
|
2013-10-24 12:16:53 +02:00
|
|
|
layoutTabularResource.add(new FieldLabel(agencyField, "Agency"),
|
|
|
|
new VerticalLayoutData(1, -1));
|
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
dateField = new TextField();
|
2013-10-24 12:16:53 +02:00
|
|
|
dateField.setReadOnly(true);
|
2013-11-19 13:06:42 +01:00
|
|
|
dateField.setValue("");
|
2013-10-24 12:16:53 +02:00
|
|
|
layoutTabularResource.add(new FieldLabel(dateField, "Date"),
|
|
|
|
new VerticalLayoutData(1, -1));
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2014-03-20 14:56:26 +01:00
|
|
|
typeField = new TextField();
|
|
|
|
typeField.setReadOnly(true);
|
|
|
|
typeField.setValue("");
|
|
|
|
layoutTabularResource.add(new FieldLabel(typeField, "Type"),
|
|
|
|
new VerticalLayoutData(1, -1));
|
2013-10-24 12:16:53 +02:00
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
rightField = new TextArea();
|
2014-04-09 19:05:19 +02:00
|
|
|
// rightField.setReadOnly(true);
|
2013-11-19 13:06:42 +01:00
|
|
|
rightField.setValue("");
|
2013-10-24 12:16:53 +02:00
|
|
|
layoutTabularResource.add(new FieldLabel(rightField, "Rights"),
|
|
|
|
new VerticalLayoutData(1, -1));
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2014-05-23 11:50:26 +02:00
|
|
|
finalizedField = new CheckBox();
|
2014-05-23 16:16:27 +02:00
|
|
|
// finalizedField.setBoxLabel("");
|
2014-05-23 11:50:26 +02:00
|
|
|
finalizedField.setValue(false);
|
2014-05-23 16:16:27 +02:00
|
|
|
finalizedField.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
|
|
|
if (event.getValue()) {
|
2014-05-23 17:35:42 +02:00
|
|
|
info(" Warning",
|
|
|
|
"A TabularResource set to final can't be modified anymore!");
|
2014-05-23 16:16:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2014-05-23 17:35:42 +02:00
|
|
|
layoutTabularResource.add(new FieldLabel(finalizedField, "Final"),
|
2014-05-23 11:50:26 +02:00
|
|
|
new VerticalLayoutData(1, -1));
|
2014-05-23 16:16:27 +02:00
|
|
|
|
2014-03-10 18:12:44 +01:00
|
|
|
// Save Button
|
|
|
|
saveButton = new TextButton("Save");
|
2014-04-17 16:08:55 +02:00
|
|
|
saveButton.setIcon(ResourceBundle.INSTANCE.save());
|
|
|
|
saveButton.setIconAlign(IconAlign.RIGHT);
|
|
|
|
saveButton.setTitle("Save");
|
2014-03-10 18:12:44 +01:00
|
|
|
SelectHandler saveHandler = new SelectHandler() {
|
|
|
|
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
onSave();
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
saveButton.addSelectHandler(saveHandler);
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2014-05-08 15:39:41 +02:00
|
|
|
// Validation Button
|
|
|
|
validationsButton = new TextButton("Validations");
|
|
|
|
validationsButton.setIcon(ResourceBundle.INSTANCE.tableValidation());
|
|
|
|
validationsButton.setIconAlign(IconAlign.RIGHT);
|
|
|
|
validationsButton.setTitle("Validations");
|
|
|
|
|
|
|
|
SelectHandler validationsHandler = new SelectHandler() {
|
|
|
|
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
openValidations();
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
validationsButton.addSelectHandler(validationsHandler);
|
2014-05-16 16:09:30 +02:00
|
|
|
|
|
|
|
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
|
|
|
hBox.add(saveButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
|
|
|
hBox.add(validationsButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
|
|
|
|
2014-05-08 15:39:41 +02:00
|
|
|
layoutTabularResource.add(hBox, new VerticalLayoutData(-1, -1,
|
|
|
|
new Margins(2)));
|
|
|
|
|
|
|
|
vl.add(trFieldSet);
|
|
|
|
|
2013-10-24 12:16:53 +02:00
|
|
|
}
|
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
protected void updateTabularResource(TabResource tabResource) {
|
2014-04-09 19:05:19 +02:00
|
|
|
this.tabResource = tabResource;
|
2014-01-27 18:29:04 +01:00
|
|
|
Log.debug(tabResource.toString());
|
2013-10-28 09:36:49 +01:00
|
|
|
nameField.setValue(tabResource.getName());
|
|
|
|
descriptionField.setValue(tabResource.getDescription());
|
|
|
|
agencyField.setValue(tabResource.getAgency());
|
|
|
|
dateField.setValue(tabResource.getDate());
|
2014-03-20 14:56:26 +01:00
|
|
|
typeField.setValue(tabResource.getTrId().getTabularResourceType());
|
2013-10-28 09:36:49 +01:00
|
|
|
rightField.setValue(tabResource.getRight());
|
2014-05-23 16:16:27 +02:00
|
|
|
if (tabResource.isFinalized()) {
|
2014-05-23 11:50:26 +02:00
|
|
|
finalizedField.setEnabled(false);
|
|
|
|
finalizedField.setValue(true);
|
|
|
|
} else {
|
|
|
|
finalizedField.setEnabled(true);
|
|
|
|
finalizedField.setValue(false);
|
|
|
|
}
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2013-10-28 09:36:49 +01:00
|
|
|
}
|
2013-10-24 12:16:53 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void addTable() {
|
|
|
|
tableFieldSet = new FieldSet();
|
|
|
|
tableFieldSet.setHeadingText("Table");
|
|
|
|
tableFieldSet.setCollapsible(true);
|
2013-11-19 18:20:52 +01:00
|
|
|
tableFieldSet.setResize(true);
|
2014-03-10 18:12:44 +01:00
|
|
|
|
2013-11-21 10:58:37 +01:00
|
|
|
layoutTable = new VerticalLayoutContainer();
|
2013-11-21 18:41:28 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
tableFieldSet.add(layoutTable);
|
2013-10-24 12:16:53 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
tableTypeNameField = new TextField();
|
|
|
|
tableTypeNameField.setReadOnly(true);
|
|
|
|
tableTypeNameField.setValue("");
|
|
|
|
layoutTable.add(new FieldLabel(tableTypeNameField, "Type"),
|
2014-03-10 18:12:44 +01:00
|
|
|
new VerticalLayoutData(1, -1));
|
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
vl.add(tableFieldSet);
|
2013-10-24 12:16:53 +02:00
|
|
|
}
|
2014-03-10 18:12:44 +01:00
|
|
|
|
2014-04-09 19:05:19 +02:00
|
|
|
protected void openValidations() {
|
|
|
|
Log.debug("Request Validations Tab");
|
|
|
|
if (trId != null) {
|
|
|
|
WidgetRequestEvent e = new WidgetRequestEvent(
|
2014-05-08 15:39:41 +02:00
|
|
|
WidgetRequestType.VALIDATIONSTASKSPANEL);
|
2014-04-09 19:05:19 +02:00
|
|
|
e.setTrId(trId);
|
|
|
|
eventBus.fireEvent(e);
|
|
|
|
} else {
|
|
|
|
Log.error("TRId is null");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
protected void updateTable(TableData tableData) {
|
|
|
|
tableTypeNameField.setValue(tableData.getTypeName());
|
2014-03-10 18:12:44 +01:00
|
|
|
if (tableMetadataPanel != null) {
|
2013-11-21 15:13:30 +01:00
|
|
|
tableFieldSet.remove(layoutTable);
|
2013-12-02 17:18:33 +01:00
|
|
|
layoutTable.remove(tableMetadataPanel);
|
2013-11-21 10:58:37 +01:00
|
|
|
}
|
2014-04-09 19:05:19 +02:00
|
|
|
trId = tableData.getTrId();
|
2014-03-10 18:12:44 +01:00
|
|
|
|
|
|
|
tableMetadataPanel = new TableMetadataAccordionPanel(
|
|
|
|
"TableInformation", trId, eventBus);
|
2013-12-02 17:18:33 +01:00
|
|
|
layoutTable.add(tableMetadataPanel, new VerticalLayoutData(-1, -1));
|
2013-11-21 15:13:30 +01:00
|
|
|
tableFieldSet.add(layoutTable);
|
2013-11-19 13:06:42 +01:00
|
|
|
}
|
2013-10-25 20:11:06 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void update() {
|
|
|
|
TDGWTServiceAsync.INSTANCE
|
|
|
|
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
2013-10-25 20:11:06 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void onSuccess(TabResource result) {
|
|
|
|
updateTabularResource(result);
|
2014-04-17 14:33:34 +02:00
|
|
|
Log.info("Retrived TR: " + result.getTrId());
|
2013-11-19 13:06:42 +01:00
|
|
|
getLastTable(result.getTrId());
|
|
|
|
}
|
2013-10-25 20:11:06 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void onFailure(Throwable caught) {
|
2014-05-16 16:09:30 +02:00
|
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
} else {
|
|
|
|
AlertMessageBox d = new AlertMessageBox("Error",
|
|
|
|
"Error retrienving properties: "
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
d.addHideHandler(new HideHandler() {
|
|
|
|
|
|
|
|
public void onHide(HideEvent event) {
|
|
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
d.show();
|
|
|
|
}
|
2013-11-19 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2013-10-25 20:11:06 +02:00
|
|
|
}
|
2013-10-24 12:16:53 +02:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
protected void getLastTable(TRId trId) {
|
2014-03-10 18:12:44 +01:00
|
|
|
TDGWTServiceAsync.INSTANCE.getLastTable(trId,
|
|
|
|
new AsyncCallback<TableData>() {
|
2013-10-28 09:36:49 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void onSuccess(TableData result) {
|
|
|
|
updateTable(result);
|
2014-04-17 16:08:55 +02:00
|
|
|
Log.debug("Retrived LastTable:" + result);
|
2013-10-28 09:36:49 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
}
|
2013-10-28 09:36:49 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void onFailure(Throwable caught) {
|
2014-05-16 16:09:30 +02:00
|
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
} else {
|
|
|
|
AlertMessageBox d = new AlertMessageBox("Error",
|
|
|
|
"Error retrienving Last Table: "
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
d.addHideHandler(new HideHandler() {
|
|
|
|
|
|
|
|
public void onHide(HideEvent event) {
|
|
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
d.show();
|
|
|
|
}
|
2013-11-19 13:06:42 +01:00
|
|
|
}
|
2013-10-28 09:36:49 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
});
|
2013-10-28 09:36:49 +01:00
|
|
|
}
|
2014-03-10 18:12:44 +01:00
|
|
|
|
2013-11-19 13:06:42 +01:00
|
|
|
public void initInformation() {
|
|
|
|
addTabularResource();
|
|
|
|
addTable();
|
|
|
|
update();
|
|
|
|
}
|
2014-04-09 19:05:19 +02:00
|
|
|
|
|
|
|
protected void onSave() {
|
2014-06-03 15:01:12 +02:00
|
|
|
if (nameField.getValue() == null || nameField.getValue().isEmpty()) {
|
2014-04-09 19:05:19 +02:00
|
|
|
alert("Attention", "Fill name field");
|
2014-03-10 18:48:24 +01:00
|
|
|
return;
|
2014-04-09 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2014-06-03 15:01:12 +02:00
|
|
|
/*if (descriptionField.getValue() == null
|
2014-04-09 19:05:19 +02:00
|
|
|
|| descriptionField.getValue().isEmpty()) {
|
|
|
|
alert("Attention", "Fill description field");
|
2014-03-10 18:48:24 +01:00
|
|
|
return;
|
2014-04-09 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rightField.getValue() == null || rightField.getValue().isEmpty()) {
|
|
|
|
alert("Attention", "Fill rights field");
|
2014-03-10 18:48:24 +01:00
|
|
|
return;
|
2014-06-03 15:01:12 +02:00
|
|
|
}*/
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2014-03-10 18:48:24 +01:00
|
|
|
tabResource.setName(nameField.getValue());
|
|
|
|
tabResource.setDescription(descriptionField.getValue());
|
|
|
|
tabResource.setAgency(agencyField.getValue());
|
|
|
|
tabResource.setRight(rightField.getValue());
|
2014-05-23 11:50:26 +02:00
|
|
|
tabResource.setFinalized(finalizedField.getValue());
|
2014-05-23 16:16:27 +02:00
|
|
|
|
2014-03-10 18:48:24 +01:00
|
|
|
TDGWTServiceAsync.INSTANCE.setTabResourceInformation(tabResource,
|
2014-03-10 18:12:44 +01:00
|
|
|
new AsyncCallback<Void>() {
|
|
|
|
|
|
|
|
public void onFailure(Throwable caught) {
|
2014-05-16 16:09:30 +02:00
|
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
} else {
|
|
|
|
Log.debug("Error Setting Tabular Resoruce Properties: "
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
alert("Error",
|
|
|
|
"Error setting tabular resource properties");
|
|
|
|
|
|
|
|
}
|
2014-03-10 18:12:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void onSuccess(Void result) {
|
2014-03-10 18:48:24 +01:00
|
|
|
Log.debug("Tabular Resource properties are set: "
|
|
|
|
+ tabResource);
|
|
|
|
info("Proprerties",
|
|
|
|
"Tabular Resource properties are set");
|
2014-05-23 16:16:27 +02:00
|
|
|
if(finalizedField.getValue()){
|
|
|
|
finalizedField.setEnabled(false);
|
|
|
|
finalizedField.setValue(true);
|
|
|
|
}
|
2014-03-10 18:12:44 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2014-04-09 19:05:19 +02:00
|
|
|
|
2014-03-10 18:12:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void alert(String title, String message) {
|
|
|
|
final AlertMessageBox d = new AlertMessageBox(title, message);
|
|
|
|
d.addHideHandler(new HideHandler() {
|
|
|
|
|
|
|
|
public void onHide(HideEvent event) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
d.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void info(String title, String message) {
|
|
|
|
final InfoMessageBox d = new InfoMessageBox(title, message);
|
|
|
|
d.addHideHandler(new HideHandler() {
|
|
|
|
|
|
|
|
public void onHide(HideEvent event) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
d.show();
|
|
|
|
|
|
|
|
}
|
2013-11-19 13:06:42 +01:00
|
|
|
|
2013-10-24 12:16:53 +02:00
|
|
|
}
|