use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowColumnPositionsEvent in project nebula.widgets.nattable by eclipse.
the class ShowColumnPositionsEventDiffTest method before.
@Before
public void before() {
this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
this.hideShowLayer = new ColumnHideShowLayer(this.dataLayer);
this.viewportLayer = new ViewportLayer(this.hideShowLayer);
this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 800, 400);
}
});
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
this.event = new ShowColumnPositionsEvent(this.dataLayer, Arrays.asList(new Integer[] { 2, 4, 7, 8, 9 }));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowColumnPositionsEvent in project nebula.widgets.nattable by eclipse.
the class ColumnHideShowLayer method showAllColumns.
@Override
public void showAllColumns() {
Collection<Integer> hiddenColumns = new ArrayList<Integer>(this.hiddenColumnIndexes);
this.hiddenColumnIndexes.clear();
invalidateCache();
fireLayerEvent(new ShowColumnPositionsEvent(this, hiddenColumns));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowColumnPositionsEvent in project nebula.widgets.nattable by eclipse.
the class ColumnGroupExpandCollapseCommandHandler method doCommand.
@Override
protected boolean doCommand(ColumnGroupExpandCollapseCommand command) {
int columnIndex = this.columnGroupExpandCollapseLayer.getColumnIndexByPosition(command.getColumnPosition());
ColumnGroupModel model = this.columnGroupExpandCollapseLayer.getModel(command.getRowPosition());
ColumnGroup columnGroup = model.getColumnGroupByIndex(columnIndex);
// further operation ...
if (columnGroup == null || !columnGroup.isCollapseable()) {
return true;
}
List<Integer> columnIndexes = new ArrayList<Integer>(columnGroup.getMembers());
columnIndexes.removeAll(columnGroup.getStaticColumnIndexes());
boolean wasCollapsed = columnGroup.isCollapsed();
if (wasCollapsed) {
// we need to cleanup the column position list before we toggle
// because the columns are hidden before the toggle and will be
// visible afterwards
cleanupColumnIndexes(columnIndexes);
}
columnGroup.toggleCollapsed();
if (!wasCollapsed) {
// we need to cleanup the column position list after we toggle
// because the columns are hidden now
cleanupColumnIndexes(columnIndexes);
}
ILayerEvent event;
if (wasCollapsed) {
event = new ShowColumnPositionsEvent(this.columnGroupExpandCollapseLayer, columnIndexes);
} else {
event = new HideColumnPositionsEvent(this.columnGroupExpandCollapseLayer, columnIndexes);
}
this.columnGroupExpandCollapseLayer.fireLayerEvent(event);
return true;
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowColumnPositionsEvent in project nebula.widgets.nattable by eclipse.
the class ColumnHideShowLayer method showColumnIndexes.
@Override
public void showColumnIndexes(Collection<Integer> columnIndexes) {
this.hiddenColumnIndexes.removeAll(columnIndexes);
invalidateCache();
fireLayerEvent(new ShowColumnPositionsEvent(this, getColumnPositionsByIndexes(columnIndexes)));
}
Aggregations