From 2bb497caf0aff75a63c1c7683482303511a09c1a Mon Sep 17 00:00:00 2001 From: John Alhroos Date: Fri, 13 Aug 2010 11:35:38 +0000 Subject: Fix for #5258 svn changeset:14487/svn branch:6.4 --- .../vaadin/terminal/gwt/client/ui/VTextField.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/com') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java index 187bd9463f..ba2b86b663 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java @@ -4,6 +4,7 @@ package com.vaadin.terminal.gwt.client.ui; +import com.google.gwt.dom.client.Style.Cursor; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ChangeEvent; @@ -61,6 +62,7 @@ public class VTextField extends TextBoxBase implements Paintable, Field, private String inputPrompt = null; private boolean prompting = false; private int lastCursorPos = -1; + private int lastTabIndex = 0; public VTextField() { this(DOM.createInputText()); @@ -89,6 +91,24 @@ public class VTextField extends TextBoxBase implements Paintable, Field, } } + @Override + public void setReadOnly(boolean readOnly) { + super.setReadOnly(readOnly); + if (readOnly) { + setTabIndex(-1); + getElement().getStyle().setCursor(Cursor.DEFAULT); + } else { + setTabIndex(lastTabIndex); + getElement().getStyle().setCursor(Cursor.TEXT); + } + } + + @Override + public void setTabIndex(int index) { + lastTabIndex = getTabIndex(); + super.setTabIndex(index); + } + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { this.client = client; id = uidl.getId(); -- cgit v1.2.3