001/* 002 * (C) Copyright 2015 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.theme.styling.service.descriptors; 020 021import java.io.Serializable; 022 023import org.apache.commons.lang.builder.EqualsBuilder; 024import org.nuxeo.common.xmap.annotation.XContent; 025import org.nuxeo.common.xmap.annotation.XNode; 026import org.nuxeo.common.xmap.annotation.XObject; 027 028/** 029 * Descriptor for icon elements. 030 * 031 * @since 7.4 032 */ 033@XObject("icon") 034public class IconDescriptor implements Serializable { 035 036 private static final long serialVersionUID = 1L; 037 038 @XNode("@name") 039 protected String name; 040 041 protected String value; 042 043 @XNode("@sizes") 044 protected String sizes; 045 046 public String getName() { 047 return name; 048 } 049 050 public void setName(String name) { 051 this.name = name; 052 } 053 054 public String getValue() { 055 return value; 056 } 057 058 @XContent 059 public void setValue(String value) { 060 if (value != null) { 061 this.value = value.trim(); 062 } else { 063 this.value = value; 064 } 065 } 066 067 public String getSizes() { 068 return sizes; 069 } 070 071 public void setSizes(String sizes) { 072 this.sizes = sizes; 073 } 074 075 @Override 076 public IconDescriptor clone() { 077 IconDescriptor clone = new IconDescriptor(); 078 clone.name = name; 079 clone.value = value; 080 clone.sizes = sizes; 081 return clone; 082 } 083 084 @Override 085 public boolean equals(Object obj) { 086 if (!(obj instanceof IconDescriptor)) { 087 return false; 088 } 089 if (obj == this) { 090 return true; 091 } 092 IconDescriptor b = (IconDescriptor) obj; 093 return new EqualsBuilder().append(name, b.name).append(value, b.value).append(sizes, b.sizes).isEquals(); 094 } 095 096}