summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-07-09 10:13:27 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-07-09 10:13:27 +0000
commit3aab8e558b60088bb6dca5e75a320ef3dc6b0aba (patch)
treee273f27903ef57313131dab0fbe679bb431650bd
parentd4d61d68982b5ce5ff435ab7c8644709cdc5950e (diff)
downloadvaadin-framework-3aab8e558b60088bb6dca5e75a320ef3dc6b0aba.tar.gz
vaadin-framework-3aab8e558b60088bb6dca5e75a320ef3dc6b0aba.zip
#7387 Render block elements in TreeTable hierarchy column correctly: draw the expand/collapse arrow as position: absolute and use padding for indentation. Also fix typo "ident" -> "indent".
svn changeset:23994/svn branch:6.8
-rw-r--r--WebContent/VAADIN/themes/base/treetable/treetable.css14
-rw-r--r--WebContent/VAADIN/themes/reindeer/table/table.css6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java44
3 files changed, 41 insertions, 23 deletions
diff --git a/WebContent/VAADIN/themes/base/treetable/treetable.css b/WebContent/VAADIN/themes/base/treetable/treetable.css
index 1bc21b890c..662839a4a2 100644
--- a/WebContent/VAADIN/themes/base/treetable/treetable.css
+++ b/WebContent/VAADIN/themes/base/treetable/treetable.css
@@ -4,13 +4,13 @@
height: 10px;
/* defines the amount of indent per level */
width: 18px;
-}
-.v-ie7 .v-treetable-treespacer{
- height: 100%; /* #7388 */
+ position: absolute;
+ left: 0;
+ top: 5px;
}
.v-treetable-node-closed {
- background: url(../treetable/img/arrow-right.png) right center no-repeat;
+ background: url(../treetable/img/arrow-right.png) right top no-repeat;
}
.v-ie6 .v-treetable-node-closed {
@@ -18,7 +18,7 @@
}
.v-treetable-node-open {
- background: url(../treetable/img/arrow-down.png) right center no-repeat;
+ background: url(../treetable/img/arrow-down.png) right top no-repeat;
}
.v-ie6 .v-treetable-node-open {
@@ -36,6 +36,10 @@
z-index: 10;
}
+.v-treetable .v-table-cell-wrapper {
+ position: relative;
+}
+
.v-treetable .v-table-body .v-table-table .v-table-row-animating {
zoom:1;
z-index:1;
diff --git a/WebContent/VAADIN/themes/reindeer/table/table.css b/WebContent/VAADIN/themes/reindeer/table/table.css
index 2e6c597160..cab7d6a01f 100644
--- a/WebContent/VAADIN/themes/reindeer/table/table.css
+++ b/WebContent/VAADIN/themes/reindeer/table/table.css
@@ -130,9 +130,9 @@
text-shadow: #f3f5f8 0 1px 0;
line-height: normal;
}
-.v-table-generated-row .v-table-cell-content {
- padding-top: 1px;
- padding-bottom: 2px;
+.v-table-generated-row .v-table-cell-wrapper {
+ padding-top: 4px;
+ padding-bottom: 5px;
}
.v-table-cell-content:last-child {
border-right-color: transparent;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java b/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java
index 324efcb67d..9899ec25e4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java
@@ -173,7 +173,7 @@ public class VTreeTable extends VScrollTable {
}
class VTreeTableScrollBody extends VScrollTable.VScrollTableBody {
- private int identWidth = -1;
+ private int indentWidth = -1;
VTreeTableScrollBody() {
super();
@@ -241,7 +241,7 @@ public class VTreeTable extends VScrollTable {
container.insertFirst(treeSpacer);
depth = rowUidl.hasAttribute("depth") ? rowUidl
.getIntAttribute("depth") : 0;
- setIdent();
+ setIndent();
isTreeCellAdded = true;
return true;
}
@@ -278,18 +278,19 @@ public class VTreeTable extends VScrollTable {
}
- private void setIdent() {
- if (getIdentWidth() > 0 && depth != 0) {
- treeSpacer.getStyle().setWidth(
- (depth + 1) * getIdentWidth(), Unit.PX);
+ private void setIndent() {
+ if (getIndentWidth() > 0) {
+ treeSpacer.getParentElement().getStyle()
+ .setPaddingLeft(getIndent(), Unit.PX);
+ treeSpacer.getStyle().setWidth(getIndent(), Unit.PX);
}
}
@Override
protected void onAttach() {
super.onAttach();
- if (getIdentWidth() < 0) {
- detectIdent(this);
+ if (getIndentWidth() < 0) {
+ detectIndent(this);
}
}
@@ -326,6 +327,19 @@ public class VTreeTable extends VScrollTable {
return consumedSpace;
}
+ @Override
+ protected void setCellWidth(int cellIx, int width) {
+ if (cellIx == colIndexOfHierarchy + (showRowHeaders ? 1 : 0)) {
+ // take indentation padding into account if this is the
+ // hierarchy column
+ width -= getIndent();
+ }
+ super.setCellWidth(cellIx, width);
+ }
+
+ private int getIndent() {
+ return (depth + 1) * getIndentWidth();
+ }
}
protected class VTreeTableGeneratedRow extends VTreeTableRow {
@@ -452,20 +466,20 @@ public class VTreeTable extends VScrollTable {
}
}
- private int getIdentWidth() {
- return identWidth;
+ private int getIndentWidth() {
+ return indentWidth;
}
- private void detectIdent(VTreeTableRow vTreeTableRow) {
- identWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
- if (identWidth == 0) {
- identWidth = -1;
+ private void detectIndent(VTreeTableRow vTreeTableRow) {
+ indentWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
+ if (indentWidth == 0) {
+ indentWidth = -1;
return;
}
Iterator<Widget> iterator = iterator();
while (iterator.hasNext()) {
VTreeTableRow next = (VTreeTableRow) iterator.next();
- next.setIdent();
+ next.setIndent();
}
}