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.tools;
029
030import org.opencms.file.CmsObject;
031
032/**
033 * Admin tool handler for tool roots.<p>
034 *
035 * @since 6.0.0
036 */
037public class CmsToolRootHandler extends A_CmsToolHandler {
038
039    /** The key to access this tool root. */
040    private String m_key;
041    /** The uri where to look for the tools for this root. */
042    private String m_uri;
043
044    /**
045     * Returns the key.<p>
046     *
047     * @return the key
048     */
049    public String getKey() {
050
051        return m_key;
052    }
053
054    /**
055     * Returns the uri.<p>
056     *
057     * @return the uri
058     */
059    public String getUri() {
060
061        return m_uri;
062    }
063
064    /**
065     * @see org.opencms.workplace.tools.A_CmsToolHandler#isEnabled(org.opencms.file.CmsObject)
066     */
067    public boolean isEnabled(CmsObject cms) {
068
069        return true;
070    }
071
072    /**
073     * @see org.opencms.workplace.tools.A_CmsToolHandler#isVisible(org.opencms.file.CmsObject)
074     */
075    public boolean isVisible(CmsObject cms) {
076
077        return true;
078    }
079
080    /**
081     * Sets the key.<p>
082     *
083     * @param key the key to set
084     */
085    public void setKey(String key) {
086
087        m_key = key;
088    }
089
090    /**
091     * @see org.opencms.workplace.tools.A_CmsToolHandler#setup(org.opencms.file.CmsObject, org.opencms.workplace.tools.CmsToolRootHandler, java.lang.String)
092     */
093    @Override
094    public boolean setup(CmsObject cms, CmsToolRootHandler root, String resourcePath) {
095
096        setDisabledHelpText(getHelpText());
097        setIconPath("admin/images/deficon.png");
098        setSmallIconPath(getIconPath());
099        setPath("/");
100        setGroup("");
101        setPosition(1);
102        setLink(cms, resourcePath);
103        return true;
104    }
105
106    /**
107     * Sets the uri.<p>
108     *
109     * @param uri the uri to set
110     */
111    public void setUri(String uri) {
112
113        m_uri = uri;
114    }
115}