aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/NativeSelect.java
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-11-23 07:45:03 +0000
committerMarc Englund <marc.englund@itmill.com>2007-11-23 07:45:03 +0000
commit795e977f82d50dfb3c1a7f3bfb24a46c5cb4a407 (patch)
treed7b68affcdee7dbf430ccca25b396d8ed628b361 /src/com/itmill/toolkit/ui/NativeSelect.java
parent1e4c89a511811135094a3e238dd04be452a3261c (diff)
downloadvaadin-framework-795e977f82d50dfb3c1a7f3bfb24a46c5cb4a407.tar.gz
vaadin-framework-795e977f82d50dfb3c1a7f3bfb24a46c5cb4a407.zip
setColumns() and setRows() added to selects as appropriate, made to match width of TextField.
Fixes #898 svn changeset:2893/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/NativeSelect.java')
-rw-r--r--src/com/itmill/toolkit/ui/NativeSelect.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/ui/NativeSelect.java b/src/com/itmill/toolkit/ui/NativeSelect.java
index 353ca9c8d8..9c5859095e 100644
--- a/src/com/itmill/toolkit/ui/NativeSelect.java
+++ b/src/com/itmill/toolkit/ui/NativeSelect.java
@@ -14,6 +14,9 @@ import com.itmill.toolkit.terminal.PaintTarget;
*/
public class NativeSelect extends AbstractSelect {
+ // width in characters, mimics TextField
+ private int columns = 0;
+
public NativeSelect() {
super();
}
@@ -30,8 +33,35 @@ public class NativeSelect extends AbstractSelect {
super(caption);
}
+ /**
+ * Sets the number of columns in the editor. If the number of columns is set
+ * 0, the actual number of displayed columns is determined implicitly by the
+ * adapter.
+ *
+ * @param columns
+ * the number of columns to set.
+ */
+ public void setColumns(int columns) {
+ if (columns < 0) {
+ columns = 0;
+ }
+ if (this.columns != columns) {
+ this.columns = columns;
+ requestRepaint();
+ }
+ }
+
+ public int getColumns() {
+ return columns;
+ }
+
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute("type", "native");
+ // Adds the number of columns
+ if (columns != 0) {
+ target.addAttribute("cols", columns);
+ }
+
super.paintContent(target);
}