001/*
002 * (C) Copyright 2006-2007 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 *     Jean-Marc Orliaguet, Chalmers
018 *
019 * $Id$
020 */
021
022package org.nuxeo.theme.presets;
023
024import org.nuxeo.common.xmap.annotation.XNode;
025import org.nuxeo.common.xmap.annotation.XObject;
026import org.nuxeo.theme.types.Type;
027import org.nuxeo.theme.types.TypeFamily;
028
029@XObject("preset")
030public class PresetType implements Type {
031
032    @XNode("@name")
033    protected String name;
034
035    @XNode("@value")
036    protected String value;
037
038    @XNode("@group")
039    protected String group;
040
041    @XNode("@category")
042    protected String category = "";
043
044    @XNode("@label")
045    protected String label = "";
046
047    @XNode("@description")
048    protected String description = "";
049
050    public PresetType() {
051    }
052
053    public PresetType(String name, String value, String group, String category, String label, String description) {
054        this.name = name;
055        this.value = value;
056        this.group = group;
057        this.category = category;
058        this.label = label;
059        this.description = description;
060    }
061
062    public TypeFamily getTypeFamily() {
063        return TypeFamily.PRESET;
064    }
065
066    public String getName() {
067        return name;
068    }
069
070    public String getTypeName() {
071        if (group != null && !"".equals(group)) {
072            return String.format("%s (%s)", name, group);
073        }
074        return name;
075    }
076
077    public String getEffectiveName() {
078        return getTypeName();
079    }
080
081    public String getValue() {
082        return value;
083    }
084
085    public String getCategory() {
086        return category;
087    }
088
089    public String getGroup() {
090        return group;
091    }
092
093    public void setName(String name) {
094        this.name = name;
095    }
096
097    public void setGroup(String group) {
098        this.group = group;
099    }
100
101    public void setCategory(String category) {
102        this.category = category;
103    }
104
105    public void setValue(String value) {
106        this.value = value;
107    }
108
109    public String getLabel() {
110        return label;
111    }
112
113    public void setLabel(String label) {
114        this.label = label;
115    }
116
117    public String getDescription() {
118        return description;
119    }
120
121    public void setDescription(String description) {
122        this.description = description;
123    }
124
125}