From e2086217131c7e2c3c9df87fb25da9603dd99091 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 14 Dec 2012 10:42:36 +0200 Subject: [PATCH] Send fraction pixel values to the client (#10531) Fixed RichTextArea to deal with fraction pixel values Change-Id: I02fa6fd2c66e87b01f642a9051641a0cc758f0f6 --- client/src/com/vaadin/client/ui/VRichTextArea.java | 5 +++-- server/src/com/vaadin/ui/AbstractComponent.java | 12 ++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/client/src/com/vaadin/client/ui/VRichTextArea.java b/client/src/com/vaadin/client/ui/VRichTextArea.java index 0a53e4505e..7f03980db3 100644 --- a/client/src/com/vaadin/client/ui/VRichTextArea.java +++ b/client/src/com/vaadin/client/ui/VRichTextArea.java @@ -246,7 +246,8 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler, @Override public void setHeight(String height) { if (height.endsWith("px")) { - int h = Integer.parseInt(height.substring(0, height.length() - 2)); + float h = Float + .parseFloat(height.substring(0, height.length() - 2)); h -= getExtraVerticalPixels(); if (h < 0) { h = 0; @@ -282,7 +283,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler, @Override public void setWidth(String width) { if (width.endsWith("px")) { - int w = Integer.parseInt(width.substring(0, width.length() - 2)); + float w = Float.parseFloat(width.substring(0, width.length() - 2)); w -= getExtraHorizontalPixels(); if (w < 0) { w = 0; diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 63cf19283f..49c3d75385 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -593,11 +593,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * @return CSS height */ private String getCSSHeight() { - if (getHeightUnits() == Unit.PIXELS) { - return ((int) getHeight()) + getHeightUnits().getSymbol(); - } else { - return getHeight() + getHeightUnits().getSymbol(); - } + return getHeight() + getHeightUnits().getSymbol(); } /** @@ -606,11 +602,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * @return CSS width */ private String getCSSWidth() { - if (getWidthUnits() == Unit.PIXELS) { - return ((int) getWidth()) + getWidthUnits().getSymbol(); - } else { - return getWidth() + getWidthUnits().getSymbol(); - } + return getWidth() + getWidthUnits().getSymbol(); } /** -- 2.39.5