1 /* BasicSplitPaneUI.java
2 Copyright (C) 2003 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package javax
.swing
.plaf
.basic
;
40 import java
.awt
.Component
;
41 import java
.awt
.Dimension
;
42 import java
.awt
.Graphics
;
43 import java
.awt
.Insets
;
44 import java
.awt
.event
.ActionListener
;
45 import java
.awt
.event
.FocusListener
;
46 import java
.beans
.PropertyChangeListener
;
47 import javax
.swing
.JComponent
;
48 import javax
.swing
.JSplitPane
;
49 import javax
.swing
.KeyStroke
;
50 import javax
.swing
.plaf
.ComponentUI
;
51 import javax
.swing
.plaf
.SplitPaneUI
;
54 * FIXME: Stubbed to allow compiling other classes,
55 * no real implementation.
57 public class BasicSplitPaneUI
60 protected static final String NON_CONTINUOUS_DIVIDER
61 = "nonContinuousDivider";
63 protected static int KEYBOARD_DIVIDER_MOVE_OFFSET
;
65 protected JSplitPane splitPane
;
66 protected BasicSplitPaneDivider divider
;
67 protected PropertyChangeListener propertyChangeListener
;
68 protected FocusListener focusListener
;
69 protected int dividerSize
;
70 protected Component nonContinuousLayoutDivider
;
71 protected boolean draggingHW
;
72 protected int beginDragDividerLocation
;
73 protected KeyStroke upKey
;
74 protected KeyStroke downKey
;
75 protected KeyStroke leftKey
;
76 protected KeyStroke rightKey
;
77 protected KeyStroke homeKey
;
78 protected KeyStroke endKey
;
79 protected KeyStroke dividerResizeToggleKey
;
80 protected ActionListener keyboardUpLeftListener
;
81 protected ActionListener keyboardDownRightListener
;
82 protected ActionListener keyboardHomeListener
;
83 protected ActionListener keyboardEndListener
;
84 protected ActionListener keyboardResizeToggleListener
;
86 public static ComponentUI
createUI(JComponent c
)
88 BasicSplitPaneUI newUI
;
90 newUI
= new BasicSplitPaneUI();
95 public BasicSplitPaneUI()
97 propertyChangeListener
= createPropertyChangeListener();
98 focusListener
= createFocusListener();
101 public void installUI(JComponent c
)
105 protected void installDefaults()
109 protected void installListeners()
113 protected void installKeyboardListeners()
117 protected void installKeyboardActions()
121 public void uninstallUI(JComponent c
)
125 protected void uninstallDefaults()
129 protected void uninstallListeners()
133 protected void uninstallKeyboardActions()
137 protected PropertyChangeListener
createPropertyChangeListener()
142 protected FocusListener
createFocusListener()
147 protected ActionListener
createKeyboardUpLeftListener()
152 protected ActionListener
createKeyboardDownRightListener()
157 protected ActionListener
createKeyboardHomeListener()
162 protected ActionListener
createKeyboardEndListener()
167 protected ActionListener
createKeyboardResizeToggleListener()
172 public int getOrientation()
174 return splitPane
.getOrientation();
177 public void setOrientation(int orientation
)
182 public boolean isContinuousLayout()
187 public void setContinuousLayout(boolean b
)
191 public int getLastDragLocation()
196 public void setLastDragLocation(int l
)
201 public BasicSplitPaneDivider
getDivider()
207 protected Component
createDefaultNonContinuousLayoutDivider()
212 protected void setNonContinuousLayoutDivider(Component newDivider
)
214 setNonContinuousLayoutDivider(newDivider
, true /* false? */);
217 protected void setNonContinuousLayoutDivider(Component newDivider
,
218 boolean rememberSizes
)
220 nonContinuousLayoutDivider
= newDivider
;
223 public Component
getNonContinuousLayoutDivider()
225 return nonContinuousLayoutDivider
;
228 public JSplitPane
getSplitPane()
233 public BasicSplitPaneDivider
createDefaultDivider()
238 public void resetToPreferredSizes(JSplitPane jc
)
242 public void setDividerLocation(JSplitPane jc
, int location
)
246 public int getDividerLocation(JSplitPane jc
)
251 public int getMinimumDividerLocation(JSplitPane jc
)
256 public int getMaximumDividerLocation(JSplitPane jc
)
261 public void finishedPaintingChildren(JSplitPane jc
, Graphics g
)
265 public void paint(Graphics g
, JComponent jc
)
269 public Dimension
getPreferredSize(JComponent jc
)
274 public Dimension
getMinimumSize(JComponent jc
)
279 public Dimension
getMaximumSize(JComponent jc
)
284 public Insets
getInsets(JComponent jc
)
286 return new Insets(0, 0, 0, 0);
289 protected void resetLayoutManager()
293 protected void startDragging()
297 protected void dragDividerTo(int location
)
301 protected void finishDraggingTo(int location
)
305 protected int getDividerBorderSize()