From 9152ce10e1e865a9215ab70654746bbd288a0d61 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 8 Jan 2015 17:33:50 +0000 Subject: [PATCH] Minor update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@107022 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../tdwx/client/TabularDataXGridPanel.java | 39 ++++++++++++------- .../client/config/ExtendedLiveGridView.java | 1 + 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java index a7181fe..557137d 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java @@ -75,9 +75,11 @@ import com.sencha.gxt.widget.core.client.event.HeaderContextMenuEvent.HeaderCont import com.sencha.gxt.widget.core.client.event.HeaderMouseDownEvent; import com.sencha.gxt.widget.core.client.event.HeaderMouseDownEvent.HeaderMouseDownHandler; import com.sencha.gxt.widget.core.client.grid.ColumnConfig; +import com.sencha.gxt.widget.core.client.grid.ColumnHeader; import com.sencha.gxt.widget.core.client.grid.ColumnModel; import com.sencha.gxt.widget.core.client.grid.Grid; import com.sencha.gxt.widget.core.client.grid.filters.Filter; +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; @@ -652,7 +654,7 @@ public class TabularDataXGridPanel extends ContentPanel { } }; } - ; + grid.addHeaderMouseDownHandler(handler); } } @@ -699,6 +701,9 @@ public class TabularDataXGridPanel extends ContentPanel { columnModel = new ColumnModel(columnsConfig); columnModel = checkOnlyColumn(columnModel); + + + columnModel .addColumnMoveHandler(new ColumnMoveEvent.ColumnMoveHandler() { @@ -715,12 +720,19 @@ public class TabularDataXGridPanel extends ContentPanel { + " Label: " + colDef.getLabel() + " Position: " + colDef.getPosition() + " ColumnId: " + colDef.getColumnLocalId()); - ColumnsReorderingConfig columnsReorderingConfig = new ColumnsReorderingConfig( - columnIndex, colDef); - ColumnsReorderingEvent columnsReorderingEvent = new ColumnsReorderingEvent( - columnsReorderingConfig); - eventBus.fireEvent(columnsReorderingEvent); + if (colDef.isViewColumn()) { + Info.display("Attention", "The view columns can not be moved"); + //ColumnHeader colHeader=grid.getView().getHeader(); + + //event.getSource().moveColumn(columnIndex, colDef.getPosition()); + } else { + ColumnsReorderingConfig columnsReorderingConfig = new ColumnsReorderingConfig( + columnIndex, colDef); + ColumnsReorderingEvent columnsReorderingEvent = new ColumnsReorderingEvent( + columnsReorderingConfig); + eventBus.fireEvent(columnsReorderingEvent); + } } }); @@ -747,7 +759,7 @@ public class TabularDataXGridPanel extends ContentPanel { return new FilterPagingLoadConfigBean(); } }; - + /* * HttpProxy proxy = new * HttpProxy( builder); proxy.setWriter(new @@ -778,7 +790,7 @@ public class TabularDataXGridPanel extends ContentPanel { grid.setView(liveGridView); grid.setBorders(false); grid.setColumnReordering(true); - + // TODO disabled editing rows /* * editing = new GridInlineEditing(grid); @@ -787,7 +799,7 @@ public class TabularDataXGridPanel extends ContentPanel { * for (ColumnConfig c : columnsConfig) { * ColumnConfigGenerator.setEditor(editing, c); } */ - + // numberer.initPlugin(grid); // Filter @@ -807,8 +819,8 @@ public class TabularDataXGridPanel extends ContentPanel { toolBar = new ToolBar(); // toolBar.add(new LiveToolItem(grid)); - tdxLiveToolItem=new TDXLiveToolItem(grid); - + tdxLiveToolItem = new TDXLiveToolItem(grid); + toolBar.add(tdxLiveToolItem); toolBar.addStyleName(ThemeStyles.get().style().borderTop()); toolBar.getElement().getStyle().setProperty("borderBottom", "none"); @@ -834,12 +846,11 @@ public class TabularDataXGridPanel extends ContentPanel { // TODO we need to manually reset the sort sm.onChangeNumberOfRows(); tdxLiveToolItem.setNoSelected(); - + loader.clearSortInfo(); reader.setDefinition(tableDefinition); grid.reconfigure(store, columnModel); - - + ArrayList> filters = FiltersGenerator .generate(columnModel); gridFilters.removeAll(); diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/config/ExtendedLiveGridView.java b/src/main/java/org/gcube/portlets/user/tdwx/client/config/ExtendedLiveGridView.java index 1e17fe7..039b8da 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/config/ExtendedLiveGridView.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/config/ExtendedLiveGridView.java @@ -48,6 +48,7 @@ public class ExtendedLiveGridView extends LiveGridView { cacheStore = list; } + /** * Returns the total number of rows that are visible given the current grid * height.