View Javadoc

1   /**********************************************
2    * Copyright (C) 2011 Lukas Laag
3    * This file is part of svgreal.
4    * 
5    * svgreal is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * 
10   * svgreal is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with svgreal.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  package org.vectomatic.svg.edit.client.command;
19  
20  import java.util.Arrays;
21  
22  import org.vectomatic.svg.edit.client.command.add.AddCircleCommandFactory;
23  import org.vectomatic.svg.edit.client.command.add.AddEllipseCommandFactory;
24  import org.vectomatic.svg.edit.client.command.add.AddLineCommandFactory;
25  import org.vectomatic.svg.edit.client.command.add.AddPathCommandFactory;
26  import org.vectomatic.svg.edit.client.command.add.AddPolygonCommandFactory;
27  import org.vectomatic.svg.edit.client.command.add.AddPolylineCommandFactory;
28  import org.vectomatic.svg.edit.client.command.add.AddRectCommandFactory;
29  
30  import com.extjs.gxt.ui.client.store.ListStore;
31  
32  /**
33   * Class to list all the command factories available in the application
34   * @author laaglu
35   */
36  public class CommandFactories {
37  	public static ListStore<IFactoryInstantiator<?>> getAllFactoriesStore() {
38  		ListStore<IFactoryInstantiator<?>> store = new ListStore<IFactoryInstantiator<?>>();
39  		store.add(Arrays.asList(new IFactoryInstantiator<?>[] {
40  				AddCircleCommandFactory.INSTANTIATOR,
41  				AddRectCommandFactory.INSTANTIATOR,
42  				AddEllipseCommandFactory.INSTANTIATOR,
43  				AddLineCommandFactory.INSTANTIATOR,
44  				AddPolylineCommandFactory.INSTANTIATOR,
45  				AddPolygonCommandFactory.INSTANTIATOR,
46  				AddPathCommandFactory.INSTANTIATOR,
47  				EditGeometryCommandFactory.INSTANTIATOR,
48  				EditTransformCommandFactory.INSTANTIATOR,
49  				RemoveElementsCommandFactory.INSTANTIATOR,
50  				EditTitleCommandFactory.INSTANTIATOR,
51  				ShowPropertiesCommandFactory.INSTANTIATOR,
52  			}));
53  		return store;
54  	}
55  	
56  	private static DndCommandFactory dndCommandFactory = null;
57  	public static DndCommandFactory getDndCommandFactory() {
58  		if (dndCommandFactory == null) {
59  			dndCommandFactory = DndCommandFactory.INSTANTIATOR.create();
60  		}
61  		return dndCommandFactory;
62  	}
63  }