summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-04-05 18:32:50 +0300
committerLeif Åstrand <leif@vaadin.com>2013-04-10 14:47:18 +0300
commit2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d (patch)
treefdef2375cc28a6c9db4501cd4535152434c97d10 /server
parentfd4f1d280e8eb6a453868db01b8accc1e7b8d0b1 (diff)
downloadvaadin-framework-2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d.tar.gz
vaadin-framework-2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d.zip
Added SharedUtil for helpers shared by client and server
Change-Id: Ie289e8eefd962631a43f35dbb47fa192fcf60abf
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java24
-rw-r--r--server/src/com/vaadin/ui/Label.java3
2 files changed, 14 insertions, 13 deletions
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index 4ec6d7bac2..eb8fc30a45 100644
--- a/server/src/com/vaadin/ui/AbstractField.java
+++ b/server/src/com/vaadin/ui/AbstractField.java
@@ -42,6 +42,7 @@ import com.vaadin.server.AbstractErrorMessage;
import com.vaadin.server.CompositeErrorMessage;
import com.vaadin.server.ErrorMessage;
import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.util.SharedUtil;
/**
* <p>
@@ -427,7 +428,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
throws Property.ReadOnlyException, Converter.ConversionException,
InvalidValueException {
- if (!equals(newFieldValue, getInternalValue())) {
+ if (!SharedUtil.equals(newFieldValue, getInternalValue())) {
// Read only fields can not be changed
if (isReadOnly()) {
@@ -435,7 +436,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
try {
T doubleConvertedFieldValue = convertFromModel(convertToModel(newFieldValue));
- if (!equals(newFieldValue, doubleConvertedFieldValue)) {
+ if (!SharedUtil
+ .equals(newFieldValue, doubleConvertedFieldValue)) {
newFieldValue = doubleConvertedFieldValue;
repaintIsNotNeeded = false;
}
@@ -512,11 +514,9 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
}
+ @Deprecated
static boolean equals(Object value1, Object value2) {
- if (value1 == null) {
- return value2 == null;
- }
- return value1.equals(value2);
+ return SharedUtil.equals(value1, value2);
}
/* External data source */
@@ -1204,8 +1204,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
public void valueChange(Property.ValueChangeEvent event) {
if (!isBuffered()) {
if (committingValueToDataSource) {
- boolean propertyNotifiesOfTheBufferedValue = equals(event
- .getProperty().getValue(), getInternalValue());
+ boolean propertyNotifiesOfTheBufferedValue = SharedUtil.equals(
+ event.getProperty().getValue(), getInternalValue());
if (!propertyNotifiesOfTheBufferedValue) {
/*
* Property (or chained property like PropertyFormatter) now
@@ -1321,7 +1321,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
private void localeMightHaveChanged() {
- if (!equals(valueLocale, getLocale())) {
+ if (!SharedUtil.equals(valueLocale, getLocale())) {
// The locale HAS actually changed
if (dataSource != null && !isModified()) {
@@ -1329,7 +1329,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
// read from that we want to update the value
T newInternalValue = convertFromModel(getPropertyDataSource()
.getValue());
- if (!equals(newInternalValue, getInternalValue())) {
+ if (!SharedUtil.equals(newInternalValue, getInternalValue())) {
setInternalValue(newInternalValue);
fireValueChange(false);
}
@@ -1345,7 +1345,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
Object convertedValue = convertToModel(getInternalValue(),
valueLocale);
T newinternalValue = convertFromModel(convertedValue);
- if (!equals(getInternalValue(), newinternalValue)) {
+ if (!SharedUtil.equals(getInternalValue(), newinternalValue)) {
setConvertedValue(convertedValue);
}
}
@@ -1594,7 +1594,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
setModified(false);
// If the new value differs from the previous one
- if (!equals(newFieldValue, getInternalValue())) {
+ if (!SharedUtil.equals(newFieldValue, getInternalValue())) {
setInternalValue(newFieldValue);
fireValueChange(false);
} else if (wasModified) {
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index f413ea47f2..72f556ee5b 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -25,6 +25,7 @@ import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.ConverterUtil;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.shared.ui.label.LabelState;
+import com.vaadin.shared.util.SharedUtil;
/**
* Label component for showing non-editable short texts.
@@ -402,7 +403,7 @@ public class Label extends AbstractComponent implements Property<String>,
private void updateValueFromDataSource() {
// Update the internal value from the data source
String newConvertedValue = getDataSourceValue();
- if (!AbstractField.equals(newConvertedValue, getState().text)) {
+ if (!SharedUtil.equals(newConvertedValue, getState().text)) {
getState().text = newConvertedValue;
fireValueChange();
}