f@0
|
1 /*
|
f@0
|
2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
|
f@0
|
3
|
f@0
|
4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
|
f@0
|
5
|
f@0
|
6 This program is free software: you can redistribute it and/or modify
|
f@0
|
7 it under the terms of the GNU General Public License as published by
|
f@0
|
8 the Free Software Foundation, either version 3 of the License, or
|
f@0
|
9 (at your option) any later version.
|
f@0
|
10
|
f@0
|
11 This program is distributed in the hope that it will be useful,
|
f@0
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
f@0
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
f@0
|
14 GNU General Public License for more details.
|
f@0
|
15
|
f@0
|
16 You should have received a copy of the GNU General Public License
|
f@0
|
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
f@0
|
18 */
|
f@0
|
19
|
f@0
|
20 package uk.ac.qmul.eecs.ccmi.gui;
|
f@0
|
21
|
f@0
|
22 import java.awt.Frame;
|
f@0
|
23 import java.util.Collection;
|
f@0
|
24
|
f@0
|
25 /**
|
f@0
|
26 * A template editor is used to create new types of diagrams.
|
f@0
|
27 *
|
f@0
|
28 * Template editors are run in the Event Dispatching Thread and can therefore make use of <i>Swing</i> components
|
f@0
|
29 * to prompt the user with choices about the diagram to be created. The diagram created by
|
f@0
|
30 * a template editor is precisely a prototype.
|
f@0
|
31 * Such prototypes diagrams will then be used
|
f@0
|
32 * to create new diagram instances (the actual diagrams operated by the user) through clonation.
|
f@0
|
33 * When a diagram prototype is created, it's added in the File->new Diagram menu.
|
f@0
|
34 */
|
f@0
|
35 public interface TemplateEditor {
|
f@0
|
36
|
f@0
|
37 /**
|
f@0
|
38 * Creates a new {@code Diagram}
|
f@0
|
39 *
|
f@0
|
40 * @param frame the frame where the template editor is run
|
f@0
|
41 * @param existingTemplates the names of already existing templates. The creation
|
f@0
|
42 * of a new {@code Diagram} with an already existing name must be prevented in order
|
f@0
|
43 * to keep the consistency of the diagram templates.
|
f@0
|
44 *
|
f@0
|
45 * @return a new {@code Diagram} prototype
|
f@0
|
46 */
|
f@0
|
47 public Diagram createNew(Frame frame, Collection<String> existingTemplates);
|
f@0
|
48
|
f@0
|
49 /**
|
f@0
|
50 * Edits an existing {@code Diagram} prototype.
|
f@0
|
51 *
|
f@0
|
52 * @param frame the frame where the template editor is run
|
f@0
|
53 * @param existingTemplates the names of already existing templates. The creation
|
f@0
|
54 * of a new {@code Diagram} with an already existing name must be prevented in order
|
f@0
|
55 * to keep the consistency of the diagram templates.
|
f@0
|
56 * @param diagram the diagram to edit
|
f@0
|
57 * @return a changed version of {@code diagram}
|
f@0
|
58 */
|
f@0
|
59 public Diagram edit(Frame frame, Collection<String> existingTemplates, Diagram diagram);
|
f@0
|
60
|
f@0
|
61 /**
|
f@0
|
62 * Templates editor methods are going to be called by the user via a menu item. This method
|
f@0
|
63 * returns the label {@code createNew} menu item.
|
f@0
|
64 *
|
f@0
|
65 * @return a label for the menu item which triggers the creation of a new template through this
|
f@0
|
66 * template editor
|
f@0
|
67 */
|
f@0
|
68 public String getLabelForNew();
|
f@0
|
69
|
f@0
|
70 /**
|
f@0
|
71 * Templates editor methods are going to be called by the user via a menu item. This method
|
f@0
|
72 * returns the label {@code edit} menu item.
|
f@0
|
73 *
|
f@0
|
74 * @return a label for the menu item which triggers the editing of a new template through this
|
f@0
|
75 * template editor
|
f@0
|
76 */
|
f@0
|
77 public String getLabelForEdit();
|
f@0
|
78 }
|