KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > gui > model > SharedInterface


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.model;
25
26 import java.util.List JavaDoc;
27
28 /**
29  * Abstract implementation of the {@link Interface} interface for interfaces of
30  * slave components.
31  */

32
33 public abstract class SharedInterface implements Interface {
34
35   /**
36    * The component that owns this interface.
37    */

38
39   protected SharedComponent owner;
40
41   /**
42    * The master interface of this slave interface.
43    */

44
45   protected Interface masterInterface;
46
47   /**
48    * Constructs a new interface for a slave component.
49    *
50    * @param owner a slave component.
51    * @param masterInterface the interface of the master component to which the
52    * constructed interface will correspond.
53    */

54
55   SharedInterface (
56     final SharedComponent owner,
57     final Interface masterInterface)
58   {
59     this.owner = owner;
60     this.masterInterface = masterInterface;
61   }
62
63   public Component getOwner () {
64     return owner;
65   }
66
67   public long getStatus () {
68     return masterInterface.getStatus();
69   }
70
71   public void setStatus (final long status) {
72     // does nothing
73
}
74
75   public String JavaDoc getName () {
76     return masterInterface.getName();
77   }
78
79   public void setName (final String JavaDoc name) {
80     masterInterface.setName(name);
81   }
82
83   public String JavaDoc getSignature () {
84     return masterInterface.getSignature();
85   }
86
87   public void setSignature (final String JavaDoc signature) {
88     masterInterface.setSignature(signature);
89   }
90
91   public boolean isInternal () {
92     return masterInterface.isInternal();
93   }
94
95   public boolean isOptional () {
96     return masterInterface.isOptional();
97   }
98
99   public void setIsOptional (final boolean isOptional) {
100     masterInterface.setIsOptional(isOptional);
101   }
102
103   public boolean isCollection () {
104     return masterInterface.isCollection();
105   }
106
107   public void setIsCollection (final boolean isCollection) {
108     masterInterface.setIsCollection(isCollection);
109   }
110
111   public Interface getMasterCollectionInterface () {
112     Interface i = masterInterface.getMasterCollectionInterface();
113     return i == null ? null : owner.getInterface(i);
114   }
115
116   public List JavaDoc getSlaveCollectionInterfaces () { // TODO
117
throw new RuntimeException JavaDoc("Internal error");
118   }
119
120   public Interface getComplementaryInterface () {
121     throw new RuntimeException JavaDoc("Internal error");
122   }
123
124   public Interface getMasterInterface () {
125     return masterInterface;
126   }
127 }
128
Popular Tags