001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/editors/A_CmsPreEditorActionDefinition.java,v $
003: * Date : $Date: 2008-02-27 12:05:23 $
004: * Version: $Revision: 1.4 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace.editors;
033:
034: import org.opencms.file.CmsResource;
035: import org.opencms.file.types.I_CmsResourceType;
036: import org.opencms.loader.CmsLoaderException;
037: import org.opencms.main.OpenCms;
038: import org.opencms.workplace.CmsDialog;
039:
040: /**
041: * Defines an action to be performed before the workplace editor is opened for the first time.<p>
042: *
043: * Implements the basic methods to handle the resource type.<p>
044: *
045: * @author Andreas Zahner
046: *
047: * @version $Revision: 1.4 $
048: *
049: * @since 6.5.4
050: */
051: public abstract class A_CmsPreEditorActionDefinition implements
052: I_CmsPreEditorActionDefinition {
053:
054: /** The resource type for which the action should be performed. */
055: private I_CmsResourceType m_resourceType;
056:
057: /** The resource type name for which the action should be performed. */
058: private String m_resourceTypeName;
059:
060: /**
061: * Constructor, without parameters.<p>
062: */
063: public A_CmsPreEditorActionDefinition() {
064:
065: // empty constructor, needed for initialization
066: }
067:
068: /**
069: * @see org.opencms.workplace.editors.I_CmsPreEditorActionDefinition#doPreAction(org.opencms.file.CmsResource, org.opencms.workplace.CmsDialog, java.lang.String)
070: */
071: public abstract boolean doPreAction(CmsResource resource,
072: CmsDialog dialog, String originalParams) throws Exception;
073:
074: /**
075: * @see org.opencms.workplace.editors.I_CmsPreEditorActionDefinition#getResourceType()
076: */
077: public I_CmsResourceType getResourceType() {
078:
079: if (m_resourceType == null) {
080: try {
081: m_resourceType = OpenCms.getResourceManager()
082: .getResourceType(m_resourceTypeName);
083: } catch (CmsLoaderException e) {
084: // should not happen, ignore
085: }
086: }
087: return m_resourceType;
088: }
089:
090: /**
091: * @see org.opencms.workplace.editors.I_CmsPreEditorActionDefinition#getResourceTypeName()
092: */
093: public String getResourceTypeName() {
094:
095: return m_resourceTypeName;
096: }
097:
098: /**
099: * @see org.opencms.workplace.editors.I_CmsPreEditorActionDefinition#setResourceTypeName(java.lang.String)
100: */
101: public void setResourceTypeName(String resourceTypeName) {
102:
103: m_resourceTypeName = resourceTypeName;
104: }
105:
106: }
|