|
|
Re: Inconsistent API [message #1723940 is a reply to message #1723852] |
Fri, 19 February 2016 07:43 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
first of all the post above was not intended to blame anyone (especially not you as you do serve really fast and accurate solutions/great work - sorry). to me the nattable code is not the simplest to understand, but its high performant and extremely configureable (and this is the most important parts)
my question was if there are reasons for this 'style' (which you answered with the UI)
As NatTable uses Commands it seemed obious to me that if a Show Command is available, also an equivalent Hide Command is available too.
i do prefer the indizes for one reason (and it is not easier understanding) its because an Command can be called twice and the state does not change. If i execute a Command referring to a Position, and this one gets called twice, then two Columns get affected (for hide).
ad contribution:
i had a look on the Commands, and those seem to go quite deep into nattable abstract code (hide is always done via positions? - makes sense if all hide stuff comes from UI)
i ended up in just adding one little method in the ColumnHideShowLayer (in my case i simply extended this class)
It is working fine in my usecase, iff you do think this is correct in all cases (not sure if this can cause problems due HideColumnPositionsEvents) feel free to add it to the default ColumnHideShowLayer
public class CustomColumnHideShowLayer extends ColumnHideShowLayer {
public CustomColumnHideShowLayer(IUniqueIndexLayer underlyingLayer) {
super(underlyingLayer);
}
public void hideColumnIndexes(Collection<Integer> columnIndexes) {
Set<Integer> columnPositions = new HashSet<Integer>();
for (Integer columnIndex : columnIndexes) {
columnPositions
.add(Integer
.valueOf(getColumnPositionByIndex(columnIndex
.intValue())));
}
getHiddenColumnIndexes().addAll(columnIndexes);
invalidateCache();
fireLayerEvent(new HideColumnPositionsEvent(this, columnPositions));
}
}
[Updated on: Fri, 19 February 2016 07:45] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02702 seconds