Added multi selection of rows
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@86292 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
cbe05635b1
commit
2acd3fa673
|
@ -5,6 +5,10 @@ package org.gcube.portlets.user.td.client;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.gcube.portlets.user.td.client.rpc.TabularDataService;
|
|||
import org.gcube.portlets.user.td.client.rpc.TabularDataServiceAsync;
|
||||
import org.gcube.portlets.user.tdw.client.TabularData;
|
||||
import org.gcube.portlets.user.tdw.client.TabularDataGridPanel;
|
||||
import org.gcube.portlets.user.tdw.client.config.Row;
|
||||
import org.gcube.portlets.user.tdw.client.event.FailureEvent;
|
||||
import org.gcube.portlets.user.tdw.client.event.FailureEventHandler;
|
||||
|
||||
|
@ -13,19 +14,32 @@ import com.google.gwt.core.client.EntryPoint;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||
import com.sencha.gxt.widget.core.client.TabPanel;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.Viewport;
|
||||
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.info.Info;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TabularDataPortlet implements EntryPoint {
|
||||
|
||||
|
@ -95,8 +109,10 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
|
||||
}
|
||||
});
|
||||
menu();
|
||||
controller.setTabularData(tabularData);
|
||||
|
||||
|
||||
|
||||
// Layout
|
||||
mainPanelLayout = new BorderLayoutContainer();
|
||||
mainPanelLayout.setId("mainPanelLayout");
|
||||
|
@ -184,6 +200,37 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void menu(){
|
||||
final HideHandler hideHandler = new HideHandler() {
|
||||
|
||||
@Override
|
||||
public void onHide(HideEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
tabularData.getGridPanel().setSelectionModel(SelectionMode.SINGLE);
|
||||
Menu menu = new Menu();
|
||||
MenuItem item = new MenuItem("Selected");
|
||||
item.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
Row row = tabularData.getGridPanel().getSelectedRow();
|
||||
if (row!=null) {
|
||||
AlertMessageBox d = new AlertMessageBox("Selected", "Row: \n"+row.toString()+"\nRow field:"+row.getFieldAsText("MyId"));
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menu.add(item);
|
||||
tabularData.getGridPanel().setContextMenu(menu);
|
||||
}
|
||||
|
||||
/*
|
||||
* private void configPanel(final Portlet panel) {
|
||||
* panel.setCollapsible(true); panel.setAnimCollapse(false);
|
||||
|
|
Loading…
Reference in New Issue