Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@95400 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-07 10:04:10 +00:00 committed by Giancarlo Panichi
parent 157ce46a6d
commit 593808b243
8 changed files with 223 additions and 0 deletions

View File

@ -34,6 +34,12 @@ public interface ResourceBundle extends ClientBundle {
@Source("close-red_32.png")
ImageResource close32();
@Source("disk.png")
ImageResource save();
@Source("disk_32.png")
ImageResource save32();
@Source("arrow-refresh.png")
ImageResource refresh();

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

View File

@ -12,6 +12,12 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
/**
* Delete rows in table
*
* @author "Giancarlo Panichi"
*
*/
public class DeleteRows {
protected TRId trId;
protected EventBus eventBus;

View File

@ -0,0 +1,78 @@
package org.gcube.portlets.user.td.tablewidget.client.rows;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession;
import org.gcube.portlets.user.td.tablewidget.client.progress.DeleteRowsProgressDialog;
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
* Edit Row
*
* @author "Giancarlo Panichi"
*
*/
public class EditRowDialog extends Window {
protected String WIDTH = "650px";
protected String HEIGHT = "530px";
protected TRId trId;
protected EventBus eventBus;
protected ArrayList<String> rows;
protected DeleteRowsSession deleteRowsSession;
protected DeleteRowsProgressDialog deleteRowsProgressDialog;
public EditRowDialog(TRId trId, ArrayList<String> rows,EventBus eventBus) {
this.trId = trId;
this.rows=rows;
this.eventBus = eventBus;
initWindow();
EditRowPanel editRowPanel= new EditRowPanel(this, trId,rows,eventBus);
add(editRowPanel);
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Edit");
setClosable(true);
setModal(true);
forceLayoutOnResize = true;
getHeader().setIcon(ResourceBundle.INSTANCE.ok());
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
protected void close (){
hide();
}
}

View File

@ -0,0 +1,133 @@
package org.gcube.portlets.user.td.tablewidget.client.rows;
import java.util.ArrayList;
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.tablewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
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.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi"
*
*/
public class EditRowPanel extends FramedPanel {
protected String WIDTH = "560px";
protected String HEIGHT = "520px";
protected EditRowDialog parent;
protected TRId trId;
protected EventBus eventBus;
protected ArrayList<String> rows;
protected ArrayList<ColumnData> columns;
private TextButton btnSave;
private TextButton btnClose;
public EditRowPanel(EditRowDialog parent, TRId trId,
ArrayList<String> rows, EventBus eventBus) {
this.parent = parent;
this.trId = trId;
this.rows = rows;
this.eventBus = eventBus;
Log.debug("Create EditRowPanel(): [" + trId.toString() + " , rows:"
+ rows + "]");
init();
retrieveColumn();
}
protected void init() {
setWidth(WIDTH);
setHeight(HEIGHT);
setHeaderVisible(false);
setBodyBorder(false);
}
protected void create() {
btnSave = new TextButton("Save");
btnSave.setIcon(ResourceBundle.INSTANCE.save());
btnSave.setIconAlign(IconAlign.RIGHT);
btnSave.setTitle("Save");
btnSave.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Save");
btnSave.disable();
save();
}
});
btnClose = new TextButton("Close");
btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Close");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer v = new VerticalLayoutContainer();
// v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
v.add(flowButton, new VerticalLayoutData(-1, 36,
new Margins(5, 2, 5, 2)));
add(v);
}
protected void retrieveColumn() {
TDGWTServiceAsync.INSTANCE.getColumns(trId,
new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) {
Log.error("load columns failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving columns",
"Error retrieving columns");
}
public void onSuccess(ArrayList<ColumnData> result) {
Log.trace("loaded " + result.size() + " ColumnData");
columns = result;
}
});
}
protected void save() {
}
protected void close() {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B