@@ -76,6 +76,7 @@ public class PortletDemo extends Application { | |||
} | |||
@SuppressWarnings("unchecked") | |||
public void handleRenderRequest(RenderRequest request, | |||
RenderResponse response) { | |||
// Portlet up-and-running, enable stuff |
@@ -14,13 +14,14 @@ import com.vaadin.ui.VerticalLayout; | |||
import com.vaadin.ui.Window; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
@SuppressWarnings("serial") | |||
public class SimpleAddressBook extends Application { | |||
private static String[] fields = { "First Name", "Last Name", "Company", | |||
"Mobile Phone", "Work Phone", "Home Phone", "Work Email", | |||
"Home Email", "Street", "Zip", "City", "State", "Country" }; | |||
private static String[] visibleCols = new String[] { "Last Name", "First Name", | |||
"Company" }; | |||
private static String[] visibleCols = new String[] { "Last Name", | |||
"First Name", "Company" }; | |||
private Table contactList = new Table(); | |||
private Form contactEditor = new Form(); | |||
@@ -28,6 +29,7 @@ public class SimpleAddressBook extends Application { | |||
private Button contactRemovalButton; | |||
private IndexedContainer addressBookData = createDummyData(); | |||
@Override | |||
public void init() { | |||
initLayout(); | |||
initContactAddRemoveButtons(); | |||
@@ -51,16 +53,17 @@ public class SimpleAddressBook extends Application { | |||
contactEditor.setImmediate(true); | |||
bottomLeftCorner.setWidth("100%"); | |||
left.addComponent(bottomLeftCorner); | |||
} | |||
} | |||
private void initContactAddRemoveButtons() { | |||
// New item button | |||
bottomLeftCorner.addComponent(new Button("+", new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
Object id = contactList.addItem(); | |||
contactList.setValue(id); | |||
} | |||
})); | |||
bottomLeftCorner.addComponent(new Button("+", | |||
new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
Object id = contactList.addItem(); | |||
contactList.setValue(id); | |||
} | |||
})); | |||
// Remove item button | |||
contactRemovalButton = new Button("-", new Button.ClickListener() { | |||
@@ -100,15 +103,17 @@ public class SimpleAddressBook extends Application { | |||
sf.addListener(new Property.ValueChangeListener() { | |||
public void valueChange(ValueChangeEvent event) { | |||
addressBookData.removeContainerFilters(pn); | |||
if (sf.toString().length() > 0 && !pn.equals(sf.toString())) | |||
if (sf.toString().length() > 0 && !pn.equals(sf.toString())) { | |||
addressBookData.addContainerFilter(pn, sf.toString(), | |||
true, false); | |||
} | |||
getMainWindow().showNotification( | |||
"" + addressBookData.size() + " matches found"); | |||
} | |||
}); | |||
} | |||
} | |||
private static IndexedContainer createDummyData() { | |||
String[] fnames = { "Peter", "Alice", "Joshua", "Mike", "Olivia", | |||
@@ -120,8 +125,9 @@ public class SimpleAddressBook extends Application { | |||
IndexedContainer ic = new IndexedContainer(); | |||
for (String p : fields) | |||
for (String p : fields) { | |||
ic.addContainerProperty(p, String.class, ""); | |||
} | |||
for (int i = 0; i < 1000; i++) { | |||
Object id = ic.addItem(); |
@@ -36,7 +36,8 @@ public class VaadinTunesLayout extends Application { | |||
*/ | |||
// Main (browser) window, needed in all Vaadin applications | |||
final Window root = new Window("VaadinTunes"); | |||
VerticalLayout rootLayout = new VerticalLayout(); | |||
final Window root = new Window("VaadinTunes", rootLayout); | |||
/* | |||
* We'll attach the window to the browser view already here, so we won't | |||
@@ -49,10 +50,10 @@ public class VaadinTunesLayout extends Application { | |||
"This is an example of how you can do layouts in Vaadin.<br/>It is not a working sound player.", | |||
Notification.TYPE_HUMANIZED_MESSAGE); | |||
// Our root window contains one VerticalLayout by default, let's make | |||
// Our root window contains one VerticalLayout, let's make | |||
// sure it's 100% sized, and remove unwanted margins | |||
root.getContent().setSizeFull(); | |||
root.getLayout().setMargin(false); | |||
rootLayout.setSizeFull(); | |||
rootLayout.setMargin(false); | |||
// Top area, containing playback and volume controls, play status, view | |||
// modes and search |
@@ -20,7 +20,7 @@ public class ColorPicker extends AbstractField { | |||
/** The property value of the field is a String. */ | |||
@Override | |||
public Class getType() { | |||
public Class<?> getType() { | |||
return String.class; | |||
} | |||
@@ -55,6 +55,7 @@ public class ColorPicker extends AbstractField { | |||
} | |||
/** Deserialize changes received from client. */ | |||
@SuppressWarnings("unchecked") | |||
@Override | |||
public void changeVariables(Object source, Map variables) { | |||
// Sets the currently selected color |
@@ -12,7 +12,7 @@ import com.vaadin.terminal.gwt.client.UIDL; | |||
public class ColorPickerWidgetSet extends DefaultWidgetSet { | |||
/** Resolves UIDL tag name to widget class. */ | |||
@Override | |||
protected Class resolveWidgetType(UIDL uidl) { | |||
protected Class<?> resolveWidgetType(UIDL uidl) { | |||
final String tag = uidl.getTag(); | |||
if ("colorpicker".equals(tag)) { | |||
return VColorPicker.class; | |||
@@ -25,7 +25,7 @@ public class ColorPickerWidgetSet extends DefaultWidgetSet { | |||
/** Creates a widget instance according to its class object. */ | |||
@Override | |||
public Paintable createWidget(UIDL uidl) { | |||
final Class type = resolveWidgetType(uidl); | |||
final Class<?> type = resolveWidgetType(uidl); | |||
if (VColorPicker.class == type) { | |||
return new VColorPicker(); | |||
} |
@@ -8,7 +8,7 @@ import com.vaadin.terminal.PaintException; | |||
import com.vaadin.terminal.PaintTarget; | |||
import com.vaadin.ui.AbstractSelect; | |||
@SuppressWarnings("serial") | |||
@SuppressWarnings( { "serial", "unchecked" }) | |||
public class Coverflow extends AbstractSelect { | |||
private String backgroundGradientStart = "FFFFFF"; |
@@ -13,7 +13,7 @@ public class CoverflowWidgetSet extends DefaultWidgetSet { | |||
/** Creates a widget according to its class name. */ | |||
@Override | |||
public Paintable createWidget(UIDL uidl) { | |||
final Class classType = resolveWidgetType(uidl); | |||
final Class<?> classType = resolveWidgetType(uidl); | |||
if (VCoverflow.class == classType) { | |||
return new VCoverflow(); | |||
} | |||
@@ -24,7 +24,7 @@ public class CoverflowWidgetSet extends DefaultWidgetSet { | |||
/** Resolves UIDL tag name to class . */ | |||
@Override | |||
protected Class resolveWidgetType(UIDL uidl) { | |||
protected Class<?> resolveWidgetType(UIDL uidl) { | |||
final String tag = uidl.getTag(); | |||
if ("cover".equals(tag)) { | |||
return VCoverflow.class; |
@@ -18,7 +18,7 @@ import com.vaadin.terminal.gwt.client.UIDL; | |||
public class VCoverflow extends Composite implements Paintable { | |||
private String uidlId; | |||
protected ApplicationConnection client; | |||
private ArrayList coverList = new ArrayList(); | |||
private ArrayList<HashMap<String, String>> coverList = new ArrayList<HashMap<String, String>>(); | |||
private Object _selected; | |||
private boolean flashInited = false; | |||
@@ -28,7 +28,7 @@ public class VCoverflow extends Composite implements Paintable { | |||
private String backgroundGradientEnd; | |||
private boolean colorChanged = false; | |||
private boolean sbVisibilityChanged = false; | |||
private HashMap keyMap = new HashMap(); | |||
private HashMap<String, String> keyMap = new HashMap<String, String>(); | |||
/** | |||
* Constructor | |||
@@ -96,16 +96,16 @@ public class VCoverflow extends Composite implements Paintable { | |||
// should | |||
// be deleted. | |||
ArrayList newList = new ArrayList(); | |||
ArrayList<HashMap<String, String>> newList = new ArrayList<HashMap<String, String>>(); | |||
// Iterate through all option elements | |||
for (final Iterator i = images.getChildIterator(); i.hasNext();) { | |||
for (final Iterator<Object> i = images.getChildIterator(); i.hasNext();) { | |||
final UIDL imgUidl = (UIDL) i.next(); | |||
// Make sure all required attributes exist | |||
if (imgUidl.hasAttribute("caption") && imgUidl.hasAttribute("key") | |||
&& imgUidl.hasAttribute("icon")) { | |||
HashMap set = new HashMap(); | |||
HashMap<String, String> set = new HashMap<String, String>(); | |||
// Update the key map | |||
keyMap.put(imgUidl.getStringAttribute("caption"), imgUidl | |||
@@ -127,27 +127,26 @@ public class VCoverflow extends Composite implements Paintable { | |||
} | |||
// Deleted items | |||
ArrayList intersectList = new ArrayList(); | |||
ArrayList<HashMap<String, String>> intersectList = new ArrayList<HashMap<String, String>>(); | |||
intersectList.addAll(coverList); | |||
intersectList.removeAll(newList); | |||
if (flashInited) { | |||
for (int i = 0; i < intersectList.size(); i++) { | |||
HashMap cover = (HashMap) intersectList.get(i); | |||
removeCover(uidlId, cover.get("caption").toString()); | |||
HashMap<String, String> cover = intersectList.get(i); | |||
removeCover(uidlId, cover.get("caption")); | |||
} | |||
} | |||
// Added items | |||
intersectList = new ArrayList(); | |||
intersectList = new ArrayList<HashMap<String, String>>(); | |||
intersectList.addAll(newList); | |||
intersectList.removeAll(coverList); | |||
if (flashInited) { | |||
for (int i = 0; i < intersectList.size(); i++) { | |||
HashMap cover = (HashMap) intersectList.get(i); | |||
addCover(uidlId, cover.get("caption").toString(), cover.get( | |||
"icon").toString()); | |||
HashMap<String, String> cover = intersectList.get(i); | |||
addCover(uidlId, cover.get("caption"), cover.get("icon")); | |||
} | |||
} | |||
@@ -189,8 +188,8 @@ public class VCoverflow extends Composite implements Paintable { | |||
return; | |||
} | |||
client.updateVariable(uidlId, "selected", new String[] { keyMap.get( | |||
coverId).toString() }, true); | |||
client.updateVariable(uidlId, "selected", new String[] { keyMap | |||
.get(coverId) }, true); | |||
} | |||
/** | |||
@@ -201,23 +200,23 @@ public class VCoverflow extends Composite implements Paintable { | |||
* id | |||
*/ | |||
public native void initializeMethods(String id) /*-{ | |||
var app = this; | |||
if($wnd.vaadin.coverflow == null) | |||
var coverflow = []; | |||
else | |||
var coverflow = $wnd.vaadin.coverflow; | |||
coverflow['getCovers_' + id] = function() { | |||
app.@com.vaadin.demo.coverflow.gwt.client.ui.VCoverflow::getCovers()(); | |||
}; | |||
coverflow['setCurrent_' + id] = function(selected) { | |||
app.@com.vaadin.demo.coverflow.gwt.client.ui.VCoverflow::setCover(Ljava/lang/String;)(selected); | |||
}; | |||
$wnd.vaadin.coverflow = coverflow; | |||
}-*/; | |||
var app = this; | |||
if($wnd.vaadin.coverflow == null) | |||
var coverflow = []; | |||
else | |||
var coverflow = $wnd.vaadin.coverflow; | |||
coverflow['getCovers_' + id] = function() { | |||
app.@com.vaadin.demo.coverflow.gwt.client.ui.VCoverflow::getCovers()(); | |||
}; | |||
coverflow['setCurrent_' + id] = function(selected) { | |||
app.@com.vaadin.demo.coverflow.gwt.client.ui.VCoverflow::setCover(Ljava/lang/String;)(selected); | |||
}; | |||
$wnd.vaadin.coverflow = coverflow; | |||
}-*/; | |||
/** | |||
* This function sends all covers to the flash. We cannot do this directly | |||
@@ -226,14 +225,13 @@ public class VCoverflow extends Composite implements Paintable { | |||
* it's ready. | |||
*/ | |||
public void getCovers() { | |||
// Loop through all stored coves | |||
// Loop through all stored covers | |||
for (int i = 0; i < coverList.size(); i++) { | |||
HashMap set = (HashMap) coverList.get(i); | |||
HashMap<String, String> set = coverList.get(i); | |||
try { | |||
// Add the cover | |||
addCover(uidlId, set.get("caption").toString(), set.get("icon") | |||
.toString()); | |||
addCover(uidlId, set.get("caption"), set.get("icon")); | |||
} catch (Exception e) { | |||
// Do not add covers lacking obligatory data | |||
} | |||
@@ -259,14 +257,14 @@ public class VCoverflow extends Composite implements Paintable { | |||
* @param icon | |||
*/ | |||
public native void addCover(String id, String caption, String icon) /*-{ | |||
try { | |||
$doc['fxcoverflow' + id].addCover(caption.toString(), icon.toString()); | |||
} | |||
catch(e) { | |||
$wnd.alert(e.message); | |||
} | |||
}-*/; | |||
try { | |||
$doc['fxcoverflow' + id].addCover(caption.toString(), icon.toString()); | |||
} | |||
catch(e) { | |||
$wnd.alert(e.message); | |||
} | |||
}-*/; | |||
/** | |||
* This function tells the flash which cover should be selected. | |||
@@ -275,21 +273,21 @@ public class VCoverflow extends Composite implements Paintable { | |||
* @param key | |||
*/ | |||
public native void selectCover(String id, String key) /*-{ | |||
$doc["fxcoverflow" + id].selectCover(key.toString()); | |||
}-*/; | |||
$doc["fxcoverflow" + id].selectCover(key.toString()); | |||
}-*/; | |||
public native void setBackgroundColor(String id, String startGradient, | |||
String endGradient) /*-{ | |||
$doc["fxcoverflow" + id].setBackgroundColor("0x" + startGradient.toString(), "0x" + endGradient.toString()); | |||
}-*/; | |||
$doc["fxcoverflow" + id].setBackgroundColor("0x" + startGradient.toString(), "0x" + endGradient.toString()); | |||
}-*/; | |||
public native void toggleScrollbarVisibility(String id, boolean visibility) /*-{ | |||
$doc["fxcoverflow" + id].toggleScrollbarVisibility(visibility); | |||
}-*/; | |||
$doc["fxcoverflow" + id].toggleScrollbarVisibility(visibility); | |||
}-*/; | |||
public native void removeCover(String id, String key) /*-{ | |||
$doc["fxcoverflow" + id].removeCover(key); | |||
}-*/; | |||
$doc["fxcoverflow" + id].removeCover(key); | |||
}-*/; | |||
/** | |||
* Set the HTML coding of the flash movie. This isn't done until the |
@@ -9,7 +9,6 @@ import java.util.Calendar; | |||
import java.util.Date; | |||
import java.util.Iterator; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
import com.vaadin.Application; | |||
import com.vaadin.data.Container; | |||
@@ -88,10 +87,11 @@ public class ReservationApplication extends Application { | |||
this, "selectedResourcesChanged"); | |||
reservationTab.addComponent(resourcePanel); | |||
HorizontalLayout reservationLayout = new HorizontalLayout(); | |||
final Panel reservationPanel = new Panel("Reservation", | |||
new HorizontalLayout()); | |||
reservationLayout); | |||
reservationPanel.addStyleName(Panel.STYLE_LIGHT); | |||
reservationPanel.getLayout().setMargin(true); | |||
reservationLayout.setMargin(true); | |||
reservationTab.addComponent(reservationPanel); | |||
final VerticalLayout infoLayout = new VerticalLayout(); | |||
@@ -230,10 +230,10 @@ public class ReservationApplication extends Application { | |||
} | |||
private Item getActiveResource() throws ResourceNotAvailableException { | |||
final List rids = resourcePanel.getSelectedResources(); | |||
final LinkedList<Item> rids = resourcePanel.getSelectedResources(); | |||
if (rids != null && rids.size() > 0) { | |||
for (final Iterator it = rids.iterator(); it.hasNext();) { | |||
final Item resource = (Item) it.next(); | |||
for (final Iterator<Item> it = rids.iterator(); it.hasNext();) { | |||
final Item resource = it.next(); | |||
final int id = ((Integer) resource.getItemProperty( | |||
SampleDB.Resource.PROPERTY_ID_ID).getValue()) | |||
.intValue(); | |||
@@ -296,9 +296,9 @@ public class ReservationApplication extends Application { | |||
resourceName.setCaption(name); | |||
resourceName.setValue(desc); | |||
// Put all resources on map (may be many if category was selected) | |||
final LinkedList srs = resourcePanel.getSelectedResources(); | |||
for (final Iterator it = srs.iterator(); it.hasNext();) { | |||
resource = (Item) it.next(); | |||
final LinkedList<Item> srs = resourcePanel.getSelectedResources(); | |||
for (final Iterator<Item> it = srs.iterator(); it.hasNext();) { | |||
resource = it.next(); | |||
name = (String) resource.getItemProperty( | |||
SampleDB.Resource.PROPERTY_ID_NAME).getValue(); | |||
desc = (String) resource.getItemProperty( |
@@ -17,14 +17,14 @@ import com.vaadin.ui.Panel; | |||
import com.vaadin.ui.VerticalLayout; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
@SuppressWarnings( { "serial", "unchecked" }) | |||
@SuppressWarnings("serial") | |||
public class ResourceSelectorPanel extends Panel implements | |||
Button.ClickListener { | |||
private final HashMap categoryLayouts = new HashMap(); | |||
private final HashMap categoryResources = new HashMap(); | |||
private final HashMap<String, Layout> categoryLayouts = new HashMap<String, Layout>(); | |||
private final HashMap<String, LinkedList<Item>> categoryResources = new HashMap<String, LinkedList<Item>>(); | |||
// private Container allResources; | |||
private LinkedList selectedResources = null; | |||
private LinkedList<Item> selectedResources = null; | |||
public ResourceSelectorPanel(String caption) { | |||
super(caption, new HorizontalLayout()); | |||
@@ -38,7 +38,7 @@ public class ResourceSelectorPanel extends Panel implements | |||
categoryLayouts.clear(); | |||
categoryResources.clear(); | |||
if (resources != null && resources.size() > 0) { | |||
for (final Iterator it = resources.getItemIds().iterator(); it | |||
for (final Iterator<?> it = resources.getItemIds().iterator(); it | |||
.hasNext();) { | |||
final Item resource = resources.getItem(it.next()); | |||
// final Integer id = (Integer) resource.getItemProperty( | |||
@@ -53,16 +53,15 @@ public class ResourceSelectorPanel extends Panel implements | |||
rButton.setStyleName("link"); | |||
rButton.setDescription(description); | |||
rButton.setData(resource); | |||
Layout resourceLayout = (Layout) categoryLayouts.get(category); | |||
LinkedList resourceList = (LinkedList) categoryResources | |||
.get(category); | |||
Layout resourceLayout = categoryLayouts.get(category); | |||
LinkedList<Item> resourceList = categoryResources.get(category); | |||
if (resourceLayout == null) { | |||
resourceLayout = new VerticalLayout(); | |||
resourceLayout.setSizeUndefined(); | |||
resourceLayout.setMargin(true); | |||
addComponent(resourceLayout); | |||
categoryLayouts.put(category, resourceLayout); | |||
resourceList = new LinkedList(); | |||
resourceList = new LinkedList<Item>(); | |||
categoryResources.put(category, resourceList); | |||
final Button cButton = new Button(category + " (any)", this); | |||
cButton.setStyleName("important-link"); | |||
@@ -75,12 +74,12 @@ public class ResourceSelectorPanel extends Panel implements | |||
} | |||
} | |||
// Selects one initial categore, inpractice randomly | |||
// Selects one initial category, in practice randomly | |||
public void selectFirstCategory() { | |||
try { | |||
final Object catId = categoryResources.keySet().iterator().next(); | |||
final LinkedList res = (LinkedList) categoryResources.get(catId); | |||
final Layout l = (Layout) categoryLayouts.get(catId); | |||
final String catId = categoryResources.keySet().iterator().next(); | |||
final LinkedList<Item> res = categoryResources.get(catId); | |||
final Layout l = categoryLayouts.get(catId); | |||
final Button catB = (Button) l.getComponentIterator().next(); | |||
setSelectedResources(res); | |||
catB.setStyleName("selected-link"); | |||
@@ -89,12 +88,12 @@ public class ResourceSelectorPanel extends Panel implements | |||
} | |||
} | |||
private void setSelectedResources(LinkedList resources) { | |||
private void setSelectedResources(LinkedList<Item> resources) { | |||
selectedResources = resources; | |||
fireEvent(new SelectedResourcesChangedEvent()); | |||
} | |||
public LinkedList getSelectedResources() { | |||
public LinkedList<Item> getSelectedResources() { | |||
return selectedResources; | |||
} | |||
@@ -104,12 +103,12 @@ public class ResourceSelectorPanel extends Panel implements | |||
final Object data = ((Button) source).getData(); | |||
resetStyles(); | |||
if (data instanceof Item) { | |||
final LinkedList rlist = new LinkedList(); | |||
rlist.add(data); | |||
final LinkedList<Item> rlist = new LinkedList<Item>(); | |||
rlist.add((Item) data); | |||
setSelectedResources(rlist); | |||
} else { | |||
final String category = (String) data; | |||
final LinkedList resources = (LinkedList) categoryResources | |||
final LinkedList<Item> resources = categoryResources | |||
.get(category); | |||
setSelectedResources(resources); | |||
} | |||
@@ -119,10 +118,11 @@ public class ResourceSelectorPanel extends Panel implements | |||
} | |||
private void resetStyles() { | |||
for (final Iterator it = categoryLayouts.values().iterator(); it | |||
for (final Iterator<Layout> it = categoryLayouts.values().iterator(); it | |||
.hasNext();) { | |||
final Layout lo = (Layout) it.next(); | |||
for (final Iterator bit = lo.getComponentIterator(); bit.hasNext();) { | |||
final Layout lo = it.next(); | |||
for (final Iterator<?> bit = lo.getComponentIterator(); bit | |||
.hasNext();) { | |||
final Button b = (Button) bit.next(); | |||
if (b.getData() instanceof Item) { | |||
b.setStyleName("link"); |
@@ -13,7 +13,7 @@ import com.vaadin.terminal.gwt.client.UIDL; | |||
public class ReservationWidgetSet extends DefaultWidgetSet { | |||
@Override | |||
public Paintable createWidget(UIDL uidl) { | |||
final Class type = resolveWidgetType(uidl); | |||
final Class<?> type = resolveWidgetType(uidl); | |||
if (VGoogleMap.class == type) { | |||
return new VGoogleMap(); | |||
} else if (VCalendarField.class == type) { | |||
@@ -24,7 +24,7 @@ public class ReservationWidgetSet extends DefaultWidgetSet { | |||
} | |||
@Override | |||
protected Class resolveWidgetType(UIDL uidl) { | |||
protected Class<?> resolveWidgetType(UIDL uidl) { | |||
final String tag = uidl.getTag(); | |||
if ("googlemap".equals(tag)) { | |||
return VGoogleMap.class; |
@@ -35,11 +35,12 @@ public class VGoogleMap extends Composite implements Paintable { | |||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | |||
widget.clearOverlays(); | |||
LatLng pos = null; | |||
for (final Iterator it = uidl.getChildIterator(); it.hasNext();) { | |||
for (final Iterator<Object> it = uidl.getChildIterator(); it.hasNext();) { | |||
final UIDL u = (UIDL) it.next(); | |||
if (u.getTag().equals("markers")) { | |||
for (final Iterator m = u.getChildIterator(); m.hasNext();) { | |||
for (final Iterator<Object> m = u.getChildIterator(); m | |||
.hasNext();) { | |||
final UIDL umarker = (UIDL) m.next(); | |||
final String html = "<span>" | |||
+ umarker.getStringAttribute("html") + "</span>"; |
@@ -15,6 +15,7 @@ import com.vaadin.terminal.gwt.server.PortletApplicationContext; | |||
import com.vaadin.terminal.gwt.server.PortletApplicationContext.PortletListener; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.ComponentContainer; | |||
import com.vaadin.ui.VerticalLayout; | |||
import com.vaadin.ui.Window; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Button.ClickListener; | |||
@@ -45,7 +46,8 @@ public class SimpleReserver extends Application { | |||
@Override | |||
public void init() { | |||
final Window w = new Window("Simple Reserver"); | |||
VerticalLayout rootLayout = new VerticalLayout(); | |||
final Window w = new Window("Simple Reserver", rootLayout); | |||
w.addStyleName("simplereserver"); | |||
if (getContext() instanceof PortletApplicationContext) { | |||
@@ -79,7 +81,7 @@ public class SimpleReserver extends Application { | |||
}); | |||
w.setTheme("liferay"); | |||
// portal will deal outer margins | |||
w.getLayout().setMargin(false); | |||
rootLayout.setMargin(false); | |||
} else { | |||
w.setTheme("reservr"); | |||
} |
@@ -88,7 +88,7 @@ public class StdView extends VerticalLayout { | |||
add.setEnabled(false); | |||
reservations.setEnabled(false); | |||
} else { | |||
List resource = new LinkedList(); | |||
List<Item> resource = new LinkedList<Item>(); | |||
resource.add(resources.getItem(resources.getValue())); | |||
final Container res = application.getDb().getReservations(resource); | |||
reservations.setContainerDataSource(res); |
@@ -11,7 +11,6 @@ import com.vaadin.terminal.Resource; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.Link; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Button.ClickListener; | |||
@SuppressWarnings("serial") | |||
public class ActiveLink extends Link { | |||
@@ -20,7 +19,7 @@ public class ActiveLink extends Link { | |||
private static final Method LINK_FOLLOWED_METHOD; | |||
private HashSet listeners = new HashSet(); | |||
private HashSet<LinkActivatedListener> listeners = new HashSet<LinkActivatedListener>(); | |||
public ActiveLink() { | |||
super(); | |||
@@ -72,7 +71,7 @@ public class ActiveLink extends Link { | |||
* @param listener | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(ClickListener listener) { | |||
public void removeListener(LinkActivatedListener listener) { | |||
listeners.remove(listener); | |||
removeListener(ClickEvent.class, listener, LINK_FOLLOWED_METHOD); | |||
if (listeners.size() == 0) { | |||
@@ -97,6 +96,7 @@ public class ActiveLink extends Link { | |||
} | |||
} | |||
@SuppressWarnings("unchecked") | |||
@Override | |||
public void changeVariables(Object source, Map variables) { | |||
super.changeVariables(source, variables); |
@@ -49,8 +49,9 @@ public class FeatureView extends HorizontalLayout { | |||
addComponent(left); | |||
setExpandRatio(left, 1); | |||
right = new Panel(); | |||
right.getLayout().setMargin(true, false, false, false); | |||
VerticalLayout rightLayout = new VerticalLayout(); | |||
right = new Panel(rightLayout); | |||
rightLayout.setMargin(true, false, false, false); | |||
right.setStyleName(Panel.STYLE_LIGHT); | |||
right.addStyleName("feature-info"); | |||
right.setWidth("369px"); | |||
@@ -213,7 +214,7 @@ public class FeatureView extends HorizontalLayout { | |||
caption.setWidth("100%"); | |||
rel.addComponent(caption); | |||
rel.setMargin(false, false, true, false); | |||
for (Class c : features) { | |||
for (Class<? extends Feature> c : features) { | |||
final Feature f = SamplerApplication.getFeatureFor(c); | |||
if (f != null) { | |||
String path = SamplerApplication.getPathFor(f); |
@@ -11,7 +11,7 @@ public class SamplerWidgetSet extends DefaultWidgetSet { | |||
@Override | |||
public Paintable createWidget(UIDL uidl) { | |||
final Class classType = resolveWidgetType(uidl); | |||
final Class<?> classType = resolveWidgetType(uidl); | |||
if (VGoogleAnalytics.class == classType) { | |||
return new VGoogleAnalytics(); | |||
} else if (VCodeLabel.class == classType) { | |||
@@ -24,7 +24,7 @@ public class SamplerWidgetSet extends DefaultWidgetSet { | |||
} | |||
@Override | |||
protected Class resolveWidgetType(UIDL uidl) { | |||
protected Class<?> resolveWidgetType(UIDL uidl) { | |||
final String tag = uidl.getTag(); | |||
if ("googleanalytics".equals(tag)) { | |||
return VGoogleAnalytics.class; |