1:
31:
32: package ;
33:
34: import ;
35: import ;
36:
37:
42: public class ActionCategory implements Comparable
43: {
44: private String resourceBase;
45: private String resourcePrefix;
46: private int position;
47: private ResourceBundleSupport resources;
48: private String name;
49:
50: public ActionCategory()
51: {
52: name = "";
53: }
54:
55: public void initialize(final SwingGuiContext context)
56: {
57: resources = new ResourceBundleSupport
58: (context.getLocale(), resourceBase);
59: }
60:
61: public String getResourceBase()
62: {
63: return resourceBase;
64: }
65:
66: public void setResourceBase(final String resourceBase)
67: {
68: this.resourceBase = resourceBase;
69: }
70:
71: public String getResourcePrefix()
72: {
73: return resourcePrefix;
74: }
75:
76: public void setResourcePrefix(final String resourcePrefix)
77: {
78: this.resourcePrefix = resourcePrefix;
79: }
80:
81: public int getPosition()
82: {
83: return position;
84: }
85:
86: public void setPosition(final int position)
87: {
88: this.position = position;
89: }
90:
91: public String getName()
92: {
93: return name;
94: }
95:
96: public void setName(final String name)
97: {
98: if (name == null)
99: {
100: throw new NullPointerException();
101: }
102: this.name = name;
103: }
104:
105:
110: public String getDisplayName()
111: {
112: return resources.getString(resourcePrefix + "name");
113: }
114:
115:
120: public String getShortDescription()
121: {
122: return resources.getString(resourcePrefix + "description");
123: }
124:
125:
130: public Integer getMnemonicKey()
131: {
132: return resources.getOptionalMnemonic(resourcePrefix + "mnemonic");
133: }
134:
135: public boolean equals(final Object o)
136: {
137: if (this == o)
138: {
139: return true;
140: }
141: if (o == null || getClass() != o.getClass())
142: {
143: return false;
144: }
145:
146: final ActionCategory that = (ActionCategory) o;
147:
148: if (position != that.position)
149: {
150: return false;
151: }
152: if (!name.equals(that.name))
153: {
154: return false;
155: }
156:
157: return true;
158: }
159:
160: public int hashCode()
161: {
162: int result = position;
163: result = 29 * result + name.hashCode();
164: return result;
165: }
166:
167:
179: public int compareTo(final Object o)
180: {
181: final ActionCategory other = (ActionCategory) o;
182: if (position < other.position)
183: {
184: return -1;
185: }
186: if (position > other.position)
187: {
188: return 1;
189: }
190: return name.compareTo(other.name);
191: }
192:
193: public String toString()
194: {
195: return "ActionCategory{" +
196: "name='" + name + '\'' +
197: ", position=" + position +
198: ", resourceBase='" + resourceBase + '\'' +
199: ", resourcePrefix='" + resourcePrefix + '\'' +
200: ", resources=" + resources +
201: '}';
202: }
203: }