KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > proxy > view > wrappers > AbstractWrapper


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20 package org.apache.directory.ldapstudio.proxy.view.wrappers;
21
22
23 import java.util.ArrayList JavaDoc;
24 import java.util.List JavaDoc;
25
26 import org.eclipse.swt.graphics.Image;
27
28
29 /**
30  * This abstract class implements the IWrapper interface and represents a Wrapper.
31  *
32  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
33  * @version $Rev$, $Date$
34  */

35 public abstract class AbstractWrapper implements IWrapper
36 {
37     /** The parent element */
38     protected IWrapper fParent;
39
40     /** The children */
41     protected List JavaDoc<IWrapper> fChildren;
42
43
44     /**
45      * Creates a new instance of Wrapper.
46      *
47      * @param parent
48      * the parent element
49      */

50     public AbstractWrapper( IWrapper parent )
51     {
52         fParent = parent;
53     }
54
55
56     /* (non-Javadoc)
57      * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getText()
58      */

59     public String JavaDoc getText()
60     {
61         return toString();
62     }
63
64
65     /* (non-Javadoc)
66      * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getImage()
67      */

68     public Image getImage()
69     {
70         return null;
71     }
72
73
74     /* (non-Javadoc)
75      * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getChildren()
76      */

77     public List JavaDoc<IWrapper> getChildren()
78     {
79         if ( fChildren != null )
80         {
81             return fChildren;
82         }
83
84         fChildren = new ArrayList JavaDoc<IWrapper>();
85         createChildren( fChildren );
86
87         return fChildren;
88     }
89
90
91     /* (non-Javadoc)
92      * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getParent()
93      */

94     public IWrapper getParent()
95     {
96         return fParent;
97     }
98
99
100     /* (non-Javadoc)
101      * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#hasChildren()
102      */

103     public boolean hasChildren()
104     {
105         return true;
106     }
107
108
109     /**
110      * Creates the children of the elements and adds them to the given children List
111      *
112      * @param children
113      * the children List to add children to
114      */

115     protected abstract void createChildren( List JavaDoc<IWrapper> children );
116 }
117
Popular Tags