1 package org.simantics.modeling.ui.componentTypeEditor;
\r
3 import org.simantics.databoard.annotations.Optional;
\r
4 import org.simantics.databoard.type.NumberType;
\r
5 import org.simantics.db.Resource;
\r
6 import org.simantics.utils.strings.AlphanumComparator;
\r
8 public class ComponentTypeViewerPropertyInfo implements Comparable<ComponentTypeViewerPropertyInfo> {
\r
9 public Resource resource;
\r
12 public String defaultValue;
\r
13 public String label;
\r
14 public String description;
\r
16 public String expression;
\r
18 public String valid;
\r
20 public NumberType numberType;
\r
23 public boolean immutable;
\r
24 public Object sectionSpecificData;
\r
26 public ComponentTypeViewerPropertyInfo(Resource resource, String name, String type, String defaultValue, NumberType numberType, String unit, String label, String description, String expression, String valid, boolean immutable) {
\r
27 this.resource = resource;
\r
30 this.defaultValue = defaultValue;
\r
31 this.numberType = numberType;
\r
34 this.description = description;
\r
35 this.expression = expression;
\r
37 this.immutable = immutable;
\r
41 public int compareTo(ComponentTypeViewerPropertyInfo o) {
\r
42 return AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(name, (o.name));
\r
46 public int hashCode() {
\r
47 final int prime = 31;
\r
49 result = prime * result
\r
50 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
\r
51 result = prime * result
\r
52 + ((description == null) ? 0 : description.hashCode());
\r
53 result = prime * result
\r
54 + ((expression == null) ? 0 : expression.hashCode());
\r
55 result = prime * result + (immutable ? 1231 : 1237);
\r
56 result = prime * result + ((label == null) ? 0 : label.hashCode());
\r
57 result = prime * result + ((name == null) ? 0 : name.hashCode());
\r
58 result = prime * result
\r
59 + ((numberType == null) ? 0 : numberType.hashCode());
\r
60 result = prime * result
\r
61 + ((resource == null) ? 0 : resource.hashCode());
\r
62 result = prime * result + ((sectionSpecificData == null) ? 0
\r
63 : sectionSpecificData.hashCode());
\r
64 result = prime * result + ((type == null) ? 0 : type.hashCode());
\r
65 result = prime * result + ((unit == null) ? 0 : unit.hashCode());
\r
66 result = prime * result + ((valid == null) ? 0 : valid.hashCode());
\r
71 public boolean equals(Object obj) {
\r
76 if (getClass() != obj.getClass())
\r
78 ComponentTypeViewerPropertyInfo other = (ComponentTypeViewerPropertyInfo) obj;
\r
79 if (defaultValue == null) {
\r
80 if (other.defaultValue != null)
\r
82 } else if (!defaultValue.equals(other.defaultValue))
\r
84 if (description == null) {
\r
85 if (other.description != null)
\r
87 } else if (!description.equals(other.description))
\r
89 if (expression == null) {
\r
90 if (other.expression != null)
\r
92 } else if (!expression.equals(other.expression))
\r
94 if (immutable != other.immutable)
\r
96 if (label == null) {
\r
97 if (other.label != null)
\r
99 } else if (!label.equals(other.label))
\r
101 if (name == null) {
\r
102 if (other.name != null)
\r
104 } else if (!name.equals(other.name))
\r
106 if (numberType == null) {
\r
107 if (other.numberType != null)
\r
109 } else if (!numberType.equals(other.numberType))
\r
111 if (resource == null) {
\r
112 if (other.resource != null)
\r
114 } else if (!resource.equals(other.resource))
\r
116 if (sectionSpecificData == null) {
\r
117 if (other.sectionSpecificData != null)
\r
119 } else if (!sectionSpecificData.equals(other.sectionSpecificData))
\r
121 if (type == null) {
\r
122 if (other.type != null)
\r
124 } else if (!type.equals(other.type))
\r
126 if (unit == null) {
\r
127 if (other.unit != null)
\r
129 } else if (!unit.equals(other.unit))
\r
131 if (valid == null) {
\r
132 if (other.valid != null)
\r
134 } else if (!valid.equals(other.valid))
\r