001/* 002 * (C) Copyright 2009-2010 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 * Anahide Tchertchian 018 */ 019package org.nuxeo.ecm.platform.forms.layout.api.impl; 020 021import java.util.List; 022import java.util.Map; 023 024import org.nuxeo.ecm.platform.forms.layout.api.WidgetTypeConfiguration; 025import org.nuxeo.ecm.platform.forms.layout.api.WidgetTypeDefinition; 026 027/** 028 * Model for a widget type definition on client side. 029 * 030 * @author Anahide Tchertchian 031 * @since 5.4 032 */ 033public class WidgetTypeDefinitionImpl implements WidgetTypeDefinition { 034 035 private static final long serialVersionUID = 1L; 036 037 protected String name; 038 039 /** 040 * @since 6.0 041 */ 042 protected List<String> aliases; 043 044 protected String handlerClassName; 045 046 protected Map<String, String> properties; 047 048 protected WidgetTypeConfiguration configuration; 049 050 // needed by GWT serialization 051 public WidgetTypeDefinitionImpl() { 052 super(); 053 } 054 055 public WidgetTypeDefinitionImpl(String name, String handlerClassName, Map<String, String> properties, 056 WidgetTypeConfiguration configuration) { 057 super(); 058 this.name = name; 059 this.handlerClassName = handlerClassName; 060 this.properties = properties; 061 this.configuration = configuration; 062 } 063 064 @Override 065 public WidgetTypeConfiguration getConfiguration() { 066 return configuration; 067 } 068 069 @Override 070 public String getHandlerClassName() { 071 return handlerClassName; 072 } 073 074 @Override 075 public String getName() { 076 return name; 077 } 078 079 @Override 080 public Map<String, String> getProperties() { 081 return properties; 082 } 083 084 @Override 085 public List<String> getAliases() { 086 return aliases; 087 } 088 089 public void setAliases(List<String> aliases) { 090 this.aliases = aliases; 091 } 092 093 /** 094 * @since 7.2 095 */ 096 @Override 097 public boolean equals(Object obj) { 098 if (!(obj instanceof WidgetTypeDefinitionImpl)) { 099 return false; 100 } 101 if (obj == this) { 102 return true; 103 } 104 WidgetTypeDefinitionImpl w = (WidgetTypeDefinitionImpl) obj; 105 return new EqualsBuilder().append(name, w.name).append(aliases, w.aliases).append(handlerClassName, 106 w.handlerClassName).append(properties, w.properties).append(configuration, w.configuration).isEquals(); 107 } 108 109}