Minor update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@101682 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
acdf233182
commit
fa6fb577c6
|
@ -13,6 +13,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridHeaderColum
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.GridHeaderColumnMenuItemType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.grid.model.RowRaw;
|
||||
import org.gcube.portlets.user.tdwx.client.config.ExtendedLiveGridView;
|
||||
import org.gcube.portlets.user.tdwx.client.config.GridAndCellSelectionModel;
|
||||
import org.gcube.portlets.user.tdwx.client.config.Row;
|
||||
import org.gcube.portlets.user.tdwx.client.config.TableViewConfig;
|
||||
|
@ -72,7 +73,6 @@ import com.sencha.gxt.widget.core.client.event.HeaderMouseDownEvent.HeaderMouseD
|
|||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
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.LiveGridView;
|
||||
import com.sencha.gxt.widget.core.client.grid.LiveToolItem;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.Filter;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
|
@ -108,7 +108,7 @@ public class TabularDataXGridPanel extends ContentPanel {
|
|||
|
||||
protected VerticalLayoutContainer container;
|
||||
|
||||
protected ExtendedLiveGridView liveGridView;
|
||||
protected ExtendedLiveGridView<DataRow> liveGridView;
|
||||
|
||||
protected DataRowPagingReader reader;
|
||||
|
||||
|
@ -739,7 +739,7 @@ public class TabularDataXGridPanel extends ContentPanel {
|
|||
loader.addLoadHandler(new LoadResultListStoreBinding<FilterPagingLoadConfig, DataRow, PagingLoadResult<DataRow>>(
|
||||
store));
|
||||
|
||||
liveGridView = new ExtendedLiveGridView();
|
||||
liveGridView = new ExtendedLiveGridView<DataRow>();
|
||||
|
||||
// liveGridView.setRowHeight(19);
|
||||
|
||||
|
@ -999,17 +999,6 @@ public class TabularDataXGridPanel extends ContentPanel {
|
|||
* int row = store.indexOf(dataRow); editing.startEditing(new
|
||||
* GridCell(row, pos)); }
|
||||
*/
|
||||
}
|
||||
|
||||
protected class ExtendedLiveGridView extends LiveGridView<DataRow> {
|
||||
// TODO bug in gxt3 3.0.0 fixed in future
|
||||
|
||||
@Override
|
||||
public void refresh(boolean headerToo) {
|
||||
preventScrollToTopOnRefresh = true;
|
||||
super.refresh(headerToo);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.tdwx.client.config;
|
||||
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.widget.core.client.grid.LiveGridView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @param <M>
|
||||
*/
|
||||
public class ExtendedLiveGridView<M> extends LiveGridView<M> {
|
||||
// TODO bug in gxt3 3.0.0 fixed in future
|
||||
|
||||
|
||||
@Override
|
||||
public void refresh(boolean headerToo) {
|
||||
preventScrollToTopOnRefresh = true;
|
||||
super.refresh(headerToo);
|
||||
}
|
||||
|
||||
public boolean getPreventSScrollToTopOnRefresh(){
|
||||
return preventScrollToTopOnRefresh;
|
||||
}
|
||||
|
||||
|
||||
public void setPreventSScrollToTopOnRefresh(boolean prevent ){
|
||||
preventScrollToTopOnRefresh=prevent;
|
||||
}
|
||||
|
||||
public ListStore<M> getCacheStore(){
|
||||
return cacheStore;
|
||||
}
|
||||
|
||||
public void setCacheStore(ListStore<M> list){
|
||||
cacheStore=list;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,13 +11,12 @@ import com.sencha.gxt.widget.core.client.event.XEvent;
|
|||
import com.sencha.gxt.widget.core.client.grid.GridSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.selection.CellSelection;
|
||||
|
||||
|
||||
/**
|
||||
* Extends the GridSelectionModel to retrieve the selected cell.
|
||||
* CellSelectionModel is not suitable.
|
||||
*
|
||||
* @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>
|
||||
*
|
||||
* @param <M>
|
||||
*/
|
||||
|
@ -62,7 +61,7 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
|
|||
}
|
||||
if (selectionMode == SelectionMode.MULTI) {
|
||||
M sel = listStore.get(rowIndex);
|
||||
cellSelected=new CellSelection<M>(sel, rowIndex,colIndex);
|
||||
cellSelected = new CellSelection<M>(sel, rowIndex, colIndex);
|
||||
if (xe.getCtrlOrMetaKey() && isSelected(sel)) {
|
||||
doDeselect(Collections.singletonList(sel), false);
|
||||
} else if (xe.getCtrlOrMetaKey()) {
|
||||
|
@ -107,12 +106,12 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
|
|||
if (event.getEvent().getButton() == Event.BUTTON_RIGHT) {
|
||||
if (selectionMode != SelectionMode.SINGLE
|
||||
&& isSelected(listStore.get(rowIndex))) {
|
||||
M sel=listStore.get(rowIndex);
|
||||
cellSelected=new CellSelection<M>(sel, rowIndex,colIndex);
|
||||
M sel = listStore.get(rowIndex);
|
||||
cellSelected = new CellSelection<M>(sel, rowIndex, colIndex);
|
||||
return;
|
||||
}
|
||||
M sel=listStore.get(rowIndex);
|
||||
cellSelected=new CellSelection<M>(sel, rowIndex,colIndex);
|
||||
M sel = listStore.get(rowIndex);
|
||||
cellSelected = new CellSelection<M>(sel, rowIndex, colIndex);
|
||||
grid.getView().focusCell(rowIndex, colIndex, false);
|
||||
select(rowIndex, false);
|
||||
} else {
|
||||
|
@ -120,7 +119,7 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
|
|||
if (selectionMode == SelectionMode.SIMPLE) {
|
||||
if (!isSelected(sel)) {
|
||||
grid.getView().focusCell(rowIndex, colIndex, false);
|
||||
cellSelected=new CellSelection<M>(sel, rowIndex,colIndex);
|
||||
cellSelected = new CellSelection<M>(sel, rowIndex, colIndex);
|
||||
select(sel, true);
|
||||
}
|
||||
|
||||
|
@ -129,7 +128,7 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
|
|||
deselect(sel);
|
||||
} else if (!isSelected(sel)) {
|
||||
grid.getView().focusCell(rowIndex, colIndex, false);
|
||||
cellSelected=new CellSelection<M>(sel, rowIndex,colIndex);
|
||||
cellSelected = new CellSelection<M>(sel, rowIndex, colIndex);
|
||||
select(sel, false);
|
||||
}
|
||||
} else if (!e.getCtrlOrMetaKey()) {
|
||||
|
@ -140,7 +139,7 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
|
|||
select(last, index, e.getCtrlOrMetaKey());
|
||||
} else if (!isSelected(sel)) {
|
||||
grid.getView().focusCell(rowIndex, colIndex, false);
|
||||
cellSelected=new CellSelection<M>(sel, rowIndex,colIndex);
|
||||
cellSelected = new CellSelection<M>(sel, rowIndex, colIndex);
|
||||
doSelect(Collections.singletonList(sel), false, false);
|
||||
}
|
||||
} else {
|
||||
|
@ -168,5 +167,4 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue