Revision 1567
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/reminder/DialogReminderManager.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.reminder; |
|
3 |
|
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
|
|
8 |
public interface DialogReminderManager extends Iterable<DialogReminder> { |
|
9 |
|
|
10 |
public boolean exists(String id); |
|
11 |
|
|
12 |
public DialogReminder get(String id); |
|
13 |
|
|
14 |
public DialogReminder add(String id); |
|
15 |
|
|
16 |
public DialogReminder add(String id, int value); |
|
17 |
|
|
18 |
@Override |
|
19 |
public Iterator<DialogReminder> iterator(); |
|
20 |
|
|
21 |
public List<DialogReminder> reminders(); |
|
22 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/reminder/DialogReminder.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.reminder; |
|
3 |
|
|
4 |
|
|
5 |
public interface DialogReminder { |
|
6 |
|
|
7 |
public String getId(); |
|
8 |
|
|
9 |
public Object getValue(); |
|
10 |
|
|
11 |
public void setValue(Object value); |
|
12 |
|
|
13 |
public void reset(); |
|
14 |
|
|
15 |
public boolean hasValue(); |
|
16 |
|
|
17 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilLocator.java | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
|
26 | 26 |
|
27 |
import org.gvsig.dialogremember.DialogRememberManager; |
|
28 | 27 |
import org.gvsig.filedialogchooser.FileDialogChooserManager; |
28 |
import org.gvsig.reminder.DialogReminderManager; |
|
29 | 29 |
import org.gvsig.svgsupport.SVGSupportManager; |
30 | 30 |
import org.gvsig.tools.locator.AbstractLocator; |
31 | 31 |
import org.gvsig.tools.locator.Locator; |
... | ... | |
46 | 46 |
public static final String FILE_DIALOG_CHOOSER_MANAGER_NAME = "org.gvsig.filedialogchooser.manager"; |
47 | 47 |
private static final String FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION = "File dialog chooser."; |
48 | 48 |
|
49 |
public static final String PLUGINS_DIALOGREMEMBERDER_MANAGER_NAME = "DialogReminderManager";
|
|
50 |
private static final String PLUGINS_DIALOGREMEMBER_MANAGER_DESCRIPTION = "DialogReminderManager";
|
|
51 |
|
|
49 |
public static final String PLUGINS_DIALOGREMINDER_MANAGER_NAME = "DialogReminderManager";
|
|
50 |
private static final String PLUGINS_DIALOGREMINDER_MANAGER_DESCRIPTION = "DialogReminderManager";
|
|
51 |
|
|
52 | 52 |
public static final String PLUGINS_SVGSUPPORT_MANAGER_NAME = "SVGSupportManager"; |
53 | 53 |
private static final String PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION = "SVGSupportManager"; |
54 |
|
|
54 |
|
|
55 | 55 |
private static final ToolsUtilLocator instance = new ToolsUtilLocator(); |
56 | 56 |
|
57 | 57 |
private ToolsUtilLocator() { |
... | ... | |
116 | 116 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
117 | 117 |
} |
118 | 118 |
|
119 |
public static DialogRememberManager getDialogRemembereManager() throws LocatorException { |
|
120 |
return (DialogRememberManager) getInstance().get(PLUGINS_DIALOGREMEMBERDER_MANAGER_NAME); |
|
119 |
//Dialog reminder |
|
120 |
public static DialogReminderManager getDialogReminderManager() throws LocatorException { |
|
121 |
return (DialogReminderManager) getInstance().get(PLUGINS_DIALOGREMINDER_MANAGER_NAME); |
|
121 | 122 |
} |
122 | 123 |
|
123 |
public static void registerDialogRememberManager(Class clazz) {
|
|
124 |
getInstance().register(PLUGINS_DIALOGREMEMBERDER_MANAGER_NAME, PLUGINS_DIALOGREMEMBER_MANAGER_DESCRIPTION,
|
|
124 |
public static void registerDialogReminderManager(Class clazz) {
|
|
125 |
getInstance().register(PLUGINS_DIALOGREMINDER_MANAGER_NAME, PLUGINS_DIALOGREMINDER_MANAGER_DESCRIPTION,
|
|
125 | 126 |
clazz); |
126 | 127 |
} |
127 | 128 |
|
128 |
public static void registerDefaultDialogRememberManager(Class clazz) {
|
|
129 |
getInstance().registerDefault(PLUGINS_SVGSUPPORT_MANAGER_NAME,
|
|
130 |
PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, clazz);
|
|
129 |
public static void registerDefaultDialogReminderManager(Class clazz) {
|
|
130 |
getInstance().registerDefault(PLUGINS_DIALOGREMINDER_MANAGER_NAME, PLUGINS_DIALOGREMINDER_MANAGER_DESCRIPTION,
|
|
131 |
clazz);
|
|
131 | 132 |
} |
132 | 133 |
|
134 |
//SVG support |
|
133 | 135 |
public static SVGSupportManager getSVGSupportManager() throws LocatorException { |
134 | 136 |
return (SVGSupportManager) getInstance().get(PLUGINS_SVGSUPPORT_MANAGER_NAME); |
135 | 137 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.impl/src/main/java/org/gvsig/tools/util/impl/ToolsUtilLibraryImpl.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.tools.util.impl; |
24 | 24 |
|
25 |
import org.gvsig.dialogremember.impl.DefaultDialogRememberManager;
|
|
25 |
import org.gvsig.dialogreminder.impl.DefaultDialogReminderManager;
|
|
26 | 26 |
import org.gvsig.filedialogchooser.impl.DefaultFileDialogChooserManager; |
27 | 27 |
import org.gvsig.svgsupport.DumbSVGSupportManager; |
28 | 28 |
import org.gvsig.tools.library.AbstractLibrary; |
... | ... | |
47 | 47 |
@Override |
48 | 48 |
protected void doInitialize() throws LibraryException { |
49 | 49 |
ToolsUtilLocator.registerDefaultToolsUtilManager(DefaultToolsUtilManager.class); |
50 |
ToolsUtilLocator.registerDefaultDialogRememberManager(DefaultDialogRememberManager.class);
|
|
50 |
ToolsUtilLocator.registerDefaultDialogReminderManager(DefaultDialogReminderManager.class);
|
|
51 | 51 |
ToolsUtilLocator.registerDefaultFileDialogChooserManager(DefaultFileDialogChooserManager.class); |
52 | 52 |
ToolsUtilLocator.registerDefaultSVGSupportManager(DumbSVGSupportManager.class); |
53 | 53 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.impl/src/main/java/org/gvsig/dialogreminder/impl/DefaultDialogReminder.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.dialogreminder.impl; |
|
3 |
|
|
4 |
import org.gvsig.reminder.DialogReminder; |
|
5 |
|
|
6 |
|
|
7 |
public class DefaultDialogReminder implements DialogReminder { |
|
8 |
private final String id; |
|
9 |
private Object value; |
|
10 |
|
|
11 |
public DefaultDialogReminder(String id) { |
|
12 |
this.id = id; |
|
13 |
this.value = null; |
|
14 |
} |
|
15 |
@Override |
|
16 |
public String getId() { |
|
17 |
return id; |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
public Object getValue() { |
|
22 |
return this.value; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void reset() { |
|
27 |
this.value = null; |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public boolean hasValue() { |
|
32 |
return this.value!=null; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public void setValue(Object value) { |
|
37 |
this.value = value; |
|
38 |
} |
|
39 |
|
|
40 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.impl/src/main/java/org/gvsig/dialogreminder/impl/DefaultDialogReminderManager.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.dialogreminder.impl; |
|
3 |
|
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Collections; |
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Iterator; |
|
8 |
import java.util.List; |
|
9 |
import java.util.Map; |
|
10 |
|
|
11 |
import org.gvsig.reminder.DialogReminder; |
|
12 |
import org.gvsig.reminder.DialogReminderManager; |
|
13 |
|
|
14 |
|
|
15 |
public class DefaultDialogReminderManager implements DialogReminderManager { |
|
16 |
|
|
17 |
private Map<String,DialogReminder> remembers; |
|
18 |
|
|
19 |
public DefaultDialogReminderManager() { |
|
20 |
this.remembers = new HashMap<>(); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
public boolean exists(String id) { |
|
25 |
return this.remembers.containsKey(id); |
|
26 |
} |
|
27 |
|
|
28 |
@Override |
|
29 |
public DialogReminder get(String id) { |
|
30 |
return this.remembers.get(id); |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public DialogReminder add(String id) { |
|
35 |
DialogReminder r = this.get(id); |
|
36 |
if( r == null ) { |
|
37 |
r = new DefaultDialogReminder(id); |
|
38 |
this.remembers.put(id, r); |
|
39 |
} |
|
40 |
return r; |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public DialogReminder add(String id, int value) { |
|
45 |
DialogReminder r = this.add(id); |
|
46 |
r.setValue(value); |
|
47 |
return r; |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public Iterator<DialogReminder> iterator() { |
|
52 |
return this.remembers.values().iterator(); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public List<DialogReminder> reminders() { |
|
57 |
return Collections.unmodifiableList(new ArrayList<>(this.remembers.values())); |
|
58 |
} |
|
59 |
|
|
60 |
} |
Also available in: Unified diff