001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.workplace.tools.searchindex;
029
030import org.opencms.i18n.CmsMessageContainer;
031import org.opencms.jsp.CmsJspActionElement;
032import org.opencms.workplace.list.A_CmsListDialog;
033import org.opencms.workplace.list.CmsListOrderEnum;
034
035/**
036 * A list dialog that may be embedded in
037 * the output of other <code>{@link org.opencms.workplace.CmsDialog}</code> instances.<p>
038 *
039 * With std. <code>{@link org.opencms.workplace.list.A_CmsListDialog}</code> this attempt will
040 * result in double gray headers in the workplace. <p>
041 *
042 * <h4>Howto</h4>
043 *
044 * <h5>1. Include content in JSP</h5>
045 * <pre>
046 <%
047 CmsJspActionElement actionElement = new CmsJspActionElement(pageContext, request, response);
048 CmsWidgetDialog wpWidget = new &lt;TYPE&gt;(actionElement);
049
050 // perform the widget actions (write later)
051 wpWidget.displayDialog(true);
052 A_CmsEmbeddedListDialog wpList = new &lt;TYPE&gt;(actionElement);
053
054 // perform the list actions (write later)
055 wpList.displayDialog(true);
056 // write the content of widget dialog
057 wpWidget.writeDialog();
058 // write the content of list dialog
059 wpList.writeDialog();
060 %>
061 * </pre>
062 *
063 * <h5>2. Include in code of other CmsDialog</h5>
064 <pre>
065 protected String createDialogHtml(String dialog) {
066
067 StringBuffer result = new StringBuffer(1024);
068
069 result.append(createWidgetTableStart());
070 // do your dialog output here....
071 ...
072 result.append(createWidgetTableEnd());
073 // create the list :
074 A_CmsEmbeddedListDialog wpList = new &lt;TYPE&gt;(getJsp());
075 wpList.writeDialog();
076 </pre>
077 *
078 *
079 * @since 6.0.0
080 */
081public abstract class A_CmsEmbeddedListDialog extends A_CmsListDialog {
082
083    /**
084     * Public constructor.<p>
085     *
086     * @param jsp an initialized JSP action element
087     * @param listId the id of the displayed list
088     * @param listName the name of the list
089     * @param sortedColId the a priory sorted column
090     * @param sortOrder the order of the sorted column
091     * @param searchableColId the column to search into
092     */
093    public A_CmsEmbeddedListDialog(
094        CmsJspActionElement jsp,
095        String listId,
096        CmsMessageContainer listName,
097        String sortedColId,
098        CmsListOrderEnum sortOrder,
099        String searchableColId) {
100
101        super(jsp, listId, listName, sortedColId, sortOrder, searchableColId);
102
103    }
104
105    /**
106     * Overrides the implementation to skip generation of gray header. <p>
107     *
108     * @see org.opencms.workplace.list.A_CmsListDialog#defaultActionHtmlStart()
109     */
110    @Override
111    public String defaultActionHtmlStart() {
112
113        return new StringBuffer(getList().listJs()).append(dialogContentStart(getParamTitle())).toString();
114    }
115}