KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > SDesktopPane


1 /*
2  * $Id: SDesktopPane.java,v 1.9 2005/05/26 14:22:10 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16
17 import org.wings.plaf.DesktopPaneCG;
18
19 /**
20  * A DesktopPane holds SInternalFrames.
21  *
22  * @author <a HREF="mailto:engels@mercatis.de">Holger Engels</a>
23  * @version $Revision: 1.9 $
24  */

25 public class SDesktopPane extends SContainer {
26     public SDesktopPane() {
27         super();
28     }
29
30     public void setLayout(SLayoutManager l) {}
31
32     /**
33      * @param component The internal frame to be added.
34      * @param constraints nothing
35      */

36     public SComponent addComponent(SComponent component,
37                                    Object JavaDoc constraints, int index) {
38         if (constraints == null)
39             constraints = component.getLowLevelEventId();
40         return super.addComponent(component, constraints, index);
41     }
42
43     /**
44      * Sets the position for the specified component.
45      *
46      * @param c the Component to set the layer for
47      * @param position an int specifying the position, where
48      * 0 is the topmost position and
49      * -1 is the bottommost position
50      */

51     public void setPosition(SComponent c, int position) {
52         getComponentList().remove(c);
53         getComponentList().add(position, c);
54     }
55
56     /**
57      * Returns the index of the specified Component.
58      * This is the absolute index, ignoring layers.
59      * Index numbers, like position numbers, have the topmost component
60      * at index zero. Larger numbers are closer to the bottom.
61      *
62      * @param c the Component to check
63      * @return an int specifying the component's index
64      */

65     public int getIndexOf(SComponent c) {
66         int i, count;
67
68         count = getComponentCount();
69         for (i = 0; i < count; i++) {
70             if (c == getComponent(i))
71                 return i;
72         }
73         return -1;
74     }
75
76     /**
77      * Get the position of the component.
78      *
79      * @param c the Component to check
80      * @return an int giving the component's position, where 0 is the
81      * topmost position and the highest index value = the count
82      * count of components minus 1
83      * @see #getIndexOf
84      */

85     public int getPosition(SComponent c) {
86         return getIndexOf(c);
87     }
88
89     public void setCG(DesktopPaneCG cg) {
90         super.setCG(cg);
91     }
92 }
93
94
95
Popular Tags