Search in sources :

Example 1 with ShowColumnPositionsEvent

use of net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent in project translationstudio8 by heartsome.

the class ColumnGroupExpandCollapseCommandHandler method doCommand.

@Override
protected boolean doCommand(ColumnGroupExpandCollapseCommand command) {
    int columnIndex = columnGroupExpandCollapseLayer.getColumnIndexByPosition(command.getColumnPosition());
    ColumnGroupModel model = columnGroupExpandCollapseLayer.getModel();
    boolean wasCollapsed = model.isCollapsed(columnIndex);
    ColumnGroup columnGroup = model.toggleColumnGroupExpandCollapse(columnIndex);
    List<Integer> columnPositions = new ArrayList<Integer>(columnGroup.getMembers());
    columnPositions.remove(0);
    ILayerEvent event;
    if (wasCollapsed) {
        event = new ShowColumnPositionsEvent(columnGroupExpandCollapseLayer, columnPositions);
    } else {
        event = new HideColumnPositionsEvent(columnGroupExpandCollapseLayer, columnPositions);
    }
    columnGroupExpandCollapseLayer.fireLayerEvent(event);
    return true;
}
Also used : ILayerEvent(net.sourceforge.nattable.layer.event.ILayerEvent) HideColumnPositionsEvent(net.sourceforge.nattable.hideshow.event.HideColumnPositionsEvent) ArrayList(java.util.ArrayList) ColumnGroup(net.sourceforge.nattable.group.ColumnGroupModel.ColumnGroup) ColumnGroupModel(net.sourceforge.nattable.group.ColumnGroupModel) ShowColumnPositionsEvent(net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent)

Example 2 with ShowColumnPositionsEvent

use of net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent in project translationstudio8 by heartsome.

the class ColumnHideShowLayer method showColumnIndexes.

protected void showColumnIndexes(Collection<Integer> columnIndexes) {
    for (int columnIndex : columnIndexes) {
        hiddenColumnIndexes.remove(Integer.valueOf(columnIndex));
    }
    invalidateCache();
    // Since we are exposing this method for showing individual columns, a structure event must be fired here.
    fireLayerEvent(new ShowColumnPositionsEvent(this, columnIndexes));
}
Also used : ShowColumnPositionsEvent(net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent)

Example 3 with ShowColumnPositionsEvent

use of net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent in project translationstudio8 by heartsome.

the class ColumnHideShowLayer method showColumnIndexes.

public void showColumnIndexes(int[] columnIndexes) {
    Set<Integer> columnIndexesSet = new HashSet<Integer>();
    for (int i = 0; i < columnIndexes.length; i++) {
        columnIndexesSet.add(Integer.valueOf(columnIndexes[i]));
    }
    hiddenColumnIndexes.removeAll(columnIndexesSet);
    invalidateCache();
    fireLayerEvent(new ShowColumnPositionsEvent(this, getColumnPositionsByIndexes(columnIndexes)));
}
Also used : ShowColumnPositionsEvent(net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent) HashSet(java.util.HashSet)

Example 4 with ShowColumnPositionsEvent

use of net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent in project translationstudio8 by heartsome.

the class ColumnHideShowLayer method showAllColumns.

public void showAllColumns() {
    Collection<Integer> hiddenColumns = new ArrayList<Integer>(hiddenColumnIndexes);
    hiddenColumnIndexes.clear();
    invalidateCache();
    fireLayerEvent(new ShowColumnPositionsEvent(this, hiddenColumns));
}
Also used : ArrayList(java.util.ArrayList) ShowColumnPositionsEvent(net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent)

Aggregations

ShowColumnPositionsEvent (net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent)4 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)1 ColumnGroupModel (net.sourceforge.nattable.group.ColumnGroupModel)1 ColumnGroup (net.sourceforge.nattable.group.ColumnGroupModel.ColumnGroup)1 HideColumnPositionsEvent (net.sourceforge.nattable.hideshow.event.HideColumnPositionsEvent)1 ILayerEvent (net.sourceforge.nattable.layer.event.ILayerEvent)1