summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorTaras Hupalo <taras.hupalo@gmail.com>2015-08-05 13:09:30 +0300
committerpatrik <patrik@vaadin.com>2015-08-12 16:13:42 +0300
commita84cb40b2f3bbfa1dc8f2ee883249295598722e8 (patch)
treeb0c240d8bfc82177ca1bf9e90a57a0447f4076d2 /client
parent2170d80b157933fb4fa36bf0cc66f3780efdf0f1 (diff)
downloadvaadin-framework-a84cb40b2f3bbfa1dc8f2ee883249295598722e8.tar.gz
vaadin-framework-a84cb40b2f3bbfa1dc8f2ee883249295598722e8.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: I71e64a420d9fc1ae0d970bdc7eb71fdfb34553c3
Diffstat (limited to 'client')
-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);