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.elements; 016 017import org.nuxeo.common.xmap.annotation.XNode; 018import org.nuxeo.common.xmap.annotation.XObject; 019import org.nuxeo.theme.nodes.NodeTypeFamily; 020import org.nuxeo.theme.types.Type; 021import org.nuxeo.theme.types.TypeFamily; 022 023@XObject("element") 024public final class ElementType implements Type { 025 026 @XNode("@name") 027 public String name; 028 029 @XNode("class") 030 public String className; 031 032 @XNode("node-type") 033 public String nodeTypeName; 034 035 public ElementType() { 036 } 037 038 public ElementType(String name, String className, String nodeTypeName) { 039 this.name = name; 040 this.nodeTypeName = nodeTypeName; 041 this.className = className; 042 } 043 044 public NodeTypeFamily getNodeTypeFamily() { 045 if (nodeTypeName.equals("leaf")) { 046 return NodeTypeFamily.LEAF; 047 } else if (nodeTypeName.equals("inner")) { 048 return NodeTypeFamily.INNER; 049 } 050 return null; 051 } 052 053 public String getTypeName() { 054 return name; 055 } 056 057 public TypeFamily getTypeFamily() { 058 return TypeFamily.ELEMENT; 059 } 060 061 public String getClassName() { 062 return className; 063 } 064 065}