001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 016 * 017 * $Id: WidgetTypeImpl.java 28478 2008-01-04 12:53:58Z sfermigier $ 018 */ 019 020package org.nuxeo.ecm.platform.forms.layout.api.impl; 021 022import java.util.List; 023import java.util.Map; 024 025import org.nuxeo.ecm.platform.forms.layout.api.WidgetType; 026 027/** 028 * Implementation for widget types. 029 * 030 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 031 */ 032public class WidgetTypeImpl implements WidgetType { 033 034 private static final long serialVersionUID = -6449946287266106594L; 035 036 protected String name; 037 038 protected List<String> aliases; 039 040 protected Class<?> typeClass; 041 042 protected Map<String, String> properties; 043 044 // needed by GWT serialization 045 protected WidgetTypeImpl() { 046 super(); 047 } 048 049 public WidgetTypeImpl(String name, Class<?> typeClass, Map<String, String> properties) { 050 this.name = name; 051 this.typeClass = typeClass; 052 this.properties = properties; 053 } 054 055 public String getName() { 056 return name; 057 } 058 059 public Class<?> getWidgetTypeClass() { 060 return typeClass; 061 } 062 063 public Map<String, String> getProperties() { 064 return properties; 065 } 066 067 public List<String> getAliases() { 068 return aliases; 069 } 070 071 public void setAliases(List<String> aliases) { 072 this.aliases = aliases; 073 } 074 075 /** 076 * @since 7.2 077 */ 078 @Override 079 public boolean equals(Object obj) { 080 if (!(obj instanceof WidgetTypeImpl)) { 081 return false; 082 } 083 if (obj == this) { 084 return true; 085 } 086 WidgetTypeImpl w = (WidgetTypeImpl) obj; 087 return new EqualsBuilder().append(name, w.name).append(aliases, w.aliases).append(typeClass, w.typeClass).append( 088 properties, w.properties).isEquals(); 089 } 090 091}