Added Change Label

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90129 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-01-15 11:10:33 +00:00
parent 1debb39c99
commit 74c879d953
1 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,91 @@
package org.gcube.portlets.user.td.columnwidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.widget.client.TextButton;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.Window;
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.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.TextField;
public class ChangeLabelColumnDialog extends Window {
protected TRId trId;
protected TextField label=null;
protected String columnName=null;
protected ColumnData column=null;
public ChangeLabelColumnDialog(TRId trId) {
create(trId, null);
}
public ChangeLabelColumnDialog(TRId trId, String columnName) {
create(trId, columnName);
}
protected void create(TRId trId, String columnName) {
this.trId=trId;
this.columnName=columnName;
setBodyBorder(false);
// getHeader().setIcon(Resources.IMAGES.side_list());
setHeadingText("Remove Column");
setWidth(400);
setHeight(120);
setResizable(false);
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
ContentPanel panel = new ContentPanel();
panel.setHeaderVisible(false);
FramedPanel form = new FramedPanel();
form.setHeaderVisible(false);
form.setBodyStyle("background: none;");
VerticalLayoutContainer v = new VerticalLayoutContainer();
label = new TextField();
label.setAllowBlank(false);
label.setWidth(150);
v.add(new FieldLabel(label, "Column Label"), new VerticalLayoutData(1, -1));
loadData();
form.add(v);
form.addButton(new TextButton("Remove"));
panel.add(form);
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
add(basicLayout);
}
protected void loadData() {
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName, new AsyncCallback<ColumnData>(){
public void onFailure(Throwable caught) {
Log.error("load column data failure:"+caught.getLocalizedMessage());
}
public void onSuccess(ColumnData result) {
Log.trace("loaded " + result);
column=result;
label.setValue(result.getLabel());
}
});
}
}