diff options
author | Dirk Fauth | 2015-11-10 20:51:55 +0000 |
---|---|---|
committer | Dirk Fauth | 2015-11-10 20:52:53 +0000 |
commit | 822039498793af73319430cb7401961daf43a5d8 (patch) | |
tree | 0fe2674d138edbbdc496a613b88e482828b1b251 | |
parent | 8929e409f95ca756ea2a70f3bc1b9a3108742d99 (diff) | |
download | org.eclipse.nebula.widgets.nattable-822039498793af73319430cb7401961daf43a5d8.tar.gz org.eclipse.nebula.widgets.nattable-822039498793af73319430cb7401961daf43a5d8.tar.xz org.eclipse.nebula.widgets.nattable-822039498793af73319430cb7401961daf43a5d8.zip |
Bug 481879 - Add convenience method for triggering a visual refresh
Change-Id: I208acffc38cfc65921db36930d78bd2ddadc1bbc
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
2 files changed, 23 insertions, 4 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/NatTable.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/NatTable.java index 7d921416..eda241bf 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/NatTable.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/NatTable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 Original authors and others. + * Copyright (c) 2012, 2015 Original authors and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -557,12 +557,32 @@ public class NatTable extends Canvas implements ILayer, PaintListener, IClientAr } /** - * Refreshes the entire NatTable as every layer will be refreshed. + * Refreshes the entire NatTable as every layer will be refreshed. Used to + * update on structural changes. */ public void refresh() { doCommand(new StructuralRefreshCommand()); } + /** + * Refreshes the entire NatTable as every layer will be refreshed. + * + * @param structuralChange + * <code>true</code> if a structural refresh should be performed + * (same as calling {@link #refresh()}), <code>false</code> if + * only a visual refresh should be performed, e.g. if + * configuration values have changed. + * + * @since 1.4 + */ + public void refresh(boolean structuralChange) { + if (structuralChange) { + refresh(); + } else { + doCommand(new VisualRefreshCommand()); + } + } + @Override public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) { throw new UnsupportedOperationException("Cannot use this method to configure NatTable. Use no-argument configure() instead."); //$NON-NLS-1$ diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java index b54dad48..ad3d8442 100644 --- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java +++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java @@ -12,7 +12,6 @@ package org.eclipse.nebula.widgets.nattable.examples._500_Layers._501_Data; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.nebula.widgets.nattable.NatTable; -import org.eclipse.nebula.widgets.nattable.command.VisualRefreshCommand; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; @@ -125,7 +124,7 @@ public class _5011_DataLayerExample extends AbstractNatExample { // triggering a refresh automatically // this is because setting the default usually should be done // prior rendering - natTable.doCommand(new VisualRefreshCommand()); + natTable.refresh(false); } }); |