OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 156
Line 38... Line 38...
38
        super(name);
38
        super(name);
39
    }
39
    }
40
 
40
 
41
    public void actionPerformed(ActionEvent e) {
41
    public void actionPerformed(ActionEvent e) {
42
        final JFrame frame = createFrame();
42
        final JFrame frame = createFrame();
-
 
43
        initFrame(frame, this, Configuration.getInstance(), this.mustLoadState);
-
 
44
        FrameUtil.show(frame);
-
 
45
    }
-
 
46
 
-
 
47
    protected static void initFrame(final JFrame frame, final Action action, final Configuration conf, final boolean mustLoadState) {
43
        frame.setIconImages(Gestion.getFrameIcon());
48
        frame.setIconImages(Gestion.getFrameIcon());
44
 
49
 
45
        final Object name = this.getValue(Action.NAME);
50
        final Object name = action.getValue(Action.NAME);
46
        WindowStateManager stateManager = null;
51
        WindowStateManager stateManager = null;
47
        if (name != null) {
52
        if (name != null) {
48
            stateManager = new WindowStateManager(frame, new File(Configuration.getInstance().getConfDir(), "Configuration" + File.separator + "Frame" + File.separator + name.toString() + ".xml"),
53
            stateManager = new WindowStateManager(frame, new File(conf.getConfDir(), "Configuration" + File.separator + "Frame" + File.separator + name.toString() + ".xml"),
49
                    true);
54
                    true);
50
        } else {
55
        } else {
51
            System.err.println("Warning: no action name for action " + this + ", unable to use a window state manager.");
56
            System.err.println("Warning: no action name for action " + action + ", unable to use a window state manager.");
52
        }
57
        }
53
 
58
 
54
        frame.pack();
59
        frame.pack();
55
 
60
 
56
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
61
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Line 61... Line 66...
61
        if (mustLoadState && stateManager != null) {
66
        if (mustLoadState && stateManager != null) {
62
            stateManager.loadState();
67
            stateManager.loadState();
63
        }
68
        }
64
 
69
 
65
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
70
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
66
        FrameUtil.show(frame);
-
 
67
 
-
 
68
    }
71
    }
69
 
72
 
70
    abstract public JFrame createFrame();
73
    abstract public JFrame createFrame();
71
}
74
}