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.fragments; 016 017import org.nuxeo.common.xmap.annotation.XNode; 018import org.nuxeo.common.xmap.annotation.XObject; 019import org.nuxeo.theme.Manager; 020import org.nuxeo.theme.models.ModelType; 021import org.nuxeo.theme.types.Type; 022import org.nuxeo.theme.types.TypeFamily; 023 024@XObject("fragment") 025public final class FragmentType implements Type { 026 027 @XNode("@name") 028 public String name; 029 030 @XNode("class") 031 public String className; 032 033 @XNode("model-type") 034 public String modelName; 035 036 @XNode("dynamic") 037 public boolean dynamic = true; 038 039 public FragmentType() { 040 } 041 042 public FragmentType(String name, String className, String modelName, boolean dynamic) { 043 this.name = name; 044 this.className = className; 045 this.modelName = modelName; 046 this.dynamic = dynamic; 047 } 048 049 public TypeFamily getTypeFamily() { 050 return TypeFamily.FRAGMENT; 051 } 052 053 public String getTypeName() { 054 return name; 055 } 056 057 public String getClassName() { 058 return className; 059 } 060 061 public String getModelName() { 062 return modelName; 063 } 064 065 public ModelType getModelType() { 066 return (ModelType) Manager.getTypeRegistry().lookup(TypeFamily.MODEL, modelName); 067 } 068 069 public boolean isDynamic() { 070 return dynamic; 071 } 072 073}