aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/AbstractComponent.java
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-03-04 09:26:02 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-03-04 09:26:02 +0000
commit707960f829ab10ccbb71cee04f2ee5db3177071a (patch)
treec63c44875aca54a41a052d69ae30b63c10b773dd /src/com/itmill/toolkit/ui/AbstractComponent.java
parentbf910594825bb1a6b58c4f6c02d30f5779387ba9 (diff)
downloadvaadin-framework-707960f829ab10ccbb71cee04f2ee5db3177071a.tar.gz
vaadin-framework-707960f829ab10ccbb71cee04f2ee5db3177071a.zip
Refactored CustomComponent. Fixed possible NPE in Abstract component. Optimization for AbstractComponent.
svn changeset:3963/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/AbstractComponent.java')
-rw-r--r--src/com/itmill/toolkit/ui/AbstractComponent.java66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/com/itmill/toolkit/ui/AbstractComponent.java b/src/com/itmill/toolkit/ui/AbstractComponent.java
index 8a1122c814..f4db9214ed 100644
--- a/src/com/itmill/toolkit/ui/AbstractComponent.java
+++ b/src/com/itmill/toolkit/ui/AbstractComponent.java
@@ -584,41 +584,39 @@ public abstract class AbstractComponent implements Component, MethodEventSource
// Paint the contents of the component
- if (getHeight() >= 0) {
- target.addAttribute("height", "" + getHeight()
- + UNIT_SYMBOLS[getHeightUnits()]);
- }
- if (getWidth() >= 0) {
- target.addAttribute("width", "" + getWidth()
- + UNIT_SYMBOLS[getWidthUnits()]);
- }
-
- if (styles != null && styles.size() > 0) {
- target.addAttribute("style", getStyle());
- }
- if (isReadOnly()) {
- target.addAttribute("readonly", true);
- }
- if (!isVisible()) {
- target.addAttribute("invisible", true);
- }
- if (isImmediate()) {
- target.addAttribute("immediate", true);
- }
- if (!isEnabled()) {
- target.addAttribute("disabled", true);
- }
- if (getCaption() != null) {
- target.addAttribute("caption", getCaption());
- }
- if (getIcon() != null) {
- target.addAttribute("icon", getIcon());
- }
-
// Only paint content of visible components.
if (isVisible()) {
- final String desc = getDescription();
- if (desc != null && description.length() > 0) {
+
+ if (getHeight() >= 0) {
+ target.addAttribute("height", "" + getHeight()
+ + UNIT_SYMBOLS[getHeightUnits()]);
+ }
+ if (getWidth() >= 0) {
+ target.addAttribute("width", "" + getWidth()
+ + UNIT_SYMBOLS[getWidthUnits()]);
+ }
+
+ if (styles != null && styles.size() > 0) {
+ target.addAttribute("style", getStyle());
+ }
+ if (isReadOnly()) {
+ target.addAttribute("readonly", true);
+ }
+
+ if (isImmediate()) {
+ target.addAttribute("immediate", true);
+ }
+ if (!isEnabled()) {
+ target.addAttribute("disabled", true);
+ }
+ if (getCaption() != null) {
+ target.addAttribute("caption", getCaption());
+ }
+ if (getIcon() != null) {
+ target.addAttribute("icon", getIcon());
+ }
+
+ if (getDescription() != null && getDescription().length() > 0) {
target.addAttribute("description", getDescription());
}
@@ -628,6 +626,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource
if (error != null) {
error.paint(target);
}
+ } else {
+ target.addAttribute("invisible", true);
}
} else {