Added Table
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@85687 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
208cc427e5
commit
41839e6606
|
@ -2,9 +2,10 @@ package org.gcube.portlets.user.td.informationwidget.client;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.TRId;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.TableData;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
@ -27,7 +28,8 @@ public class TabularResourceProperties extends ContentPanel {
|
|||
protected VerticalLayoutContainer vl;
|
||||
protected EventBus eventBus;
|
||||
|
||||
protected FieldSet fieldSet;
|
||||
protected FieldSet trFieldSet;
|
||||
protected FieldSet tableFieldSet;
|
||||
|
||||
protected TextField nameField;
|
||||
protected TextArea descriptionField;
|
||||
|
@ -35,65 +37,67 @@ public class TabularResourceProperties extends ContentPanel {
|
|||
protected TextField dateField;
|
||||
protected TextArea rightField;
|
||||
|
||||
protected TextField tableNameField;
|
||||
protected TextField tableTypeNameField;
|
||||
|
||||
|
||||
|
||||
public TabularResourceProperties(String name, EventBus eventBus) {
|
||||
super();
|
||||
setId(name);
|
||||
this.eventBus = eventBus;
|
||||
|
||||
vl = new VerticalLayoutContainer();
|
||||
initInformation();
|
||||
|
||||
FramedPanel panel = new FramedPanel();
|
||||
panel.setHeaderVisible(false);
|
||||
panel.setBodyStyle("background: none; padding: 2px; min-width:310px;");
|
||||
|
||||
vl = new VerticalLayoutContainer();
|
||||
panel.add(vl);
|
||||
|
||||
this.add(panel);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addTabularResource(TabResource tabResource) {
|
||||
fieldSet = new FieldSet();
|
||||
fieldSet.setHeadingText("Tabular Resource");
|
||||
fieldSet.setCollapsible(true);
|
||||
public void addTabularResource() {
|
||||
trFieldSet = new FieldSet();
|
||||
trFieldSet.setHeadingText("Tabular Resource");
|
||||
trFieldSet.setCollapsible(true);
|
||||
|
||||
VerticalLayoutContainer layoutTabularResource = new VerticalLayoutContainer();
|
||||
fieldSet.add(layoutTabularResource);
|
||||
trFieldSet.add(layoutTabularResource);
|
||||
|
||||
nameField = new TextField();
|
||||
nameField.setReadOnly(true);
|
||||
nameField.setValue(tabResource.getName());
|
||||
nameField.setValue("");
|
||||
layoutTabularResource.add(new FieldLabel(nameField, "Name"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
descriptionField = new TextArea();
|
||||
descriptionField.setReadOnly(true);
|
||||
descriptionField.setValue(tabResource.getDescription());
|
||||
descriptionField.setValue("");
|
||||
layoutTabularResource.add(new FieldLabel(descriptionField,
|
||||
"Description"), new VerticalLayoutData(1, -1));
|
||||
|
||||
agencyField = new TextField();
|
||||
agencyField.setReadOnly(true);
|
||||
agencyField.setValue(tabResource.getAgency());
|
||||
agencyField.setValue("");
|
||||
layoutTabularResource.add(new FieldLabel(agencyField, "Agency"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
dateField = new TextField();
|
||||
dateField.setReadOnly(true);
|
||||
dateField.setValue(tabResource.getDate());
|
||||
dateField.setValue("");
|
||||
layoutTabularResource.add(new FieldLabel(dateField, "Date"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
rightField = new TextArea();
|
||||
rightField.setReadOnly(true);
|
||||
rightField.setValue(tabResource.getRight());
|
||||
rightField.setValue("");
|
||||
layoutTabularResource.add(new FieldLabel(rightField, "Rights"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
vl.add(fieldSet);
|
||||
vl.add(trFieldSet);
|
||||
|
||||
}
|
||||
|
||||
|
@ -105,20 +109,36 @@ public class TabularResourceProperties extends ContentPanel {
|
|||
rightField.setValue(tabResource.getRight());
|
||||
}
|
||||
|
||||
public void addTable(TabResource tabResource) {
|
||||
FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setHeadingText("Table");
|
||||
fieldSet.setCollapsible(true);
|
||||
public void addTable() {
|
||||
tableFieldSet = new FieldSet();
|
||||
tableFieldSet.setHeadingText("Table");
|
||||
tableFieldSet.setCollapsible(true);
|
||||
|
||||
VerticalLayoutContainer layoutTable = new VerticalLayoutContainer();
|
||||
tableFieldSet.add(layoutTable);
|
||||
|
||||
VerticalLayoutContainer layoutTabularResource = new VerticalLayoutContainer();
|
||||
fieldSet.add(layoutTabularResource);
|
||||
tableNameField = new TextField();
|
||||
tableNameField.setReadOnly(true);
|
||||
tableNameField.setValue("");
|
||||
layoutTable.add(new FieldLabel(tableNameField, "Name"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
vl.add(fieldSet);
|
||||
tableTypeNameField = new TextField();
|
||||
tableTypeNameField.setReadOnly(true);
|
||||
tableTypeNameField.setValue("");
|
||||
layoutTable.add(new FieldLabel(tableTypeNameField, "Type"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
vl.add(tableFieldSet);
|
||||
}
|
||||
|
||||
protected void updateTable(TableData tableData) {
|
||||
tableNameField.setValue(tableData.getName());
|
||||
tableTypeNameField.setValue(tableData.getTypeName());
|
||||
|
||||
}
|
||||
|
||||
public void update(){
|
||||
|
||||
public void update() {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||
|
||||
|
@ -126,6 +146,7 @@ public class TabularResourceProperties extends ContentPanel {
|
|||
public void onSuccess(TabResource result) {
|
||||
updateTabularResource(result);
|
||||
Log.info("Retrived TR:" + result.getId());
|
||||
getLastTable(result.getTrId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,20 +170,22 @@ public class TabularResourceProperties extends ContentPanel {
|
|||
});
|
||||
}
|
||||
|
||||
public void initInformation(){
|
||||
|
||||
protected void getLastTable(TRId trId) {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||
.getLastTable(trId,new AsyncCallback<TableData>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(TabResource result) {
|
||||
addTabularResource(result);
|
||||
Log.info("Retrived TR:" + result.getId());
|
||||
public void onSuccess(TableData result) {
|
||||
updateTable(result);
|
||||
Log.info("Retrived LastTable:" + result.getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error retrienving properties: "
|
||||
"Error retrienving Last Table: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
|
@ -180,4 +203,10 @@ public class TabularResourceProperties extends ContentPanel {
|
|||
});
|
||||
}
|
||||
|
||||
public void initInformation() {
|
||||
addTabularResource();
|
||||
addTable();
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue