1 /*
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.apple.laf;
27
28 import java.awt.*;
29 import java.beans.PropertyChangeEvent;
30
31 import javax.swing.*;
32 import javax.swing.border.Border;
33 import javax.swing.plaf.basic.BasicSplitPaneDivider;
34
35 import apple.laf.*;
36 import apple.laf.JRSUIConstants.State;
37
38 import com.apple.laf.AquaUtils.LazyKeyedSingleton;
39 import com.apple.laf.AquaUtils.RecyclableSingleton;
40 import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
41
42 public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
43 final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getSplitPaneDivider());
44
45 public AquaSplitPaneDividerUI(final AquaSplitPaneUI ui) {
46 super(ui);
47 setLayout(new AquaSplitPaneDividerUI.DividerLayout());
48 }
49
50 /**
51 * Property change event, presumably from the JSplitPane, will message
52 * updateOrientation if necessary.
53 */
54 public void propertyChange(final PropertyChangeEvent e) {
55 if (e.getSource() == splitPane) {
56 final String propName = e.getPropertyName();
57 if ("enabled".equals(propName)) {
58 final boolean enabled = splitPane.isEnabled();
59 if (leftButton != null) leftButton.setEnabled(enabled);
60 if (rightButton != null) rightButton.setEnabled(enabled);
61 } else if (JSplitPane.ORIENTATION_PROPERTY.equals(propName)) {
|
1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.apple.laf;
27
28 import java.awt.*;
29 import java.beans.PropertyChangeEvent;
30
31 import javax.swing.*;
32 import javax.swing.border.Border;
33 import javax.swing.plaf.basic.BasicSplitPaneDivider;
34
35 import apple.laf.*;
36 import apple.laf.JRSUIConstants.State;
37
38 import com.apple.laf.AquaUtils.LazyKeyedSingleton;
39 import com.apple.laf.AquaUtils.RecyclableSingleton;
40 import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
41
42 @SuppressWarnings("serial") // Superclass is not serializable across versions
43 public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
44 final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getSplitPaneDivider());
45
46 public AquaSplitPaneDividerUI(final AquaSplitPaneUI ui) {
47 super(ui);
48 setLayout(new AquaSplitPaneDividerUI.DividerLayout());
49 }
50
51 /**
52 * Property change event, presumably from the JSplitPane, will message
53 * updateOrientation if necessary.
54 */
55 public void propertyChange(final PropertyChangeEvent e) {
56 if (e.getSource() == splitPane) {
57 final String propName = e.getPropertyName();
58 if ("enabled".equals(propName)) {
59 final boolean enabled = splitPane.isEnabled();
60 if (leftButton != null) leftButton.setEnabled(enabled);
61 if (rightButton != null) rightButton.setEnabled(enabled);
62 } else if (JSplitPane.ORIENTATION_PROPERTY.equals(propName)) {
|