KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > workplace > CmsButtonText


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/workplace/CmsButtonText.java,v $
3 * Date : $Date: 2005/06/27 23:22:07 $
4 * Version: $Revision: 1.2 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29
30 package com.opencms.workplace;
31
32 import org.opencms.file.CmsObject;
33 import org.opencms.main.CmsException;
34
35 import com.opencms.template.A_CmsXmlContent;
36
37 import java.util.Hashtable JavaDoc;
38
39 import org.w3c.dom.Element JavaDoc;
40
41 /**
42  * Class for building workplace text buttons. <BR>
43  * Called by CmsXmlTemplateFile for handling the special XML tag <code>&lt;TEXTBUTTON&gt;</code>.
44  *
45  * @author Alexander Lucas
46  * @version $Revision: 1.2 $ $Date: 2005/06/27 23:22:07 $
47  * @see com.opencms.workplace.CmsXmlWpTemplateFile
48  *
49  * @deprecated Will not be supported past the OpenCms 6 release.
50  */

51
52 public class CmsButtonText extends A_CmsWpElement {
53     
54     /**
55      * Handling of the special workplace <CODE>&lt;TEXTBUTTON&gt;</CODE> tags.
56      * <P>
57      * Reads the code of a button from the buttons definition file
58      * and returns the processed code with the actual elements.
59      * <P>
60      * Text Buttons can be referenced in any workplace template by <br>
61      * <CODE>&lt;TEXTBUTTON name="..." action="..." alt="..."/&gt;</CODE>
62      *
63      * @param cms CmsObject Object for accessing resources.
64      * @param n XML element containing the <code>&lt;TEXTBUTTON&gt;</code> tag.
65      * @param doc Reference to the A_CmsXmlContent object of the initiating XLM document.
66      * @param callingObject reference to the calling object <em>(not used here)</em>.
67      * @param parameters Hashtable containing all user parameters <em>(not used here)</em>.
68      * @param lang CmsXmlLanguageFile conataining the currently valid language file.
69      * @return Processed button.
70      * @throws CmsException
71      */

72     
73     public Object JavaDoc handleSpecialWorkplaceTag(CmsObject cms, Element JavaDoc n, A_CmsXmlContent doc,
74             Object JavaDoc callingObject, Hashtable JavaDoc parameters, CmsXmlLanguageFile lang) throws CmsException {
75         
76         // Read button parameters
77
String JavaDoc buttonName = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_NAME);
78         String JavaDoc buttonAction = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_ACTION);
79         String JavaDoc buttonValue = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_VALUE);
80         String JavaDoc buttonStyle = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_STYLE);
81         String JavaDoc buttonWidth = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_WIDTH);
82         
83         // Get button definition and language values
84
CmsXmlWpButtonsDefFile buttondef = getButtonDefinitions(cms);
85         buttonValue = lang.getLanguageValue(CmsWorkplaceDefault.C_LANG_BUTTON + "." + buttonValue);
86         
87         // get the processed button.
88
String JavaDoc result = buttondef.getButtonText(buttonName, buttonAction, buttonValue,
89                 buttonStyle, buttonWidth);
90         return result;
91     }
92 }
93
Popular Tags