📄 cmsexportpointslist.java
字号:
*/
public String getParamModule() {
return m_paramModule;
}
/**
* Sets the module parameter.<p>
* @param paramModule the module parameter
*/
public void setParamModule(String paramModule) {
m_paramModule = paramModule;
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
*/
protected void fillDetails(String detailId) {
// noop
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
*/
protected List getListItems() {
List ret = new ArrayList();
String moduleName = getParamModule();
CmsModule module = OpenCms.getModuleManager().getModule(moduleName);
// get exportpoints
List exportpoints = module.getExportPoints();
Iterator i = exportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exportpoint = (CmsExportPoint)i.next();
CmsListItem item = getList().newItem(exportpoint.getUri());
// name
item.set(LIST_COLUMN_URI, exportpoint.getUri());
// destination
item.set(LIST_COLUMN_DESTINATION, exportpoint.getConfiguredDestination());
// server
item.set(LIST_COLUMN_SERVERDESTINATION, exportpoint.getDestinationPath());
ret.add(item);
}
return ret;
}
/**
* @see org.opencms.workplace.CmsWorkplace#initMessages()
*/
protected void initMessages() {
// add specific dialog resource bundle
addMessages(Messages.get().getBundleName());
// add default resource bundles
super.initMessages();
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
*/
protected void setColumns(CmsListMetadata metadata) {
//add column for edit action
CmsListColumnDefinition editCol = new CmsListColumnDefinition(LIST_COLUMN_EDIT);
editCol.setName(Messages.get().container(Messages.GUI_MODULES_LIST_COLS_EDIT_0));
editCol.setWidth("20");
editCol.setSorteable(false);
editCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
// add the edit action
CmsListDirectAction editColAction = new CmsListDirectAction(LIST_ACTION_EDIT);
editColAction.setName(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_ACTION_EDIT_NAME_0));
editColAction.setHelpText(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_ACTION_EDIT_HELP_0));
editColAction.setIconPath(PATH_BUTTONS + "module_exportpoints.png");
editColAction.setEnabled(true);
editColAction.setConfirmationMessage(null);
editCol.addDirectAction(editColAction);
metadata.addColumn(editCol);
// add column for delete action
CmsListColumnDefinition delCol = new CmsListColumnDefinition(LIST_COLUMN_DELETE);
delCol.setName(Messages.get().container(Messages.GUI_MODULES_LIST_COLS_DELETE_0));
delCol.setWidth("20");
delCol.setSorteable(false);
delCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
// direct action: delete module
CmsListDirectAction delDependency = new CmsListDirectAction(LIST_ACTION_DELETE);
delDependency.setName(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_ACTION_DELETE_NAME_0));
delDependency.setConfirmationMessage(Messages.get().container(
Messages.GUI_EXPORTPOINTS_LIST_ACTION_DELETE_CONF_0));
delDependency.setIconPath(ICON_DELETE);
delDependency.setEnabled(true);
delDependency.setHelpText(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_ACTION_DELETE_HELP_0));
delCol.addDirectAction(delDependency);
metadata.addColumn(delCol);
// add column for name
CmsListColumnDefinition nameCol = new CmsListColumnDefinition(LIST_COLUMN_URI);
nameCol.setName(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_COLS_URI_0));
nameCol.setWidth("40%");
nameCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
// create default edit action for name column: edit dependency
CmsListDefaultAction nameColAction = new CmsListDefaultAction(LIST_DEFACTION_EDIT);
nameColAction.setName(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_ACTION_OVERVIEW_NAME_0));
nameColAction.setIconPath(null);
nameColAction.setHelpText(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_ACTION_OVERVIEW_HELP_0));
nameColAction.setEnabled(true);
nameColAction.setConfirmationMessage(null);
// set action for the name column
nameCol.addDefaultAction(nameColAction);
metadata.addColumn(nameCol);
// add column for destination
CmsListColumnDefinition destinationCol = new CmsListColumnDefinition(LIST_COLUMN_DESTINATION);
destinationCol.setName(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_COLS_DESTINATION_0));
destinationCol.setWidth("30%");
destinationCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
metadata.addColumn(destinationCol);
// add column for server destination
CmsListColumnDefinition serverDestinationCol = new CmsListColumnDefinition(LIST_COLUMN_SERVERDESTINATION);
serverDestinationCol.setName(Messages.get().container(Messages.GUI_EXPORTPOINTS_LIST_COLS_SERVERDESTINATION_0));
serverDestinationCol.setWidth("30%");
serverDestinationCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
metadata.addColumn(serverDestinationCol);
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
*/
protected void setIndependentActions(CmsListMetadata metadata) {
// noop
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
*/
protected void setMultiActions(CmsListMetadata metadata) {
// add the delete dependencies multi action
CmsListMultiAction deleteDependencies = new CmsListMultiAction(LIST_MACTION_DELETE);
deleteDependencies.setName(Messages.get().container(Messages.GUI_DEPENDENCIES_LIST_ACTION_MDELETE_NAME_0));
deleteDependencies.setConfirmationMessage(Messages.get().container(
Messages.GUI_DEPENDENCIES_LIST_ACTION_MDELETE_CONF_0));
deleteDependencies.setIconPath(ICON_MULTI_DELETE);
deleteDependencies.setEnabled(true);
deleteDependencies.setHelpText(Messages.get().container(Messages.GUI_DEPENDENCIES_LIST_ACTION_MDELETE_HELP_0));
metadata.addMultiAction(deleteDependencies);
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters()
*/
protected void validateParamaters() throws Exception {
if (OpenCms.getModuleManager().getModule(getParamModule()) == null) {
// just throw a dummy exception here since getModule does not produce an exception when a
// module is not found
throw new Exception();
}
}
/**
* Deletes a module exportpoint from a module.<p>
*
* @param module the module to delete the dependency from
* @param exportpoint the name of the exportpoint to delete
*/
private void deleteExportpoint(CmsModule module, String exportpoint) {
List oldExportpoints = module.getExportPoints();
List newExportpoints = new ArrayList();
Iterator i = oldExportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exp = (CmsExportPoint)i.next();
if (!exp.getUri().equals(exportpoint)) {
newExportpoints.add(exp);
}
}
module.setExportPoints(newExportpoints);
// update the module information
try {
OpenCms.getModuleManager().updateModule(getCms(), module);
} catch (CmsConfigurationException ce) {
// should never happen
throw new CmsRuntimeException(Messages.get().container(
Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2,
exportpoint,
module.getName()), ce);
} catch (CmsRoleViolationException re) {
throw new CmsRuntimeException(Messages.get().container(
Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2,
exportpoint,
module.getName()), re);
}
getList().removeItem(exportpoint, getLocale());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -