Minor Updated
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@92711 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
222594fb68
commit
1ad1aea147
|
@ -11,15 +11,15 @@
|
|||
<Software>
|
||||
<Description>tabular-data-information-widget allows the recovery of the information relating to a tabular resource</Description>
|
||||
<Name>tabular-data-information-widget</Name>
|
||||
<Version>2.0.0-SNAPSHOT</Version>
|
||||
<Version>2.1.0-SNAPSHOT</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-information-widget</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
</MavenCoordinates>
|
||||
<Type>library</Type>
|
||||
<Files>
|
||||
<File>tabular-data-information-widget-2.0.0-SNAPSHOT.jar</File>
|
||||
<File>tabular-data-information-widget-2.1.0-SNAPSHOT.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
|
|
|
@ -13,7 +13,7 @@ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
|||
Version and Release Date
|
||||
------------------------
|
||||
|
||||
v. 2.0.0-SNAPSHOT (2013-10-18)
|
||||
v. 2.1.0-SNAPSHOT (2013-10-18)
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets.user.tabular-data-information-widget.2-0-0"
|
||||
date="2014-02-01">
|
||||
<Change>Table Metadata View</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets.user.tabular-data-information-widget.1-0-0"
|
||||
date="2013-10-18">
|
||||
<Change>First Release</Change>
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
package org.gcube.portlets.user.td.informationwidget.client;
|
||||
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
||||
import org.gcube.portlets.user.td.informationwidget.client.progress.ChangeTableTypeProgressDialog;
|
||||
import org.gcube.portlets.user.td.informationwidget.client.table.TableTypeElement;
|
||||
import org.gcube.portlets.user.td.informationwidget.client.table.TableTypeProperties;
|
||||
import org.gcube.portlets.user.td.informationwidget.client.table.TableTypeStore;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
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;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ChangeTableTypePanel extends FramedPanel {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
|
||||
protected TRId trId;
|
||||
protected TableData table;
|
||||
protected String headingTitle;
|
||||
protected VerticalLayoutContainer vl;
|
||||
protected EventBus eventBus;
|
||||
protected ChangeTableTypeSession changeTableTypeSession;
|
||||
protected ChangeTableTypeProgressDialog changeTableTypeProgressDialog;
|
||||
|
||||
protected ComboBox<TableTypeElement> comboTableType;
|
||||
protected TextButton change;
|
||||
|
||||
|
||||
|
||||
public ChangeTableTypePanel(TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
this.trId=trId;
|
||||
this.eventBus = eventBus;
|
||||
forceLayoutOnResize=true;
|
||||
create();
|
||||
}
|
||||
|
||||
protected void create(){
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
|
||||
|
||||
TableTypeProperties props = GWT.create(TableTypeProperties.class);
|
||||
ListStore<TableTypeElement> storeTableType = new ListStore<TableTypeElement>(props.id());
|
||||
|
||||
storeTableType.addAll(TableTypeStore.getTableTypes());
|
||||
|
||||
Log.trace("Store created");
|
||||
|
||||
comboTableType = new ComboBox<TableTypeElement>(storeTableType,
|
||||
props.label());
|
||||
|
||||
Log.trace("ComboTableType created");
|
||||
|
||||
|
||||
comboTableType.setEmptyText("Select a Table Type...");
|
||||
comboTableType.setItemId("ComboTableType");
|
||||
comboTableType.setWidth("200px");
|
||||
comboTableType.setEditable(false);
|
||||
comboTableType.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
|
||||
change=new TextButton("Change");
|
||||
change.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
onChangeTableType();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vl = new VerticalLayoutContainer();
|
||||
vl.setScrollMode(ScrollMode.AUTO);
|
||||
vl.setAdjustForScroll(true);
|
||||
|
||||
|
||||
vl.add(new FieldLabel(comboTableType, "Table Type"), new VerticalLayoutData(1,
|
||||
-1));
|
||||
vl.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
|
||||
|
||||
add(vl);
|
||||
show();
|
||||
load();
|
||||
|
||||
}
|
||||
|
||||
protected void onChangeTableType(){
|
||||
TableTypeElement tableTypeElement = comboTableType.getCurrentValue();
|
||||
if(tableTypeElement!=null){
|
||||
changeTableTypeSession=new ChangeTableTypeSession(trId,tableTypeElement.getTableType());
|
||||
callChangeTableType();
|
||||
} else {
|
||||
alert("Attention", "Select a table type!");
|
||||
}
|
||||
}
|
||||
|
||||
private void callChangeTableType() {
|
||||
TDGWTServiceAsync.INSTANCE.startChangeTableType(
|
||||
changeTableTypeSession, new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.debug("Change The Table Type Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
alert("Error Changing The Table Type",
|
||||
"Error in invocation of Change Table Type operation!");
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
changeTableTypeProgressDialog= new ChangeTableTypeProgressDialog(changeTableTypeSession, eventBus);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setCurrentType(){
|
||||
TableTypeElement tElement=TableTypeStore.getTableTypeElement(table.getTypeName());
|
||||
comboTableType.setValue(tElement);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void load() {
|
||||
TDGWTServiceAsync.INSTANCE.getTable(trId,
|
||||
new AsyncCallback<TableData>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error retrieving table: "
|
||||
+ caught.getMessage());
|
||||
alert("Error retrieving table",caught.getMessage());
|
||||
}
|
||||
|
||||
public void onSuccess(TableData result) {
|
||||
Log.debug("Retrieved table: "+result.toString());
|
||||
table=result;
|
||||
setCurrentType();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
public void update(TRId trId) {
|
||||
this.trId = trId;
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue