001/*
002 * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     bstefanescu
018 */
019package org.nuxeo.ecm.webengine.model.impl;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * Can be used to register links to your module entry points in the main web engine page
026 *
027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
028 */
029@XObject("shortcut")
030public class ModuleShortcut {
031
032    /**
033     * The relative href to your entry point (relative to webengine root)
034     */
035    @XNode("@href")
036    public String href;
037
038    /**
039     * A title. If not specified module name will be used.
040     */
041    @XNode("title")
042    public String title;
043
044    /**
045     * An optional icon
046     */
047    @XNode("icon")
048    public String icon;
049
050    public ModuleShortcut() {
051    }
052
053    public ModuleShortcut(String href, String title) {
054        this.href = href;
055        this.title = title;
056    }
057
058    public String getIcon() {
059        return icon;
060    }
061
062    public String getTitle() {
063        return title;
064    }
065
066    public String getHref() {
067        return href;
068    }
069
070    @Override
071    public boolean equals(Object obj) {
072        if (this == obj) {
073            return true;
074        }
075        if (obj instanceof ModuleShortcut) {
076            return ((ModuleShortcut) obj).href.equals(href);
077        }
078        return false;
079    }
080
081    @Override
082    public String toString() {
083        return href;
084    }
085
086}