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 * <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 018 * 019 * $Id: WidgetTypeImpl.java 28478 2008-01-04 12:53:58Z sfermigier $ 020 */ 021 022package org.nuxeo.ecm.platform.forms.layout.api.impl; 023 024import java.util.List; 025import java.util.Map; 026 027import org.nuxeo.ecm.platform.forms.layout.api.WidgetType; 028 029/** 030 * Implementation for widget types. 031 * 032 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 033 */ 034public class WidgetTypeImpl implements WidgetType { 035 036 private static final long serialVersionUID = -6449946287266106594L; 037 038 protected String name; 039 040 protected List<String> aliases; 041 042 protected Class<?> typeClass; 043 044 protected Map<String, String> properties; 045 046 // needed by GWT serialization 047 protected WidgetTypeImpl() { 048 super(); 049 } 050 051 public WidgetTypeImpl(String name, Class<?> typeClass, Map<String, String> properties) { 052 this.name = name; 053 this.typeClass = typeClass; 054 this.properties = properties; 055 } 056 057 @Override 058 public String getName() { 059 return name; 060 } 061 062 @Override 063 public Class<?> getWidgetTypeClass() { 064 return typeClass; 065 } 066 067 @Override 068 public Map<String, String> getProperties() { 069 return properties; 070 } 071 072 @Override 073 public List<String> getAliases() { 074 return aliases; 075 } 076 077 public void setAliases(List<String> aliases) { 078 this.aliases = aliases; 079 } 080 081 /** 082 * @since 7.2 083 */ 084 @Override 085 public boolean equals(Object obj) { 086 if (!(obj instanceof WidgetTypeImpl)) { 087 return false; 088 } 089 if (obj == this) { 090 return true; 091 } 092 WidgetTypeImpl w = (WidgetTypeImpl) obj; 093 return new EqualsBuilder().append(name, w.name).append(aliases, w.aliases).append(typeClass, w.typeClass).append( 094 properties, w.properties).isEquals(); 095 } 096 097}