View Javadoc
1   /**
2    * Copyright (C) 2007 Joern Krueger surething@users.sourceforge.net
3    * 
4    * This program is free software; you can redistribute
5    * it and/or modify it under the terms of the GNU General
6    * Public License version 2 as published by the Free Software
7    * Foundation.
8    *
9    * This program is distributed in the hope that it will be
10   * useful, but WITHOUT ANY WARRANTY; without even the implied
11   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12   * PURPOSE.  See the GNU General Public License for more
13   * details.
14   *
15   * You should have received a copy of the GNU General Public
16   * License along with this program; if not, write to the
17   * Free Software Foundation, Inc., 59 Temple Place,
18   * Suite 330, Boston, MA  02111-1307  USA
19   *
20   */
21  package de.surething.lda.actions;
22  
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  import de.surethingies.properties.ParameterFactory;
27  import de.surethingies.properties.TypedParameter;
28  
29  public class ActionFactory {
30  
31      // Singleton
32      private static ActionFactory instance;
33  
34      private ActionFactory() {
35      }
36  
37      public static ActionFactory instance() {
38          if (instance == null) {
39              instance = new ActionFactory();
40          }
41  
42          return instance;
43      }
44  
45      public List<ActionTask> getActions() {
46          List<ActionTask> result = new ArrayList<ActionTask>();
47  
48          List<TypedParameter> params = ParameterFactory.instance().get(MailActionSettings.DISPLAY_NAME.param());
49          for (TypedParameter param : params) {
50              result.add(new MailAction(param.getIdentifier()));
51          }
52  
53          // Check if Default is needed
54          if (result.size() <= 0) {
55              result.add(new MailAction("Mail Current Location"));
56          }
57  
58          return result;
59      }
60  }