KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > searchindex > CmsSearchIndexSourceAssignResourcesWidget


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchIndexSourceAssignResourcesWidget.java,v $
3  * Date : $Date: 2006/03/27 14:52:21 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.tools.searchindex;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.widgets.CmsDisplayWidget;
36 import org.opencms.widgets.CmsVfsFileWidget;
37 import org.opencms.workplace.CmsWidgetDialogParameter;
38
39 import javax.servlet.http.HttpServletRequest JavaDoc;
40 import javax.servlet.http.HttpServletResponse JavaDoc;
41 import javax.servlet.jsp.PageContext JavaDoc;
42
43 /**
44  *
45  * Widget dialog to add or remove resources (folders) to / from the request parameter
46  * given <code>{@link org.opencms.search.CmsSearchIndexSource}</code> ("indexsource").<p>
47  *
48  * @author Achim Westermann
49  *
50  * @version $Revision: 1.2 $
51  *
52  * @since 6.0.0
53  */

54 public class CmsSearchIndexSourceAssignResourcesWidget extends A_CmsEditIndexSourceDialog {
55
56     /**
57      * Public constructor with JSP action element.<p>
58      *
59      * @param jsp an initialized JSP action element
60      */

61     public CmsSearchIndexSourceAssignResourcesWidget(CmsJspActionElement jsp) {
62
63         super(jsp);
64     }
65
66     /**
67      * Public constructor with JSP variables.<p>
68      *
69      * @param context the JSP page context
70      * @param req the JSP request
71      * @param res the JSP response
72      */

73     public CmsSearchIndexSourceAssignResourcesWidget(
74         PageContext JavaDoc context,
75         HttpServletRequest JavaDoc req,
76         HttpServletResponse JavaDoc res) {
77
78         this(new CmsJspActionElement(context, req, res));
79     }
80
81     /**
82      * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
83      *
84      * This overwrites the method from the super class to create a layout variation for the widgets.<p>
85      *
86      * @param dialog the dialog (page) to get the HTML for
87      * @return the dialog HTML for all defined widgets of the named dialog (page)
88      */

89     protected String JavaDoc createDialogHtml(String JavaDoc dialog) {
90
91         StringBuffer JavaDoc result = new StringBuffer JavaDoc(1024);
92
93         result.append(createWidgetTableStart());
94         // show error header once if there were validation errors
95
result.append(createWidgetErrorHeader());
96
97         if (dialog.equals(PAGES[0])) {
98             // 1st block: indexsource information
99
result.append(dialogBlockStart(key(Messages.GUI_LABEL_INDEXSOURCE_BLOCK_SETTINGS_0)));
100             result.append(createWidgetTableStart());
101             result.append(createDialogRowsHtml(0, 1));
102             result.append(createWidgetTableEnd());
103             result.append(dialogBlockEnd());
104
105             // 2nd block: configureable resources for indexsource
106
result.append(dialogBlockStart(key(Messages.GUI_LIST_SEARCHRESOURCES_NAME_0)));
107             result.append(createWidgetTableStart());
108             result.append(createDialogRowsHtml(2, 2));
109             result.append(createWidgetTableEnd());
110             result.append(dialogBlockEnd());
111         }
112
113         result.append(createWidgetTableEnd());
114         return result.toString();
115     }
116
117     /**
118      * Creates the list of widgets for this dialog.<p>
119      */

120     protected void defineWidgets() {
121
122         super.defineWidgets();
123
124         // widgets to display
125
// indexsource data (first block)
126
addWidget(new CmsWidgetDialogParameter(m_indexsource, "name", PAGES[0], new CmsDisplayWidget()));
127         addWidget(new CmsWidgetDialogParameter(m_indexsource, "indexerClassName", PAGES[0], new CmsDisplayWidget()));
128
129         // resources block
130
addWidget(new CmsWidgetDialogParameter(
131             m_indexsource.getResourcesNames(),
132             "resourcesNames",
133             "/",
134             PAGES[0],
135             new CmsVfsFileWidget(false, ""),
136             1,
137             10));
138     }
139 }
Popular Tags