diff options
Diffstat (limited to 'src/com/vaadin/terminal/gwt/client/ui')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java | 7 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java | 44 |
2 files changed, 35 insertions, 16 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java index 4050f1bafc..c8bebc2c66 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java +++ b/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java @@ -301,7 +301,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, if (!prompting && newText != null && !newText.equals(valueBeforeEdit)) { sendValueChange = immediate; - client.updateVariable(paintableId, "text", getText(), false); + client.updateVariable(paintableId, "text", newText, false); valueBeforeEdit = newText; valueBeforeEditIsSynced = true; } @@ -366,6 +366,11 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, @Override public void onBlur(BlurEvent event) { + // this is called twice on Chrome when e.g. changing tab while prompting + // field focused - do not change settings on the second time + if (focusedTextField != this) { + return; + } removeStyleDependentName(CLASSNAME_FOCUS); focusedTextField = null; String text = getText(); diff --git a/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java b/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java index 91e1fe2a3d..c03dff9507 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java @@ -97,7 +97,7 @@ public class VTreeTable extends VScrollTable { } class VTreeTableScrollBody extends VScrollTable.VScrollTableBody { - private int identWidth = -1; + private int indentWidth = -1; VTreeTableScrollBody() { super(); @@ -165,7 +165,7 @@ public class VTreeTable extends VScrollTable { container.insertFirst(treeSpacer); depth = rowUidl.hasAttribute("depth") ? rowUidl .getIntAttribute("depth") : 0; - setIdent(); + setIndent(); isTreeCellAdded = true; return true; } @@ -202,18 +202,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); } } @@ -227,6 +228,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 = Math.max(width - getIndent(), 0); + } + super.setCellWidth(cellIx, width); + } + + private int getIndent() { + return (depth + 1) * getIndentWidth(); + } } protected class VTreeTableGeneratedRow extends VTreeTableRow { @@ -354,20 +368,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(); } } |