summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/automatedtests/robustness/RobustnessComplex.java
blob: 4f9325693da33da2de58f6cb7010067cf21165f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* 
@ITMillApache2LicenseForJavaFiles@
 */

package com.itmill.toolkit.automatedtests.robustness;

import com.itmill.toolkit.automatedtests.util.Log;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Label;

public class RobustnessComplex extends Robustness implements
        Button.ClickListener {

    /**
     * Create complex layouts with components and listeners.
     */
    public void create() {
        count++;

        // remove old stressLayout, all dependant components should be now
        // allowed for garbage collection.
        if (stressLayout != null)
            main.removeComponent(stressLayout);

        // create new stress layout
        stressLayout = randomComponents
                .getRandomComponentContainer("Component container " + count);

        Label label = new Label("Label " + Log.getMemoryStatistics(),
                Label.CONTENT_PREFORMATTED);
        stressLayout.addComponent(label);

        // fill with random components
        randomComponents.fillLayout(stressLayout, 50);

        // add new component container to main layout
        main.addComponent(stressLayout);

        // if ((count % 100) == 0) {
        System.out.println("Created " + count + " times.");
        // }
    }
}