aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/CustomField.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/ui/CustomField.java')
-rw-r--r--src/com/vaadin/ui/CustomField.java31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/com/vaadin/ui/CustomField.java b/src/com/vaadin/ui/CustomField.java
index 806ee91335..0998c11612 100644
--- a/src/com/vaadin/ui/CustomField.java
+++ b/src/com/vaadin/ui/CustomField.java
@@ -62,24 +62,18 @@ public abstract class CustomField<T> extends AbstractField<T> implements
*/
@Override
public void attach() {
- root = getContent();
+ // First call super attach to notify all children (none if content has
+ // not yet been created)
super.attach();
- getContent().setParent(this);
- getContent().attach();
- fireComponentAttachEvent(getContent());
- }
-
- /**
- * Notifies the content that the {@link CustomField} is detached from a
- * window.
- *
- * @see com.vaadin.ui.Component#detach()
- */
- @Override
- public void detach() {
- super.detach();
- getContent().detach();
+ // If the content has not yet been created, we create and attach it at
+ // this point.
+ if (root == null) {
+ // Ensure content is created and its parent is set.
+ // The getContent() call creates the content and attaches the
+ // content
+ fireComponentAttachEvent(getContent());
+ }
}
/**
@@ -90,6 +84,7 @@ public abstract class CustomField<T> extends AbstractField<T> implements
protected Component getContent() {
if (null == root) {
root = initContent();
+ root.setParent(this);
}
return root;
}
@@ -154,10 +149,6 @@ public abstract class CustomField<T> extends AbstractField<T> implements
return (null != getContent()) ? 1 : 0;
}
- public void requestRepaintAll() {
- AbstractComponentContainer.requestRepaintAll(this);
- }
-
/**
* Fires the component attached event. This should be called by the
* addComponent methods after the component have been added to this