Fixed tab repeating
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@84449 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0a468dd68a
commit
f5c533c137
|
@ -26,16 +26,21 @@ public class TabularResourceProperties extends ContentPanel {
|
||||||
protected HashMap<String, String> tabularResourcePropertiesMap;
|
protected HashMap<String, String> tabularResourcePropertiesMap;
|
||||||
protected VerticalLayoutContainer vl;
|
protected VerticalLayoutContainer vl;
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
|
|
||||||
// protected TDInformationServiceAsync service = GWT
|
protected FieldSet fieldSet;
|
||||||
// .create(TDInformationService.class);
|
|
||||||
|
protected TextField nameField;
|
||||||
|
protected TextArea descriptionField;
|
||||||
|
protected TextField agencyField;
|
||||||
|
protected TextField dateField;
|
||||||
|
protected TextArea rightField;
|
||||||
|
|
||||||
public TabularResourceProperties(String name, EventBus eventBus) {
|
public TabularResourceProperties(String name, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
setId(name);
|
setId(name);
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
update();
|
initInformation();
|
||||||
|
|
||||||
FramedPanel panel = new FramedPanel();
|
FramedPanel panel = new FramedPanel();
|
||||||
panel.setHeaderVisible(false);
|
panel.setHeaderVisible(false);
|
||||||
|
@ -49,46 +54,40 @@ public class TabularResourceProperties extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addTabularResource(TabResource tabResource) {
|
public void addTabularResource(TabResource tabResource) {
|
||||||
FieldSet fieldSet = new FieldSet();
|
fieldSet = new FieldSet();
|
||||||
fieldSet.setHeadingText("Tabular Resource");
|
fieldSet.setHeadingText("Tabular Resource");
|
||||||
fieldSet.setCollapsible(true);
|
fieldSet.setCollapsible(true);
|
||||||
// form.add(fieldSet);
|
|
||||||
|
|
||||||
VerticalLayoutContainer layoutTabularResource = new VerticalLayoutContainer();
|
VerticalLayoutContainer layoutTabularResource = new VerticalLayoutContainer();
|
||||||
fieldSet.add(layoutTabularResource);
|
fieldSet.add(layoutTabularResource);
|
||||||
|
|
||||||
// TextField idField = new TextField();
|
nameField = new TextField();
|
||||||
// idField.setReadOnly(true);
|
|
||||||
// idField.setValue(String.valueOf(tabResource.getId()));
|
|
||||||
// layoutTabularResource.add(new FieldLabel(idField, "Id"), new
|
|
||||||
// VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
TextField nameField = new TextField();
|
|
||||||
nameField.setReadOnly(true);
|
nameField.setReadOnly(true);
|
||||||
nameField.setValue(tabResource.getName());
|
nameField.setValue(tabResource.getName());
|
||||||
layoutTabularResource.add(new FieldLabel(nameField, "Name"),
|
layoutTabularResource.add(new FieldLabel(nameField, "Name"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
TextArea descriptionField = new TextArea();
|
descriptionField = new TextArea();
|
||||||
descriptionField.setReadOnly(true);
|
descriptionField.setReadOnly(true);
|
||||||
descriptionField.setValue(tabResource.getDescription());
|
descriptionField.setValue(tabResource.getDescription());
|
||||||
layoutTabularResource.add(new FieldLabel(descriptionField,
|
layoutTabularResource.add(new FieldLabel(descriptionField,
|
||||||
"Description"), new VerticalLayoutData(1, -1));
|
"Description"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
TextField agencyField = new TextField();
|
agencyField = new TextField();
|
||||||
agencyField.setReadOnly(true);
|
agencyField.setReadOnly(true);
|
||||||
agencyField.setValue(tabResource.getAgency());
|
agencyField.setValue(tabResource.getAgency());
|
||||||
layoutTabularResource.add(new FieldLabel(agencyField, "Agency"),
|
layoutTabularResource.add(new FieldLabel(agencyField, "Agency"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
TextField dateField = new TextField();
|
dateField = new TextField();
|
||||||
dateField.setReadOnly(true);
|
dateField.setReadOnly(true);
|
||||||
dateField.setValue(tabResource.getDate());
|
dateField.setValue(tabResource.getDate());
|
||||||
layoutTabularResource.add(new FieldLabel(dateField, "Date"),
|
layoutTabularResource.add(new FieldLabel(dateField, "Date"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
TextArea rightField = new TextArea();
|
rightField = new TextArea();
|
||||||
rightField.setReadOnly(true);
|
rightField.setReadOnly(true);
|
||||||
rightField.setValue(tabResource.getRight());
|
rightField.setValue(tabResource.getRight());
|
||||||
layoutTabularResource.add(new FieldLabel(rightField, "Rights"),
|
layoutTabularResource.add(new FieldLabel(rightField, "Rights"),
|
||||||
|
@ -98,11 +97,19 @@ public class TabularResourceProperties extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updateTabularResource(TabResource tabResource) {
|
||||||
|
nameField.setValue(tabResource.getName());
|
||||||
|
descriptionField.setValue(tabResource.getDescription());
|
||||||
|
agencyField.setValue(tabResource.getAgency());
|
||||||
|
dateField.setValue(tabResource.getDate());
|
||||||
|
rightField.setValue(tabResource.getRight());
|
||||||
|
}
|
||||||
|
|
||||||
public void addTable(TabResource tabResource) {
|
public void addTable(TabResource tabResource) {
|
||||||
FieldSet fieldSet = new FieldSet();
|
FieldSet fieldSet = new FieldSet();
|
||||||
fieldSet.setHeadingText("Table");
|
fieldSet.setHeadingText("Table");
|
||||||
fieldSet.setCollapsible(true);
|
fieldSet.setCollapsible(true);
|
||||||
// form.add(fieldSet);
|
|
||||||
|
|
||||||
VerticalLayoutContainer layoutTabularResource = new VerticalLayoutContainer();
|
VerticalLayoutContainer layoutTabularResource = new VerticalLayoutContainer();
|
||||||
fieldSet.add(layoutTabularResource);
|
fieldSet.add(layoutTabularResource);
|
||||||
|
@ -112,6 +119,37 @@ public class TabularResourceProperties extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
|
TDGWTServiceAsync.INSTANCE
|
||||||
|
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(TabResource result) {
|
||||||
|
updateTabularResource(result);
|
||||||
|
Log.info("Retrived TR:" + result.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
AlertMessageBox d = new AlertMessageBox("Error",
|
||||||
|
"Error retrienving properties: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initInformation(){
|
||||||
TDGWTServiceAsync.INSTANCE
|
TDGWTServiceAsync.INSTANCE
|
||||||
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
@ -141,5 +179,5 @@ public class TabularResourceProperties extends ContentPanel {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue