Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.api / src / main / java / org / gvsig / tools / swing / api / BasePropertiesPanelHelper.java @ 1256

History | View | Annotate | Download (2.11 KB)

1
package org.gvsig.tools.swing.api;
2

    
3
import java.awt.event.ActionEvent;
4
import java.awt.event.ActionListener;
5
import javax.swing.JComponent;
6
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
7

    
8
public class BasePropertiesPanelHelper implements BasePropertiesPanel {
9

    
10
    protected final JComponent component;
11
    protected final JComponent accept;
12
    protected boolean canceled;
13
    protected ActionListenerSupport listeners;
14

    
15
    public BasePropertiesPanelHelper(JComponent component, JComponent accept) {
16
        this.component = component;
17
        this.accept = accept;
18

    
19
    }
20

    
21
    public void closeWindow() {
22
        this.component.setVisible(false);
23
    }
24

    
25
    public void showWindow(String title, WindowManager.MODE mode) {
26
        WindowManager manager = ToolsSwingLocator.getWindowManager();
27
        manager.showWindow(this.component, title, mode);
28
    }
29

    
30
    public boolean isCanceled() {
31
        return this.canceled;
32
    }
33

    
34
    public void addActionListener(ActionListener listener) {
35
        this.listeners.addActionListener(listener);
36
    }
37

    
38
    public void removeActionListener(ActionListener listener) {
39
        this.listeners.removeActionListener(listener);
40
    }
41

    
42
    public void removeAllActionListener() {
43
        this.listeners.removeAllActionListener();
44
    }
45

    
46
    public void fireActionEvent(ActionEvent actionEvent) {
47
        this.listeners.fireActionEvent(actionEvent);
48
    }
49

    
50
    public void fireAcceptEvent() {
51
        this.listeners.fireActionEvent(
52
                new ActionEvent(this.component, ACTION_ACCEPT, "accept")
53
        );
54
    }
55

    
56
    public void fireCancelEvent() {
57
        this.listeners.fireActionEvent(
58
                new ActionEvent(this.component, ACTION_CANCEL, "cancel")
59
        );
60
    }
61

    
62
    public void setVisibleAceptCancel(boolean visible) {
63
        this.accept.setVisible(visible);
64
    }
65

    
66
    public boolean getVisibleAceptCancel() {
67
        return accept.isVisible();
68
    }
69

    
70
    public void clear() {
71
        // Do nothing
72
    }
73

    
74
    public JComponent asJComponent() {
75
        return this.component;
76
    }
77

    
78
    public void setCanceled(boolean canceled) {
79
        this.canceled = canceled;
80
    }
81
}