01: package org.osbl.client.item;
02:
03: import org.osbl.client.action.ActionRegistry;
04: import org.osbl.item.AbstractItemCollector;
05:
06: import javax.swing.*;
07: import java.util.*;
08:
09: public class ActionLocalizationCollector extends AbstractItemCollector {
10: List<String> items;
11:
12: public ActionLocalizationCollector() {
13: }
14:
15: public Collection<String> getItems() {
16: if (items == null) {
17: Collection<Action> actions = ActionRegistry.getActions();
18: items = new ArrayList<String>(actions.size());
19:
20: for (Action action : actions) {
21: items.add((String) action
22: .getValue(Action.ACTION_COMMAND_KEY));
23: }
24: }
25: return items;
26: }
27:
28: public void refresh() {
29: items = null;
30: }
31:
32: public int hashCode() {
33: return getClass().hashCode();
34: }
35:
36: public boolean equals(Object obj) {
37: return obj != null && getClass().equals(obj.getClass());
38: }
39: }
|