001/*
002 * (C) Copyright 2006-2010 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     bstefanescu
016 */
017package org.nuxeo.ecm.webengine.model.impl;
018
019import org.nuxeo.common.xmap.annotation.XNode;
020import org.nuxeo.common.xmap.annotation.XObject;
021
022/**
023 * Can be used to register links to your module entry points in the main web engine page
024 *
025 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
026 */
027@XObject("shortcut")
028public class ModuleShortcut {
029
030    /**
031     * The relative href to your entry point (relative to webengine root)
032     */
033    @XNode("@href")
034    public String href;
035
036    /**
037     * A title. If not specified module name will be used.
038     */
039    @XNode("title")
040    public String title;
041
042    /**
043     * An optional icon
044     */
045    @XNode("icon")
046    public String icon;
047
048    public ModuleShortcut() {
049    }
050
051    public ModuleShortcut(String href, String title) {
052        this.href = href;
053        this.title = title;
054    }
055
056    public String getIcon() {
057        return icon;
058    }
059
060    public String getTitle() {
061        return title;
062    }
063
064    public String getHref() {
065        return href;
066    }
067
068    @Override
069    public boolean equals(Object obj) {
070        if (this == obj) {
071            return true;
072        }
073        if (obj instanceof ModuleShortcut) {
074            return ((ModuleShortcut) obj).href.equals(href);
075        }
076        return false;
077    }
078
079    @Override
080    public String toString() {
081        return href;
082    }
083
084}