Minor updated
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@86689 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0319fb8870
commit
ed9046b255
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.portlets.user.td.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.client.ribbon.TabularDataRibbon;
|
||||
import org.gcube.portlets.user.td.client.rpc.TabularDataService;
|
||||
import org.gcube.portlets.user.td.client.rpc.TabularDataServiceAsync;
|
||||
|
@ -8,6 +10,8 @@ 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;
|
||||
import org.gcube.portlets.user.tdw.client.model.grid.DataRowColumnConfig;
|
||||
import org.gcube.portlets.user.tdw.shared.model.DataRow;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
|
@ -29,17 +33,17 @@ 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.grid.ColumnConfig;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TabularDataPortlet implements EntryPoint {
|
||||
|
||||
|
@ -109,10 +113,9 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
controller.setTabularData(tabularData);
|
||||
|
||||
|
||||
|
||||
// Layout
|
||||
mainPanelLayout = new BorderLayoutContainer();
|
||||
mainPanelLayout.setId("mainPanelLayout");
|
||||
|
@ -129,15 +132,15 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
|
||||
mainPanelLayout.setNorthWidget(toolBarPanel, toolBarData);
|
||||
|
||||
// Grid Panel
|
||||
// Grid Panel
|
||||
final TabularDataGridPanel gridPanel = tabularData.getGridPanel();
|
||||
gridPanel.setHeaderVisible(false);
|
||||
|
||||
MarginData gridData = new MarginData();
|
||||
mainPanelLayout.setCenterWidget(gridPanel, gridData);
|
||||
|
||||
// Functionality Panel
|
||||
functionalityPanel= new ContentPanel();
|
||||
|
||||
// Functionality Panel
|
||||
functionalityPanel = new ContentPanel();
|
||||
functionalityPanel.setWidth(310);
|
||||
functionalityPanel.setHeaderVisible(false);
|
||||
functionalityPanel.setResize(true);
|
||||
|
@ -166,7 +169,7 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
controller.setEastData(eastData);
|
||||
|
||||
bind(mainPanelLayout);
|
||||
|
||||
menu(gridPanel);
|
||||
}
|
||||
|
||||
protected void bind(BorderLayoutContainer mainWidget) {
|
||||
|
@ -183,7 +186,7 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
} else {
|
||||
Log.info("Application div with id " + JSP_TAG_ID
|
||||
+ " found, starting in portal mode");
|
||||
PortalViewport viewport = new PortalViewport();
|
||||
PortalViewport viewport = new PortalViewport();
|
||||
Log.info("Created Viewport");
|
||||
viewport.setEnableScroll(false);
|
||||
viewport.setWidget(mainWidget);
|
||||
|
@ -200,37 +203,58 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void menu(){
|
||||
protected void menu(final TabularDataGridPanel gridPanel) {
|
||||
Log.debug("Add Menu to tabular data widget");
|
||||
final HideHandler hideHandler = new HideHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onHide(HideEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
tabularData.getGridPanel().setSelectionModel(SelectionMode.SINGLE);
|
||||
Log.debug("Set SelectionMode.SINGLE");
|
||||
gridPanel.setSelectionModel(SelectionMode.SINGLE);
|
||||
Log.debug("Init menu creation");
|
||||
Menu menu = new Menu();
|
||||
Log.debug("Create Item");
|
||||
MenuItem item = new MenuItem("Selected");
|
||||
Log.debug("Added Handler");
|
||||
|
||||
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();
|
||||
Log.debug("Start On Selection");
|
||||
Log.debug("gridPanel is: "+gridPanel);
|
||||
if (gridPanel != null) {
|
||||
List<ColumnConfig<DataRow, ?>> columns= gridPanel.getGrid().getColumnModel().getColumns();
|
||||
DataRowColumnConfig<?> dc=(DataRowColumnConfig<?>)columns.get(0);
|
||||
|
||||
|
||||
|
||||
Row row = gridPanel.getSelectedRow();
|
||||
Log.debug("Retrived row");
|
||||
|
||||
String rowInfo;
|
||||
if (row != null) {
|
||||
rowInfo = row.getFieldAsText(dc.getDefinition().getId());
|
||||
} else {
|
||||
rowInfo = "no row retrived";
|
||||
}
|
||||
Log.debug("Set Alert");
|
||||
AlertMessageBox d = new AlertMessageBox("Selected",
|
||||
"Row: \n" + rowInfo);
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Log.debug("Add Item to Menu");
|
||||
menu.add(item);
|
||||
tabularData.getGridPanel().setContextMenu(menu);
|
||||
Log.debug("Set Menu on Tabular data Widget");
|
||||
gridPanel.setContextMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* private void configPanel(final Portlet panel) {
|
||||
* panel.setCollapsible(true); panel.setAnimCollapse(false);
|
||||
|
|
Loading…
Reference in New Issue