aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2011-12-22 08:27:52 +0200
committerArtur Signell <artur@vaadin.com>2011-12-22 08:27:52 +0200
commit9e146487a2dec08b538f87e650e8f714ac2089cf (patch)
treef61b9bb311c1cfa020ef9e6c235f15e376b762b8 /src
parent5d09873ca96c8e61681299f79194b3e52325e4d5 (diff)
downloadvaadin-framework-9e146487a2dec08b538f87e650e8f714ac2089cf.tar.gz
vaadin-framework-9e146487a2dec08b538f87e650e8f714ac2089cf.zip
Removed getStringValue based on API review meeting
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/data/util/AbstractProperty.java18
-rw-r--r--src/com/vaadin/data/util/IndexedContainer.java19
-rw-r--r--src/com/vaadin/data/util/PropertyFormatter.java18
-rw-r--r--src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java23
-rw-r--r--src/com/vaadin/ui/AbstractField.java47
-rw-r--r--src/com/vaadin/ui/AbstractTextField.java2
-rw-r--r--src/com/vaadin/ui/ProgressIndicator.java11
-rw-r--r--src/com/vaadin/ui/RichTextArea.java2
8 files changed, 31 insertions, 109 deletions
diff --git a/src/com/vaadin/data/util/AbstractProperty.java b/src/com/vaadin/data/util/AbstractProperty.java
index 5e90d11831..3b6db3807e 100644
--- a/src/com/vaadin/data/util/AbstractProperty.java
+++ b/src/com/vaadin/data/util/AbstractProperty.java
@@ -59,8 +59,7 @@ public abstract class AbstractProperty<T> implements Property<T>,
* format.
*
* @return String representation of the value stored in the Property
- * @deprecated use the property value directly, or {@link #getStringValue()}
- * during migration period
+ * @deprecated use {@link #getValue()} instead and possibly toString on that
*/
@Deprecated
@Override
@@ -70,21 +69,6 @@ public abstract class AbstractProperty<T> implements Property<T>,
+ ".toString()");
}
- /**
- * Returns the value of the <code>Property</code> in human readable textual
- * format.
- *
- * @return String representation of the value stored in the Property
- * @since 7.0
- */
- public String getStringValue() {
- final Object value = getValue();
- if (value == null) {
- return null;
- }
- return value.toString();
- }
-
/* Events */
/**
diff --git a/src/com/vaadin/data/util/IndexedContainer.java b/src/com/vaadin/data/util/IndexedContainer.java
index 424fccb1e9..1e0a2fae1a 100644
--- a/src/com/vaadin/data/util/IndexedContainer.java
+++ b/src/com/vaadin/data/util/IndexedContainer.java
@@ -894,8 +894,8 @@ public class IndexedContainer extends
*
* @return <code>String</code> representation of the value stored in the
* Property
- * @deprecated use the property value directly, or
- * {@link #getStringValue()} during migration period
+ * @deprecated use {@link #getValue()} instead and possibly toString on
+ * that
*/
@Deprecated
@Override
@@ -905,21 +905,6 @@ public class IndexedContainer extends
}
/**
- * Returns the value of the <code>Property</code> in human readable
- * textual format.
- *
- * @return String representation of the value stored in the Property
- * @since 7.0
- */
- public String getStringValue() {
- final Object value = getValue();
- if (value == null) {
- return null;
- }
- return value.toString();
- }
-
- /**
* Calculates a integer hash-code for the Property that's unique inside
* the Item containing the Property. Two different Properties inside the
* same Item contained in the same list always have different
diff --git a/src/com/vaadin/data/util/PropertyFormatter.java b/src/com/vaadin/data/util/PropertyFormatter.java
index e126d97d3c..a63973535b 100644
--- a/src/com/vaadin/data/util/PropertyFormatter.java
+++ b/src/com/vaadin/data/util/PropertyFormatter.java
@@ -106,7 +106,7 @@ public abstract class PropertyFormatter<T> extends AbstractProperty<String>
.removeListener(this);
}
readOnly = isReadOnly();
- prevValue = getStringValue();
+ prevValue = getValue();
}
dataSource = newDataSource;
@@ -124,7 +124,7 @@ public abstract class PropertyFormatter<T> extends AbstractProperty<String>
if (isReadOnly() != readOnly) {
fireReadOnlyStatusChange();
}
- String newVal = getStringValue();
+ String newVal = getValue();
if ((prevValue == null && newVal != null)
|| (prevValue != null && !prevValue.equals(newVal))) {
fireValueChange();
@@ -143,18 +143,6 @@ public abstract class PropertyFormatter<T> extends AbstractProperty<String>
* String given by format().
*/
public String getValue() {
- return getStringValue();
- }
-
- /**
- * Get the formatted value. For PropertyFormatter, this is identical with
- * {@link #getValue()}.
- *
- * @return If the datasource returns null, this is null. Otherwise this is
- * String given by format().
- */
- @Override
- public String getStringValue() {
T value = dataSource == null ? null : dataSource.getValue();
if (value == null) {
return null;
@@ -219,7 +207,7 @@ public abstract class PropertyFormatter<T> extends AbstractProperty<String>
} else {
try {
dataSource.setValue(parse(newValue.toString()));
- if (!newValue.equals(getStringValue())) {
+ if (!newValue.equals(getValue())) {
fireValueChange();
}
} catch (Exception e) {
diff --git a/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java b/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
index 5e152da79e..a74db6ce8a 100644
--- a/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
+++ b/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
@@ -160,8 +160,7 @@ final public class ColumnProperty implements Property {
* Returns the value of the Property in human readable textual format.
*
* @see java.lang.Object#toString()
- * @deprecated get the string representation from the value, or use
- * getStringValue() during migration
+ * @deprecated get the string representation from the value
*/
@Deprecated
@Override
@@ -170,26 +169,6 @@ final public class ColumnProperty implements Property {
"Use ColumnProperty.getValue() instead of ColumnProperty.toString()");
}
- /**
- * Returns the (UI type) value of the field converted to a String using
- * toString().
- *
- * This method exists to help migration from the use of Property.toString()
- * to get the field value - for new applications, access getValue()
- * directly. This method may disappear in future Vaadin versions.
- *
- * @return string representation of the field value or null if the value is
- * null
- * @since 7.0
- */
- public String getStringValue() {
- final Object value = getValue();
- if (value == null) {
- return null;
- }
- return value.toString();
- }
-
public void setOwner(RowItem owner) {
if (owner == null) {
throw new IllegalArgumentException("Owner can not be set to null.");
diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java
index cbdee0eae1..3e75da5ae2 100644
--- a/src/com/vaadin/ui/AbstractField.java
+++ b/src/com/vaadin/ui/AbstractField.java
@@ -13,6 +13,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.logging.Logger;
import com.vaadin.Application;
import com.vaadin.data.Buffered;
@@ -63,6 +64,9 @@ public abstract class AbstractField<T> extends AbstractComponent implements
/* Private members */
+ private static final Logger logger = Logger.getLogger(AbstractField.class
+ .getName());
+
/**
* Value of the abstract field.
*/
@@ -340,16 +344,20 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
}
+ /**
+ * Gets the value from the data source. This is only here because of clarity
+ * in the code that handles both the data model value and the field value.
+ *
+ * @return The value of the property data source
+ */
private Object getDataSourceValue() {
return dataSource.getValue();
}
/**
- * Returns the value that is or should be displayed in the field. This is
- * always of type T.
- *
- * This method should return the converter data source value if there are no
- * buffered changes in the field.
+ * Returns the field value. This is always identical to {@link #getValue()}
+ * and only here because of clarity in the code that handles both the data
+ * model value and the field value.
*
* @return The value of the field
*/
@@ -488,32 +496,21 @@ public abstract class AbstractField<T> extends AbstractComponent implements
/* Property interface implementation */
/**
- * Returns the value of the Property in human readable textual format.
+ * Returns the (field) value converted to a String using toString().
*
* @see java.lang.Object#toString()
- * @deprecated get the string representation from the data source, or use
- * getStringValue() during migration
+ * @deprecated Instead use {@link #getValue()} to get the value of the
+ * field, {@link #getConvertedValue()} to get the field value
+ * converted to the data model type or
+ * {@link #getPropertyDataSource()} .getValue() to get the value
+ * of the data source.
*/
@Deprecated
@Override
public String toString() {
- throw new UnsupportedOperationException(
- "Use Property.getValue() instead of " + getClass()
- + ".toString()");
- }
-
- /**
- * Returns the (UI type) value of the field converted to a String.
- *
- * This method exists to help migration from the use of Property.toString()
- * to get the field value. For new applications, it is often better to
- * access getValue() directly.
- *
- * @return string representation of the field value or null if the value is
- * null
- * @since 7.0
- */
- public String getStringValue() {
+ logger.warning("You are using AbstractField.toString() to get the value for a "
+ + getClass().getSimpleName()
+ + ". This is not recommended and will not be supported in future versions.");
final Object value = getFieldValue();
if (value == null) {
return null;
diff --git a/src/com/vaadin/ui/AbstractTextField.java b/src/com/vaadin/ui/AbstractTextField.java
index 7d2509b978..96d8a11410 100644
--- a/src/com/vaadin/ui/AbstractTextField.java
+++ b/src/com/vaadin/ui/AbstractTextField.java
@@ -375,7 +375,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements
@Override
protected boolean isEmpty() {
- return super.isEmpty() || getStringValue().length() == 0;
+ return super.isEmpty() || getValue().length() == 0;
}
/**
diff --git a/src/com/vaadin/ui/ProgressIndicator.java b/src/com/vaadin/ui/ProgressIndicator.java
index 30555f9427..cc17333cc4 100644
--- a/src/com/vaadin/ui/ProgressIndicator.java
+++ b/src/com/vaadin/ui/ProgressIndicator.java
@@ -150,17 +150,6 @@ public class ProgressIndicator extends AbstractField<Number> implements
}
/**
- * @see com.vaadin.ui.AbstractField#toString()
- * @deprecated use the data source value instead of toString()
- */
- @Deprecated
- @Override
- public String toString() {
- throw new UnsupportedOperationException(
- "Use Property.getValue() instead of ProgressIndicator.toString()");
- }
-
- /**
* @see com.vaadin.ui.AbstractField#getType()
*/
@Override
diff --git a/src/com/vaadin/ui/RichTextArea.java b/src/com/vaadin/ui/RichTextArea.java
index 1ef843b789..ea22a6b54b 100644
--- a/src/com/vaadin/ui/RichTextArea.java
+++ b/src/com/vaadin/ui/RichTextArea.java
@@ -343,7 +343,7 @@ public class RichTextArea extends AbstractField<String> {
@Override
protected boolean isEmpty() {
- return super.isEmpty() || getStringValue().length() == 0;
+ return super.isEmpty() || getValue().length() == 0;
}
}