浏览代码

added CSS formatting for sizes, so we don't get decimals for pixel sizes

svn changeset:5536/svn branch:trunk
tags/6.7.0.beta1
Matti Tahvonen 15 年前
父节点
当前提交
656d5f210c
共有 1 个文件被更改,包括 28 次插入4 次删除
  1. 28
    4
      src/com/itmill/toolkit/ui/AbstractComponent.java

+ 28
- 4
src/com/itmill/toolkit/ui/AbstractComponent.java 查看文件

@@ -604,12 +604,10 @@ public abstract class AbstractComponent implements Component, MethodEventSource
if (isVisible()) {

if (getHeight() >= 0) {
target.addAttribute("height", "" + getHeight()
+ UNIT_SYMBOLS[getHeightUnits()]);
target.addAttribute("height", "" + getCSSHeight());
}
if (getWidth() >= 0) {
target.addAttribute("width", "" + getWidth()
+ UNIT_SYMBOLS[getWidthUnits()]);
target.addAttribute("width", "" + getCSSWidth());
}

if (styles != null && styles.size() > 0) {
@@ -655,6 +653,32 @@ public abstract class AbstractComponent implements Component, MethodEventSource
repaintRequestListenersNotified = false;
}

/**
* Build CSS compatible string representation of height.
*
* @return CSS height
*/
private String getCSSHeight() {
if (getHeightUnits() == UNITS_PIXELS) {
return ((int) getHeight()) + UNIT_SYMBOLS[getHeightUnits()];
} else {
return getHeight() + UNIT_SYMBOLS[getHeightUnits()];
}
}

/**
* Build CSS compatible string representation of width.
*
* @return CSS width
*/
private String getCSSWidth() {
if (getWidthUnits() == UNITS_PIXELS) {
return ((int) getWidth()) + UNIT_SYMBOLS[getWidthUnits()];
} else {
return getWidth() + UNIT_SYMBOLS[getWidthUnits()];
}
}

/**
* Paints any needed component-specific things to the given UIDL stream. The
* more general {@link #paint(PaintTarget)} method handles all general

正在加载...
取消
保存