summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket2029.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/tickets/Ticket2029.java
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket2029.java')
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2029.java140
1 files changed, 140 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java
new file mode 100644
index 0000000000..5900c76706
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java
@@ -0,0 +1,140 @@
+package com.vaadin.tests.tickets;
+
+import java.util.Random;
+
+import com.vaadin.Application;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.UserError;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class Ticket2029 extends Application.LegacyApplication {
+
+ int COMPONENTS;
+ int DIM1, DIM2;
+ Random r = new Random();
+
+ @Override
+ public void init() {
+ COMPONENTS = 5;
+ DIM1 = 504;
+ DIM2 = 100;
+
+ LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
+ setMainWindow(w);
+ // setTheme("tests-tickets");
+ Panel p = createPanel();
+ w.getContent().addComponent(p);
+ // w.getLayout().addComponent(createGLPanel());
+ w.getContent().addComponent(createPanelV());
+ }
+
+ private Panel createPanel() {
+ Panel p = new Panel(DIM1 + "x" + DIM2 + " OrderedLayout");
+ p.setWidth(DIM1 + "px");
+ p.setHeight(DIM2 + "px");
+
+ HorizontalLayout layout = new HorizontalLayout();
+ p.setContent(layout);
+ p.getContent().setSizeFull();
+
+ for (int i = 0; i < COMPONENTS; i++) {
+ TextField tf = new TextField();
+ if (r.nextBoolean()) {
+ tf.setCaption("Caption");
+ }
+ if (r.nextBoolean()) {
+ tf.setRequired(true);
+ }
+ if (r.nextBoolean()) {
+ tf.setComponentError(new UserError("Error"));
+ }
+ tf.setWidth("100%");
+ layout.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+ p.addComponent(tf);
+
+ }
+
+ return p;
+ }
+
+ @SuppressWarnings("unused")
+ private Panel createGLPanel() {
+ Panel p = new Panel("" + DIM1 + "x" + DIM2 + " GridLayout");
+ p.setWidth("" + DIM1 + "px");
+ p.setHeight("" + DIM2 + "px");
+
+ GridLayout layout = new GridLayout(COMPONENTS, 1);
+ p.setContent(layout);
+ p.getContent().setSizeFull();
+
+ for (int i = 0; i < COMPONENTS; i++) {
+ TextField tf = new TextField();
+ tf.setImmediate(true);
+ tf.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ Component c = ((Component) event.getProperty());
+ c.setCaption("askfdj");
+
+ }
+ });
+ if (r.nextBoolean()) {
+ tf.setCaption("Caption");
+ }
+ if (r.nextBoolean()) {
+ tf.setRequired(true);
+ }
+ if (r.nextBoolean()) {
+ tf.setComponentError(new UserError("Error"));
+ }
+ tf.setWidth("100%");
+ layout.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
+ p.addComponent(tf);
+
+ }
+
+ return p;
+ }
+
+ private Panel createPanelV() {
+ Panel p = new Panel("" + DIM1 + "x" + DIM2 + " OrderedLayout");
+ p.setWidth("" + DIM2 + "px");
+ p.setHeight("" + DIM1 + "px");
+
+ VerticalLayout layout = new VerticalLayout();
+ p.setContent(layout);
+ p.getContent().setSizeFull();
+
+ for (int i = 0; i < COMPONENTS; i++) {
+ TextArea tf = new TextArea();
+ if (r.nextBoolean()) {
+ tf.setCaption("Caption");
+ }
+ if (r.nextBoolean()) {
+ tf.setRequired(true);
+ }
+ if (r.nextBoolean()) {
+ tf.setComponentError(new UserError("Error"));
+ }
+
+ tf.setRows(2);
+ tf.setSizeFull();
+
+ layout.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+ p.addComponent(tf);
+
+ }
+
+ return p;
+ }
+}