001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Jean-Marc Orliaguet, Chalmers
011 *
012 * $Id$
013 */
014
015package org.nuxeo.theme.presets;
016
017import org.nuxeo.common.xmap.annotation.XNode;
018import org.nuxeo.common.xmap.annotation.XObject;
019import org.nuxeo.theme.types.Type;
020import org.nuxeo.theme.types.TypeFamily;
021
022@XObject("preset")
023public class PresetType implements Type {
024
025    @XNode("@name")
026    protected String name;
027
028    @XNode("@value")
029    protected String value;
030
031    @XNode("@group")
032    protected String group;
033
034    @XNode("@category")
035    protected String category = "";
036
037    @XNode("@label")
038    protected String label = "";
039
040    @XNode("@description")
041    protected String description = "";
042
043    public PresetType() {
044    }
045
046    public PresetType(String name, String value, String group, String category, String label, String description) {
047        this.name = name;
048        this.value = value;
049        this.group = group;
050        this.category = category;
051        this.label = label;
052        this.description = description;
053    }
054
055    public TypeFamily getTypeFamily() {
056        return TypeFamily.PRESET;
057    }
058
059    public String getName() {
060        return name;
061    }
062
063    public String getTypeName() {
064        if (group != null && !"".equals(group)) {
065            return String.format("%s (%s)", name, group);
066        }
067        return name;
068    }
069
070    public String getEffectiveName() {
071        return getTypeName();
072    }
073
074    public String getValue() {
075        return value;
076    }
077
078    public String getCategory() {
079        return category;
080    }
081
082    public String getGroup() {
083        return group;
084    }
085
086    public void setName(String name) {
087        this.name = name;
088    }
089
090    public void setGroup(String group) {
091        this.group = group;
092    }
093
094    public void setCategory(String category) {
095        this.category = category;
096    }
097
098    public void setValue(String value) {
099        this.value = value;
100    }
101
102    public String getLabel() {
103        return label;
104    }
105
106    public void setLabel(String label) {
107        this.label = label;
108    }
109
110    public String getDescription() {
111        return description;
112    }
113
114    public void setDescription(String description) {
115        this.description = description;
116    }
117
118}