KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > instrument > client > DesktopPane


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

19
20 package org.apache.excalibur.instrument.client;
21
22 import javax.swing.JDesktopPane JavaDoc;
23 import javax.swing.JInternalFrame JavaDoc;
24
25 /**
26  * This class was build to make it possible to use some of the JDK1.3
27  * features work in 1.2.2. Taken from JDK1.3 source to make it work.
28  *
29  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
30  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:24 $
31  * @since 4.1
32  */

33 class DesktopPane extends JDesktopPane JavaDoc
34 {
35     private transient JInternalFrame JavaDoc selectedFrame = null;
36
37     /**
38      * Used to indicate you wish to see the entire contents of the item being
39      * dragged inside the desktop pane.
40      *
41      * @see #OUTLINE_DRAG_MODE
42      * @see #setDragMode
43      */

44     public static int LIVE_DRAG_MODE = 0;
45
46     /**
47      * Used to indicate you wish to see only an outline of the item being
48      * dragged inside the desktop pane.
49      *
50      * @see #LIVE_DRAG_MODE
51      * @see #setDragMode
52      */

53     public static int OUTLINE_DRAG_MODE = 1;
54
55     private int dragMode = LIVE_DRAG_MODE;
56
57     /**
58      * Set the "dragging style" used by the desktop pane. You may want to change
59      * to one mode or another for performance or aesthetic reasons.
60      *
61      * @param dragMode the style of drag to use for items in the Desktop
62      *
63      * @beaninfo
64      * bound: true
65      * description: Dragging style for internal frame children.
66      * enum: LIVE_DRAG_MODE JDesktopPane.LIVE_DRAG_MODE
67      * OUTLINE_DRAG_MODE JDesktopPane.OUTLINE_DRAG_MODE
68      */

69     public void setDragMode( int dragMode )
70     {
71         /* if (!(dragMode == LIVE_DRAG_MODE || dragMode == OUTLINE_DRAG_MODE)) {
72         throw new IllegalArgumentException("Not a valid drag mode");
73         }*/

74         firePropertyChange( "dragMode", this.dragMode, dragMode );
75         this.dragMode = dragMode;
76     }
77
78     /**
79      * Get the current "dragging style" used by the desktop pane.
80      * @see #setDragMode
81      */

82     public int getDragMode()
83     {
84         return dragMode;
85     }
86
87     /** return the currently active JInternalFrame in this JDesktopPane, or
88      * null if no JInternalFrame is currently active.
89      *
90      * @return the currently active JInternalFrame or null
91      * @since 1.3
92      */

93     public JInternalFrame JavaDoc getSelectedFrame()
94     {
95         return selectedFrame;
96     }
97
98     /** set the currently active JInternalFrame in this JDesktopPane.
99      *
100      * @param f The internal frame that's currently selected
101      * @since 1.3
102      */

103
104     public void setSelectedFrame( JInternalFrame JavaDoc f )
105     {
106         selectedFrame = f;
107     }
108 }
109
Popular Tags