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 com.extjs.gxt.ui.client.data.BeanModel;
21  
22  
23  /**
24   * Interface to represent a command. A command is an atomic modification of
25   * the SVG model. The modification can be done or undone. The command provides various descriptions
26   * of its effect on the model.
27   */
28  public interface ICommand {
29  	public static final String NAME = "name";
30  	public static final String DESCRIPTION = "description";
31  	/**
32  	 * Provides a detailed description of this command. The message 
33  	 * must describe precisely what the command does ("Group circle #11, square #207" or
34  	 * "Apply translate(24, 14) to circle #22")
35  	 */
36  	public String getDescription();
37  
38  	/**
39  	 * Applies the modification represented by this command to the model
40  	 */
41  	public void commit();
42  
43  	/**
44  	 * Restores the model to its previous state
45  	 */
46  	public void rollback();
47  	
48  	/**
49  	 * Returns the factory which manufactured this command
50  	 */
51  	public ICommandFactory getFactory();
52  	
53  	/**
54  	 * Returns a BeanModel wrapping this command
55  	 * @return a BeanModel wrapping this command
56  	 */
57  	public BeanModel asModel();
58  }