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.list; 029 030import org.opencms.i18n.CmsMessageContainer; 031 032/** 033 * For adding detail information to the list items add an instance 034 * of this class to the list metadata and fill the data like an 035 * additional column.<p> 036 * 037 * For detail contents you may use HTML code.<p> 038 * 039 * @since 6.0.0 040 */ 041public class CmsListItemDetails extends CmsListColumnDefinition { 042 043 /** Id of the first column to include. */ 044 private String m_atColumn; 045 046 /** Action for hidding the details. */ 047 private I_CmsListAction m_hideAction; 048 049 /** Action for showing the details. */ 050 private I_CmsListAction m_showAction; 051 052 /** 053 * Default constructor.<p> 054 * 055 * @param id the unique id 056 */ 057 public CmsListItemDetails(String id) { 058 059 super(id); 060 // set default actions 061 setAlign(CmsListColumnAlignEnum.ALIGN_LEFT); 062 m_hideAction = new CmsListIndependentAction(id); 063 m_hideAction.setIconPath(A_CmsListDialog.ICON_DETAILS_HIDE); 064 m_showAction = new CmsListIndependentAction(id); 065 m_showAction.setIconPath(A_CmsListDialog.ICON_DETAILS_SHOW); 066 } 067 068 /** 069 * @see org.opencms.workplace.list.CmsListColumnDefinition#setWp(org.opencms.workplace.list.A_CmsListDialog) 070 */ 071 @Override 072 public void setWp(A_CmsListDialog wp) { 073 074 super.setWp(wp); 075 m_hideAction.setWp(wp); 076 m_showAction.setWp(wp); 077 } 078 079 /** 080 * Returns the current active action.<p> 081 * 082 * @return the current active action 083 */ 084 public I_CmsListAction getAction() { 085 086 return isVisible() ? m_hideAction : m_showAction; 087 } 088 089 /** 090 * Returns the id of the first column to include.<p> 091 * 092 * @return the id of the first column to include 093 */ 094 public String getAtColumn() { 095 096 return m_atColumn; 097 } 098 099 /** 100 * Sets the id of the first column to include.<p> 101 * 102 * @param atColumn the id of the first column to set 103 */ 104 public void setAtColumn(String atColumn) { 105 106 m_atColumn = atColumn; 107 } 108 109 /** 110 * Sets the hide details Action.<p> 111 * 112 * @param hideAction the hide details Action to set 113 */ 114 public void setHideAction(I_CmsListAction hideAction) { 115 116 m_hideAction = hideAction; 117 } 118 119 /** 120 * Sets the help text of the hide action.<p> 121 * 122 * @param hideActionHelp the help text of the hide action 123 */ 124 public void setHideActionHelpText(CmsMessageContainer hideActionHelp) { 125 126 m_hideAction.setHelpText(hideActionHelp); 127 } 128 129 /** 130 * Sets the name of the hide action.<p> 131 * 132 * @param hideActionName the name of the hide action 133 */ 134 public void setHideActionName(CmsMessageContainer hideActionName) { 135 136 m_hideAction.setName(hideActionName); 137 } 138 139 /** 140 * Sets the id of the list.<p> 141 * 142 * @param listId the id of the list 143 */ 144 @Override 145 public void setListId(String listId) { 146 147 m_hideAction.setListId(listId); 148 m_showAction.setListId(listId); 149 } 150 151 /** 152 * Sets the show details Action.<p> 153 * 154 * @param showAction the showdetails Action to set 155 */ 156 public void setShowAction(I_CmsListAction showAction) { 157 158 m_showAction = showAction; 159 } 160 161 /** 162 * Sets the help text of the show action.<p> 163 * 164 * @param showActionHelp the help text of the show action 165 */ 166 public void setShowActionHelpText(CmsMessageContainer showActionHelp) { 167 168 m_showAction.setHelpText(showActionHelp); 169 } 170 171 /** 172 * Sets the name of the show action.<p> 173 * 174 * @param showActionName the name of the show action 175 */ 176 public void setShowActionName(CmsMessageContainer showActionName) { 177 178 m_showAction.setName(showActionName); 179 } 180}