< prev index next >

src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java

Print this page




 272     public void setGraphicsUtils(SynthGraphicsUtils graphics) {
 273         this.synthGraphics = graphics;
 274     }
 275 
 276     /**
 277      * Returns a SynthGraphicsUtils.
 278      *
 279      * @param context SynthContext identifying requestor
 280      * @return SynthGraphicsUtils
 281      */
 282     public SynthGraphicsUtils getGraphicsUtils(SynthContext context) {
 283         if (synthGraphics == null) {
 284             return super.getGraphicsUtils(context);
 285         }
 286         return synthGraphics;
 287     }
 288 
 289     /**
 290      * Sets the insets.
 291      *
 292      * @param Insets.
 293      */
 294     public void setInsets(Insets insets) {
 295         this.insets = insets;
 296     }
 297 
 298     /**
 299      * Returns the Insets. If <code>to</code> is non-null the resulting
 300      * insets will be placed in it, otherwise a new Insets object will be
 301      * created and returned.
 302      *
 303      * @param context SynthContext identifying requestor
 304      * @param to Where to place Insets
 305      * @return Insets.
 306      */
 307     public Insets getInsets(SynthContext state, Insets to) {
 308         if (to == null) {
 309             to = new Insets(0, 0, 0, 0);
 310         }
 311         if (insets != null) {
 312             to.left = insets.left;
 313             to.right = insets.right;
 314             to.top = insets.top;
 315             to.bottom = insets.bottom;
 316         }
 317         else {
 318             to.left = to.right = to.top = to.bottom = 0;
 319         }
 320         return to;
 321     }
 322 
 323     /**


 418                 }
 419             }
 420             if (value instanceof UIDefaults.LazyValue) {
 421                 synchronized(stateData) {
 422                     stateData.put(key, PENDING);
 423                 }
 424                 value = ((UIDefaults.LazyValue)value).createValue(null);
 425                 synchronized(stateData) {
 426                     stateData.put(key, value);
 427                     stateData.notifyAll();
 428                 }
 429             }
 430         }
 431         return value;
 432     }
 433 
 434     /**
 435      * Returns the default value for a particular property.  This is only
 436      * invoked if this style doesn't define a property for <code>key</code>.
 437      *
 438      * @param state SynthContext identifying requestor
 439      * @param key Property being requested.
 440      * @return Value of the named property
 441      */
 442     public Object getDefaultValue(SynthContext context, Object key) {
 443         return super.get(context, key);
 444     }
 445 
 446     /**
 447      * Creates a clone of this style.
 448      *
 449      * @return Clone of this style
 450      */
 451     public Object clone() {
 452         DefaultSynthStyle style;
 453         try {
 454             style = (DefaultSynthStyle)super.clone();
 455         } catch (CloneNotSupportedException cnse) {
 456             return null;
 457         }
 458         if (states != null) {


 707      * StateInfo represents Style information specific to the state of
 708      * a component.
 709      */
 710     public static class StateInfo {
 711         private Map<Object, Object> data;
 712         private Font font;
 713         private Color[] colors;
 714         private int state;
 715 
 716         /**
 717          * Creates a new StateInfo.
 718          */
 719         public StateInfo() {
 720         }
 721 
 722         /**
 723          * Creates a new StateInfo with the specified properties
 724          *
 725          * @param state Component state(s) that this StateInfo should be used
 726          * for
 727          * @param painter Painter responsible for rendering
 728          * @param bgPainter Painter responsible for rendering the background
 729          * @param font Font for this state
 730          * @param colors Colors for this state
 731          */
 732         public StateInfo(int state, Font font, Color[] colors) {
 733             this.state = state;
 734             this.font = font;
 735             this.colors = colors;
 736         }
 737 
 738         /**
 739          * Creates a new StateInfo that is a copy of the passed in
 740          * StateInfo.
 741          *
 742          * @param info StateInfo to copy.
 743          */
 744         public StateInfo(StateInfo info) {
 745             this.state = info.state;
 746             this.font = info.font;
 747             if(info.data != null) {
 748                if(data == null) {




 272     public void setGraphicsUtils(SynthGraphicsUtils graphics) {
 273         this.synthGraphics = graphics;
 274     }
 275 
 276     /**
 277      * Returns a SynthGraphicsUtils.
 278      *
 279      * @param context SynthContext identifying requestor
 280      * @return SynthGraphicsUtils
 281      */
 282     public SynthGraphicsUtils getGraphicsUtils(SynthContext context) {
 283         if (synthGraphics == null) {
 284             return super.getGraphicsUtils(context);
 285         }
 286         return synthGraphics;
 287     }
 288 
 289     /**
 290      * Sets the insets.
 291      *
 292      * @param insets the new insets.
 293      */
 294     public void setInsets(Insets insets) {
 295         this.insets = insets;
 296     }
 297 
 298     /**
 299      * Returns the Insets. If <code>to</code> is non-null the resulting
 300      * insets will be placed in it, otherwise a new Insets object will be
 301      * created and returned.
 302      *
 303      * @param state SynthContext identifying requestor
 304      * @param to Where to place Insets
 305      * @return Insets.
 306      */
 307     public Insets getInsets(SynthContext state, Insets to) {
 308         if (to == null) {
 309             to = new Insets(0, 0, 0, 0);
 310         }
 311         if (insets != null) {
 312             to.left = insets.left;
 313             to.right = insets.right;
 314             to.top = insets.top;
 315             to.bottom = insets.bottom;
 316         }
 317         else {
 318             to.left = to.right = to.top = to.bottom = 0;
 319         }
 320         return to;
 321     }
 322 
 323     /**


 418                 }
 419             }
 420             if (value instanceof UIDefaults.LazyValue) {
 421                 synchronized(stateData) {
 422                     stateData.put(key, PENDING);
 423                 }
 424                 value = ((UIDefaults.LazyValue)value).createValue(null);
 425                 synchronized(stateData) {
 426                     stateData.put(key, value);
 427                     stateData.notifyAll();
 428                 }
 429             }
 430         }
 431         return value;
 432     }
 433 
 434     /**
 435      * Returns the default value for a particular property.  This is only
 436      * invoked if this style doesn't define a property for <code>key</code>.
 437      *
 438      * @param context SynthContext identifying requestor
 439      * @param key Property being requested.
 440      * @return Value of the named property
 441      */
 442     public Object getDefaultValue(SynthContext context, Object key) {
 443         return super.get(context, key);
 444     }
 445 
 446     /**
 447      * Creates a clone of this style.
 448      *
 449      * @return Clone of this style
 450      */
 451     public Object clone() {
 452         DefaultSynthStyle style;
 453         try {
 454             style = (DefaultSynthStyle)super.clone();
 455         } catch (CloneNotSupportedException cnse) {
 456             return null;
 457         }
 458         if (states != null) {


 707      * StateInfo represents Style information specific to the state of
 708      * a component.
 709      */
 710     public static class StateInfo {
 711         private Map<Object, Object> data;
 712         private Font font;
 713         private Color[] colors;
 714         private int state;
 715 
 716         /**
 717          * Creates a new StateInfo.
 718          */
 719         public StateInfo() {
 720         }
 721 
 722         /**
 723          * Creates a new StateInfo with the specified properties
 724          *
 725          * @param state Component state(s) that this StateInfo should be used
 726          * for


 727          * @param font Font for this state
 728          * @param colors Colors for this state
 729          */
 730         public StateInfo(int state, Font font, Color[] colors) {
 731             this.state = state;
 732             this.font = font;
 733             this.colors = colors;
 734         }
 735 
 736         /**
 737          * Creates a new StateInfo that is a copy of the passed in
 738          * StateInfo.
 739          *
 740          * @param info StateInfo to copy.
 741          */
 742         public StateInfo(StateInfo info) {
 743             this.state = info.state;
 744             this.font = info.font;
 745             if(info.data != null) {
 746                if(data == null) {


< prev index next >