📄 cmspropertycomparisonlist.java
字号:
* 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 resourceType.<p>
*
* @return the resourceType
*/
public int getResourceType() {
return m_resourceType;
}
/**
* Sets the paramPath1.<p>
*
* @param paramPath1 the paramPath1 to set
*/
public void setParamPath1(String paramPath1) {
m_paramPath1 = paramPath1;
}
/**
* Sets the paramPath2.<p>
*
* @param paramPath2 the paramPath2 to set
*/
public void setParamPath2(String paramPath2) {
m_paramPath2 = paramPath2;
}
/**
* Sets the paramTagId1.<p>
*
* @param paramTagId1 the paramTagId1 to set
*/
public void setParamTagId1(String paramTagId1) {
m_paramTagId1 = paramTagId1;
}
/**
* Sets the paramTagId2.<p>
*
* @param paramTagId2 the paramTagId2 to set
*/
public void setParamTagId2(String paramTagId2) {
m_paramTagId2 = paramTagId2;
}
/**
* Sets the paramNewversionid.<p>
*
* @param paramNewversionid the paramNewversionid to set
*/
public void setParamVersion1(String paramNewversionid) {
m_paramVersion1 = paramNewversionid;
}
/**
* Sets the paramOldversionid.<p>
*
* @param paramOldversionid the paramOldversionid to set
*/
public void setParamVersion2(String paramOldversionid) {
m_paramVersion2 = paramOldversionid;
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
*/
protected void fillDetails(String detailId) {
// no-op
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
*/
protected List getListItems() throws CmsException {
List ret = new ArrayList();
Iterator diffs = CmsResourceComparison.compareProperties(getCms(), getFile1(), getFile2()).iterator();
while (diffs.hasNext()) {
CmsAttributeComparison comparison = (CmsAttributeComparison)diffs.next();
CmsListItem item = getList().newItem(comparison.getName());
item.set(LIST_COLUMN_PROPERTY_NAME, comparison.getName());
item.set(LIST_COLUMN_VERSION_1, CmsStringUtil.trimToSize(comparison.getVersion1(), TRIM_AT_LENGTH));
item.set(LIST_COLUMN_VERSION_2, CmsStringUtil.trimToSize(comparison.getVersion2(), TRIM_AT_LENGTH));
if (CmsResourceComparison.TYPE_ADDED.equals(comparison.getStatus())) {
item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_ADDED_0));
} else if (CmsResourceComparison.TYPE_REMOVED.equals(comparison.getStatus())) {
item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_REMOVED_0));
} else if (CmsResourceComparison.TYPE_CHANGED.equals(comparison.getStatus())) {
item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_CHANGED_0));
} else {
if (!getList().getMetadata().getItemDetailDefinition(LIST_IACTION_SHOW).isVisible()) {
// do not display entry
continue;
} else {
item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_UNCHANGED_0));
}
}
ret.add(item);
}
getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_1).setName(
Messages.get().container(Messages.GUI_COMPARE_VERSION_1, getParamVersion1()));
getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_2).setName(
Messages.get().container(Messages.GUI_COMPARE_VERSION_1, getParamVersion2()));
return ret;
}
/**
*
* @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
*/
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) {
super.initWorkplaceRequestValues(settings, request);
try {
m_file1 = CmsResourceComparisonDialog.readFile(getCms(), getParamPath1(),
getParamVersion1(), Integer.parseInt(getParamTagId1()));
m_file2 = CmsResourceComparisonDialog.readFile(getCms(), getParamPath2(),
getParamVersion2(), Integer.parseInt(getParamTagId2()));
} catch (CmsException e) {
LOG.error(e.getStackTrace(), e);
}
m_resourceType = m_file1.getTypeId();
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
*/
protected void setColumns(CmsListMetadata metadata) {
// create column for icon
CmsListColumnDefinition iconCol = new CmsListColumnDefinition(LIST_COLUMN_ICON);
iconCol.setName(Messages.get().container(Messages.GUI_COMPARE_COLS_ICON_0));
iconCol.setWidth("20");
iconCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
iconCol.setSorteable(true);
// add state error action
CmsListDirectAction addedAction = new CmsListDirectAction(CmsResourceComparison.TYPE_ADDED) {
/**
* @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isVisible()
*/
public boolean isVisible() {
String type = getItem().get(LIST_COLUMN_TYPE).toString();
return key(Messages.GUI_COMPARE_ADDED_0).equals(type);
}
};
addedAction.setName(Messages.get().container(Messages.GUI_COMPARE_ELEM_ADDED_0));
addedAction.setIconPath("tools/ex_history/buttons/added.png");
addedAction.setEnabled(true);
iconCol.addDirectAction(addedAction);
// add state error action
CmsListDirectAction removedAction = new CmsListDirectAction(CmsResourceComparison.TYPE_REMOVED) {
/**
* @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isVisible()
*/
public boolean isVisible() {
String type = getItem().get(LIST_COLUMN_TYPE).toString();
return key(Messages.GUI_COMPARE_REMOVED_0).equals(type);
}
};
removedAction.setName(Messages.get().container(Messages.GUI_COMPARE_ELEM_REMOVED_0));
removedAction.setIconPath("tools/ex_history/buttons/removed.png");
removedAction.setEnabled(true);
iconCol.addDirectAction(removedAction);
// add state error action
CmsListDirectAction changedAction = new CmsListDirectAction(CmsResourceComparison.TYPE_CHANGED) {
/**
* @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isVisible()
*/
public boolean isVisible() {
String type = getItem().get(LIST_COLUMN_TYPE).toString();
return key(Messages.GUI_COMPARE_CHANGED_0).equals(type);
}
};
changedAction.setName(Messages.get().container(Messages.GUI_COMPARE_ELEM_CHANGED_0));
changedAction.setIconPath("tools/ex_history/buttons/changed.png");
changedAction.setEnabled(true);
iconCol.addDirectAction(changedAction);
// add state error action
CmsListDirectAction unchangedAction = new CmsListDirectAction(CmsResourceComparison.TYPE_UNCHANGED) {
/**
* @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isVisible()
*/
public boolean isVisible() {
String type = getItem().get(LIST_COLUMN_TYPE).toString();
return key(Messages.GUI_COMPARE_UNCHANGED_0).equals(type);
}
};
unchangedAction.setName(Messages.get().container(Messages.GUI_COMPARE_ELEM_UNCHANGED_0));
unchangedAction.setIconPath("tools/ex_history/buttons/unchanged.png");
unchangedAction.setEnabled(true);
iconCol.addDirectAction(unchangedAction);
metadata.addColumn(iconCol);
iconCol.setPrintable(false);
// add column for type
CmsListColumnDefinition typeCol = new CmsListColumnDefinition(LIST_COLUMN_TYPE);
typeCol.setName(Messages.get().container(Messages.GUI_COMPARE_COLS_STATUS_0));
typeCol.setWidth("10%");
CmsListDefaultAction typeColAction = new CmsListDefaultAction(CmsElementComparisonList.LIST_ACTION_STATUS);
typeColAction.setName(Messages.get().container(Messages.GUI_COMPARE_COLS_STATUS_0));
typeColAction.setEnabled(true);
// set action for the name column
typeCol.addDefaultAction(typeColAction);
metadata.addColumn(typeCol);
typeCol.setPrintable(true);
// add column for name
CmsListColumnDefinition nameCol = new CmsListColumnDefinition(LIST_COLUMN_PROPERTY_NAME);
nameCol.setName(Messages.get().container(Messages.GUI_COMPARE_COLS_PROPERTY_NAME_0));
nameCol.setWidth("20%");
metadata.addColumn(nameCol);
nameCol.setPrintable(true);
// add column for first value
CmsListColumnDefinition version1Col = new CmsListColumnDefinition(LIST_COLUMN_VERSION_1);
version1Col.setName(Messages.get().container(Messages.GUI_COMPARE_VERSION_1, getParamVersion1()));
version1Col.setWidth("35%");
version1Col.setSorteable(false);
metadata.addColumn(version1Col);
version1Col.setPrintable(true);
// add column for second value
CmsListColumnDefinition version2Col = new CmsListColumnDefinition(LIST_COLUMN_VERSION_2);
version2Col.setName(Messages.get().container(Messages.GUI_COMPARE_VERSION_1, getParamVersion2()));
version2Col.setWidth("35%");
version2Col.setSorteable(false);
metadata.addColumn(version2Col);
version2Col.setPrintable(true);
}
/**
*
* @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
*/
protected void setIndependentActions(CmsListMetadata metadata) {
// add event details
CmsListItemDetails eventDetails = new CmsListItemDetails(LIST_IACTION_SHOW);
eventDetails.setVisible(false);
eventDetails.setShowActionName(Messages.get().container(Messages.GUI_COMPARE_SHOW_ALL_PROPERTIES_0));
eventDetails.setHideActionName(Messages.get().container(Messages.GUI_COMPARE_HIDE_IDENTICAL_PROPERTIES_0));
metadata.addItemDetails(eventDetails);
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
*/
protected void setMultiActions(CmsListMetadata metadata) {
// no-op
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -