MoveSelectionCommand with multiple cells selected [message #1724541] |
Wed, 24 February 2016 08:48  |
Eclipse User |
|
|
|
Hi,
is there a way to move all selected cells by MoveSelectionCommand? Or is there may be another way to
move all selections?
As fare as I noticed only one cell is selected after the MoveSelectionCommand command was done.
Any hints are appreciated, Martin
|
|
|
|
|
|
Re: MoveSelectionCommand with multiple cells selected [message #1724727 is a reply to message #1724675] |
Thu, 25 February 2016 10:36   |
Eclipse User |
|
|
|
Yes it is only to keep the selection on moved rows.
After looking up the examples found at github I added the PreserveSelectionModel but now I cant
select cells/rows any more.
The BodyLayerStack code is as follow:
public class BodyLayerStack extends AbstractLayerTransform {
private SelectionLayer mSelectionLayer;
private DataLayer mBodyDataLayer;
public BodyLayerStack(IDataProvider dataProvider) {
mBodyDataLayer = new DataLayer(dataProvider);
mBodyDataLayer.setColumnPercentageSizing(true);
mBodyDataLayer.setColumnWidthPercentageByPosition(0, 20);
mBodyDataLayer.setColumnWidthPercentageByPosition(1, 20);
mBodyDataLayer.setColumnWidthPercentageByPosition(2, 20);
mBodyDataLayer.setColumnWidthPercentageByPosition(3, 13);
mBodyDataLayer.setColumnWidthPercentageByPosition(4, 13);
mBodyDataLayer.setColumnWidthPercentageByPosition(5, 14);
mSelectionLayer = new SelectionLayer(mBodyDataLayer,false);
mSelectionLayer.setSelectionModel(new
PreserveSelectionModel<CorridorItem>(mSelectionLayer, (IRowDataProvider<CorridorItem>) dataProvider,
new IRowIdAccessor<CorridorItem>() {
@Override
public Serializable getRowId(CorridorItem rowObject) {
return rowObject.getClass().hashCode();
}
}));
ViewportLayer viewportLayer = new ViewportLayer(mSelectionLayer);
setUnderlyingLayer(viewportLayer);
}
public SelectionLayer getSelectionLayer() {
return mSelectionLayer;
}
public DataLayer getBodyDataLayer() {
return mBodyDataLayer;
}
}
May be it has to do with enable row selection. But how to do this?
Martin
Dirk Fauth schrieb am 25.02.2016 um 12:49:
> So it is only to keep the selection on moved rows? Do you have row selection enabled? In that case
> it is quite simple. Use the RowSelectionModel which tracks the selection by unique row id you have
> to specify. On cell level it is the PreserveSelectionModel (I think that is the name).
|
|
|
Re: MoveSelectionCommand with multiple cells selected [message #1724729 is a reply to message #1724727] |
Thu, 25 February 2016 10:44   |
Eclipse User |
|
|
|
my mistake was to use
mSelectionLayer = new SelectionLayer(mBodyDataLayer,false);
bu should have used
mSelectionLayer = new SelectionLayer(mBodyDataLayer); //without the false parameter
Now I am able to select a single cell but the whole column is highlighted. Without the selection
model I can select individual cells which I prefer. But how to do this with PreserveSelectionModel?
Martin
Martin Jacob schrieb am 25.02.2016 um 16:36:
> Yes it is only to keep the selection on moved rows.
> After looking up the examples found at github I added the PreserveSelectionModel but now I cant
> select cells/rows any more.
>
> The BodyLayerStack code is as follow:
> public class BodyLayerStack extends AbstractLayerTransform {
> private SelectionLayer mSelectionLayer;
> private DataLayer mBodyDataLayer;
>
> public BodyLayerStack(IDataProvider dataProvider) {
> mBodyDataLayer = new DataLayer(dataProvider);
> mBodyDataLayer.setColumnPercentageSizing(true);
> mBodyDataLayer.setColumnWidthPercentageByPosition(0, 20);
> mBodyDataLayer.setColumnWidthPercentageByPosition(1, 20);
> mBodyDataLayer.setColumnWidthPercentageByPosition(2, 20);
> mBodyDataLayer.setColumnWidthPercentageByPosition(3, 13);
> mBodyDataLayer.setColumnWidthPercentageByPosition(4, 13);
> mBodyDataLayer.setColumnWidthPercentageByPosition(5, 14);
> mSelectionLayer = new SelectionLayer(mBodyDataLayer,false);
> mSelectionLayer.setSelectionModel(new
> PreserveSelectionModel<CorridorItem>(mSelectionLayer, (IRowDataProvider<CorridorItem>)
> dataProvider, new IRowIdAccessor<CorridorItem>() {
>
> @Override
> public Serializable getRowId(CorridorItem rowObject) {
> return rowObject.getClass().hashCode();
> }
>
> }));
>
> ViewportLayer viewportLayer = new ViewportLayer(mSelectionLayer);
> setUnderlyingLayer(viewportLayer);
> }
>
> public SelectionLayer getSelectionLayer() {
> return mSelectionLayer;
> }
>
> public DataLayer getBodyDataLayer() {
> return mBodyDataLayer;
> }
> }
>
>
> May be it has to do with enable row selection. But how to do this?
>
> Martin
>
> Dirk Fauth schrieb am 25.02.2016 um 12:49:
>> So it is only to keep the selection on moved rows? Do you have row selection enabled? In that
>> case it is quite simple. Use the RowSelectionModel which tracks the selection by unique row id
>> you have to specify. On cell level it is the PreserveSelectionModel (I think that is the name).
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04179 seconds