📄 cmspropertycomparisonlist.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/comparison/CmsPropertyComparisonList.java,v $
* Date : $Date: 2006/03/30 09:31:45 $
* Version: $Revision: 1.5 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.workplace.comparison;
import org.opencms.file.CmsFile;
import org.opencms.i18n.CmsMessageContainer;
import org.opencms.jsp.CmsJspActionElement;
import org.opencms.main.CmsException;
import org.opencms.main.CmsLog;
import org.opencms.util.CmsStringUtil;
import org.opencms.workplace.CmsWorkplaceSettings;
import org.opencms.workplace.commons.CmsHistoryList;
import org.opencms.workplace.list.A_CmsListDialog;
import org.opencms.workplace.list.CmsListColumnAlignEnum;
import org.opencms.workplace.list.CmsListColumnDefinition;
import org.opencms.workplace.list.CmsListDefaultAction;
import org.opencms.workplace.list.CmsListDirectAction;
import org.opencms.workplace.list.CmsListItem;
import org.opencms.workplace.list.CmsListItemDetails;
import org.opencms.workplace.list.CmsListMetadata;
import org.opencms.workplace.list.CmsListOrderEnum;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import org.apache.commons.logging.Log;
/**
* List for property comparison including columns for property name and the values. <p>
*
* @author Jan Baudisch
*
* @version $Revision: 1.5 $
*
* @since 6.0.0
*/
public class CmsPropertyComparisonList extends A_CmsListDialog {
/** view first file action constant. */
public static final String LIST_ACTION_VIEW1 = "v1";
/** view second file action constant. */
public static final String LIST_ACTION_VIEW2 = "v2";
/** list action id constant. */
public static final String LIST_COLUMN_ICON = "ci";
/** list column id constant. */
public static final String LIST_COLUMN_PROPERTY_NAME = "cp";
/** list action id constant. */
public static final String LIST_COLUMN_TYPE = "cz";
/** list column id constant. */
public static final String LIST_COLUMN_VERSION_1 = "cv";
/** list column id constant. */
public static final String LIST_COLUMN_VERSION_2 = "cw";
/** list default action id constant. */
public static final String LIST_DEFACTION_VIEW = "dv";
/** list independent action id constant. */
public static final String LIST_DETAIL_TYPE = "dt";
/** list independent action id constant. */
public static final String LIST_IACTION_SHOW = "is";
/** List id constant. */
public static final String LIST_ID = "hipcl";
/** request parameter indicating whether attributes, elements or properties are compared.<p> */
public static final String PARAM_COMPARE = "compare";
/** The maximum length of properties and attributes to be displayed.<p> */
protected static final int TRIM_AT_LENGTH = 60;
/** The log object for this class. */
private static final Log LOG = CmsLog.getLog(CmsPropertyComparisonList.class);
/** The first file to compare. */
private CmsFile m_file1;
/** The second file to compare. */
private CmsFile m_file2;
/** Parameter value for the path of the first file. */
private String m_paramPath1;
/** Parameter value for the path of the second file. */
private String m_paramPath2;
/** Parameter value for the tag id of the first file. */
private String m_paramTagId1;
/** Parameter value for the tag id of the second file. */
private String m_paramTagId2;
/** Parameter value for the version of the first file. */
private String m_paramVersion1;
/** Parameter value for the version of the second file. */
private String m_paramVersion2;
/** The type of the files. */
private int m_resourceType;
/**
* Public constructor.<p>
*
* @param jsp an initialized JSP action element
*/
public CmsPropertyComparisonList(CmsJspActionElement jsp) {
this(LIST_ID, jsp);
}
/**
* Public constructor with JSP variables.<p>
*
* @param context the JSP page context
* @param req the JSP request
* @param res the JSP response
*/
public CmsPropertyComparisonList(PageContext context, HttpServletRequest req, HttpServletResponse res) {
this(new CmsJspActionElement(context, req, res));
}
/**
* Public constructor.<p>
* @param jsp an initialized JSP action element
* @param listId the id of the displayed list
* @param listName the name of the list
* @param sortedColId the a priory sorted column
* @param sortOrder the order of the sorted column
* @param searchableColId the column to search into
*/
protected CmsPropertyComparisonList(
CmsJspActionElement jsp,
String listId,
CmsMessageContainer listName,
String sortedColId,
CmsListOrderEnum sortOrder,
String searchableColId) {
super(jsp, listId, listName, sortedColId, sortOrder, searchableColId);
}
/**
* Protected constructor.<p>
*
* @param listId the id of the specialized list
* @param jsp an initialized JSP action element
*/
protected CmsPropertyComparisonList(String listId, CmsJspActionElement jsp) {
super(
jsp,
listId,
Messages.get().container(Messages.GUI_COMPARE_PROPERTIES_0),
LIST_COLUMN_PROPERTY_NAME,
CmsListOrderEnum.ORDER_ASCENDING,
null);
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
*/
public void executeListMultiActions() {
throwListUnsupportedActionException();
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
*/
public void executeListSingleActions() throws IOException, ServletException {
// forward to the edit module screen
Map params = new HashMap();
params.put(CmsHistoryList.PARAM_TAGID_1, getParamTagId1());
params.put(CmsHistoryList.PARAM_TAGID_2, getParamTagId2());
params.put(CmsHistoryList.PARAM_VERSION_1, getParamVersion1());
params.put(CmsHistoryList.PARAM_VERSION_2, getParamVersion2());
params.put(CmsHistoryList.PARAM_PATH_1, getParamPath1());
params.put(CmsHistoryList.PARAM_PATH_2, getParamPath2());
params.put(PARAM_COMPARE, "properties");
params.put(PARAM_RESOURCE, getParamResource());
// forward to the difference screen
getToolManager().jspForwardTool(this, "/history/comparison/difference", params);
}
/**
* Returns the file1.<p>
*
* @return the file1
*/
public CmsFile getFile1() {
return m_file1;
}
/**
* Returns the file2.<p>
*
* @return the file2
*/
public CmsFile getFile2() {
return m_file2;
}
/**
* Returns the paramPath1.<p>
*
* @return the paramPath1
*/
public String getParamPath1() {
return m_paramPath1;
}
/**
* Returns the paramPath2.<p>
*
* @return the paramPath2
*/
public String getParamPath2() {
return m_paramPath2;
}
/**
* Returns the paramTagId1.<p>
*
* @return the paramTagId1
*/
public String getParamTagId1() {
return m_paramTagId1;
}
/**
* Returns the paramTagId2.<p>
*
* @return the paramTagId2
*/
public String getParamTagId2() {
return m_paramTagId2;
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -