summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui
diff options
context:
space:
mode:
authorTeppo Kurki <teppo.kurki@vaadin.com>2015-06-26 13:52:08 +0300
committerTeppo Kurki <teppo.kurki@vaadin.com>2015-06-26 13:52:48 +0300
commit9d8c26b49b9ef6900fe19745ac995cad5c5b74fc (patch)
tree505b6a86b2ed876b6c4bde4c57946ce58971ac09 /server/src/com/vaadin/ui
parent3065d80e1826bcacd53df1a4a214318253697272 (diff)
parentf7a852e3df45437568e54cff592aae50ae9a06ce (diff)
downloadvaadin-framework-9d8c26b49b9ef6900fe19745ac995cad5c5b74fc.tar.gz
vaadin-framework-9d8c26b49b9ef6900fe19745ac995cad5c5b74fc.zip
Merge branch 'master' into grid-unbuffered-editor
Change-Id: I82cdb7a08a62679b4717d480b50ab951ade8855c
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java12
-rw-r--r--server/src/com/vaadin/ui/AbstractTextField.java33
-rw-r--r--server/src/com/vaadin/ui/Grid.java6
-rw-r--r--server/src/com/vaadin/ui/GridLayout.java12
-rw-r--r--server/src/com/vaadin/ui/Slider.java2
-rw-r--r--server/src/com/vaadin/ui/declarative/DesignFormatter.java6
-rw-r--r--server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java3
-rw-r--r--server/src/com/vaadin/ui/renderers/ButtonRenderer.java3
-rw-r--r--server/src/com/vaadin/ui/renderers/ClickableRenderer.java3
-rw-r--r--server/src/com/vaadin/ui/renderers/DateRenderer.java17
-rw-r--r--server/src/com/vaadin/ui/renderers/HtmlRenderer.java3
-rw-r--r--server/src/com/vaadin/ui/renderers/NumberRenderer.java15
-rw-r--r--server/src/com/vaadin/ui/renderers/TextRenderer.java1
13 files changed, 72 insertions, 44 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 18c3509af7..f499cb1fec 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -1170,16 +1170,16 @@ public abstract class AbstractComponent extends AbstractClientConnector
// first try the full shorthands
if (widthFull && heightFull) {
- attributes.put("size-full", "true");
+ attributes.put("size-full", "");
} else if (widthAuto && heightAuto) {
- attributes.put("size-auto", "true");
+ attributes.put("size-auto", "");
} else {
// handle width
if (!hasEqualWidth(defaultInstance)) {
if (widthFull) {
- attributes.put("width-full", "true");
+ attributes.put("width-full", "");
} else if (widthAuto) {
- attributes.put("width-auto", "true");
+ attributes.put("width-auto", "");
} else {
String widthString = DesignAttributeHandler.getFormatter()
.format(getWidth()) + getWidthUnits().getSymbol();
@@ -1190,9 +1190,9 @@ public abstract class AbstractComponent extends AbstractClientConnector
if (!hasEqualHeight(defaultInstance)) {
// handle height
if (heightFull) {
- attributes.put("height-full", "true");
+ attributes.put("height-full", "");
} else if (heightAuto) {
- attributes.put("height-auto", "true");
+ attributes.put("height-auto", "");
} else {
String heightString = DesignAttributeHandler.getFormatter()
.format(getHeight()) + getHeightUnits().getSymbol();
diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java
index 14c135228c..93025ac0fd 100644
--- a/server/src/com/vaadin/ui/AbstractTextField.java
+++ b/server/src/com/vaadin/ui/AbstractTextField.java
@@ -126,22 +126,25 @@ public abstract class AbstractTextField extends AbstractField<String> implements
selectionPosition = -1;
}
- target.addAttribute(TextFieldConstants.ATTR_TEXTCHANGE_EVENTMODE,
- getTextChangeEventMode().toString());
- target.addAttribute(TextFieldConstants.ATTR_TEXTCHANGE_TIMEOUT,
- getTextChangeTimeout());
- if (lastKnownTextContent != null) {
- /*
- * The field has be repainted for some reason (e.g. caption, size,
- * stylename), but the value has not been changed since the last
- * text change event. Let the client side know about the value the
- * server side knows. Client side may then ignore the actual value,
- * depending on its state.
- */
- target.addAttribute(
- TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS,
- true);
+ if (hasListeners(TextChangeEvent.class)) {
+ target.addAttribute(TextFieldConstants.ATTR_TEXTCHANGE_EVENTMODE,
+ getTextChangeEventMode().toString());
+ target.addAttribute(TextFieldConstants.ATTR_TEXTCHANGE_TIMEOUT,
+ getTextChangeTimeout());
+ if (lastKnownTextContent != null) {
+ /*
+ * The field has be repainted for some reason (e.g. caption,
+ * size, stylename), but the value has not been changed since
+ * the last text change event. Let the client side know about
+ * the value the server side knows. Client side may then ignore
+ * the actual value, depending on its state.
+ */
+ target.addAttribute(
+ TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS,
+ true);
+ }
}
+
}
@Override
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index b0542352b9..64f26b6205 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -3627,6 +3627,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
private final Footer footer = new Footer(this);
private Object editedItemId = null;
+ private boolean editorActive = false;
private FieldGroup editorFieldGroup = new CustomFieldGroup();
private CellStyleGenerator cellStyleGenerator;
@@ -5803,7 +5804,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* @return true iff the editor is open
*/
public boolean isEditorActive() {
- return editedItemId != null;
+ return editorActive;
}
private void checkColumnExists(Object propertyId) {
@@ -5878,6 +5879,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
.getPropertyId());
}
+ editorActive = true;
// Must ensure that all fields, recursively, are sent to the client
// This is needed because the fields are hidden using isRendered
for (Field<?> f : getEditorFields()) {
@@ -5929,6 +5931,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
protected void doCancelEditor() {
editedItemId = null;
+ editorActive = false;
editorFieldGroup.discard();
editorFieldGroup.setItemDataSource(null);
}
@@ -5946,6 +5949,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
editedItemId = null;
+ editorActive = false;
editorFieldGroup = new CustomFieldGroup();
}
diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java
index 6ccb272704..792ad72dcc 100644
--- a/server/src/com/vaadin/ui/GridLayout.java
+++ b/server/src/com/vaadin/ui/GridLayout.java
@@ -1319,11 +1319,15 @@ public class GridLayout extends AbstractLayout implements
setMargin(readMargin(design, getMargin(), designContext));
- // Prepare a 2D map for reading column contents
- Elements rowElements = design.getElementsByTag("row");
+ List<Element> rowElements = new ArrayList<Element>();
List<Map<Integer, Component>> rows = new ArrayList<Map<Integer, Component>>();
- for (int i = 0; i < rowElements.size(); ++i) {
- rows.add(new HashMap<Integer, Component>());
+ // Prepare a 2D map for reading column contents
+ for (Element e : design.children()) {
+ if (e.tagName().equalsIgnoreCase("row")) {
+ rowElements.add(e);
+ rows.add(new HashMap<Integer, Component>());
+
+ }
}
setRows(Math.max(rows.size(), 1));
diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java
index 2e00628eb0..15c94b6d3c 100644
--- a/server/src/com/vaadin/ui/Slider.java
+++ b/server/src/com/vaadin/ui/Slider.java
@@ -285,7 +285,7 @@ public class Slider extends AbstractField<Double> {
final int resolution = getResolution();
double ratio = Math.pow(10, resolution);
- if(v >= 0) {
+ if (v >= 0) {
return Math.floor(v * ratio) / ratio;
} else {
return Math.ceil(v * ratio) / ratio;
diff --git a/server/src/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/com/vaadin/ui/declarative/DesignFormatter.java
index b1d2520631..73c45caed4 100644
--- a/server/src/com/vaadin/ui/declarative/DesignFormatter.java
+++ b/server/src/com/vaadin/ui/declarative/DesignFormatter.java
@@ -94,7 +94,11 @@ public class DesignFormatter implements Serializable {
public String convertToPresentation(Boolean value,
Class<? extends String> targetType, Locale locale)
throws Converter.ConversionException {
- return String.valueOf(value.booleanValue());
+ if (value.booleanValue()) {
+ return "";
+ } else {
+ return "false";
+ }
}
@Override
diff --git a/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java b/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java
index 104e07f02f..57e8130b29 100644
--- a/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java
@@ -105,7 +105,8 @@ public abstract class AbstractJavaScriptRenderer<T> extends AbstractRenderer<T>
private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper(
this);
- protected AbstractJavaScriptRenderer(Class<T> presentationType, String nullRepresentation) {
+ protected AbstractJavaScriptRenderer(Class<T> presentationType,
+ String nullRepresentation) {
super(presentationType, nullRepresentation);
}
diff --git a/server/src/com/vaadin/ui/renderers/ButtonRenderer.java b/server/src/com/vaadin/ui/renderers/ButtonRenderer.java
index a747e45713..e7e723ebd6 100644
--- a/server/src/com/vaadin/ui/renderers/ButtonRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/ButtonRenderer.java
@@ -45,7 +45,8 @@ public class ButtonRenderer extends ClickableRenderer<String> {
* @param nullRepresentation
* the textual representation of {@code null} value
*/
- public ButtonRenderer(RendererClickListener listener, String nullRepresentation) {
+ public ButtonRenderer(RendererClickListener listener,
+ String nullRepresentation) {
this(nullRepresentation);
addClickListener(listener);
}
diff --git a/server/src/com/vaadin/ui/renderers/ClickableRenderer.java b/server/src/com/vaadin/ui/renderers/ClickableRenderer.java
index 01e939bb67..7210eb7840 100644
--- a/server/src/com/vaadin/ui/renderers/ClickableRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/ClickableRenderer.java
@@ -106,7 +106,8 @@ public class ClickableRenderer<T> extends AbstractRenderer<T> {
this(presentationType, null);
}
- protected ClickableRenderer(Class<T> presentationType, String nullRepresentation) {
+ protected ClickableRenderer(Class<T> presentationType,
+ String nullRepresentation) {
super(presentationType, nullRepresentation);
registerRpc(new RendererClickRpc() {
@Override
diff --git a/server/src/com/vaadin/ui/renderers/DateRenderer.java b/server/src/com/vaadin/ui/renderers/DateRenderer.java
index 092b3f405e..dddeb6cd77 100644
--- a/server/src/com/vaadin/ui/renderers/DateRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/DateRenderer.java
@@ -72,7 +72,8 @@ public class DateRenderer extends AbstractRenderer<Date> {
* @throws IllegalArgumentException
* if {@code locale} is {@code null}
*/
- public DateRenderer(Locale locale, String nullRepresentation) throws IllegalArgumentException {
+ public DateRenderer(Locale locale, String nullRepresentation)
+ throws IllegalArgumentException {
this("%s", locale, nullRepresentation);
}
@@ -110,7 +111,8 @@ public class DateRenderer extends AbstractRenderer<Date> {
* href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format
* String Syntax</a>
*/
- public DateRenderer(String formatString, String nullRepresentation) throws IllegalArgumentException {
+ public DateRenderer(String formatString, String nullRepresentation)
+ throws IllegalArgumentException {
this(formatString, Locale.getDefault(), nullRepresentation);
}
@@ -132,8 +134,9 @@ public class DateRenderer extends AbstractRenderer<Date> {
*/
public DateRenderer(String formatString, Locale locale)
throws IllegalArgumentException {
- this(formatString,locale, "");
+ this(formatString, locale, "");
}
+
/**
* Creates a new date renderer.
* <p>
@@ -152,8 +155,8 @@ public class DateRenderer extends AbstractRenderer<Date> {
* href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format
* String Syntax</a>
*/
- public DateRenderer(String formatString, Locale locale, String nullRepresentation)
- throws IllegalArgumentException {
+ public DateRenderer(String formatString, Locale locale,
+ String nullRepresentation) throws IllegalArgumentException {
super(Date.class, nullRepresentation);
if (formatString == null) {
@@ -182,6 +185,7 @@ public class DateRenderer extends AbstractRenderer<Date> {
public DateRenderer(DateFormat dateFormat) throws IllegalArgumentException {
this(dateFormat, "");
}
+
/**
* Creates a new date renderer.
* <p>
@@ -192,7 +196,8 @@ public class DateRenderer extends AbstractRenderer<Date> {
* @throws IllegalArgumentException
* if {@code dateFormat} is {@code null}
*/
- public DateRenderer(DateFormat dateFormat, String nullRepresentation) throws IllegalArgumentException {
+ public DateRenderer(DateFormat dateFormat, String nullRepresentation)
+ throws IllegalArgumentException {
super(Date.class, nullRepresentation);
if (dateFormat == null) {
throw new IllegalArgumentException("date format may not be null");
diff --git a/server/src/com/vaadin/ui/renderers/HtmlRenderer.java b/server/src/com/vaadin/ui/renderers/HtmlRenderer.java
index df89c60ad2..2ec43800c0 100644
--- a/server/src/com/vaadin/ui/renderers/HtmlRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/HtmlRenderer.java
@@ -28,7 +28,8 @@ public class HtmlRenderer extends AbstractRenderer<String> {
/**
* Creates a new HTML renderer.
*
- * @param nullRepresentation the html representation of {@code null} value
+ * @param nullRepresentation
+ * the html representation of {@code null} value
*/
public HtmlRenderer(String nullRepresentation) {
super(String.class, nullRepresentation);
diff --git a/server/src/com/vaadin/ui/renderers/NumberRenderer.java b/server/src/com/vaadin/ui/renderers/NumberRenderer.java
index 1d4d7e0ec9..b1ba309c9a 100644
--- a/server/src/com/vaadin/ui/renderers/NumberRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/NumberRenderer.java
@@ -69,7 +69,7 @@ public class NumberRenderer extends AbstractRenderer<Number> {
* @param nullRepresentation
* the textual representation of {@code null} value
* @throws IllegalArgumentException
- * if {@code numberFormat} is {@code null}
+ * if {@code numberFormat} is {@code null}
*/
public NumberRenderer(NumberFormat numberFormat, String nullRepresentation)
throws IllegalArgumentException {
@@ -112,8 +112,10 @@ public class NumberRenderer extends AbstractRenderer<Number> {
* @throws IllegalArgumentException
* if {@code locale} is {@code null}
*/
- public NumberRenderer(String formatString, Locale locale) throws IllegalArgumentException {
- this(formatString, locale, ""); //This will call #toString() during formatting
+ public NumberRenderer(String formatString, Locale locale)
+ throws IllegalArgumentException {
+ this(formatString, locale, ""); // This will call #toString() during
+ // formatting
}
/**
@@ -122,8 +124,8 @@ public class NumberRenderer extends AbstractRenderer<Number> {
* The renderer is configured to render with the given format string in the
* default locale.
*
- * @param
- * formatString the format string with which to format the number
+ * @param formatString
+ * the format string with which to format the number
* @throws IllegalArgumentException
* if {@code formatString} is {@code null}
* @see <a
@@ -150,7 +152,8 @@ public class NumberRenderer extends AbstractRenderer<Number> {
* href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format
* String Syntax</a>
*/
- public NumberRenderer(String formatString, Locale locale, String nullRepresentation) {
+ public NumberRenderer(String formatString, Locale locale,
+ String nullRepresentation) {
super(Number.class, nullRepresentation);
if (formatString == null) {
diff --git a/server/src/com/vaadin/ui/renderers/TextRenderer.java b/server/src/com/vaadin/ui/renderers/TextRenderer.java
index 0045024b2f..ce8a73d057 100644
--- a/server/src/com/vaadin/ui/renderers/TextRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/TextRenderer.java
@@ -35,6 +35,7 @@ public class TextRenderer extends AbstractRenderer<String> {
/**
* Creates a new text renderer
+ *
* @param nullRepresentation
* the textual representation of {@code null} value
*/