View Javadoc

1   /*
2    * @(#)$Id: ComponentHandler.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author       :   Michele Croci, mcroci@gmail.com
5    *
6    * Purpose      :  Provides access to available actions. Each action is
7    *                  instantiated only once.
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date             Who         Reason
14   *
15   * Nov 22, 2007     crocimi     Initial Release
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;
28  
29  import org.ximtec.igesture.geco.dialog.MappingDialog;
30  import org.ximtec.igesture.geco.dialog.NewProjectDialog;
31  import org.ximtec.igesture.geco.dialog.OptionsDialog;
32  
33  
34  
35  
36  
37  /**
38   * Provides access to available actions. Each action is instantiated only once.
39   * @version 0.9, Nov 22, 2007
40   * @author Michele Croci, mcroci@gmail.com
41   */
42  public class ComponentHandler {
43  
44     private MainView view;
45     private MappingDialog mappingDialog;
46     private NewProjectDialog newProjectDialog;
47     private OptionsDialog optionsDialog;
48  
49  
50  
51     /**
52      * Constructor.
53      */
54     public ComponentHandler(MainView view) {
55        this.view = view;
56     } // GecoActionHandler
57  
58  
59     /**
60      * Returns the dialog for mapping a gesture
61      */
62     public MappingDialog getMappingDialog() {
63        if (mappingDialog == null) {
64           mappingDialog = new MappingDialog(view);
65        }
66  
67        return mappingDialog;
68     } // getOpenProjectAction
69  
70  
71     /**
72      * Get the dialog for creating a new project
73      */
74     public NewProjectDialog getNewProjectDialog() {
75        if (newProjectDialog == null) {
76           newProjectDialog = new NewProjectDialog(view);
77        }
78  
79        return newProjectDialog;
80     } // getExitApplicationAction
81     
82     /**
83      * Get the dialog for creating a new project
84      */
85     public OptionsDialog getOptionsDialog() {
86        if (optionsDialog == null) {
87           optionsDialog = new OptionsDialog(view);
88        }
89  
90        return optionsDialog;
91     } // getExitApplicationAction
92    
93    
94  
95     
96  }