KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > webapp > data > ActivitiesData


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.help.internal.webapp.data;
12 import javax.servlet.*;
13 import javax.servlet.http.*;
14
15 import org.eclipse.help.internal.base.*;
16 /**
17  * Helper for pages in navigation frames. Used enabling/disabling activity
18  * filtering
19  */

20 public class ActivitiesData extends RequestData {
21     /**
22      * Constructs the data for a request.
23      *
24      * @param context
25      * @param request
26      */

27     public ActivitiesData(ServletContext context, HttpServletRequest request,
28             HttpServletResponse response) {
29         super(context, request, response);
30         String JavaDoc changeShowAll = request.getParameter("showAll"); //$NON-NLS-1$
31
if (changeShowAll != null) {
32             if ("off".equalsIgnoreCase(changeShowAll)) { //$NON-NLS-1$
33
HelpBasePlugin.getActivitySupport().setFilteringEnabled(true);
34             } else if ("on".equalsIgnoreCase(changeShowAll)) { //$NON-NLS-1$
35
HelpBasePlugin.getActivitySupport().setFilteringEnabled(false);
36             } else {
37                 // not supported value
38
}
39         } else {
40             // no change to afilter
41
}
42         String JavaDoc confirmShowAll = request.getParameter("showconfirm"); //$NON-NLS-1$
43
if ("false".equalsIgnoreCase(confirmShowAll)) { //$NON-NLS-1$
44
preferences.setDontConfirmShowAll(true);
45         }
46     }
47     /**
48      * @return Checks if filtering is enabled.
49      */

50     public boolean isActivityFiltering() {
51         return HelpBasePlugin.getActivitySupport().isFilteringEnabled();
52     }
53     /**
54      * Gives state of show all topics button
55      *
56      * @return "hidden", "off", or "on"
57      */

58     public String JavaDoc getButtonState() {
59         if (!HelpBasePlugin.getActivitySupport().isUserCanToggleFiltering())
60             return "hidden"; //$NON-NLS-1$
61
else if (HelpBasePlugin.getActivitySupport().isFilteringEnabled())
62             return "off"; //$NON-NLS-1$
63
else
64             return "on"; //$NON-NLS-1$
65
}
66 }
67
Popular Tags