Revision 2158 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/windowmanager/DefaultDialog.java

View differences:

DefaultDialog.java
32 32
    protected Image icon = null;
33 33
    protected Image image = null;
34 34
    private WindowManager windowManager = null;
35
    private boolean autoclose;
35 36

  
36 37
    @SuppressWarnings("OverridableMethodCallInConstructor")
37 38
    public DefaultDialog(JComponent contents, String title, String header, int buttons) {
......
40 41
        this.buttons = buttons;
41 42
        this.action = BUTTON_CANCEL;
42 43
        this.listeners = new DefaultActionListenerSupport();
44
        this.autoclose = true;
43 45
        this.initComponents();
44 46
        this.setButtons(buttons);
45 47
        this.setHeaderLabel(header);
......
67 69
            @Override
68 70
            public void actionPerformed(ActionEvent ae) {
69 71
                action = BUTTON_OK;
70
                setVisible(false);
72
                if (autoclose) {
73
                    setVisible(false);
74
                }
71 75
                fireActionEvent(new ActionEvent(DefaultDialog.this, BUTTON_OK, "ok"));
72 76
            }
73 77
        });
......
75 79
            @Override
76 80
            public void actionPerformed(ActionEvent ae) {
77 81
                action = BUTTON_CANCEL;
78
                setVisible(false);
82
                if (autoclose) {
83
                    setVisible(false);
84
                }
79 85
                fireActionEvent(new ActionEvent(DefaultDialog.this, BUTTON_CANCEL, "cancel"));
80 86
            }
81 87
        });
......
215 221
    public boolean isButtonEnabled(int button) {
216 222
        return this.getButton(button).isEnabled();
217 223
    }
224

  
225
    @Override
226
    public void setAutoclose(boolean autoclose) {
227
        this.autoclose = autoclose;
228
    }
229

  
230
    @Override
231
    public boolean isAutoclose() {
232
        return this.autoclose;
233
    }
218 234
}

Also available in: Unified diff