KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > contrib > dbroggisch > examples > controller > handlers > NavigationBarHandler


1 /*
2  * Copyright (C) 2003 Diez B. Roggisch [deets@web.de]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: NavigationBarHandler.java,v 1.2 2004/02/01 05:16:27 christianc Exp $
19  */

20 package org.enhydra.barracuda.contrib.dbroggisch.examples.controller.handlers;
21
22 import java.io.IOException JavaDoc;
23 import java.util.ArrayList JavaDoc;
24 import java.util.List JavaDoc;
25 import javax.servlet.ServletException JavaDoc;
26 import org.enhydra.barracuda.core.comp.BLink;
27 import org.enhydra.barracuda.core.event.ControlEventContext;
28 import org.enhydra.barracuda.core.event.EventException;
29 import org.enhydra.barracuda.contrib.dbroggisch.page.Page;
30 import org.enhydra.barracuda.contrib.dbroggisch.page.PageEventListener;
31
32 import org.enhydra.barracuda.contrib.dbroggisch.examples.controller.events.*;
33 import org.enhydra.barracuda.contrib.dbroggisch.examples.view.pages.*;
34
35
36 public class NavigationBarHandler extends PageEventListener {
37
38     public void handleControlEvent(ControlEventContext context, Page p)
39             throws EventException, ServletException JavaDoc, IOException JavaDoc {
40         ExampleBasePage basePage = (ExampleBasePage)p;
41         List JavaDoc menupoints = new ArrayList JavaDoc(3);
42         BLink bl = null;
43         ExampleBasePage.State state = basePage.getState();
44
45         if (state == ExampleBasePage.REPOPULATION) {
46             bl = new BLink("*Repopulation", new Repopulation());
47             menupoints.add(bl);
48             bl = new BLink("FileUpload", new FileUpload());
49             menupoints.add(bl);
50             bl = new BLink("PrefixMapping", new PrefixMapping());
51             menupoints.add(bl);
52
53         }
54         if (state == ExampleBasePage.PREFIXMAPPING) {
55             bl = new BLink("Repopulation", new Repopulation());
56             menupoints.add(bl);
57             bl = new BLink("FileUpload", new FileUpload());
58             menupoints.add(bl);
59             bl = new BLink("*PrefixMapping", new PrefixMapping());
60             menupoints.add(bl);
61
62         }
63         if (state == ExampleBasePage.FILEUPLOAD) {
64             bl = new BLink("Repopulation", new Repopulation());
65             menupoints.add(bl);
66             bl = new BLink("*FileUpload", new FileUpload());
67             menupoints.add(bl);
68             bl = new BLink("PrefixMapping", new PrefixMapping());
69             menupoints.add(bl);
70
71         }
72         basePage.setMenuPoints(menupoints);
73     }
74
75 }
76
Popular Tags