145 if (oldStyle != null) { |
145 if (oldStyle != null) { |
146 uninstallKeyboardActions(); |
146 uninstallKeyboardActions(); |
147 installKeyboardActions(); |
147 installKeyboardActions(); |
148 } |
148 } |
149 } |
149 } |
150 context.dispose(); |
|
151 |
150 |
152 context = getContext(tree, Region.TREE_CELL, ENABLED); |
151 context = getContext(tree, Region.TREE_CELL, ENABLED); |
153 cellStyle = SynthLookAndFeel.updateStyle(context, this); |
152 cellStyle = SynthLookAndFeel.updateStyle(context, this); |
154 context.dispose(); |
|
155 } |
153 } |
156 |
154 |
157 /** |
155 /** |
158 * {@inheritDoc} |
156 * {@inheritDoc} |
159 */ |
157 */ |
221 @Override |
219 @Override |
222 protected void uninstallDefaults() { |
220 protected void uninstallDefaults() { |
223 SynthContext context = getContext(tree, ENABLED); |
221 SynthContext context = getContext(tree, ENABLED); |
224 |
222 |
225 style.uninstallDefaults(context); |
223 style.uninstallDefaults(context); |
226 context.dispose(); |
|
227 style = null; |
224 style = null; |
228 |
225 |
229 context = getContext(tree, Region.TREE_CELL, ENABLED); |
226 context = getContext(tree, Region.TREE_CELL, ENABLED); |
230 cellStyle.uninstallDefaults(context); |
227 cellStyle.uninstallDefaults(context); |
231 context.dispose(); |
|
232 cellStyle = null; |
228 cellStyle = null; |
233 |
229 |
234 |
230 |
235 if (tree.getTransferHandler() instanceof UIResource) { |
231 if (tree.getTransferHandler() instanceof UIResource) { |
236 tree.setTransferHandler(null); |
232 tree.setTransferHandler(null); |
264 |
260 |
265 SynthLookAndFeel.update(context, g); |
261 SynthLookAndFeel.update(context, g); |
266 context.getPainter().paintTreeBackground(context, |
262 context.getPainter().paintTreeBackground(context, |
267 g, 0, 0, c.getWidth(), c.getHeight()); |
263 g, 0, 0, c.getWidth(), c.getHeight()); |
268 paint(context, g); |
264 paint(context, g); |
269 context.dispose(); |
|
270 } |
265 } |
271 |
266 |
272 /** |
267 /** |
273 * {@inheritDoc} |
268 * {@inheritDoc} |
274 */ |
269 */ |
741 } |
734 } |
742 else { |
735 else { |
743 context.getPainter().paintTreeCellFocus(context, g, |
736 context.getPainter().paintTreeCellFocus(context, g, |
744 0, 0, getWidth() - imageOffset, getHeight()); |
737 0, 0, getWidth() - imageOffset, getHeight()); |
745 } |
738 } |
746 context.dispose(); |
|
747 } |
739 } |
748 SynthLookAndFeel.resetSelectedUI(); |
740 SynthLookAndFeel.resetSelectedUI(); |
749 } |
741 } |
750 } |
742 } |
751 |
743 |
783 public void paintIcon(SynthContext context, Graphics g, int x, |
775 public void paintIcon(SynthContext context, Graphics g, int x, |
784 int y, int w, int h) { |
776 int y, int w, int h) { |
785 if (context == null) { |
777 if (context == null) { |
786 context = getContext(tree); |
778 context = getContext(tree); |
787 SynthGraphicsUtils.paintIcon(expandedIcon, context, g, x, y, w, h); |
779 SynthGraphicsUtils.paintIcon(expandedIcon, context, g, x, y, w, h); |
788 context.dispose(); |
|
789 } |
780 } |
790 else { |
781 else { |
791 SynthGraphicsUtils.paintIcon(expandedIcon, context, g, x, y, w, h); |
782 SynthGraphicsUtils.paintIcon(expandedIcon, context, g, x, y, w, h); |
792 } |
783 } |
793 } |
784 } |
795 public int getIconWidth(SynthContext context) { |
786 public int getIconWidth(SynthContext context) { |
796 int width; |
787 int width; |
797 if (context == null) { |
788 if (context == null) { |
798 context = getContext(tree); |
789 context = getContext(tree); |
799 width = SynthGraphicsUtils.getIconWidth(expandedIcon, context); |
790 width = SynthGraphicsUtils.getIconWidth(expandedIcon, context); |
800 context.dispose(); |
|
801 } |
791 } |
802 else { |
792 else { |
803 width = SynthGraphicsUtils.getIconWidth(expandedIcon, context); |
793 width = SynthGraphicsUtils.getIconWidth(expandedIcon, context); |
804 } |
794 } |
805 return width; |
795 return width; |
808 public int getIconHeight(SynthContext context) { |
798 public int getIconHeight(SynthContext context) { |
809 int height; |
799 int height; |
810 if (context == null) { |
800 if (context == null) { |
811 context = getContext(tree); |
801 context = getContext(tree); |
812 height = SynthGraphicsUtils.getIconHeight(expandedIcon, context); |
802 height = SynthGraphicsUtils.getIconHeight(expandedIcon, context); |
813 context.dispose(); |
|
814 } |
803 } |
815 else { |
804 else { |
816 height = SynthGraphicsUtils.getIconHeight(expandedIcon, context); |
805 height = SynthGraphicsUtils.getIconHeight(expandedIcon, context); |
817 } |
806 } |
818 return height; |
807 return height; |