aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2009-05-25 11:17:52 +0000
committerHenri Sara <henri.sara@itmill.com>2009-05-25 11:17:52 +0000
commit0f3e18635c4525538cfebc7dd8ef448be8a2f4c6 (patch)
tree8819e1c778cd3b2c8f02d132fd0883fec5235f75
parent798d35b70d615bbb30a45b0280712ad0b528d2c1 (diff)
downloadvaadin-framework-0f3e18635c4525538cfebc7dd8ef448be8a2f4c6.tar.gz
vaadin-framework-0f3e18635c4525538cfebc7dd8ef448be8a2f4c6.zip
#2643 more fixing of demo warnings
svn changeset:7987/svn branch:6.0
-rw-r--r--src/com/vaadin/automatedtests/featurebrowser/FeatureBrowser.java16
-rw-r--r--src/com/vaadin/demo/VaadinTunesLayout.java4
-rw-r--r--src/com/vaadin/demo/colorpicker/ColorPicker.java2
-rw-r--r--src/com/vaadin/demo/featurebrowser/FeatureBrowser.java18
-rw-r--r--src/com/vaadin/demo/featurebrowser/GeneratedColumnExample.java34
-rw-r--r--src/com/vaadin/demo/featurebrowser/TableExample.java1
-rw-r--r--src/com/vaadin/demo/reservation/CalendarField.java14
-rw-r--r--src/com/vaadin/demo/reservation/GoogleMap.java4
-rw-r--r--src/com/vaadin/demo/reservation/ResourceSelectorPanel.java2
-rw-r--r--src/com/vaadin/demo/reservation/SampleDB.java12
-rw-r--r--src/com/vaadin/demo/reservation/gwt/client/ui/VCalendarField.java4
-rw-r--r--src/com/vaadin/demo/reservation/gwt/client/ui/VGoogleMap.java1
-rw-r--r--src/com/vaadin/demo/reservation/simple/AdminView.java3
-rw-r--r--src/com/vaadin/demo/reservation/simple/SampleDB.java12
-rw-r--r--src/com/vaadin/demo/sampler/APIResource.java12
-rw-r--r--src/com/vaadin/demo/sampler/ModeSwitch.java5
-rw-r--r--src/com/vaadin/demo/sampler/SamplerApplication.java19
-rw-r--r--src/com/vaadin/demo/sampler/features/accordions/AccordionDisabledExample.java1
-rw-r--r--src/com/vaadin/demo/sampler/features/accordions/AccordionIconsExample.java9
-rw-r--r--src/com/vaadin/demo/sampler/features/commons/ValidationExample.java10
-rw-r--r--src/com/vaadin/demo/sampler/features/form/FormPojoExample.java3
-rw-r--r--src/com/vaadin/demo/sampler/features/layouts/ApplicationLayoutExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/layouts/WebLayoutExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/panels/PanelBasicExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/panels/PanelLightExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/selects/ComboBoxContainsExample.java4
-rw-r--r--src/com/vaadin/demo/sampler/features/selects/ComboBoxStartsWithExample.java4
-rw-r--r--src/com/vaadin/demo/sampler/features/selects/ListSelectSingleExample.java5
-rw-r--r--src/com/vaadin/demo/sampler/features/table/TableMainFeaturesExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/tabsheets/TabSheetDisabledExample.java1
-rw-r--r--src/com/vaadin/demo/sampler/features/tabsheets/TabSheetIconsExample.java8
-rw-r--r--src/com/vaadin/demo/sampler/features/tabsheets/TabSheetScrollingExample.java8
-rw-r--r--src/com/vaadin/demo/sampler/features/trees/TreeMultiSelectExample.java5
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/NativeWindowExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/SubwindowAutoSizedExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/SubwindowCloseExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/SubwindowExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/SubwindowModalExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/SubwindowPositionedExample.java2
-rw-r--r--src/com/vaadin/demo/sampler/features/windows/SubwindowSizedExample.java2
40 files changed, 134 insertions, 111 deletions
diff --git a/src/com/vaadin/automatedtests/featurebrowser/FeatureBrowser.java b/src/com/vaadin/automatedtests/featurebrowser/FeatureBrowser.java
index 275d42efb6..b6f2e0e163 100644
--- a/src/com/vaadin/automatedtests/featurebrowser/FeatureBrowser.java
+++ b/src/com/vaadin/automatedtests/featurebrowser/FeatureBrowser.java
@@ -54,7 +54,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
private TabSheet ts;
// Example "cache"
- private final HashMap exampleInstances = new HashMap();
+ private final HashMap<Class<?>, Component> exampleInstances = new HashMap<Class<?>, Component>();
private String section;
// List of examples
@@ -129,9 +129,9 @@ public class FeatureBrowser extends com.vaadin.Application implements
final SplitPanel split = new SplitPanel(
SplitPanel.ORIENTATION_HORIZONTAL);
split.setSplitPosition(200, SplitPanel.UNITS_PIXELS);
- main.setLayout(split);
+ main.setContent(split);
- final HashMap sectionIds = new HashMap();
+ final HashMap<String, Object> sectionIds = new HashMap<String, Object>();
final HierarchicalContainer container = createContainer();
final Object rootId = container.addItem();
Item item = container.getItem(rootId);
@@ -212,7 +212,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
public void buttonClick(ClickEvent event) {
Component component = (Component) ts.getComponentIterator()
.next();
- String caption = ts.getTabCaption(component);
+ String caption = ts.getTab(component).getCaption();
try {
component = component.getClass().newInstance();
} catch (Exception e) {
@@ -222,7 +222,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
Window w = new Window(caption);
w.setWidth("640px");
if (Layout.class.isAssignableFrom(component.getClass())) {
- w.setLayout((Layout) component);
+ w.setContent((Layout) component);
} else {
// w.getLayout().getSize().setSizeFull();
w.addComponent(component);
@@ -237,7 +237,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
public void buttonClick(ClickEvent event) {
Component component = (Component) ts.getComponentIterator()
.next();
- final String caption = ts.getTabCaption(component);
+ final String caption = ts.getTab(component).getCaption();
Window w = getWindow(caption);
if (w == null) {
try {
@@ -249,7 +249,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
w = new Window(caption);
w.setName(caption);
if (Layout.class.isAssignableFrom(component.getClass())) {
- w.setLayout((Layout) component);
+ w.setContent((Layout) component);
} else {
// w.getLayout().getSize().setSizeFull();
w.addComponent(component);
@@ -381,7 +381,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
return null;
}
}
- return (Component) exampleInstances.get(componentClass);
+ return exampleInstances.get(componentClass);
}
}
diff --git a/src/com/vaadin/demo/VaadinTunesLayout.java b/src/com/vaadin/demo/VaadinTunesLayout.java
index 695c4dc2cf..6b82e53e0a 100644
--- a/src/com/vaadin/demo/VaadinTunesLayout.java
+++ b/src/com/vaadin/demo/VaadinTunesLayout.java
@@ -51,7 +51,7 @@ public class VaadinTunesLayout extends Application {
// Our root window contains one VerticalLayout by default, let's make
// sure it's 100% sized, and remove unwanted margins
- root.getLayout().setSizeFull();
+ root.getContent().setSizeFull();
root.getLayout().setMargin(false);
// Top area, containing playback and volume controls, play status, view
@@ -172,7 +172,7 @@ public class VaadinTunesLayout extends Application {
// The splitpanel is by default 100% x 100%, but we'll need to adjust
// our main window layout to accomodate the height
- ((VerticalLayout) root.getLayout()).setExpandRatio(bottom, 1.0F);
+ ((VerticalLayout) root.getContent()).setExpandRatio(bottom, 1.0F);
// Give the sidebar less space than the listing
bottom.setSplitPosition(200, SplitPanel.UNITS_PIXELS);
diff --git a/src/com/vaadin/demo/colorpicker/ColorPicker.java b/src/com/vaadin/demo/colorpicker/ColorPicker.java
index 520a99d04a..99a3abd37a 100644
--- a/src/com/vaadin/demo/colorpicker/ColorPicker.java
+++ b/src/com/vaadin/demo/colorpicker/ColorPicker.java
@@ -18,7 +18,7 @@ public class ColorPicker extends AbstractField {
setValue(new String("white"));
}
- /** The property value of the field is an Integer. */
+ /** The property value of the field is a String. */
@Override
public Class getType() {
return String.class;
diff --git a/src/com/vaadin/demo/featurebrowser/FeatureBrowser.java b/src/com/vaadin/demo/featurebrowser/FeatureBrowser.java
index 45da691988..5b9e769015 100644
--- a/src/com/vaadin/demo/featurebrowser/FeatureBrowser.java
+++ b/src/com/vaadin/demo/featurebrowser/FeatureBrowser.java
@@ -53,7 +53,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
private TabSheet ts;
// Example "cache"
- private final HashMap exampleInstances = new HashMap();
+ private final HashMap<Class<?>, Component> exampleInstances = new HashMap<Class<?>, Component>();
private String section;
// List of examples
@@ -129,7 +129,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
split.setSplitPosition(200, SplitPanel.UNITS_PIXELS);
main.setContent(split);
- final HashMap sectionIds = new HashMap();
+ final HashMap<String, Object> sectionIds = new HashMap<String, Object>();
final HierarchicalContainer container = createContainer();
final Object rootId = container.addItem();
Item item = container.getItem(rootId);
@@ -166,7 +166,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
tree.addListener(this);
tree.setImmediate(true);
tree.expandItemsRecursively(rootId);
- for (Iterator i = container.getItemIds().iterator(); i.hasNext();) {
+ for (Iterator<?> i = container.getItemIds().iterator(); i.hasNext();) {
Object id = i.next();
if (container.getChildren(id) == null) {
tree.setChildrenAllowed(id, false);
@@ -209,7 +209,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
public void buttonClick(ClickEvent event) {
Component component = (Component) ts.getComponentIterator()
.next();
- String caption = ts.getTabCaption(component);
+ String caption = ts.getTab(component).getCaption();
try {
component = component.getClass().newInstance();
} catch (Exception e) {
@@ -233,7 +233,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
public void buttonClick(ClickEvent event) {
Component component = (Component) ts.getComponentIterator()
.next();
- final String caption = ts.getTabCaption(component);
+ final String caption = ts.getTab(component).getCaption();
Window w = getWindow(caption);
if (w == null) {
try {
@@ -347,8 +347,8 @@ public class FeatureBrowser extends com.vaadin.Application implements
tree.setValue(table.getValue());
table.addListener(this);
final Item item = table.getItem(table.getValue());
- final Class c = (Class) item.getItemProperty(PROPERTY_ID_CLASS)
- .getValue();
+ final Class<?> c = (Class<?>) item.getItemProperty(
+ PROPERTY_ID_CLASS).getValue();
final Component component = getComponent(c);
if (component != null) {
final String caption = (String) item.getItemProperty(
@@ -368,7 +368,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
}
- private Component getComponent(Class componentClass) {
+ private Component getComponent(Class<?> componentClass) {
if (!exampleInstances.containsKey(componentClass)) {
try {
final Component c = (Component) componentClass.newInstance();
@@ -377,7 +377,7 @@ public class FeatureBrowser extends com.vaadin.Application implements
return null;
}
}
- return (Component) exampleInstances.get(componentClass);
+ return exampleInstances.get(componentClass);
}
}
diff --git a/src/com/vaadin/demo/featurebrowser/GeneratedColumnExample.java b/src/com/vaadin/demo/featurebrowser/GeneratedColumnExample.java
index cbb543722c..0ce1afb511 100644
--- a/src/com/vaadin/demo/featurebrowser/GeneratedColumnExample.java
+++ b/src/com/vaadin/demo/featurebrowser/GeneratedColumnExample.java
@@ -4,10 +4,10 @@
package com.vaadin.demo.featurebrowser;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.GregorianCalendar;
-import java.util.Vector;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
@@ -15,10 +15,10 @@ import com.vaadin.data.Property;
import com.vaadin.data.Container.Indexed;
import com.vaadin.data.util.BeanItem;
import com.vaadin.ui.AbstractField;
-import com.vaadin.ui.BaseFieldFactory;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
@@ -117,15 +117,15 @@ public class GeneratedColumnExample extends CustomComponent {
* implementations, as they are not needed in this example.
*/
public class MySimpleIndexedContainer implements Container, Indexed {
- Vector items;
+ ArrayList<BeanItem> items;
Object itemtemplate;
public MySimpleIndexedContainer(Object itemtemplate) {
this.itemtemplate = itemtemplate;
- items = new Vector(); // Yeah this is just a test
+ items = new ArrayList<BeanItem>(); // Yeah this is just a test
}
- public boolean addContainerProperty(Object propertyId, Class type,
+ public boolean addContainerProperty(Object propertyId, Class<?> type,
Object defaultValue) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
@@ -165,7 +165,7 @@ public class GeneratedColumnExample extends CustomComponent {
if (itemId instanceof Integer) {
int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < items.size()) {
- Item item = (Item) items.get(pos);
+ Item item = items.get(pos);
// The BeanItem provides the property objects for the items.
return item.getItemProperty(propertyId);
@@ -175,7 +175,7 @@ public class GeneratedColumnExample extends CustomComponent {
}
/** Table calls this to get the column names. */
- public Collection getContainerPropertyIds() {
+ public Collection<?> getContainerPropertyIds() {
Item item = new BeanItem(itemtemplate);
// The BeanItem knows how to get the property names from the bean.
@@ -186,21 +186,21 @@ public class GeneratedColumnExample extends CustomComponent {
if (itemId instanceof Integer) {
int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < items.size()) {
- return (Item) items.get(pos);
+ return items.get(pos);
}
}
return null;
}
- public Collection getItemIds() {
- Vector ids = new Vector(items.size());
+ public Collection<?> getItemIds() {
+ ArrayList<Integer> ids = new ArrayList<Integer>(items.size());
for (int i = 0; i < items.size(); i++) {
ids.add(Integer.valueOf(i));
}
return ids;
}
- public Class getType(Object propertyId) {
+ public Class<?> getType(Object propertyId) {
return BeanItem.class;
}
@@ -427,11 +427,13 @@ public class GeneratedColumnExample extends CustomComponent {
/**
* Custom field factory that sets the fields as immediate.
*/
- public class ImmediateFieldFactory extends BaseFieldFactory {
+ public class ImmediateFieldFactory extends DefaultFieldFactory {
@Override
- public Field createField(Class type, Component uiContext) {
- // Let the BaseFieldFactory create the fields
- Field field = super.createField(type, uiContext);
+ public Field createField(Container container, Object itemId,
+ Object propertyId, Component uiContext) {
+ // Let the DefaultFieldFactory create the fields
+ Field field = super.createField(container, itemId, propertyId,
+ uiContext);
// ...and just set them as immediate
((AbstractField) field).setImmediate(true);
@@ -529,7 +531,7 @@ public class GeneratedColumnExample extends CustomComponent {
// Use a custom field factory to set the edit fields as immediate.
// This is used when the table is in editable mode.
- table.setFieldFactory(new ImmediateFieldFactory());
+ table.setTableFieldFactory(new ImmediateFieldFactory());
// Setting the table itself as immediate has no relevance in this
// example,
diff --git a/src/com/vaadin/demo/featurebrowser/TableExample.java b/src/com/vaadin/demo/featurebrowser/TableExample.java
index 057bf380b5..808762724b 100644
--- a/src/com/vaadin/demo/featurebrowser/TableExample.java
+++ b/src/com/vaadin/demo/featurebrowser/TableExample.java
@@ -232,6 +232,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
}
}
+ @SuppressWarnings("unchecked")
public void buttonClick(ClickEvent event) {
final Button b = event.getButton();
if (b == deselect) {
diff --git a/src/com/vaadin/demo/reservation/CalendarField.java b/src/com/vaadin/demo/reservation/CalendarField.java
index f555c83228..2af0f1ed71 100644
--- a/src/com/vaadin/demo/reservation/CalendarField.java
+++ b/src/com/vaadin/demo/reservation/CalendarField.java
@@ -126,19 +126,19 @@ public class CalendarField extends DateField implements Container.Viewer {
// Check old propertyIds
if (itemEndPropertyId != null) {
- final Class c = dataSource.getType(itemEndPropertyId);
+ final Class<?> c = dataSource.getType(itemEndPropertyId);
if (!Date.class.isAssignableFrom(c)) {
itemEndPropertyId = null;
}
}
if (itemNotimePropertyId != null) {
- final Class c = dataSource.getType(itemNotimePropertyId);
+ final Class<?> c = dataSource.getType(itemNotimePropertyId);
if (!Boolean.class.isAssignableFrom(c)) {
itemNotimePropertyId = null;
}
}
if (itemStartPropertyId != null) {
- final Class c = dataSource.getType(itemStartPropertyId);
+ final Class<?> c = dataSource.getType(itemStartPropertyId);
if (Date.class.isAssignableFrom(c)) {
// All we _really_ need is one date
return true;
@@ -147,10 +147,10 @@ public class CalendarField extends DateField implements Container.Viewer {
}
}
// We need at least one Date
- final Collection ids = dataSource.getContainerPropertyIds();
- for (final Iterator it = ids.iterator(); it.hasNext();) {
+ final Collection<?> ids = dataSource.getContainerPropertyIds();
+ for (final Iterator<?> it = ids.iterator(); it.hasNext();) {
final Object id = it.next();
- final Class c = dataSource.getType(id);
+ final Class<?> c = dataSource.getType(id);
if (Date.class.isAssignableFrom(c)) {
itemStartPropertyId = id;
return true;
@@ -257,7 +257,7 @@ public class CalendarField extends DateField implements Container.Viewer {
month = ((Date) value).getMonth();
}
- for (final Iterator it = dataSource.getItemIds().iterator(); it
+ for (final Iterator<?> it = dataSource.getItemIds().iterator(); it
.hasNext();) {
final Object itemId = it.next();
final Item item = dataSource.getItem(itemId);
diff --git a/src/com/vaadin/demo/reservation/GoogleMap.java b/src/com/vaadin/demo/reservation/GoogleMap.java
index 54d7d4bcf7..e82f7c0f6a 100644
--- a/src/com/vaadin/demo/reservation/GoogleMap.java
+++ b/src/com/vaadin/demo/reservation/GoogleMap.java
@@ -55,8 +55,8 @@ public class GoogleMap extends AbstractComponent implements Sizeable,
if (dataSource != null) {
target.startTag(TAG_MARKERS);
- final Collection itemIds = dataSource.getItemIds();
- for (final Iterator it = itemIds.iterator(); it.hasNext();) {
+ final Collection<?> itemIds = dataSource.getItemIds();
+ for (final Iterator<?> it = itemIds.iterator(); it.hasNext();) {
final Object itemId = it.next();
final Item item = dataSource.getItem(itemId);
Property p = item.getItemProperty(getItemMarkerXPropertyId());
diff --git a/src/com/vaadin/demo/reservation/ResourceSelectorPanel.java b/src/com/vaadin/demo/reservation/ResourceSelectorPanel.java
index c73e287ef1..a99cb23940 100644
--- a/src/com/vaadin/demo/reservation/ResourceSelectorPanel.java
+++ b/src/com/vaadin/demo/reservation/ResourceSelectorPanel.java
@@ -17,7 +17,7 @@ import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;
-@SuppressWarnings("serial")
+@SuppressWarnings( { "serial", "unchecked" })
public class ResourceSelectorPanel extends Panel implements
Button.ClickListener {
private final HashMap categoryLayouts = new HashMap();
diff --git a/src/com/vaadin/demo/reservation/SampleDB.java b/src/com/vaadin/demo/reservation/SampleDB.java
index a9ab81fc1b..9be151c9e0 100644
--- a/src/com/vaadin/demo/reservation/SampleDB.java
+++ b/src/com/vaadin/demo/reservation/SampleDB.java
@@ -267,7 +267,7 @@ public class SampleDB {
}
- public Container getReservations(List resources) {
+ public Container getReservations(List<?> resources) {
// TODO where reserved_by=?
// TODO where from=?
// TODO where to=?
@@ -277,7 +277,7 @@ public class SampleDB {
+ Resource.PROPERTY_ID_ID;
if (resources != null && resources.size() > 0) {
final StringBuffer s = new StringBuffer();
- for (final Iterator it = resources.iterator(); it.hasNext();) {
+ for (final Iterator<?> it = resources.iterator(); it.hasNext();) {
if (s.length() > 0) {
s.append(",");
}
@@ -397,14 +397,14 @@ public class SampleDB {
"Customer meeting", "Guests arriving at harbour",
"Moving furniture", "Taking guests to see town" };
final Container cat = getCategories();
- final Collection cIds = cat.getItemIds();
- for (final Iterator it = cIds.iterator(); it.hasNext();) {
+ final Collection<?> cIds = cat.getItemIds();
+ for (final Iterator<?> it = cIds.iterator(); it.hasNext();) {
final Object id = it.next();
final Item ci = cat.getItem(id);
final String c = (String) ci.getItemProperty(
Resource.PROPERTY_ID_CATEGORY).getValue();
final Container resources = getResources(c);
- final Collection rIds = resources.getItemIds();
+ final Collection<?> rIds = resources.getItemIds();
final Calendar cal = Calendar.getInstance();
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
@@ -413,7 +413,7 @@ public class SampleDB {
// cal.add(Calendar.DAY_OF_MONTH, -days);
for (int i = 0; i < days; i++) {
int r = 3;
- for (final Iterator rit = rIds.iterator(); rit.hasNext()
+ for (final Iterator<?> rit = rIds.iterator(); rit.hasNext()
&& r > 0; r--) {
final Object rid = rit.next();
final Item resource = resources.getItem(rid);
diff --git a/src/com/vaadin/demo/reservation/gwt/client/ui/VCalendarField.java b/src/com/vaadin/demo/reservation/gwt/client/ui/VCalendarField.java
index ad9b2f8ae3..0ccb5b73ef 100644
--- a/src/com/vaadin/demo/reservation/gwt/client/ui/VCalendarField.java
+++ b/src/com/vaadin/demo/reservation/gwt/client/ui/VCalendarField.java
@@ -24,6 +24,7 @@ import com.vaadin.terminal.gwt.client.ui.CalendarEntry;
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel;
import com.vaadin.terminal.gwt.client.ui.VDateField;
+@SuppressWarnings( { "deprecation", "unchecked" })
public class VCalendarField extends VDateField {
private final VCalendarPanel calPanel;
@@ -87,7 +88,6 @@ public class VCalendarField extends VDateField {
buildDayView(date);
}
- @SuppressWarnings("deprecation")
protected void buildDayView(Date date) {
if (hourPanel == null) {
hourPanel = new SimplePanel();
@@ -219,7 +219,6 @@ public class VCalendarField extends VDateField {
private final HashMap dates = new HashMap();
- @SuppressWarnings("deprecation")
public void addItem(UIDL item) {
final String styleName = item.getStringAttribute("styleName");
// final Integer id = new Integer(item.getIntAttribute("id"));
@@ -265,7 +264,6 @@ public class VCalendarField extends VDateField {
}
}
- @SuppressWarnings("deprecation")
public List getEntries(Date date, int resolution) {
final ArrayList res = new ArrayList();
if (date == null) {
diff --git a/src/com/vaadin/demo/reservation/gwt/client/ui/VGoogleMap.java b/src/com/vaadin/demo/reservation/gwt/client/ui/VGoogleMap.java
index 026f89f1be..e6150c39b7 100644
--- a/src/com/vaadin/demo/reservation/gwt/client/ui/VGoogleMap.java
+++ b/src/com/vaadin/demo/reservation/gwt/client/ui/VGoogleMap.java
@@ -78,6 +78,7 @@ public class VGoogleMap extends Composite implements Paintable {
private void addMarkerPopup(Marker marker, final String html) {
marker.addMarkerClickHandler(new MarkerClickHandler() {
+ @SuppressWarnings("deprecation")
public void onClick(MarkerClickEvent event) {
widget.getInfoWindow().open(event.getSender().getPoint(),
new InfoWindowContent(html));
diff --git a/src/com/vaadin/demo/reservation/simple/AdminView.java b/src/com/vaadin/demo/reservation/simple/AdminView.java
index 59d772b80a..49798f5181 100644
--- a/src/com/vaadin/demo/reservation/simple/AdminView.java
+++ b/src/com/vaadin/demo/reservation/simple/AdminView.java
@@ -76,8 +76,7 @@ public class AdminView extends VerticalLayout {
public void buttonClick(ClickEvent event) {
if (editedItem == null) {
// save
- int addResource = application.getDb().addResource(
- name.getValue().toString(),
+ application.getDb().addResource(name.getValue().toString(),
desc.getValue().toString());
} else {
// update
diff --git a/src/com/vaadin/demo/reservation/simple/SampleDB.java b/src/com/vaadin/demo/reservation/simple/SampleDB.java
index 286f1dd564..bd1808e385 100644
--- a/src/com/vaadin/demo/reservation/simple/SampleDB.java
+++ b/src/com/vaadin/demo/reservation/simple/SampleDB.java
@@ -236,7 +236,7 @@ public class SampleDB {
}
- public Container getReservations(List resources) {
+ public Container getReservations(List<?> resources) {
// TODO where reserved_by=?
// TODO where from=?
// TODO where to=?
@@ -246,7 +246,7 @@ public class SampleDB {
+ Resource.PROPERTY_ID_ID;
if (resources != null && resources.size() > 0) {
final StringBuffer s = new StringBuffer();
- for (final Iterator it = resources.iterator(); it.hasNext();) {
+ for (final Iterator<?> it = resources.iterator(); it.hasNext();) {
if (s.length() > 0) {
s.append(",");
}
@@ -355,14 +355,14 @@ public class SampleDB {
"Customer meeting", "Guests arriving at harbour",
"Moving furniture", "Taking guests to see town" };
final Container cat = getCategories();
- final Collection cIds = cat.getItemIds();
- for (final Iterator it = cIds.iterator(); it.hasNext();) {
+ final Collection<?> cIds = cat.getItemIds();
+ for (final Iterator<?> it = cIds.iterator(); it.hasNext();) {
final Object id = it.next();
final Item ci = cat.getItem(id);
final String c = (String) ci.getItemProperty(
Resource.PROPERTY_ID_CATEGORY).getValue();
final Container resources = getResources(c);
- final Collection rIds = resources.getItemIds();
+ final Collection<?> rIds = resources.getItemIds();
final Calendar cal = Calendar.getInstance();
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
@@ -371,7 +371,7 @@ public class SampleDB {
// cal.add(Calendar.DAY_OF_MONTH, -days);
for (int i = 0; i < days; i++) {
int r = 3;
- for (final Iterator rit = rIds.iterator(); rit.hasNext()
+ for (final Iterator<?> rit = rIds.iterator(); rit.hasNext()
&& r > 0; r--) {
final Object rid = rit.next();
final Item resource = resources.getItem(rid);
diff --git a/src/com/vaadin/demo/sampler/APIResource.java b/src/com/vaadin/demo/sampler/APIResource.java
index 111b0be60f..76719f48ab 100644
--- a/src/com/vaadin/demo/sampler/APIResource.java
+++ b/src/com/vaadin/demo/sampler/APIResource.java
@@ -14,15 +14,15 @@ public class APIResource extends NamedExternalResource {
private static final String SERVLET_BASE = "http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2";
private static final String PORTLET_BASE = "http://developers.sun.com/docs/jscreator/apis/portlet";
- public APIResource(Class clazz) {
+ public APIResource(Class<?> clazz) {
this(resolveBaseUrl(clazz), clazz);
}
- public APIResource(String baseUrl, Class clazz) {
+ public APIResource(String baseUrl, Class<?> clazz) {
super(resolveName(clazz), getJavadocUrl(baseUrl, clazz));
}
- private static String getJavadocUrl(String baseUrl, Class clazz) {
+ private static String getJavadocUrl(String baseUrl, Class<?> clazz) {
if (!baseUrl.endsWith("/")) {
baseUrl += "/";
}
@@ -38,7 +38,7 @@ public class APIResource extends NamedExternalResource {
* @param clazz
* @return
*/
- private static String resolveBaseUrl(Class clazz) {
+ private static String resolveBaseUrl(Class<?> clazz) {
String name = clazz.getName();
if (name.startsWith("javax.servlet.")) {
return SERVLET_BASE;
@@ -50,8 +50,8 @@ public class APIResource extends NamedExternalResource {
return VAADIN_BASE;
}
- private static String resolveName(Class clazz) {
- Class ec = clazz.getEnclosingClass();
+ private static String resolveName(Class<?> clazz) {
+ Class<?> ec = clazz.getEnclosingClass();
return (ec != null ? ec.getSimpleName() + "." : "")
+ clazz.getSimpleName();
}
diff --git a/src/com/vaadin/demo/sampler/ModeSwitch.java b/src/com/vaadin/demo/sampler/ModeSwitch.java
index c6565c0c61..738f9f07cb 100644
--- a/src/com/vaadin/demo/sampler/ModeSwitch.java
+++ b/src/com/vaadin/demo/sampler/ModeSwitch.java
@@ -72,10 +72,11 @@ public class ModeSwitch extends CustomComponent {
updateStyles();
}
+ @SuppressWarnings("unchecked")
private void updateStyles() {
boolean first = true;
- for (Iterator it = layout.getComponentIterator(); it.hasNext();) {
- Button b = (Button) it.next();
+ for (Iterator<Button> it = layout.getComponentIterator(); it.hasNext();) {
+ Button b = it.next();
String isOn = (b.getData() == mode ? "-on" : "");
if (first) {
first = false;
diff --git a/src/com/vaadin/demo/sampler/SamplerApplication.java b/src/com/vaadin/demo/sampler/SamplerApplication.java
index ea35d986ac..2b5fc4a8ac 100644
--- a/src/com/vaadin/demo/sampler/SamplerApplication.java
+++ b/src/com/vaadin/demo/sampler/SamplerApplication.java
@@ -126,9 +126,11 @@ public class SamplerApplication extends Application {
* @param clazz
* @return
*/
+ @SuppressWarnings("unchecked")
public static Feature getFeatureFor(Class clazz) {
- for (Iterator it = allFeatures.getItemIds().iterator(); it.hasNext();) {
- Feature f = (Feature) it.next();
+ for (Iterator<Feature> it = allFeatures.getItemIds().iterator(); it
+ .hasNext();) {
+ Feature f = it.next();
if (f.getClass() == clazz) {
return f;
}
@@ -174,7 +176,7 @@ public class SamplerApplication extends Application {
SamplerWindow() {
// Main top/expanded-bottom layout
VerticalLayout mainExpand = new VerticalLayout();
- setLayout(mainExpand);
+ setContent(mainExpand);
setSizeFull();
mainExpand.setSizeFull();
setCaption("Vaadin Sampler");
@@ -316,7 +318,7 @@ public class SamplerApplication extends Application {
search.setNullSelectionAllowed(true);
search.setImmediate(true);
search.setContainerDataSource(allFeatures);
- for (Iterator it = allFeatures.getItemIds().iterator(); it
+ for (Iterator<?> it = allFeatures.getItemIds().iterator(); it
.hasNext();) {
Object id = it.next();
if (id instanceof FeatureSet) {
@@ -678,17 +680,18 @@ public class SamplerApplication extends Application {
FeatureGrid() {
setSizeFull();
- setLayout(grid);
+ setContent(grid);
grid.setSizeUndefined();
grid.setSpacing(true);
setStyleName(Panel.STYLE_LIGHT);
}
+ @SuppressWarnings("unchecked")
public void setFeatureContainer(HierarchicalContainer c) {
grid.removeAllComponents();
- Collection features = c.getItemIds();
- for (Iterator it = features.iterator(); it.hasNext();) {
- final Feature f = (Feature) it.next();
+ Collection<Feature> features = c.getItemIds();
+ for (Iterator<Feature> it = features.iterator(); it.hasNext();) {
+ final Feature f = it.next();
if (f instanceof FeatureSet) {
grid.newLine();
Label title = new Label(f.getName());
diff --git a/src/com/vaadin/demo/sampler/features/accordions/AccordionDisabledExample.java b/src/com/vaadin/demo/sampler/features/accordions/AccordionDisabledExample.java
index 5be3d68d24..edc1b6a95a 100644
--- a/src/com/vaadin/demo/sampler/features/accordions/AccordionDisabledExample.java
+++ b/src/com/vaadin/demo/sampler/features/accordions/AccordionDisabledExample.java
@@ -20,6 +20,7 @@ public class AccordionDisabledExample extends VerticalLayout implements
private Label l1;
private Label l2;
private Label l3;
+ @SuppressWarnings("unused")
private Tab t1;
private Tab t2;
private Tab t3;
diff --git a/src/com/vaadin/demo/sampler/features/accordions/AccordionIconsExample.java b/src/com/vaadin/demo/sampler/features/accordions/AccordionIconsExample.java
index 886fdcd861..9bb8418fbc 100644
--- a/src/com/vaadin/demo/sampler/features/accordions/AccordionIconsExample.java
+++ b/src/com/vaadin/demo/sampler/features/accordions/AccordionIconsExample.java
@@ -4,7 +4,9 @@ import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
+import com.vaadin.ui.TabSheet.Tab;
@SuppressWarnings("serial")
public class AccordionIconsExample extends HorizontalLayout implements
@@ -38,7 +40,10 @@ public class AccordionIconsExample extends HorizontalLayout implements
}
public void selectedTabChange(SelectedTabChangeEvent event) {
- String c = a.getTabCaption(event.getTabSheet().getSelectedTab());
- getWindow().showNotification("Selected tab: " + c);
+ TabSheet tabsheet = event.getTabSheet();
+ Tab tab = tabsheet.getTab(tabsheet.getSelectedTab());
+ if (tab != null) {
+ getWindow().showNotification("Selected tab: " + tab.getCaption());
+ }
}
}
diff --git a/src/com/vaadin/demo/sampler/features/commons/ValidationExample.java b/src/com/vaadin/demo/sampler/features/commons/ValidationExample.java
index 44339f926a..1c88312d76 100644
--- a/src/com/vaadin/demo/sampler/features/commons/ValidationExample.java
+++ b/src/com/vaadin/demo/sampler/features/commons/ValidationExample.java
@@ -14,7 +14,7 @@ import com.vaadin.ui.VerticalLayout;
@SuppressWarnings("serial")
public class ValidationExample extends VerticalLayout {
- HashSet usernames = new HashSet();
+ HashSet<String> usernames = new HashSet<String>();
public ValidationExample() {
setSpacing(true);
@@ -53,9 +53,11 @@ public class ValidationExample extends VerticalLayout {
public void valueChange(ValueChangeEvent event) {
TextField tf = (TextField) event.getProperty();
tf.validate();
- usernames.add(tf.getValue());
- addComponent(new Label("Added " + tf.getValue()
- + " to usernames"));
+ if (tf.getValue() != null) {
+ usernames.add(tf.getValue().toString());
+ addComponent(new Label("Added " + tf.getValue()
+ + " to usernames"));
+ }
}
});
diff --git a/src/com/vaadin/demo/sampler/features/form/FormPojoExample.java b/src/com/vaadin/demo/sampler/features/form/FormPojoExample.java
index 1b29af31f4..3ee7d60b12 100644
--- a/src/com/vaadin/demo/sampler/features/form/FormPojoExample.java
+++ b/src/com/vaadin/demo/sampler/features/form/FormPojoExample.java
@@ -103,8 +103,7 @@ public class FormPojoExample extends VerticalLayout {
public PersonFieldFactory() {
countries.setWidth("30em");
- countries.setContainerDataSource(ExampleUtil
- .getStaticISO3166Container());
+ countries.setContainerDataSource(ExampleUtil.getISO3166Container());
countries
.setItemCaptionPropertyId(ExampleUtil.iso3166_PROPERTY_NAME);
countries.setItemIconPropertyId(ExampleUtil.iso3166_PROPERTY_FLAG);
diff --git a/src/com/vaadin/demo/sampler/features/layouts/ApplicationLayoutExample.java b/src/com/vaadin/demo/sampler/features/layouts/ApplicationLayoutExample.java
index c809d66ca2..64be08f74b 100644
--- a/src/com/vaadin/demo/sampler/features/layouts/ApplicationLayoutExample.java
+++ b/src/com/vaadin/demo/sampler/features/layouts/ApplicationLayoutExample.java
@@ -65,7 +65,7 @@ public class ApplicationLayoutExample extends VerticalLayout {
Tree tree = new Tree();
tree.setContainerDataSource(ExampleUtil.getHardwareContainer());
tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME);
- for (Iterator it = tree.rootItemIds().iterator(); it.hasNext();) {
+ for (Iterator<?> it = tree.rootItemIds().iterator(); it.hasNext();) {
tree.expandItemsRecursively(it.next());
}
treePanel.addComponent(tree);
diff --git a/src/com/vaadin/demo/sampler/features/layouts/WebLayoutExample.java b/src/com/vaadin/demo/sampler/features/layouts/WebLayoutExample.java
index 08bfb4eb97..9aaded5432 100644
--- a/src/com/vaadin/demo/sampler/features/layouts/WebLayoutExample.java
+++ b/src/com/vaadin/demo/sampler/features/layouts/WebLayoutExample.java
@@ -59,7 +59,7 @@ public class WebLayoutExample extends VerticalLayout {
Tree tree = new Tree();
tree.setContainerDataSource(ExampleUtil.getHardwareContainer());
tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME);
- for (Iterator it = tree.rootItemIds().iterator(); it.hasNext();) {
+ for (Iterator<?> it = tree.rootItemIds().iterator(); it.hasNext();) {
tree.expandItemsRecursively(it.next());
}
addComponent(tree);
diff --git a/src/com/vaadin/demo/sampler/features/panels/PanelBasicExample.java b/src/com/vaadin/demo/sampler/features/panels/PanelBasicExample.java
index 92f58c78ca..1d81dd1246 100644
--- a/src/com/vaadin/demo/sampler/features/panels/PanelBasicExample.java
+++ b/src/com/vaadin/demo/sampler/features/panels/PanelBasicExample.java
@@ -20,7 +20,7 @@ public class PanelBasicExample extends VerticalLayout implements ClickListener {
panel.setHeight("200px"); // we want scrollbars
// let's adjust the panels default layout (a VerticalLayout)
- VerticalLayout layout = (VerticalLayout) panel.getLayout();
+ VerticalLayout layout = (VerticalLayout) panel.getContent();
layout.setMargin(true); // we want a margin
layout.setSpacing(true); // and spacing between components
addComponent(panel);
diff --git a/src/com/vaadin/demo/sampler/features/panels/PanelLightExample.java b/src/com/vaadin/demo/sampler/features/panels/PanelLightExample.java
index 464ab42347..25fe68c3a0 100644
--- a/src/com/vaadin/demo/sampler/features/panels/PanelLightExample.java
+++ b/src/com/vaadin/demo/sampler/features/panels/PanelLightExample.java
@@ -23,7 +23,7 @@ public class PanelLightExample extends VerticalLayout implements ClickListener {
panel.setHeight("200px"); // we want scrollbars
// let's adjust the panels default layout (a VerticalLayout)
- VerticalLayout layout = (VerticalLayout) panel.getLayout();
+ VerticalLayout layout = (VerticalLayout) panel.getContent();
layout.setMargin(true); // we want a margin
layout.setSpacing(true); // and spacing between components
addComponent(panel);
diff --git a/src/com/vaadin/demo/sampler/features/selects/ComboBoxContainsExample.java b/src/com/vaadin/demo/sampler/features/selects/ComboBoxContainsExample.java
index 4abdcae806..e74e6ab385 100644
--- a/src/com/vaadin/demo/sampler/features/selects/ComboBoxContainsExample.java
+++ b/src/com/vaadin/demo/sampler/features/selects/ComboBoxContainsExample.java
@@ -17,7 +17,7 @@ public class ComboBoxContainsExample extends VerticalLayout implements
// Creates a new combobox using an existing container
ComboBox l = new ComboBox("Please select your country", ExampleUtil
- .getStaticISO3166Container());
+ .getISO3166Container());
// Sets the combobox to show a certain property as the item caption
l.setItemCaptionPropertyId(ExampleUtil.iso3166_PROPERTY_NAME);
@@ -44,7 +44,7 @@ public class ComboBoxContainsExample extends VerticalLayout implements
* Shows a notification when a selection is made.
*/
public void valueChange(ValueChangeEvent event) {
- Property selected = ExampleUtil.getStaticISO3166Container()
+ Property selected = ExampleUtil.getISO3166Container()
.getContainerProperty(event.getProperty().toString(), "name");
getWindow().showNotification("Selected country: " + selected);
}
diff --git a/src/com/vaadin/demo/sampler/features/selects/ComboBoxStartsWithExample.java b/src/com/vaadin/demo/sampler/features/selects/ComboBoxStartsWithExample.java
index 66610a656a..c98c105557 100644
--- a/src/com/vaadin/demo/sampler/features/selects/ComboBoxStartsWithExample.java
+++ b/src/com/vaadin/demo/sampler/features/selects/ComboBoxStartsWithExample.java
@@ -17,7 +17,7 @@ public class ComboBoxStartsWithExample extends VerticalLayout implements
// Creates a new combobox using an existing container
ComboBox l = new ComboBox("Please select your country", ExampleUtil
- .getStaticISO3166Container());
+ .getISO3166Container());
// Sets the combobox to show a certain property as the item caption
l.setItemCaptionPropertyId(ExampleUtil.iso3166_PROPERTY_NAME);
@@ -44,7 +44,7 @@ public class ComboBoxStartsWithExample extends VerticalLayout implements
* Shows a notification when a selection is made.
*/
public void valueChange(ValueChangeEvent event) {
- Property selected = ExampleUtil.getStaticISO3166Container()
+ Property selected = ExampleUtil.getISO3166Container()
.getContainerProperty(event.getProperty().toString(), "name");
getWindow().showNotification("Selected country: " + selected);
}
diff --git a/src/com/vaadin/demo/sampler/features/selects/ListSelectSingleExample.java b/src/com/vaadin/demo/sampler/features/selects/ListSelectSingleExample.java
index da4ee3707f..bff69f5e91 100644
--- a/src/com/vaadin/demo/sampler/features/selects/ListSelectSingleExample.java
+++ b/src/com/vaadin/demo/sampler/features/selects/ListSelectSingleExample.java
@@ -12,8 +12,9 @@ import com.vaadin.ui.VerticalLayout;
public class ListSelectSingleExample extends VerticalLayout implements
Property.ValueChangeListener {
- private static final List cities = Arrays.asList(new String[] { "Berlin",
- "Brussels", "Helsinki", "Madrid", "Oslo", "Paris", "Stockholm" });
+ private static final List<String> cities = Arrays.asList(new String[] {
+ "Berlin", "Brussels", "Helsinki", "Madrid", "Oslo", "Paris",
+ "Stockholm" });
public ListSelectSingleExample() {
setSpacing(true);
diff --git a/src/com/vaadin/demo/sampler/features/table/TableMainFeaturesExample.java b/src/com/vaadin/demo/sampler/features/table/TableMainFeaturesExample.java
index 8d6d0c2659..6868358ce3 100644
--- a/src/com/vaadin/demo/sampler/features/table/TableMainFeaturesExample.java
+++ b/src/com/vaadin/demo/sampler/features/table/TableMainFeaturesExample.java
@@ -138,7 +138,7 @@ public class TableMainFeaturesExample extends VerticalLayout {
public void valueChange(ValueChangeEvent event) {
// in multiselect mode, a Set of itemIds is returned,
// in singleselect mode the itemId is returned directly
- Set value = (Set) event.getProperty().getValue();
+ Set<?> value = (Set<?>) event.getProperty().getValue();
if (null == value || value.size() == 0) {
selected.setValue("No selection");
} else {
diff --git a/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetDisabledExample.java b/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetDisabledExample.java
index ffc335def4..7a39fd8da8 100644
--- a/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetDisabledExample.java
+++ b/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetDisabledExample.java
@@ -26,6 +26,7 @@ public class TabSheetDisabledExample extends VerticalLayout implements
private VerticalLayout l1;
private VerticalLayout l2;
private VerticalLayout l3;
+ @SuppressWarnings("unused")
private Tab t1, t2, t3;
public TabSheetDisabledExample() {
diff --git a/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetIconsExample.java b/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetIconsExample.java
index 17b06bca43..0dbff62381 100644
--- a/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetIconsExample.java
+++ b/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetIconsExample.java
@@ -5,6 +5,7 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
+import com.vaadin.ui.TabSheet.Tab;
@SuppressWarnings("serial")
public class TabSheetIconsExample extends VerticalLayout implements
@@ -47,7 +48,10 @@ public class TabSheetIconsExample extends VerticalLayout implements
}
public void selectedTabChange(SelectedTabChangeEvent event) {
- String c = t.getTabCaption(event.getTabSheet().getSelectedTab());
- getWindow().showNotification("Selected tab: " + c);
+ TabSheet tabsheet = event.getTabSheet();
+ Tab tab = tabsheet.getTab(tabsheet.getSelectedTab());
+ if (tab != null) {
+ getWindow().showNotification("Selected tab: " + tab.getCaption());
+ }
}
}
diff --git a/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetScrollingExample.java b/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetScrollingExample.java
index 41e9b2beba..43509ba809 100644
--- a/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetScrollingExample.java
+++ b/src/com/vaadin/demo/sampler/features/tabsheets/TabSheetScrollingExample.java
@@ -5,6 +5,7 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
+import com.vaadin.ui.TabSheet.Tab;
@SuppressWarnings("serial")
public class TabSheetScrollingExample extends VerticalLayout implements
@@ -55,7 +56,10 @@ public class TabSheetScrollingExample extends VerticalLayout implements
}
public void selectedTabChange(SelectedTabChangeEvent event) {
- String c = t.getTabCaption(event.getTabSheet().getSelectedTab());
- getWindow().showNotification("Selected tab: " + c);
+ TabSheet tabsheet = event.getTabSheet();
+ Tab tab = tabsheet.getTab(tabsheet.getSelectedTab());
+ if (tab != null) {
+ getWindow().showNotification("Selected tab: " + tab.getCaption());
+ }
}
}
diff --git a/src/com/vaadin/demo/sampler/features/trees/TreeMultiSelectExample.java b/src/com/vaadin/demo/sampler/features/trees/TreeMultiSelectExample.java
index f1350e0a70..e7e89886b0 100644
--- a/src/com/vaadin/demo/sampler/features/trees/TreeMultiSelectExample.java
+++ b/src/com/vaadin/demo/sampler/features/trees/TreeMultiSelectExample.java
@@ -41,7 +41,7 @@ public class TreeMultiSelectExample extends VerticalLayout implements
Tree t = (Tree) event.getProperty();
// enable if something is selected, returns a set
deleteButton.setEnabled(t.getValue() != null
- && ((Set) t.getValue()).size() > 0);
+ && ((Set<?>) t.getValue()).size() > 0);
}
});
@@ -53,12 +53,13 @@ public class TreeMultiSelectExample extends VerticalLayout implements
tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
// Expand whole tree
- for (Iterator it = tree.rootItemIds().iterator(); it.hasNext();) {
+ for (Iterator<?> it = tree.rootItemIds().iterator(); it.hasNext();) {
tree.expandItemsRecursively(it.next());
}
// Create the 'delete button', inline click-listener
deleteButton = new Button("Delete", new Button.ClickListener() {
+ @SuppressWarnings("unchecked")
public void buttonClick(ClickEvent event) {
// Delete all the selected objects
Object[] toDelete = ((Set<Object>) tree.getValue()).toArray();
diff --git a/src/com/vaadin/demo/sampler/features/windows/NativeWindowExample.java b/src/com/vaadin/demo/sampler/features/windows/NativeWindowExample.java
index e322f2a208..adff1292b6 100644
--- a/src/com/vaadin/demo/sampler/features/windows/NativeWindowExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/NativeWindowExample.java
@@ -58,7 +58,7 @@ public class NativeWindowExample extends VerticalLayout {
class NativeWindow extends Window {
NativeWindow() {
// Configure the layout
- VerticalLayout layout = (VerticalLayout) getLayout();
+ VerticalLayout layout = (VerticalLayout) getContent();
layout.setMargin(true);
layout.setSpacing(true);
diff --git a/src/com/vaadin/demo/sampler/features/windows/SubwindowAutoSizedExample.java b/src/com/vaadin/demo/sampler/features/windows/SubwindowAutoSizedExample.java
index 482682bfeb..11016fd6f6 100644
--- a/src/com/vaadin/demo/sampler/features/windows/SubwindowAutoSizedExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/SubwindowAutoSizedExample.java
@@ -17,7 +17,7 @@ public class SubwindowAutoSizedExample extends VerticalLayout {
subwindow = new Window("Automatically sized subwindow");
// Configure the windws layout; by default a VerticalLayout
- VerticalLayout layout = (VerticalLayout) subwindow.getLayout();
+ VerticalLayout layout = (VerticalLayout) subwindow.getContent();
layout.setMargin(true);
layout.setSpacing(true);
// make it undefined for auto-sizing window
diff --git a/src/com/vaadin/demo/sampler/features/windows/SubwindowCloseExample.java b/src/com/vaadin/demo/sampler/features/windows/SubwindowCloseExample.java
index 2a39508dd7..34f886c0a9 100644
--- a/src/com/vaadin/demo/sampler/features/windows/SubwindowCloseExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/SubwindowCloseExample.java
@@ -25,7 +25,7 @@ public class SubwindowCloseExample extends VerticalLayout {
});
// Configure the windws layout; by default a VerticalLayout
- VerticalLayout layout = (VerticalLayout) subwindow.getLayout();
+ VerticalLayout layout = (VerticalLayout) subwindow.getContent();
layout.setMargin(true);
layout.setSpacing(true);
diff --git a/src/com/vaadin/demo/sampler/features/windows/SubwindowExample.java b/src/com/vaadin/demo/sampler/features/windows/SubwindowExample.java
index 307c2a9376..49c7809e62 100644
--- a/src/com/vaadin/demo/sampler/features/windows/SubwindowExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/SubwindowExample.java
@@ -17,7 +17,7 @@ public class SubwindowExample extends VerticalLayout {
subwindow = new Window("A subwindow");
// Configure the windws layout; by default a VerticalLayout
- VerticalLayout layout = (VerticalLayout) subwindow.getLayout();
+ VerticalLayout layout = (VerticalLayout) subwindow.getContent();
layout.setMargin(true);
layout.setSpacing(true);
diff --git a/src/com/vaadin/demo/sampler/features/windows/SubwindowModalExample.java b/src/com/vaadin/demo/sampler/features/windows/SubwindowModalExample.java
index 65abf8885f..c698828794 100644
--- a/src/com/vaadin/demo/sampler/features/windows/SubwindowModalExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/SubwindowModalExample.java
@@ -19,7 +19,7 @@ public class SubwindowModalExample extends VerticalLayout {
subwindow.setModal(true);
// Configure the windws layout; by default a VerticalLayout
- VerticalLayout layout = (VerticalLayout) subwindow.getLayout();
+ VerticalLayout layout = (VerticalLayout) subwindow.getContent();
layout.setMargin(true);
layout.setSpacing(true);
diff --git a/src/com/vaadin/demo/sampler/features/windows/SubwindowPositionedExample.java b/src/com/vaadin/demo/sampler/features/windows/SubwindowPositionedExample.java
index dbbc64a571..c1712499b8 100644
--- a/src/com/vaadin/demo/sampler/features/windows/SubwindowPositionedExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/SubwindowPositionedExample.java
@@ -21,7 +21,7 @@ public class SubwindowPositionedExample extends VerticalLayout {
subwindow.setHeight("200px");
// Configure the windws layout; by default a VerticalLayout
- VerticalLayout layout = (VerticalLayout) subwindow.getLayout();
+ VerticalLayout layout = (VerticalLayout) subwindow.getContent();
layout.setMargin(true);
layout.setSpacing(true);
// make it fill the whole window
diff --git a/src/com/vaadin/demo/sampler/features/windows/SubwindowSizedExample.java b/src/com/vaadin/demo/sampler/features/windows/SubwindowSizedExample.java
index a4d72b0e38..9cdebb9e83 100644
--- a/src/com/vaadin/demo/sampler/features/windows/SubwindowSizedExample.java
+++ b/src/com/vaadin/demo/sampler/features/windows/SubwindowSizedExample.java
@@ -19,7 +19,7 @@ public class SubwindowSizedExample extends VerticalLayout {
subwindow.setHeight("80%");
// Configure the windws layout; by default a VerticalLayout
- VerticalLayout layout = (VerticalLayout) subwindow.getLayout();
+ VerticalLayout layout = (VerticalLayout) subwindow.getContent();
layout.setMargin(true);
layout.setSpacing(true);
// make it fill the whole window