package com.vaadin.tests.components.listselect;

import java.util.LinkedHashMap;

import com.vaadin.tests.components.select.AbstractSelectTestCase;
import com.vaadin.ui.ListSelect;

public class ListSelects extends AbstractSelectTestCase<ListSelect> {

    @Override
    protected Class<ListSelect> getTestClass() {
        return ListSelect.class;
    }

    @Override
    protected void createActions() {
        super.createActions();
        createColumnSelectAction();
        createRowSelectAction();
    }

    private void createColumnSelectAction() {
        LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
        options.put("-", 0);
        for (int i = 1; i <= 10; i++) {
            options.put(String.valueOf(i), i);
        }
        options.put("50", 50);
        options.put("100", 100);
        options.put("1000", 1000);

        super.createSelectAction("Columns", CATEGORY_DATA_SOURCE, options, "-",
                columnsAction);

    }

    private void createRowSelectAction() {
        LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
        options.put("-", 0);
        for (int i = 1; i <= 10; i++) {
            options.put(String.valueOf(i), i);
        }
        options.put("50", 50);
        options.put("100", 100);
        options.put("1000", 1000);

        super.createSelectAction("Rows", CATEGORY_DATA_SOURCE, options, "-",
                rowsAction);

    }

    private Command<ListSelect, Integer> columnsAction = new Command<ListSelect, Integer>() {

        public void execute(ListSelect c, Integer value, Object data) {
            c.setColumns(value);
        }
    };
    private Command<ListSelect, Integer> rowsAction = new Command<ListSelect, Integer>() {

        public void execute(ListSelect c, Integer value, Object data) {
            c.setRows(value);
        }
    };

}

@@ -263,273 +263,218 @@
     
-@Override%0D%0A    protected Class%3CListSelect%3E getTestClass() %7B%0D%0A        return ListSelect.class;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected void createActions() %7B%0D%0A        super.createActions();%0D%0A        createColumnSelectAction();%0D%0A        createRowSelectAction();
+private Command%3CListSelect, Integer%3E rowsCommand = new Command%3CListSelect, Integer%3E() %7B%0D%0A        public void execute(ListSelect c, Integer value, Object data) %7B%0D%0A            c.setRows(value);%0D%0A        %7D
 %0D%0A    %7D
+;
 %0D%0A%0D%0A
@@ -489,116 +489,73 @@
 ate 
-void createColumnSelectAction() %7B%0D%0A        LinkedHashMap%3CString, Integer%3E options = new LinkedHashMap%3CString
+Command%3CListSelect, Integer%3E colsCommand = new Command%3CListSelect
 , In
@@ -554,33 +554,34 @@
 lect, Integer%3E()
-;
+ %7B
 %0D%0A        option
@@ -578,355 +578,419 @@
     
-options.put(%22-%22, 0);%0D%0A        for (int i = 1; i %3C= 10; i++) %7B%0D%0A            options.put(String.valueOf(i), i);%0D%0A        %7D%0D%0A        options.put(%2250%22, 50);%0D%0A        options.put(%22100%22, 100);%0D%0A        options.put(%221000%22, 1000);%0D%0A%0D%0A        super.createSelectAction(%22Columns%22, CATEGORY_DATA_SOURCE, options, %22-%22,%0D%0A                columnsAction);%0D%0A
+public void execute(ListSelect c, Integer value, Object data) %7B%0D%0A            c.setColumns(value);%0D%0A        %7D%0D%0A    %7D;%0D%0A%0D%0A    @Override%0D%0A    protected Class%3CListSelect%3E getTestClass() %7B%0D%0A        return ListSelect.class;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected void createActions() %7B%0D%0A        super.createActions();%0D%0A        createRowsAction(CATEGORY_FEATURES);%0D%0A        createColsAction(CATEGORY_FEATURES);
 %0D%0A    %7D
+;
 %0D%0A%0D%0A
@@ -1015,29 +1015,39 @@
 reateRow
-Select
+s
 Action(
+String category
 ) %7B%0D%0A   
@@ -1096,295 +1096,43 @@
 s = 
-new LinkedHashMap%3CString, Integer%3E();%0D%0A        options.put(%22-%22, 0);%0D%0A        for (int i = 1; i %3C= 10; i++) %7B%0D%0A            options.put(String.valueOf(i), i);%0D%0A        %7D%0D%0A        options.put(%2250%22, 50);%0D%0A        options.put(%22100%22, 100);%0D%0A        options.put(%221000%22, 1000);%0D%0A%0D%0A        super.
+createIntegerOptions(20);%0D%0A        
 crea
@@ -1158,28 +1158,16 @@
 s%22, 
-CATEGORY_DATA_SOURCE
+category
 , op
@@ -1178,159 +1178,98 @@
 s, %22
--%22,%0D%0A                rowsAction);%0D%0A%0D%0A    %7D%0D%0A%0D%0A    private Command%3CListSelect, Integer%3E columnsAction = new Command%3CListSelect, Integer%3E(
+0%22, rowsCommand);%0D%0A    %7D%0D%0A%0D%0A    private void createColsAction(String category
 ) %7B%0D%0A
-%0D%0A
         
 publ
@@ -1268,156 +1268,28 @@
     
-public void execute(ListSelect c, Integer value, Object data) %7B%0D%0A            c.setColumns(value);%0D%0A        %7D%0D%0A    %7D;%0D%0A    private Command%3CListSelect
+LinkedHashMap%3CString
 , In
@@ -1299,169 +1299,126 @@
 er%3E 
-rowsAc
+op
 tion
+s
  = 
-new Command%3CListSelect, Integer%3E() %7B%0D%0A%0D%0A        public void execute(ListSelect c, Integer value, Object data) %7B%0D%0A            c.setRows(value
+createIntegerOptions(20);%0D%0A        createSelectAction(%22Columns%22, category, options, %220%22, colsCommand
 );%0D%0A    
     
@@ -1409,32 +1409,20 @@
 mand);%0D%0A    
-    %7D%0D%0A    %7D;
+%7D
 %0D%0A%0D%0A%7D%0D%0A

Use methods in super class