KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > plugins > fractal > context > ContentControllerContext


1 /*====================================================================
2
3 Objectweb Browser Framework
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Moroy.
23 Contributor(s): Romain Rouvoy______________________________________.
24
25 ---------------------------------------------------------------------
26  $Id: ContentControllerContext.java,v 1.1 2004/04/20 16:37:26 moroy Exp $
27 ====================================================================*/

28
29 package org.objectweb.util.browser.plugins.fractal.context;
30
31 import java.util.List JavaDoc;
32 import java.util.Vector JavaDoc;
33
34 import org.objectweb.fractal.api.Component;
35 import org.objectweb.fractal.api.Interface;
36 import org.objectweb.fractal.api.control.ContentController;
37 import org.objectweb.util.browser.api.Entry;
38 import org.objectweb.util.browser.core.naming.AbstractContext;
39 import org.objectweb.util.browser.core.naming.DefaultEntry;
40 import org.objectweb.util.browser.core.naming.DefaultName;
41 import org.objectweb.util.browser.plugins.fractal.FcBrowser;
42
43 /**
44  * ContentController interface navigation context.
45  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jerome Moroy</a>
46  * @version 0.2
47  */

48 public class ContentControllerContext
49      extends AbstractContext
50 {
51     // ==================================================================
52
//
53
// Internal state.
54
//
55
// ==================================================================
56

57     /** The content controller. */
58     private ContentController cc_ = null;
59
60     // ==================================================================
61
//
62
// No Constructors.
63
//
64
// ==================================================================
65

66     // ==================================================================
67
//
68
// Internal methods.
69
//
70
// ==================================================================
71

72     // ==================================================================
73
//
74
// Public methods for interface Context.
75
//
76
// ==================================================================
77

78     /**
79      * Returns an array containing the entries contained by the target context.
80      * @return A new array of entry.
81      */

82     public Entry[] getEntries() {
83         Object JavaDoc[] ir = cc_.getFcInternalInterfaces();
84         Component[] ci = cc_.getFcSubComponents();
85         List JavaDoc l = new Vector JavaDoc();
86         int cpt = 0;
87         // List of interfaces.
88
for (int i = 0; i < ir.length; i++) {
89             Interface itf = (Interface) ir[i];
90             l.add(new DefaultEntry(InterfaceWrapperFactory.singleton.getWrapper(itf),
91                                    new DefaultName(FcBrowser.getName(itf)),
92                                    this));
93             cpt = cpt + 1 ;
94         }
95         
96         // List of components.
97
for (int i = 0 ; i < ci.length ; i++){
98             l.add(new DefaultEntry(ci[i],
99                                    new DefaultName(FcBrowser.getName(ci[i])),
100                                    this));
101             cpt = cpt + 1 ;
102         }
103         return (Entry[])l.toArray(new Entry[0]);
104     }
105
106     // ==================================================================
107
//
108
// Additional public methods for Wrapper interface.
109
//
110
// ==================================================================
111

112     /**
113      * Fix the wrapped object.
114      * @param object The object to wrap.
115      */

116     public void setWrapped(Object JavaDoc object) {
117         cc_ = (ContentController) object;
118     }
119
120     /**
121      * Gets the wrapped object.
122      * @return The wrapped object.
123      */

124     public Object JavaDoc getWrapped() {
125         return cc_;
126     }
127 }
128
Popular Tags