cmspropertycomparisonlist.java
来自「找了很久才找到到源代码」· Java 代码 · 共 554 行 · 第 1/2 页
JAVA
554 行
/*
* File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/comparison/CmsPropertyComparisonList.java,v $
* Date : $Date: 2007-08-13 16:30:18 $
* Version: $Revision: 1.8 $
*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) 2002 - 2007 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.CmsResource;
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.util.CmsUUID;
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.8 $
*
* @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);
/** Parameter value for the structure id of the first file. */
private String m_paramId1;
/** Parameter value for the structure id of the second file. */
private String m_paramId2;
/** 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 first resource to compare. */
private CmsResource m_resource1;
/** The second resource to compare. */
private CmsResource m_resource2;
/** 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_VERSION_1, getParamVersion1());
params.put(CmsHistoryList.PARAM_VERSION_2, getParamVersion2());
params.put(CmsHistoryList.PARAM_ID_1, getParamId1());
params.put(CmsHistoryList.PARAM_ID_2, getParamId2());
params.put(PARAM_COMPARE, "properties");
params.put(PARAM_RESOURCE, getParamResource());
// forward to the difference screen
getToolManager().jspForwardTool(this, "/history/comparison/difference", params);
}
/**
* Returns the paramId1.<p>
*
* @return the paramId1
*/
public String getParamId1() {
return m_paramId1;
}
/**
* Returns the paramId2.<p>
*
* @return the paramId2
*/
public String getParamId2() {
return m_paramId2;
}
/**
* Returns the paramNewversionid.<p>
*
* @return the paramNewversionid
*/
public String getParamVersion1() {
return m_paramVersion1;
}
/**
* Returns the paramOldversionid.<p>
*
* @return the paramOldversionid
*/
public String getParamVersion2() {
return m_paramVersion2;
}
/**
* Returns the resource 1.<p>
*
* @return the resource 1
*/
public CmsResource getResource1() {
return m_resource1;
}
/**
* Returns the resource 2.<p>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?