summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorTaras Hupalo <taras.hupalo@gmail.com>2015-08-05 13:09:30 +0300
committerVaadin Code Review <review@vaadin.com>2015-08-12 09:54:54 +0000
commita3c9c8ee978ec4117266a30e6483da5aca475e46 (patch)
tree4aa56f001d2c91becb6865d12f1def4e205c047c /client/src
parente02262491c5d3d1b5c8c8e08a118af65e9b5f6ac (diff)
downloadvaadin-framework-a3c9c8ee978ec4117266a30e6483da5aca475e46.tar.gz
vaadin-framework-a3c9c8ee978ec4117266a30e6483da5aca475e46.zip
Add class for last frozen column requested by designers (#18590)
See https://github.com/vaadin/components/pull/57#issuecomment-127622121 for details Change-Id: Iba32b6f36f5c98c86a3902133c7486af2dad9669
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/widgets/Escalator.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java
index a6247aee12..99f13378d4 100644
--- a/client/src/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/com/vaadin/client/widgets/Escalator.java
@@ -1475,6 +1475,9 @@ public class Escalator extends Widget implements RequiresResize,
cellElem.addClassName("frozen");
position.set(cellElem, scroller.lastScrollLeft, 0);
}
+ if (columnConfiguration.frozenColumns > 0 && col == columnConfiguration.frozenColumns - 1) {
+ cellElem.addClassName("last-frozen");
+ }
}
referenceRow = paintInsertRow(referenceRow, tr, row);
@@ -1732,6 +1735,14 @@ public class Escalator extends Widget implements RequiresResize,
}
public void setColumnFrozen(int column, boolean frozen) {
+ toggleFrozenColumnClass(column, frozen, "frozen");
+
+ if (frozen) {
+ updateFreezePosition(column, scroller.lastScrollLeft);
+ }
+ }
+
+ private void toggleFrozenColumnClass(int column, boolean frozen, String className) {
final NodeList<TableRowElement> childRows = root.getRows();
for (int row = 0; row < childRows.getLength(); row++) {
@@ -1742,16 +1753,16 @@ public class Escalator extends Widget implements RequiresResize,
TableCellElement cell = tr.getCells().getItem(column);
if (frozen) {
- cell.addClassName("frozen");
+ cell.addClassName(className);
} else {
- cell.removeClassName("frozen");
+ cell.removeClassName(className);
position.reset(cell);
}
}
+ }
- if (frozen) {
- updateFreezePosition(column, scroller.lastScrollLeft);
- }
+ public void setColumnLastFrozen(int column, boolean lastFrozen) {
+ toggleFrozenColumnClass(column, lastFrozen, "last-frozen");
}
public void updateFreezePosition(int column, double scrollLeft) {
@@ -4309,6 +4320,17 @@ public class Escalator extends Widget implements RequiresResize,
firstUnaffectedCol = oldCount;
}
+ if (oldCount > 0) {
+ header.setColumnLastFrozen(oldCount - 1, false);
+ body.setColumnLastFrozen(oldCount - 1, false);
+ footer.setColumnLastFrozen(oldCount - 1, false);
+ }
+ if (count > 0) {
+ header.setColumnLastFrozen(count - 1, true);
+ body.setColumnLastFrozen(count - 1, true);
+ footer.setColumnLastFrozen(count - 1, true);
+ }
+
for (int col = firstAffectedCol; col < firstUnaffectedCol; col++) {
header.setColumnFrozen(col, frozen);
body.setColumnFrozen(col, frozen);