src/share/classes/com/sun/java/swing/plaf/windows/TMSchema.java

Print this page




 429                          new State[] { NORMAL, HOT, PUSHED,
 430                                        DISABLED, DISABLEDHOT, DISABLEDPUSHED });
 431             stateMap.put(Part.MP_POPUPCHECK,
 432                          new State[] { CHECKMARKNORMAL, CHECKMARKDISABLED,
 433                                        BULLETNORMAL, BULLETDISABLED });
 434             stateMap.put(Part.MP_POPUPCHECKBACKGROUND,
 435                          new State[] { DISABLEDPUSHED, NORMAL, BITMAP });
 436             stateMap.put(Part.MP_POPUPITEM,
 437                          new State[] { NORMAL, HOT, DISABLED, DISABLEDHOT });
 438             stateMap.put(Part.MP_POPUPSUBMENU,
 439                          new State[] { NORMAL, DISABLED });
 440 
 441         }
 442 
 443 
 444         public static synchronized int getValue(Part part, State state) {
 445             if (stateMap == null) {
 446                 initStates();
 447             }
 448 
 449             Enum[] states = stateMap.get(part);
 450             if (states != null) {
 451                 for (int i = 0; i < states.length; i++) {
 452                     if (state == states[i]) {
 453                         return i + 1;
 454                     }
 455                 }
 456             }
 457 
 458             if (state == null || state == State.NORMAL) {
 459                 return 1;
 460             }
 461 
 462             return 0;
 463         }
 464 
 465     }
 466 
 467 
 468     /**
 469      * An enumeration of the possible component attributes and the


 487 
 488         NORMALSIZE(Dimension.class,      3409), // size of dest rect that exactly source
 489 
 490 
 491         SIZINGMARGINS ( Insets.class,    3601), // margins used for 9-grid sizing
 492         CONTENTMARGINS(Insets.class,     3602), // margins that define where content can be placed
 493         CAPTIONMARGINS(Insets.class,     3603), // margins that define where caption text can be placed
 494 
 495         BORDERCOLOR(Color.class,         3801), // color of borders for BorderFill
 496         FILLCOLOR  (  Color.class,       3802), // color of bg fill
 497         TEXTCOLOR  (  Color.class,       3803), // color text is drawn in
 498 
 499         TEXTSHADOWCOLOR(Color.class,     3818), // color of text shadow
 500 
 501         BGTYPE(Integer.class,            4001), // basic drawing type for each part
 502 
 503         TEXTSHADOWTYPE(Integer.class,    4010), // type of shadow to draw with text
 504 
 505         TRANSITIONDURATIONS(Integer.class, 6000);
 506 
 507         private final Class type;
 508         private final int value;
 509 
 510         private Prop(Class type, int value) {
 511             this.type     = type;
 512             this.value    = value;
 513         }
 514 
 515         public int getValue() {
 516             return value;
 517         }
 518 
 519         public String toString() {
 520             return name()+"["+type.getName()+"] = "+value;
 521         }
 522     }
 523 
 524 
 525     /**
 526      * An enumeration of attribute values for some Props
 527      */
 528     public static enum TypeEnum {
 529         BT_IMAGEFILE (Prop.BGTYPE, "imagefile",  0),
 530         BT_BORDERFILL(Prop.BGTYPE, "borderfill", 1),




 429                          new State[] { NORMAL, HOT, PUSHED,
 430                                        DISABLED, DISABLEDHOT, DISABLEDPUSHED });
 431             stateMap.put(Part.MP_POPUPCHECK,
 432                          new State[] { CHECKMARKNORMAL, CHECKMARKDISABLED,
 433                                        BULLETNORMAL, BULLETDISABLED });
 434             stateMap.put(Part.MP_POPUPCHECKBACKGROUND,
 435                          new State[] { DISABLEDPUSHED, NORMAL, BITMAP });
 436             stateMap.put(Part.MP_POPUPITEM,
 437                          new State[] { NORMAL, HOT, DISABLED, DISABLEDHOT });
 438             stateMap.put(Part.MP_POPUPSUBMENU,
 439                          new State[] { NORMAL, DISABLED });
 440 
 441         }
 442 
 443 
 444         public static synchronized int getValue(Part part, State state) {
 445             if (stateMap == null) {
 446                 initStates();
 447             }
 448 
 449             Enum<?>[] states = stateMap.get(part);
 450             if (states != null) {
 451                 for (int i = 0; i < states.length; i++) {
 452                     if (state == states[i]) {
 453                         return i + 1;
 454                     }
 455                 }
 456             }
 457 
 458             if (state == null || state == State.NORMAL) {
 459                 return 1;
 460             }
 461 
 462             return 0;
 463         }
 464 
 465     }
 466 
 467 
 468     /**
 469      * An enumeration of the possible component attributes and the


 487 
 488         NORMALSIZE(Dimension.class,      3409), // size of dest rect that exactly source
 489 
 490 
 491         SIZINGMARGINS ( Insets.class,    3601), // margins used for 9-grid sizing
 492         CONTENTMARGINS(Insets.class,     3602), // margins that define where content can be placed
 493         CAPTIONMARGINS(Insets.class,     3603), // margins that define where caption text can be placed
 494 
 495         BORDERCOLOR(Color.class,         3801), // color of borders for BorderFill
 496         FILLCOLOR  (  Color.class,       3802), // color of bg fill
 497         TEXTCOLOR  (  Color.class,       3803), // color text is drawn in
 498 
 499         TEXTSHADOWCOLOR(Color.class,     3818), // color of text shadow
 500 
 501         BGTYPE(Integer.class,            4001), // basic drawing type for each part
 502 
 503         TEXTSHADOWTYPE(Integer.class,    4010), // type of shadow to draw with text
 504 
 505         TRANSITIONDURATIONS(Integer.class, 6000);
 506 
 507         private final Class<?> type;
 508         private final int value;
 509 
 510         private Prop(Class<?> type, int value) {
 511             this.type     = type;
 512             this.value    = value;
 513         }
 514 
 515         public int getValue() {
 516             return value;
 517         }
 518 
 519         public String toString() {
 520             return name()+"["+type.getName()+"] = "+value;
 521         }
 522     }
 523 
 524 
 525     /**
 526      * An enumeration of attribute values for some Props
 527      */
 528     public static enum TypeEnum {
 529         BT_IMAGEFILE (Prop.BGTYPE, "imagefile",  0),
 530         BT_BORDERFILL(Prop.BGTYPE, "borderfill", 1),