< prev index next >

src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java

Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>


  31 import java.beans.*;
  32 import java.util.*;
  33 import javax.swing.*;
  34 import javax.swing.event.*;
  35 import javax.swing.plaf.*;
  36 import javax.swing.plaf.basic.*;
  37 import sun.swing.plaf.synth.SynthUI;
  38 
  39 
  40 /**
  41  * Synth's SplitPaneUI.
  42  *
  43  * @author Scott Violet
  44  */
  45 class SynthSplitPaneUI extends BasicSplitPaneUI implements
  46                                     PropertyChangeListener, SynthUI {
  47     /**
  48      * Keys to use for forward focus traversal when the JComponent is
  49      * managing focus.
  50      */
  51     private static Set managingFocusForwardTraversalKeys;
  52 
  53     /**
  54      * Keys to use for backward focus traversal when the JComponent is
  55      * managing focus.
  56      */
  57     private static Set managingFocusBackwardTraversalKeys;
  58 
  59     /**
  60      * Style for the JSplitPane.
  61      */
  62     private SynthStyle style;
  63     /**
  64      * Style for the divider.
  65      */
  66     private SynthStyle dividerStyle;
  67 
  68 
  69     /**
  70      * Creates a new SynthSplitPaneUI instance
  71      */
  72     public static ComponentUI createUI(JComponent x) {
  73         return new SynthSplitPaneUI();
  74     }
  75 
  76     /**
  77      * Installs the UI defaults.


  79     protected void installDefaults() {
  80         updateStyle(splitPane);
  81 
  82         setOrientation(splitPane.getOrientation());
  83         setContinuousLayout(splitPane.isContinuousLayout());
  84 
  85         resetLayoutManager();
  86 
  87         /* Install the nonContinuousLayoutDivider here to avoid having to
  88         add/remove everything later. */
  89         if(nonContinuousLayoutDivider == null) {
  90             setNonContinuousLayoutDivider(
  91                                 createDefaultNonContinuousLayoutDivider(),
  92                                 true);
  93         } else {
  94             setNonContinuousLayoutDivider(nonContinuousLayoutDivider, true);
  95         }
  96 
  97         // focus forward traversal key
  98         if (managingFocusForwardTraversalKeys==null) {
  99             managingFocusForwardTraversalKeys = new HashSet();
 100             managingFocusForwardTraversalKeys.add(
 101                 KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
 102         }
 103         splitPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
 104                                         managingFocusForwardTraversalKeys);
 105         // focus backward traversal key
 106         if (managingFocusBackwardTraversalKeys==null) {
 107             managingFocusBackwardTraversalKeys = new HashSet();
 108             managingFocusBackwardTraversalKeys.add(
 109                 KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
 110         }
 111         splitPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
 112                                         managingFocusBackwardTraversalKeys);
 113     }
 114 
 115     private void updateStyle(JSplitPane splitPane) {
 116         SynthContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER,
 117                                           ENABLED);
 118         SynthStyle oldDividerStyle = dividerStyle;
 119         dividerStyle = SynthLookAndFeel.updateStyle(context, this);
 120         context.dispose();
 121 
 122         context = getContext(splitPane, ENABLED);
 123         SynthStyle oldStyle = style;
 124 
 125         style = SynthLookAndFeel.updateStyle(context, this);
 126 
 127         if (style != oldStyle) {




  31 import java.beans.*;
  32 import java.util.*;
  33 import javax.swing.*;
  34 import javax.swing.event.*;
  35 import javax.swing.plaf.*;
  36 import javax.swing.plaf.basic.*;
  37 import sun.swing.plaf.synth.SynthUI;
  38 
  39 
  40 /**
  41  * Synth's SplitPaneUI.
  42  *
  43  * @author Scott Violet
  44  */
  45 class SynthSplitPaneUI extends BasicSplitPaneUI implements
  46                                     PropertyChangeListener, SynthUI {
  47     /**
  48      * Keys to use for forward focus traversal when the JComponent is
  49      * managing focus.
  50      */
  51     private static Set<KeyStroke> managingFocusForwardTraversalKeys;
  52 
  53     /**
  54      * Keys to use for backward focus traversal when the JComponent is
  55      * managing focus.
  56      */
  57     private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
  58 
  59     /**
  60      * Style for the JSplitPane.
  61      */
  62     private SynthStyle style;
  63     /**
  64      * Style for the divider.
  65      */
  66     private SynthStyle dividerStyle;
  67 
  68 
  69     /**
  70      * Creates a new SynthSplitPaneUI instance
  71      */
  72     public static ComponentUI createUI(JComponent x) {
  73         return new SynthSplitPaneUI();
  74     }
  75 
  76     /**
  77      * Installs the UI defaults.


  79     protected void installDefaults() {
  80         updateStyle(splitPane);
  81 
  82         setOrientation(splitPane.getOrientation());
  83         setContinuousLayout(splitPane.isContinuousLayout());
  84 
  85         resetLayoutManager();
  86 
  87         /* Install the nonContinuousLayoutDivider here to avoid having to
  88         add/remove everything later. */
  89         if(nonContinuousLayoutDivider == null) {
  90             setNonContinuousLayoutDivider(
  91                                 createDefaultNonContinuousLayoutDivider(),
  92                                 true);
  93         } else {
  94             setNonContinuousLayoutDivider(nonContinuousLayoutDivider, true);
  95         }
  96 
  97         // focus forward traversal key
  98         if (managingFocusForwardTraversalKeys==null) {
  99             managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
 100             managingFocusForwardTraversalKeys.add(
 101                 KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
 102         }
 103         splitPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
 104                                         managingFocusForwardTraversalKeys);
 105         // focus backward traversal key
 106         if (managingFocusBackwardTraversalKeys==null) {
 107             managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
 108             managingFocusBackwardTraversalKeys.add(
 109                 KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
 110         }
 111         splitPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
 112                                         managingFocusBackwardTraversalKeys);
 113     }
 114 
 115     private void updateStyle(JSplitPane splitPane) {
 116         SynthContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER,
 117                                           ENABLED);
 118         SynthStyle oldDividerStyle = dividerStyle;
 119         dividerStyle = SynthLookAndFeel.updateStyle(context, this);
 120         context.dispose();
 121 
 122         context = getContext(splitPane, ENABLED);
 123         SynthStyle oldStyle = style;
 124 
 125         style = SynthLookAndFeel.updateStyle(context, this);
 126 
 127         if (style != oldStyle) {


< prev index next >