1 /*
2 * @(#)$Id: SaveProjectAction.java 689 2009-07-22 00:10:27Z bsigner $
3 *
4 * Author : Michele Croci, mcroci@gmail.com
5 *
6 * Purpose : Saves the gesture mappings.
7 *
8 * -----------------------------------------------------------------------
9 *
10 * Revision Information:
11 *
12 * Date Who Reason
13 *
14 * Nov 15, 2007 crocimi Initial Release
15 * Jan 20, 2008 bsigner Cleanup
16 *
17 * -----------------------------------------------------------------------
18 *
19 * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20 *
21 * This software is the proprietary information of ETH Zurich.
22 * Use is subject to license terms.
23 *
24 */
25
26
27 package org.ximtec.igesture.geco.gui.action;
28
29 import java.awt.event.ActionEvent;
30
31 import org.sigtec.graphix.widget.BasicAction;
32 import org.ximtec.igesture.geco.gui.MainModel;
33 import org.ximtec.igesture.geco.gui.MainView;
34 import org.ximtec.igesture.geco.util.GuiBundleTool;
35 import org.ximtec.igesture.geco.xml.XMLGeco;
36
37
38 /**
39 * Saves the gesture mappings.
40 *
41 * @version 0.9, Nov 2007
42 * @author Michele Croci, mcroci@gmail.com
43 * @author Beat Signer, signer@inf.ethz.ch
44 */
45 public class SaveProjectAction extends BasicAction {
46
47 /**
48 * The key used to retrieve action details from the resource bundle.
49 */
50 public static final String KEY = "SaveProjectAction";
51
52 private MainView mainView;
53
54
55 public SaveProjectAction(MainView mainView) {
56 super(KEY, GuiBundleTool.getBundle());
57 this.mainView = mainView;
58 }
59
60
61 /**
62 * Save the mappings.
63 *
64 * @param event the event to be handled.
65 */
66 public void actionPerformed(ActionEvent event) {
67 save();
68 } // actionPerformed
69
70
71 public void save() {
72 MainModel model = mainView.getModel();
73 XMLGeco.exportProject(model.getMappings().values(), model.getGestureSet(),
74 model.getGestureSetFileName(), model.getProjectFile());
75 mainView.getModel().setNeedSave(false);
76 mainView.disableSaveButton(); // FIXME: work directly on button action
77 } // save
78
79 }