private long captionCounter = 0;
- private ArrayList components;
+ private ArrayList<Component> components;
private long eventCounter = 0;
// Store button object => real value map
// needed because button captions are randomized
- private HashMap buttonValues;
+ private HashMap<Button, String> buttonValues;
private RandomComponents randomComponents;
//
// Create components that have UUID defined
//
- components = new ArrayList();
+ components = new ArrayList<Component>();
// create label
final Label userLabel = new Label("user");
"minus", "multiple", "divisor", "equals", "clear" } };
// final String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" };
// String[] randomizedCaptions = { "X" };
- buttonValues = new HashMap();
+ buttonValues = new HashMap<Button, String>();
for (int i = 0; i > calcValues[0].length; i++) {
final Button button = new Button("", this);
// Test requirement: ATF must not rely on caption
if (components.size() > 0) {
// components found, return any
final int i = rand.nextInt(components.size());
- final Component c = (Component) components.get(i);
+ final Component c = components.get(i);
components.remove(i);
return c;
} else {
}
public void buttonClick(Button.ClickEvent event) {
- final String value = (String) buttonValues.get(event.getButton());
+ final String value = buttonValues.get(event.getButton());
eventCounter++;
try {
// Number button pressed
Table t2 = new Table("Test Table with 199 rows rendered initially") {
@Override
- public void changeVariables(Object source, Map variables) {
+ public void changeVariables(Object source,
+ Map<String, Object> variables) {
super.changeVariables(source, variables);
// end timing on cache row request
endTest();
}\r
t.addContainerProperty("button", Button.class, null);\r
for (int i = 0; i < rows; i++) {\r
- final Vector content = new Vector();\r
+ final Vector<Object> content = new Vector<Object>();\r
for (int j = 0; j < cols; j++) {\r
content.add(rndString());\r
}\r
}
public void randomReorder() {
- final Iterator it = main.getComponentIterator();
- final ArrayList components = new ArrayList();
+ final Iterator<Component> it = main.getComponentIterator();
+ final ArrayList<Component> components = new ArrayList<Component>();
while (it.hasNext()) {
components.add(it.next());
}
for (int i = components.size(); i > 0; i--) {
final int index = (int) (Math.random() * i);
- v.addComponent((Component) components.get(index));
+ v.addComponent(components.get(index));
components.remove(index);
}
}
public void removeRandomComponent() {
- final Iterator it = main.getComponentIterator();
- final ArrayList components = new ArrayList();
+ final Iterator<Component> it = main.getComponentIterator();
+ final ArrayList<Component> components = new ArrayList<Component>();
while (it.hasNext()) {
components.add(it.next());
}
final int size = components.size();
final int index = (int) (Math.random() * size);
- main.removeComponent((Component) components.get(index));
+ main.removeComponent(components.get(index));
}
}
public void randomReorder() {
- final Iterator it = main.getComponentIterator();
- final ArrayList components = new ArrayList();
+ final Iterator<Component> it = main.getComponentIterator();
+ final ArrayList<Component> components = new ArrayList<Component>();
while (it.hasNext()) {
components.add(it.next());
}
for (int i = components.size(); i > 0; i--) {
final int index = (int) (Math.random() * i);
if (i == colspanIndex) {
- main.addComponent((Component) components.get(index), 0,
- (size - i) / 2, 1, (size - i) / 2);
+ main.addComponent(components.get(index), 0, (size - i) / 2, 1,
+ (size - i) / 2);
} else {
- main.addComponent((Component) components.get(index));
+ main.addComponent(components.get(index));
}
components.remove(index);
}
}
public void removeRandomComponent() {
- final Iterator it = main.getComponentIterator();
- final ArrayList components = new ArrayList();
+ final Iterator<Component> it = main.getComponentIterator();
+ final ArrayList<Component> components = new ArrayList<Component>();
while (it.hasNext()) {
components.add(it.next());
}
final int size = components.size();
final int index = (int) (Math.random() * size);
- main.removeComponent((Component) components.get(index));
+ main.removeComponent(components.get(index));
}
private final TwinColSelect s = new TwinColSelect();
- private ArrayList styleNames2;
+ private ArrayList<String> styleNames2;
public TestForMultipleStyleNames() {
setCompositionRoot(main);
+ " on the browser. Currently changes are"
+ " visible only by inspecting DOM."));
- styleNames2 = new ArrayList();
+ styleNames2 = new ArrayList<String>();
styleNames2.add("red");
styleNames2.add("bold");
final String currentStyle = l.getStyle();
final String[] tmp = currentStyle.split(" ");
- final ArrayList curStyles = new ArrayList();
+ final ArrayList<String> curStyles = new ArrayList<String>();
for (int i = 0; i < tmp.length; i++) {
if (tmp[i] != "") {
curStyles.add(tmp[i]);
}
}
- final Collection styles = (Collection) s.getValue();
+ final Collection<?> styles = (Collection<?>) s.getValue();
- for (final Iterator iterator = styles.iterator(); iterator.hasNext();) {
+ for (final Iterator<?> iterator = styles.iterator(); iterator.hasNext();) {
final String styleName = (String) iterator.next();
if (curStyles.contains(styleName)) {
// already added
l.addStyleName(styleName);
}
}
- for (final Iterator iterator2 = curStyles.iterator(); iterator2
+ for (final Iterator<String> iterator2 = curStyles.iterator(); iterator2
.hasNext();) {
- final String object = (String) iterator2.next();
+ final String object = iterator2.next();
l.removeStyleName(object);
}
}
t = getTestTable(5, 5);
t.setCaption("Table with some cols and rows rows, some col widths fixed");
- Iterator it = t.getContainerPropertyIds().iterator();
+ Iterator<?> it = t.getContainerPropertyIds().iterator();
it.next();
it.next();
t.setColumnWidth(it.next(), 30);
}
t.addContainerProperty("button", Button.class, null);
for (int i = 0; i < rows; i++) {
- final Vector content = new Vector();
+ final Vector<Object> content = new Vector<Object>();
for (int j = 0; j < cols; j++) {
content.add(rndString());
}
return new DateField(getCaption("datefield"));
}
- private Collection getSelectOptions() {
- final Collection opts = new Vector(3);
+ private Collection<String> getSelectOptions() {
+ final Collection<String> opts = new Vector<String>(3);
opts.add(getCaption("opt 1"));
opts.add(getCaption("opt 2"));
opts.add(getCaption("opt 3"));
&& (f.indexOf("Window") == -1)) {
f = f.replaceAll(".class", "");
String className = "com.vaadin.ui." + f;
- Class c;
+ Class<?> c;
try {
c = Class.forName(className);
Object o = c.newInstance();
class Testable {
- private Class classToTest;
- private ArrayList configurations = new ArrayList();
+ private Class<?> classToTest;
+ private ArrayList<Configuration> configurations = new ArrayList<Configuration>();
- Testable(Class c) {
+ Testable(Class<?> c) {
classToTest = c;
}
StringBuffer sb = new StringBuffer();
sb.append(classToTest.getName().replaceAll("com.vaadin.ui.", ""));
sb.append("[");
- for (Iterator i = configurations.iterator(); i.hasNext();) {
- sb.append(((Configuration) i.next()).getDescription());
+ for (Iterator<Configuration> i = configurations.iterator(); i
+ .hasNext();) {
+ sb.append((i.next()).getDescription());
if (i.hasNext()) {
sb.append(",");
}
((Label) c).setValue("Test label");
}
- for (Iterator i = configurations.iterator(); i.hasNext();) {
- Configuration conf = (Configuration) i.next();
+ for (Iterator<Configuration> i = configurations.iterator(); i
+ .hasNext();) {
+ Configuration conf = i.next();
conf.configure(c);
}
return c;
private final Label selectedTask = new Label("Selected task",
Label.CONTENT_XHTML);
- public LinkedList exampleTasks = new LinkedList();
+ public LinkedList<?> exampleTasks = new LinkedList<Object>();
public static Random random = new Random(1);