From de4063199b4835a3bf8425428a08d3ef6c0821af Mon Sep 17 00:00:00 2001
From: Artur Signell
Date: Fri, 19 Aug 2011 13:35:36 +0000
Subject: [PATCH] #7369 Removed "final" to enable CDI compatibility and added
javadoc that explains the methods should not be overridden
svn changeset:20525/svn branch:6.7
---
src/com/vaadin/ui/AbstractComponent.java | 50 ++++++++++++++++++++----
src/com/vaadin/ui/Window.java | 17 ++++++--
2 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java
index 836ea498fd..eaad6f6126 100644
--- a/src/com/vaadin/ui/AbstractComponent.java
+++ b/src/com/vaadin/ui/AbstractComponent.java
@@ -654,9 +654,24 @@ public abstract class AbstractComponent implements Component, MethodEventSource
}
}
- /*
- * Gets the parent application of the component. Don't add a JavaDoc comment
- * here, we use the default documentation from implemented interface.
+ /**
+ * Gets the application object to which the component is attached.
+ *
+ *
+ * The method will return {@code null} if the component is not currently
+ * attached to an application. This is often a problem in constructors of
+ * regular components and in the initializers of custom composite
+ * components. A standard workaround is to move the problematic
+ * initialization to {@link #attach()}, as described in the documentation of
+ * the method.
+ *
+ *
+ * This method is not meant to be overridden. Due to CDI requirements we
+ * cannot declare it as final even though it should be final.
+ *
+ *
+ * @return the parent application of the component or null
.
+ * @see #attach()
*/
public Application getApplication() {
if (parent == null) {
@@ -673,11 +688,32 @@ public abstract class AbstractComponent implements Component, MethodEventSource
repaintRequestListenersNotified = false;
}
- /*
- * Paints the component into a UIDL stream. Don't add a JavaDoc comment
- * here, we use the default documentation from implemented interface.
+ /**
+ *
+ *
+ * Paints the Paintable into a UIDL stream. This method creates the UIDL
+ * sequence describing it and outputs it to the given UIDL stream.
+ *
+ *
+ *
+ * It is called when the contents of the component should be painted in
+ * response to the component first being shown or having been altered so
+ * that its visual representation is changed.
+ *
+ *
+ *
+ * Do not override this to paint your component. Override
+ * {@link #paintContent(PaintTarget)} instead.
+ *
+ *
+ *
+ * @param target
+ * the target UIDL stream where the component should paint itself
+ * to.
+ * @throws PaintException
+ * if the paint operation failed.
*/
- public final void paint(PaintTarget target) throws PaintException {
+ public void paint(PaintTarget target) throws PaintException {
final String tag = target.getTag(this);
if (!target.startTag(this, tag) || repaintRequestListenersNotified) {
diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java
index 37f9967c08..ddd1f6fc3b 100644
--- a/src/com/vaadin/ui/Window.java
+++ b/src/com/vaadin/ui/Window.java
@@ -285,12 +285,16 @@ public class Window extends Panel implements URIHandler, ParameterHandler,
*
* This is always the window itself.
*
+ *
+ * This method is not meant to be overridden. Due to CDI requirements we
+ * cannot declare it as final even though it should be final.
+ *
*
* @see Component#getWindow()
* @return the window itself
*/
@Override
- public final Window getWindow() {
+ public Window getWindow() {
return this;
}
@@ -300,11 +304,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler,
* @see com.vaadin.ui.AbstractComponent#getApplication()
*/
@Override
- public final Application getApplication() {
+ public Application getApplication() {
if (getParent() == null) {
return application;
}
- return (getParent()).getApplication();
+ return getParent().getApplication();
}
/**
@@ -314,12 +318,17 @@ public class Window extends Panel implements URIHandler, ParameterHandler,
* The parent of an application window is always null. The parent of a sub
* window is the application window the sub window is attached to.
*
+ *
+ * This method is not meant to be overridden. Due to CDI requirements we
+ * cannot declare it as final even though it should be final.
+ *
+ *
*
* @return the parent window
* @see Component#getParent()
*/
@Override
- public final Window getParent() {
+ public Window getParent() {
return (Window) super.getParent();
}
--
2.39.5