~ubuntu-branches/debian/stretch/insubstantial/stretch

« back to all changes in this revision

Viewing changes to substance/src/main/java/org/pushingpixels/substance/internal/utils/SubstanceSplitPaneDivider.java

  • Committer: Package Import Robot
  • Author(s): Felix Natter
  • Date: 2016-01-18 20:58:45 UTC
  • Revision ID: package-import@ubuntu.com-20160118205845-crbmrkda61qsi5qa
Tags: upstream-7.3+dfsg2
ImportĀ upstreamĀ versionĀ 7.3+dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2005-2010 Substance Kirill Grouchnikov. All Rights Reserved.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without
 
5
 * modification, are permitted provided that the following conditions are met:
 
6
 *
 
7
 *  o Redistributions of source code must retain the above copyright notice,
 
8
 *    this list of conditions and the following disclaimer.
 
9
 *
 
10
 *  o Redistributions in binary form must reproduce the above copyright notice,
 
11
 *    this list of conditions and the following disclaimer in the documentation
 
12
 *    and/or other materials provided with the distribution.
 
13
 *
 
14
 *  o Neither the name of Substance Kirill Grouchnikov nor the names of
 
15
 *    its contributors may be used to endorse or promote products derived
 
16
 *    from this software without specific prior written permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
19
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 
20
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
21
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 
22
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
23
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
24
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 
25
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
26
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 
27
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 
28
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
29
 */
 
30
package org.pushingpixels.substance.internal.utils;
 
31
 
 
32
import java.awt.*;
 
33
import java.awt.event.MouseEvent;
 
34
import java.beans.PropertyChangeEvent;
 
35
import java.beans.PropertyChangeListener;
 
36
import java.util.Map;
 
37
 
 
38
import javax.swing.*;
 
39
import javax.swing.border.EmptyBorder;
 
40
import javax.swing.plaf.basic.BasicSplitPaneDivider;
 
41
import javax.swing.plaf.basic.BasicSplitPaneUI;
 
42
 
 
43
import org.pushingpixels.lafwidget.LafWidgetUtilities;
 
44
import org.pushingpixels.substance.api.*;
 
45
import org.pushingpixels.substance.internal.animation.StateTransitionTracker;
 
46
import org.pushingpixels.substance.internal.animation.TransitionAwareUI;
 
47
import org.pushingpixels.substance.internal.animation.StateTransitionTracker.ModelStateInfo;
 
48
import org.pushingpixels.substance.internal.painter.BackgroundPaintingUtils;
 
49
import org.pushingpixels.substance.internal.ui.SubstanceSplitPaneUI;
 
50
import org.pushingpixels.substance.internal.utils.icon.TransitionAwareIcon;
 
51
 
 
52
/**
 
53
 * Split pane divider in <code>Substance</code> look and feel.
 
54
 * 
 
55
 * @author Kirill Grouchnikov
 
56
 */
 
57
public class SubstanceSplitPaneDivider extends BasicSplitPaneDivider implements
 
58
                TransitionAwareUI {
 
59
        /**
 
60
         * Listener for transition animations.
 
61
         */
 
62
        private RolloverControlListener substanceRolloverListener;
 
63
 
 
64
        protected StateTransitionTracker stateTransitionTracker;
 
65
 
 
66
        /**
 
67
         * Listener on property change events.
 
68
         */
 
69
        private PropertyChangeListener substancePropertyChangeListener;
 
70
        /**
 
71
         * Surrogate button model for tracking the thumb transitions.
 
72
         */
 
73
        private ButtonModel gripModel;
 
74
 
 
75
        /**
 
76
         * Simple constructor.
 
77
         * 
 
78
         * @param ui
 
79
         *            Associated UI.
 
80
         */
 
81
        public SubstanceSplitPaneDivider(SubstanceSplitPaneUI ui) {
 
82
                super(ui);
 
83
                this.setLayout(new SubstanceDividerLayout());
 
84
        }
 
85
 
 
86
        @Override
 
87
        public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
 
88
                if (this.splitPane != null) {
 
89
                        // fix for defect 358 - multiple listeners were installed
 
90
                        // on the same split pane
 
91
                        this.uninstall();
 
92
                }
 
93
 
 
94
                if (newUI != null) {
 
95
                        // installing
 
96
                        this.splitPane = newUI.getSplitPane();
 
97
 
 
98
                        this.gripModel = new DefaultButtonModel();
 
99
                        this.gripModel.setArmed(false);
 
100
                        this.gripModel.setSelected(false);
 
101
                        this.gripModel.setPressed(false);
 
102
                        this.gripModel.setRollover(false);
 
103
                        this.gripModel.setEnabled(this.splitPane.isEnabled());
 
104
 
 
105
                        this.stateTransitionTracker = new StateTransitionTracker(
 
106
                                        this.splitPane, this.gripModel);
 
107
 
 
108
                        // fix for defect 109 - memory leak on changing skin
 
109
                        this.substanceRolloverListener = new RolloverControlListener(this,
 
110
                                        this.gripModel);
 
111
                        this.addMouseListener(this.substanceRolloverListener);
 
112
                        this.addMouseMotionListener(this.substanceRolloverListener);
 
113
 
 
114
                        this.substancePropertyChangeListener = new PropertyChangeListener() {
 
115
                                @Override
 
116
                public void propertyChange(PropertyChangeEvent evt) {
 
117
                                        if ("enabled".equals(evt.getPropertyName())) {
 
118
                                                boolean isEnabled = splitPane.isEnabled();
 
119
                                                gripModel.setEnabled(isEnabled);
 
120
                                                if (leftButton != null)
 
121
                                                        leftButton.setEnabled(isEnabled);
 
122
                                                if (rightButton != null)
 
123
                                                        rightButton.setEnabled(isEnabled);
 
124
                                                setEnabled(isEnabled);
 
125
                                        }
 
126
                                }
 
127
                        };
 
128
                        // System.out.println("Registering " + this.hashCode() + ":"
 
129
                        // + this.substancePropertyChangeListener.hashCode() + " on "
 
130
                        // + this.splitPane.hashCode());
 
131
                        this.splitPane
 
132
                                        .addPropertyChangeListener(this.substancePropertyChangeListener);
 
133
 
 
134
                        this.stateTransitionTracker.registerModelListeners();
 
135
                } else {
 
136
                        uninstall();
 
137
                }
 
138
                super.setBasicSplitPaneUI(newUI);
 
139
        }
 
140
 
 
141
        /**
 
142
         * Uninstalls this divider.
 
143
         */
 
144
        private void uninstall() {
 
145
                // uninstalling
 
146
                // fix for defect 109 - memory leak on changing skin
 
147
                this.removeMouseListener(this.substanceRolloverListener);
 
148
                this.removeMouseMotionListener(this.substanceRolloverListener);
 
149
                this.substanceRolloverListener = null;
 
150
 
 
151
                if (this.substancePropertyChangeListener != null) {
 
152
                        // System.out.println("Unregistering " + this.hashCode() + ":"
 
153
                        // + this.substancePropertyChangeListener.hashCode()
 
154
                        // + " from " + this.splitPane.hashCode());
 
155
                        this.splitPane
 
156
                                        .removePropertyChangeListener(this.substancePropertyChangeListener);
 
157
                        this.substancePropertyChangeListener = null;
 
158
                }
 
159
 
 
160
                this.stateTransitionTracker.unregisterModelListeners();
 
161
        }
 
162
 
 
163
        /*
 
164
         * (non-Javadoc)
 
165
         * 
 
166
         * @see java.awt.Component#paint(java.awt.Graphics)
 
167
         */
 
168
        @Override
 
169
        public void paint(Graphics g) {
 
170
                if (SubstanceCoreUtilities.hasFlatAppearance(this.splitPane, true)) {
 
171
                        BackgroundPaintingUtils.updateIfOpaque(g, this.splitPane);
 
172
                }
 
173
 
 
174
                Graphics2D graphics = (Graphics2D) g.create();
 
175
 
 
176
                ModelStateInfo modelStateInfo = this.stateTransitionTracker
 
177
                                .getModelStateInfo();
 
178
                ComponentState currState = modelStateInfo.getCurrModelState();
 
179
                Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
 
180
                                .getStateContributionMap();
 
181
 
 
182
                float alpha = SubstanceColorSchemeUtilities.getAlpha(this.splitPane,
 
183
                                currState);
 
184
 
 
185
                // compute the grip handle dimension
 
186
                int minSizeForGripPresence = SubstanceSizeUtils.getAdjustedSize(
 
187
                                SubstanceSizeUtils.getComponentFontSize(this), 30, 1, 2, false);
 
188
                int maxGripSize = SubstanceSizeUtils.getAdjustedSize(SubstanceSizeUtils
 
189
                                .getComponentFontSize(this), 40, 1, 3, false);
 
190
                if (this.splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
 
191
                        int thumbHeight = this.getHeight();
 
192
                        if (thumbHeight >= minSizeForGripPresence) {
 
193
                                int gripHeight = thumbHeight / 4;
 
194
                                if (gripHeight > maxGripSize)
 
195
                                        gripHeight = maxGripSize;
 
196
 
 
197
                                int thumbWidth = this.getWidth();
 
198
 
 
199
                                int gripX = 0;
 
200
                                int gripY = (thumbHeight - gripHeight) / 2;
 
201
 
 
202
                                // draw the grip bumps
 
203
                                for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
 
204
                                                .entrySet()) {
 
205
                                        float contribution = activeEntry.getValue()
 
206
                                                        .getContribution();
 
207
                                        if (contribution == 0.0f)
 
208
                                                continue;
 
209
 
 
210
                                        ComponentState activeState = activeEntry.getKey();
 
211
                                        graphics.setComposite(LafWidgetUtilities.getAlphaComposite(
 
212
                                                        this.splitPane, alpha * contribution, g));
 
213
                                        SubstanceImageCreator.paintSplitDividerBumpImage(graphics,
 
214
                                                        this, gripX, gripY, thumbWidth, gripHeight, false,
 
215
                                                        SubstanceColorSchemeUtilities.getColorScheme(this,
 
216
                                                                        ColorSchemeAssociationKind.MARK,
 
217
                                                                        activeState));
 
218
                                }
 
219
                        }
 
220
                } else {
 
221
                        int thumbWidth = this.getWidth();
 
222
                        if (thumbWidth >= minSizeForGripPresence) {
 
223
                                int gripWidth = thumbWidth / 4;
 
224
                                if (gripWidth > maxGripSize)
 
225
                                        gripWidth = maxGripSize;
 
226
 
 
227
                                int thumbHeight = this.getHeight();
 
228
                                // int gripHeight = thumbHeight * 2 / 3;
 
229
 
 
230
                                int gripX = (thumbWidth - gripWidth) / 2;
 
231
                                int gripY = 1;
 
232
 
 
233
                                // draw the grip bumps
 
234
                                for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
 
235
                                                .entrySet()) {
 
236
                                        float contribution = activeEntry.getValue()
 
237
                                                        .getContribution();
 
238
                                        if (contribution == 0.0f)
 
239
                                                continue;
 
240
 
 
241
                                        ComponentState activeState = activeEntry.getKey();
 
242
                                        graphics.setComposite(LafWidgetUtilities.getAlphaComposite(
 
243
                                                        this.splitPane, alpha * contribution, g));
 
244
                                        SubstanceImageCreator.paintSplitDividerBumpImage(graphics,
 
245
                                                        this, gripX, gripY, gripWidth, thumbHeight, true,
 
246
                                                        SubstanceColorSchemeUtilities.getColorScheme(this,
 
247
                                                                        ColorSchemeAssociationKind.MARK,
 
248
                                                                        activeState));
 
249
                                }
 
250
                        }
 
251
                }
 
252
 
 
253
                graphics.dispose();
 
254
 
 
255
                super.paint(g);
 
256
        }
 
257
 
 
258
        /*
 
259
         * (non-Javadoc)
 
260
         * 
 
261
         * @see
 
262
         * javax.swing.plaf.basic.BasicSplitPaneDivider#createLeftOneTouchButton()
 
263
         */
 
264
        @Override
 
265
        protected JButton createLeftOneTouchButton() {
 
266
                JButton oneTouchButton = new JButton() {
 
267
                        // Don't want the button to participate in focus traversable.
 
268
                        @Override
 
269
                        public boolean isFocusable() {
 
270
                                return false;
 
271
                        }
 
272
                };
 
273
                Icon verticalSplit = new TransitionAwareIcon(oneTouchButton,
 
274
                                new TransitionAwareIcon.Delegate() {
 
275
                                        @Override
 
276
                    public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
 
277
                                                int fontSize = SubstanceSizeUtils
 
278
                                                                .getComponentFontSize(splitPane);
 
279
                                                return SubstanceImageCreator.getArrowIcon(
 
280
                                                                SubstanceSizeUtils
 
281
                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
282
                                                                SubstanceSizeUtils
 
283
                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
284
                                                                SubstanceSizeUtils
 
285
                                                                                .getArrowStrokeWidth(fontSize),
 
286
                                                                SwingConstants.NORTH, scheme);
 
287
                                        }
 
288
                                }, "substance.splitPane.left.vertical");
 
289
                Icon horizontalSplit = new TransitionAwareIcon(oneTouchButton,
 
290
                                new TransitionAwareIcon.Delegate() {
 
291
                                        @Override
 
292
                    public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
 
293
                                                int fontSize = SubstanceSizeUtils
 
294
                                                                .getComponentFontSize(splitPane);
 
295
                                                return SubstanceImageCreator.getArrowIcon(
 
296
                                                                SubstanceSizeUtils
 
297
                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
298
                                                                SubstanceSizeUtils
 
299
                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
300
                                                                SubstanceSizeUtils
 
301
                                                                                .getArrowStrokeWidth(fontSize),
 
302
                                                                SwingConstants.WEST, scheme);
 
303
                                        }
 
304
                                }, "substance.splitPane.left.horizontal");
 
305
                oneTouchButton
 
306
                                .setIcon(this.splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT ? verticalSplit
 
307
                                                : horizontalSplit);
 
308
 
 
309
                oneTouchButton.putClientProperty(
 
310
                                SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
 
311
                // fix for issue 281 - set empty border so that the arrow
 
312
                // icon is not cropped
 
313
                oneTouchButton.setBorder(new EmptyBorder(0, 0, 0, 0));
 
314
 
 
315
                oneTouchButton.setRequestFocusEnabled(false);
 
316
                oneTouchButton
 
317
                                .setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
 
318
                oneTouchButton.setFocusPainted(false);
 
319
                oneTouchButton.setBorderPainted(false);
 
320
                return oneTouchButton;
 
321
        }
 
322
 
 
323
        /*
 
324
         * (non-Javadoc)
 
325
         * 
 
326
         * @see
 
327
         * javax.swing.plaf.basic.BasicSplitPaneDivider#createRightOneTouchButton()
 
328
         */
 
329
        @Override
 
330
        protected JButton createRightOneTouchButton() {
 
331
                JButton oneTouchButton = new JButton() {
 
332
                        // Don't want the button to participate in focus traversable.
 
333
                        @Override
 
334
                        public boolean isFocusable() {
 
335
                                return false;
 
336
                        }
 
337
                };
 
338
                Icon verticalSplit = new TransitionAwareIcon(oneTouchButton,
 
339
                                new TransitionAwareIcon.Delegate() {
 
340
                                        @Override
 
341
                    public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
 
342
                                                int fontSize = SubstanceSizeUtils
 
343
                                                                .getComponentFontSize(splitPane);
 
344
                                                return SubstanceImageCreator.getArrowIcon(
 
345
                                                                SubstanceSizeUtils
 
346
                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
347
                                                                SubstanceSizeUtils
 
348
                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
349
                                                                SubstanceSizeUtils
 
350
                                                                                .getArrowStrokeWidth(fontSize),
 
351
                                                                SwingConstants.SOUTH, scheme);
 
352
                                        }
 
353
                                }, "substance.splitPane.right.vertical");
 
354
                Icon horizontalSplit = new TransitionAwareIcon(oneTouchButton,
 
355
                                new TransitionAwareIcon.Delegate() {
 
356
                                        @Override
 
357
                    public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
 
358
                                                int fontSize = SubstanceSizeUtils
 
359
                                                                .getComponentFontSize(splitPane);
 
360
                                                return SubstanceImageCreator.getArrowIcon(
 
361
                                                                SubstanceSizeUtils
 
362
                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
363
                                                                SubstanceSizeUtils
 
364
                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
365
                                                                SubstanceSizeUtils
 
366
                                                                                .getArrowStrokeWidth(fontSize),
 
367
                                                                SwingConstants.EAST, scheme);
 
368
                                        }
 
369
                                }, "substance.splitPane.right.horizontal");
 
370
                oneTouchButton
 
371
                                .setIcon(this.splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT ? verticalSplit
 
372
                                                : horizontalSplit);
 
373
 
 
374
                oneTouchButton.putClientProperty(
 
375
                                SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
 
376
                // fix for issue 281 - set empty border so that the arrow
 
377
                // icon is not cropped
 
378
                oneTouchButton.setBorder(new EmptyBorder(0, 0, 0, 0));
 
379
 
 
380
                oneTouchButton
 
381
                                .setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
 
382
                oneTouchButton.setFocusPainted(false);
 
383
                oneTouchButton.setBorderPainted(false);
 
384
                oneTouchButton.setRequestFocusEnabled(false);
 
385
                // b.setOpaque(false);
 
386
                return oneTouchButton;
 
387
        }
 
388
 
 
389
        /**
 
390
         * Updates the one-touch buttons.
 
391
         * 
 
392
         * @param orientation
 
393
         *            Split pane orientation.
 
394
         */
 
395
        public void updateOneTouchButtons(int orientation) {
 
396
                if (orientation == JSplitPane.VERTICAL_SPLIT) {
 
397
                        if (this.leftButton != null) {
 
398
                                this.leftButton.setIcon(new TransitionAwareIcon(
 
399
                                                this.leftButton, new TransitionAwareIcon.Delegate() {
 
400
                                                        @Override
 
401
                            public Icon getColorSchemeIcon(
 
402
                                                                        SubstanceColorScheme scheme) {
 
403
                                                                int fontSize = SubstanceSizeUtils
 
404
                                                                                .getComponentFontSize(splitPane);
 
405
                                                                return SubstanceImageCreator
 
406
                                                                                .getArrowIcon(
 
407
                                                                                                SubstanceSizeUtils
 
408
                                                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
409
                                                                                                SubstanceSizeUtils
 
410
                                                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
411
                                                                                                SubstanceSizeUtils
 
412
                                                                                                                .getArrowStrokeWidth(fontSize),
 
413
                                                                                                SwingConstants.NORTH, scheme);
 
414
                                                        }
 
415
                                                }, "substance.splitPane.left.vertical"));
 
416
                        }
 
417
                        if (this.rightButton != null) {
 
418
                                this.rightButton.setIcon(new TransitionAwareIcon(
 
419
                                                this.rightButton, new TransitionAwareIcon.Delegate() {
 
420
                                                        @Override
 
421
                            public Icon getColorSchemeIcon(
 
422
                                                                        SubstanceColorScheme scheme) {
 
423
                                                                int fontSize = SubstanceSizeUtils
 
424
                                                                                .getComponentFontSize(splitPane);
 
425
                                                                return SubstanceImageCreator
 
426
                                                                                .getArrowIcon(
 
427
                                                                                                SubstanceSizeUtils
 
428
                                                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
429
                                                                                                SubstanceSizeUtils
 
430
                                                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
431
                                                                                                SubstanceSizeUtils
 
432
                                                                                                                .getArrowStrokeWidth(fontSize),
 
433
                                                                                                SwingConstants.SOUTH, scheme);
 
434
                                                        }
 
435
                                                }, "substance.splitPane.right.vertical"));
 
436
                        }
 
437
                } else {
 
438
                        if (this.leftButton != null) {
 
439
                                this.leftButton.setIcon(new TransitionAwareIcon(
 
440
                                                this.leftButton, new TransitionAwareIcon.Delegate() {
 
441
                                                        @Override
 
442
                            public Icon getColorSchemeIcon(
 
443
                                                                        SubstanceColorScheme scheme) {
 
444
                                                                int fontSize = SubstanceSizeUtils
 
445
                                                                                .getComponentFontSize(splitPane);
 
446
                                                                return SubstanceImageCreator
 
447
                                                                                .getArrowIcon(
 
448
                                                                                                SubstanceSizeUtils
 
449
                                                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
450
                                                                                                SubstanceSizeUtils
 
451
                                                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
452
                                                                                                SubstanceSizeUtils
 
453
                                                                                                                .getArrowStrokeWidth(fontSize),
 
454
                                                                                                SwingConstants.WEST, scheme);
 
455
                                                        }
 
456
                                                }, "substance.splitPane.left.horizontal"));
 
457
                        }
 
458
                        if (this.rightButton != null) {
 
459
                                this.rightButton.setIcon(new TransitionAwareIcon(
 
460
                                                this.rightButton, new TransitionAwareIcon.Delegate() {
 
461
                                                        @Override
 
462
                            public Icon getColorSchemeIcon(
 
463
                                                                        SubstanceColorScheme scheme) {
 
464
                                                                int fontSize = SubstanceSizeUtils
 
465
                                                                                .getComponentFontSize(splitPane);
 
466
                                                                return SubstanceImageCreator
 
467
                                                                                .getArrowIcon(
 
468
                                                                                                SubstanceSizeUtils
 
469
                                                                                                                .getSplitPaneArrowIconWidth(fontSize),
 
470
                                                                                                SubstanceSizeUtils
 
471
                                                                                                                .getSplitPaneArrowIconHeight(fontSize),
 
472
                                                                                                SubstanceSizeUtils
 
473
                                                                                                                .getArrowStrokeWidth(fontSize),
 
474
                                                                                                SwingConstants.EAST, scheme);
 
475
                                                        }
 
476
                                                }, "substance.splitPane.right.horizontal"));
 
477
                        }
 
478
                }
 
479
        }
 
480
 
 
481
        /*
 
482
         * (non-Javadoc)
 
483
         * 
 
484
         * @seeorg.pushingpixels.substance.utils.Trackable#isInside(java.awt.event.
 
485
         * MouseEvent)
 
486
         */
 
487
        @Override
 
488
    public boolean isInside(MouseEvent me) {
 
489
                // entire area is sensitive
 
490
                return true;
 
491
        }
 
492
 
 
493
        @Override
 
494
        public StateTransitionTracker getTransitionTracker() {
 
495
                return this.stateTransitionTracker;
 
496
        }
 
497
 
 
498
        /**
 
499
         * Layout manager for the split pane divider.
 
500
         * 
 
501
         * @author Kirill Grouchnikov
 
502
         */
 
503
        protected class SubstanceDividerLayout extends DividerLayout {
 
504
                @Override
 
505
                public void layoutContainer(Container c) {
 
506
                        if (leftButton != null && rightButton != null
 
507
                                        && c == SubstanceSplitPaneDivider.this) {
 
508
                                if (splitPane.isOneTouchExpandable()) {
 
509
                                        Insets insets = getInsets();
 
510
 
 
511
                                        if (orientation == JSplitPane.VERTICAL_SPLIT) {
 
512
                                                int extraX = (insets != null) ? insets.left : 0;
 
513
                                                int blockSize = getHeight();
 
514
 
 
515
                                                if (insets != null) {
 
516
                                                        blockSize -= (insets.top + insets.bottom);
 
517
                                                        blockSize = Math.max(blockSize, 0);
 
518
                                                }
 
519
 
 
520
                                                int y = (c.getSize().height - blockSize) / 2;
 
521
 
 
522
                                                int offset = SubstanceSizeUtils
 
523
                                                                .getSplitPaneButtonOffset(SubstanceSizeUtils
 
524
                                                                                .getComponentFontSize(splitPane));
 
525
                                                leftButton.setBounds(extraX + offset, y, leftButton
 
526
                                                                .getPreferredSize().width * 2 / 3, blockSize);
 
527
                                                rightButton.setBounds(leftButton.getX()
 
528
                                                                + leftButton.getWidth(), y, rightButton
 
529
                                                                .getPreferredSize().width * 2 / 3, blockSize);
 
530
                                        } else {
 
531
                                                int extraY = (insets != null) ? insets.top : 0;
 
532
                                                int blockSize = getWidth();
 
533
 
 
534
                                                if (insets != null) {
 
535
                                                        blockSize -= (insets.left + insets.right);
 
536
                                                        blockSize = Math.max(blockSize, 0);
 
537
                                                }
 
538
 
 
539
                                                int x = (c.getSize().width - blockSize) / 2;
 
540
 
 
541
                                                int offset = SubstanceSizeUtils
 
542
                                                                .getSplitPaneButtonOffset(SubstanceSizeUtils
 
543
                                                                                .getComponentFontSize(splitPane));
 
544
                                                leftButton.setBounds(x, extraY + offset, blockSize,
 
545
                                                                leftButton.getPreferredSize().height * 2 / 3);
 
546
                                                rightButton.setBounds(x, leftButton.getY()
 
547
                                                                + leftButton.getHeight(), blockSize, leftButton
 
548
                                                                .getPreferredSize().height * 2 / 3);
 
549
                                        }
 
550
                                } else {
 
551
                                        leftButton.setBounds(-5, -5, 1, 1);
 
552
                                        rightButton.setBounds(-5, -5, 1, 1);
 
553
                                }
 
554
                        }
 
555
                }
 
556
        }
 
557
}