From: Marc Englund Date: Tue, 4 Dec 2007 16:05:01 +0000 (+0000) Subject: Select a category to begin with, for quicker initial render. X-Git-Tag: 6.7.0.beta1~5296 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=943aa20ade0cf3d0fc0631032c2a224d292b792b;p=vaadin-framework.git Select a category to begin with, for quicker initial render. svn changeset:3153/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java b/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java index bc951eadc5..c95ca3857c 100644 --- a/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java +++ b/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java @@ -187,6 +187,7 @@ public class ReservationApplication extends Application { } }); + resourcePanel.selectFirstCategory(); refreshReservations(true); } diff --git a/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java b/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java index 17bd72f9a5..a34bdd66ad 100644 --- a/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java +++ b/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java @@ -65,6 +65,20 @@ public class ResourceSelectorPanel extends Panel implements } } + // Selects one initial categore, inpractice randomly + public void selectFirstCategory() { + try { + Object catId = categoryResources.keySet().iterator().next(); + LinkedList res = (LinkedList) categoryResources.get(catId); + Layout l = (Layout) categoryLayouts.get(catId); + Button catB = (Button) l.getComponentIterator().next(); + setSelectedResources(res); + catB.setStyleName("selected-link"); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + private void setSelectedResources(LinkedList resources) { selectedResources = resources; fireEvent(new SelectedResourcesChangedEvent());