From 30a5dee6b6327a2f9f9b95e5748f27a7db657235 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 21 Oct 2010 14:45:47 +0000 Subject: [PATCH] #5865: class stubs + depracations towards one to one widget mapping svn changeset:15648/svn branch:6.5 --- src/com/vaadin/ui/HorizontalSplitPanel.java | 5 ++ src/com/vaadin/ui/PasswordField.java | 30 +++++++ src/com/vaadin/ui/SplitPanel.java | 20 +++++ src/com/vaadin/ui/TextArea.java | 98 +++++++++++++++++++++ src/com/vaadin/ui/TextField.java | 21 ++++- src/com/vaadin/ui/VerticalSplitPanel.java | 9 ++ 6 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 src/com/vaadin/ui/HorizontalSplitPanel.java create mode 100644 src/com/vaadin/ui/PasswordField.java create mode 100644 src/com/vaadin/ui/TextArea.java create mode 100644 src/com/vaadin/ui/VerticalSplitPanel.java diff --git a/src/com/vaadin/ui/HorizontalSplitPanel.java b/src/com/vaadin/ui/HorizontalSplitPanel.java new file mode 100644 index 0000000000..53707c93f2 --- /dev/null +++ b/src/com/vaadin/ui/HorizontalSplitPanel.java @@ -0,0 +1,5 @@ +package com.vaadin.ui; + +public class HorizontalSplitPanel extends SplitPanel { + +} diff --git a/src/com/vaadin/ui/PasswordField.java b/src/com/vaadin/ui/PasswordField.java new file mode 100644 index 0000000000..9cd4895f96 --- /dev/null +++ b/src/com/vaadin/ui/PasswordField.java @@ -0,0 +1,30 @@ +package com.vaadin.ui; + +import com.vaadin.data.Property; +import com.vaadin.terminal.gwt.client.ui.VPasswordField; + +@ClientWidget(VPasswordField.class) +@SuppressWarnings("serial") +public class PasswordField extends TextField { + + public PasswordField() { + super(); + } + + public PasswordField(Property dataSource) { + super(dataSource); + } + + public PasswordField(String caption, Property dataSource) { + super(caption, dataSource); + } + + public PasswordField(String caption, String value) { + super(caption, value); + } + + public PasswordField(String caption) { + super(caption); + } + +} diff --git a/src/com/vaadin/ui/SplitPanel.java b/src/com/vaadin/ui/SplitPanel.java index 197569d1aa..cc8a19aa3d 100644 --- a/src/com/vaadin/ui/SplitPanel.java +++ b/src/com/vaadin/ui/SplitPanel.java @@ -112,7 +112,12 @@ public class SplitPanel extends AbstractLayout { /** * Creates a new split panel. The orientation of the panels is * ORIENTATION_VERTICAL. + * + * @deprecated this class will become abstract in a becoming version. Use + * {@link HorizontalSplitPanel} and {@link VerticalSplitPanel} + * instead. */ + @Deprecated public SplitPanel() { orientation = ORIENTATION_VERTICAL; setSizeFull(); @@ -124,7 +129,12 @@ public class SplitPanel extends AbstractLayout { * * @param orientation * the Orientation of the layout. + * + * @deprecated this class will become abstract in a becoming version. Use + * {@link HorizontalSplitPanel} and {@link VerticalSplitPanel} + * instead. */ + @Deprecated public SplitPanel(int orientation) { this(); setOrientation(orientation); @@ -264,7 +274,12 @@ public class SplitPanel extends AbstractLayout { * Gets the orientation of the container. * * @return the Value of property orientation. + * + * @deprecated this class will become abstract in a becoming version. Use + * {@link HorizontalSplitPanel} and {@link VerticalSplitPanel} + * instead. */ + @Deprecated public int getOrientation() { return orientation; } @@ -274,7 +289,12 @@ public class SplitPanel extends AbstractLayout { * * @param orientation * the New value of property orientation. + * + * @deprecated this class will become abstract in a becoming version. Use + * {@link HorizontalSplitPanel} and {@link VerticalSplitPanel} + * instead. */ + @Deprecated public void setOrientation(int orientation) { // Checks the validity of the argument diff --git a/src/com/vaadin/ui/TextArea.java b/src/com/vaadin/ui/TextArea.java new file mode 100644 index 0000000000..1b8d6dc687 --- /dev/null +++ b/src/com/vaadin/ui/TextArea.java @@ -0,0 +1,98 @@ +package com.vaadin.ui; + +import com.vaadin.data.Property; +import com.vaadin.terminal.gwt.client.ui.VTextArea; + +@ClientWidget(VTextArea.class) +public class TextArea extends TextField { + + private static final int DEFAULT_ROWS = 5; + + public TextArea() { + setRows(DEFAULT_ROWS); + } + + public TextArea(String caption) { + super(caption); + setRows(DEFAULT_ROWS); + } + + public TextArea(Property dataSource) { + super(dataSource); + setRows(DEFAULT_ROWS); + } + + public TextArea(String caption, Property dataSource) { + super(caption, dataSource); + setRows(DEFAULT_ROWS); + } + + public TextArea(String caption, String value) { + super(caption, value); + setRows(DEFAULT_ROWS); + } + + /** + * Sets the number of rows in the editor. + * + * @param rows + * the number of rows for this editor. + */ + @Override + public void setRows(int rows) { + // TODO implement here once AbstractTextField (or something similar is + // created). + super.setRows(rows); + } + + /** + * Gets the number of rows in the editor. If the number of rows is set to 0, + * the actual number of displayed rows is determined implicitly by the + * adapter. + * + * @return number of explicitly set rows. + */ + @Override + public int getRows() { + // TODO implement here once AbstractTextField (or something similar is + // created). + return super.getRows(); + } + + /** + * Sets the editor's word-wrap mode on or off. + * + * @param wordwrap + * the boolean value specifying if the editor should be in + * word-wrap mode after the call or not. + */ + @Override + public void setWordwrap(boolean wordwrap) { + // TODO implement here once AbstractTextField (or something similar is + // created). + super.setWordwrap(wordwrap); + } + + /** + * Tests if the editor is in word-wrap mode. + * + * @return true if the component is in the word-wrap mode, + * false if not. + */ + @Override + public boolean isWordwrap() { + return super.isWordwrap(); + } + + // TODO deprecate in TextField and add javadocs without deprecation here?? + // @Override + // public void setHeight(float height, int unit) { + // super.setHeight(height, unit); + // } + // + // @Override + // public void setHeight(String height) { + // super.setHeight(height); + // } + +} diff --git a/src/com/vaadin/ui/TextField.java b/src/com/vaadin/ui/TextField.java index fff0beaf0c..c2d0aee29f 100644 --- a/src/com/vaadin/ui/TextField.java +++ b/src/com/vaadin/ui/TextField.java @@ -110,7 +110,7 @@ public class TextField extends AbstractField implements * the caption String for the editor. */ public TextField(String caption) { - setValue(""); + this(); setCaption(caption); } @@ -331,7 +331,12 @@ public class TextField extends AbstractField implements * adapter. * * @return number of explicitly set rows. + * @deprecated use {@link TextArea} component and the same method there. + * This method will be removed from TextField that is to be used + * for one line text input only in the next versions. + * */ + @Deprecated public int getRows() { return rows; } @@ -341,7 +346,12 @@ public class TextField extends AbstractField implements * * @param rows * the number of rows for this editor. + * + * @deprecated use {@link TextArea} component and the same method there. + * This method will be removed from TextField that is to be used + * for one line text input only in the next versions. */ + @Deprecated public void setRows(int rows) { if (rows < 0) { rows = 0; @@ -407,7 +417,11 @@ public class TextField extends AbstractField implements * * @return true if the component is in the word-wrap mode, * false if not. + * @deprecated use {@link TextArea} component and the same method there. + * This method will be removed from TextField that is to be used + * for one line text input only in the next versions. */ + @Deprecated public boolean isWordwrap() { return wordwrap; } @@ -418,7 +432,12 @@ public class TextField extends AbstractField implements * @param wordwrap * the boolean value specifying if the editor should be in * word-wrap mode after the call or not. + * + * @deprecated use {@link TextArea} component and the same method there. + * This method will be removed from TextField that is to be used + * for one line text input only in the next versions. */ + @Deprecated public void setWordwrap(boolean wordwrap) { if (this.wordwrap != wordwrap) { this.wordwrap = wordwrap; diff --git a/src/com/vaadin/ui/VerticalSplitPanel.java b/src/com/vaadin/ui/VerticalSplitPanel.java new file mode 100644 index 0000000000..10e7a50ead --- /dev/null +++ b/src/com/vaadin/ui/VerticalSplitPanel.java @@ -0,0 +1,9 @@ +package com.vaadin.ui; + +public class VerticalSplitPanel extends SplitPanel { + + public VerticalSplitPanel() { + super(ORIENTATION_VERTICAL); + } + +} -- 2.39.5