From 943aa20ade0cf3d0fc0631032c2a224d292b792b Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Tue, 4 Dec 2007 16:05:01 +0000 Subject: [PATCH] Select a category to begin with, for quicker initial render. svn changeset:3153/svn branch:trunk --- .../demo/reservation/ReservationApplication.java | 1 + .../demo/reservation/ResourceSelectorPanel.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+) 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()); -- 2.39.5