javaeclipse-rcpnattable

where is COLLAPSED_CHILD label being added for Collapsed row in HIERARCHICAL TABLE(NATTABLE)


I'm working on HierarchicalTreeLayerExample from nattable. When I collapse a row, and try to copy a collapsed cell the value previously in that place gets copied. To prevent it from being copied I'm checking the config label of that particular cell is COLLAPSED_CHILD or not. Even though it is a collapsed child it is not showing COLLAPSED_CHILD in the config label stack.

I needed to know where COLLAPSED_CHILD label is being added into the config label stack and also the label accumulator class for COLLAPSED_CHILD label.


Solution

  • There is no label accumulator class that adds the COLLAPSED_CHILD label. It is directly added by the HierarchicalTreeLayer.

    As the copy operation is done on the SelectionLayer and the HierarchicalTreeLayer is on top of it, you need to mechanism that connects the two layers.

    NatTable provides this via the HierarchicalTreeCopyDataCommandHandler

    For the example you mentioned the following snippet solves the requirement:

        bodyLayerStack.getSelectionLayer().registerCommandHandler(
                new HierarchicalTreeCopyDataCommandHandler(
                        bodyLayerStack.getSelectionLayer(),
                        bodyLayerStack.getTreeLayer(),
                        natTable.getInternalCellClipboard()));