KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > gui > clipboard > model > Clipboard


1 /***
2  * FractalGUI: a graphical tool to edit Fractal component configurations.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: fractal@objectweb.org
20  *
21  * Authors: Eric Bruneton, Patrice Fauvel
22  */

23
24 package org.objectweb.fractal.gui.clipboard.model;
25
26 import org.objectweb.fractal.gui.model.Component;
27 import org.objectweb.fractal.gui.model.Factory;
28 import org.objectweb.fractal.gui.graph.model.GraphModel;
29
30 /**
31  * A model for the clipboard.
32  */

33
34 public interface Clipboard {
35
36   /**
37    * Returns <tt>true</tt> if the given component can be cut.
38    *
39    * @param srcComponent the component to be cut.
40    * @return <tt>true</tt> if the given component can be cut.
41    */

42
43   boolean canCut (Component srcComponent);
44
45   /**
46    * Cuts the given component.
47    *
48    * @param srcComponent the component to be cut.
49    * @param srcGraph the graph model that contains the coordinates of the
50    * component.
51    * @param srcFactory the factory to be used to create a clone of the given
52    * component. This clone is then stored in the clipboard.
53    */

54
55   void cut (Component srcComponent, GraphModel srcGraph, Factory srcFactory);
56
57   /**
58    * Returns <tt>true</tt> if the given component can be copied.
59    *
60    * @param srcComponent the component to be copied.
61    * @return <tt>true</tt> if the given component can be copie.
62    */

63
64   boolean canCopy (Component srcComponent);
65
66   /**
67    * Copies the given component.
68    *
69    * @param srcComponent the component to be copied.
70    * @param srcGraph the graph model that contains the coordinates of the
71    * component.
72    * @param srcFactory the factory to be used to create a clone of the given
73    * component. This clone is then stored in the clipboard.
74    */

75
76   void copy (Component srcComponent, GraphModel srcGraph, Factory srcFactory);
77
78   /**
79    * Returns <tt>true</tt> if the clipboard's content can be pasted into the
80    * given component.
81    *
82    * @param dstComponent the component into which the clipboard's content must
83    * be pasted.
84    * @return <tt>true</tt> if the clipboard is not empty, and if its content can
85    * be pasted into the given component.
86    */

87
88   boolean canPaste (Component dstComponent);
89
90   /**
91    * Pastes the clipboard's content into the given component.
92    *
93    * @param dstComponent the component into which the clipboard's content must
94    * be pasted.
95    * @param dstGraph the graph model into which the coordinates of the
96    * clipboard's component must be pasted.
97    * @param dstFactory the factory to be used to create a clone of the
98    * clipboard's content. This clone is then added as a sub component of
99    * the given component.
100    */

101
102   void paste (Component dstComponent, GraphModel dstGraph, Factory dstFactory);
103
104   /**
105    * Returns <tt>true</tt> if the clipboard's content can be pasted into the
106    * given component as a shared component.
107    *
108    * @param dstComponent the component into which the clipboard's content must
109    * be pasted as a shared component.
110    * @return <tt>true</tt> if the clipboard is not empty, and if its content can
111    * be pasted into the given component as a shared component.
112    */

113
114   boolean canPasteAsShared (Component dstComponent);
115
116   /**
117    * Pastes the clipboard's content into the given component, as a shared
118    * component.
119    *
120    * @param dstComponent the component into which the clipboard's content must
121    * be pasted.
122    * @param dstGraph the graph model into which the coordinates of the
123    * clipboard's component must be pasted.
124    * @param dstFactory the factory to be used to create a slave component of the
125    * clipboard's content. This slave component is then added as a sub
126    * component of the given component.
127    */

128
129   void pasteAsShared (
130     Component dstComponent,
131     GraphModel dstGraph,
132     Factory dstFactory);
133 }
134
Popular Tags