--- /dev/null
+package com.vaadin.tests.components.popupview;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.PopupView;\r
+import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.Button.ClickListener;\r
+import com.vaadin.ui.Window.Notification;\r
+\r
+public class PopupViewNullValues extends TestBase {\r
+\r
+ private PopupView pv[] = new PopupView[4];\r
+ private Button b[] = new Button[4];\r
+\r
+ @Override\r
+ protected void setup() {\r
+ try {\r
+ pv[0] = new PopupView("Popupview 1 - no component", null);\r
+ addComponent(pv[0]);\r
+ b[0] = new Button("Open popupview 1", new ClickListener() {\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ pv[0].setPopupVisible(true);\r
+ }\r
+\r
+ });\r
+ } catch (Exception e) {\r
+ getMainWindow()\r
+ .showNotification(\r
+ "Error, 'null content' should not throw an exception at this point",\r
+ Notification.TYPE_ERROR_MESSAGE);\r
+ }\r
+\r
+ try {\r
+ pv[1] = new PopupView(null, new TextField(\r
+ "Empty html, contains component"));\r
+ addComponent(pv[1]);\r
+ b[1] = new Button("Open popupview 2", new ClickListener() {\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ pv[1].setPopupVisible(true);\r
+ }\r
+\r
+ });\r
+ } catch (Exception e) {\r
+ getMainWindow()\r
+ .showNotification(\r
+ "Error, 'null html', should not throw an exception at this point",\r
+ Notification.TYPE_ERROR_MESSAGE);\r
+ }\r
+\r
+ try {\r
+ pv[2] = new PopupView(null, null);\r
+ addComponent(pv[2]);\r
+ b[2] = new Button("Open popupview 3", new ClickListener() {\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ pv[2].setPopupVisible(true);\r
+ }\r
+\r
+ });\r
+ } catch (Exception e) {\r
+ getMainWindow()\r
+ .showNotification(\r
+ "Error, 'null html, null content', should not throw an exception at this point",\r
+ Notification.TYPE_ERROR_MESSAGE);\r
+ }\r
+ try {\r
+ pv[3] = new PopupView("Popupview 4 - has component", new TextField(\r
+ "This is the content of popupview 4"));\r
+ addComponent(pv[3]);\r
+ b[3] = new Button("Open popupview 4", new ClickListener() {\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ pv[3].setPopupVisible(true);\r
+ }\r
+\r
+ });\r
+ } catch (Exception e) {\r
+ getMainWindow()\r
+ .showNotification(\r
+ "Error, 'null html, null content', should not throw an exception at this point",\r
+ Notification.TYPE_ERROR_MESSAGE);\r
+ }\r
+\r
+ addComponent(b[0]);\r
+ addComponent(b[1]);\r
+ addComponent(b[2]);\r
+ addComponent(b[3]);\r
+ }\r
+\r
+ @Override\r
+ protected String getDescription() {\r
+ return "This test case contains 3 popupviews. Only the second and the forth popup views have non-null components and can be opened. 1 and 3 will produce an exception if you try to open them.";\r
+ }\r
+\r
+ @Override\r
+ protected Integer getTicketNumber() {\r
+ return 3248;\r
+ }\r
+\r
+}\r
*/
public void setContent(PopupView.Content newContent)
throws IllegalArgumentException {
- if (newContent == null || newContent.getMinimizedValueAsHTML() == null
- || newContent.getPopupComponent() == null) {
- throw new IllegalArgumentException(
- "Content object is or contains null");
+ if (newContent == null) {
+ throw new IllegalArgumentException("Content must not be null");
}
-
content = newContent;
requestRepaint();
}
String html = content.getMinimizedValueAsHTML();
if (html == null) {
- throw new PaintException(
- "Recieved null when trying to paint minimized value.");
+ html = "";
}
- target.addAttribute("html", content.getMinimizedValueAsHTML());
+ target.addAttribute("html", html);
target.addAttribute("hideOnMouseOut", hideOnMouseOut);
// Only paint component to client if we know that the popup is showing