KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/searchindex/CmsEditIndexSourceDialog.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.search.CmsVfsIndexer;
36 import org.opencms.widgets.CmsComboWidget;
37 import org.opencms.widgets.CmsDisplayWidget;
38 import org.opencms.widgets.CmsInputWidget;
39 import org.opencms.widgets.CmsSelectWidgetOption;
40 import org.opencms.workplace.CmsWidgetDialogParameter;
41
42 import java.util.LinkedList JavaDoc;
43 import java.util.List JavaDoc;
44
45 import javax.servlet.http.HttpServletRequest JavaDoc;
46 import javax.servlet.http.HttpServletResponse JavaDoc;
47 import javax.servlet.jsp.PageContext JavaDoc;
48
49 /**
50  *
51  * Dialog to edit new or existing search indexsource in the administration view.<p>
52  *
53  * @author Achim Westermann
54  *
55  * @version $Revision: 1.2 $
56  *
57  * @since 6.0.0
58  */

59 public class CmsEditIndexSourceDialog extends A_CmsEditIndexSourceDialog {
60
61     /**
62      * Public constructor with JSP action element.<p>
63      *
64      * @param jsp an initialized JSP action element
65      */

66     public CmsEditIndexSourceDialog(CmsJspActionElement jsp) {
67
68         super(jsp);
69     }
70
71     /**
72      * Public constructor with JSP variables.<p>
73      *
74      * @param context the JSP page context
75      * @param req the JSP request
76      * @param res the JSP response
77      */

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

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

115     protected void defineWidgets() {
116
117         super.defineWidgets();
118
119         // widgets to display
120
// new indexsource
121
if (m_indexsource.getName() == null) {
122             addWidget(new CmsWidgetDialogParameter(m_indexsource, "name", PAGES[0], new CmsInputWidget()));
123         } else {
124             // existing indexsource
125
addWidget(new CmsWidgetDialogParameter(m_indexsource, "name", PAGES[0], new CmsDisplayWidget()));
126         }
127         // m_indexsource.getIndexerClassName();
128
// m_indexsource.setIndexerClassName(null);
129
addWidget(new CmsWidgetDialogParameter(m_indexsource, "indexerClassName", "", PAGES[0], new CmsComboWidget(
130             getIndexerClassWidgetConfiguration()), 1, 1));
131
132     }
133
134     private List JavaDoc getIndexerClassWidgetConfiguration() {
135
136         List JavaDoc result = new LinkedList JavaDoc();
137         result.add(new CmsSelectWidgetOption(CmsVfsIndexer.class.getName(), true));
138         return result;
139     }
140 }
Popular Tags