410 /**
411 * Tree region. To bind a style to this <code>Region</code> use the name
412 * <code>Tree</code>.
413 */
414 public static final Region TREE = new Region("Tree", false);
415
416 /**
417 * Region of the Tree for one cell. To bind a style to this
418 * <code>Region</code> use the name <code>TreeCell</code>.
419 */
420 public static final Region TREE_CELL = new Region("TreeCell", true);
421
422 /**
423 * Viewport region. To bind a style to this <code>Region</code> use
424 * the name <code>Viewport</code>.
425 */
426 public static final Region VIEWPORT = new Region("Viewport", false);
427
428 private static Map<String, Region> getUItoRegionMap() {
429 AppContext context = AppContext.getAppContext();
430 Map<String, Region> map = (Map<String, Region>) context.get(UI_TO_REGION_MAP_KEY);
431 if (map == null) {
432 map = new HashMap<String, Region>();
433 map.put("ArrowButtonUI", ARROW_BUTTON);
434 map.put("ButtonUI", BUTTON);
435 map.put("CheckBoxUI", CHECK_BOX);
436 map.put("CheckBoxMenuItemUI", CHECK_BOX_MENU_ITEM);
437 map.put("ColorChooserUI", COLOR_CHOOSER);
438 map.put("ComboBoxUI", COMBO_BOX);
439 map.put("DesktopPaneUI", DESKTOP_PANE);
440 map.put("DesktopIconUI", DESKTOP_ICON);
441 map.put("EditorPaneUI", EDITOR_PANE);
442 map.put("FileChooserUI", FILE_CHOOSER);
443 map.put("FormattedTextFieldUI", FORMATTED_TEXT_FIELD);
444 map.put("InternalFrameUI", INTERNAL_FRAME);
445 map.put("InternalFrameTitlePaneUI", INTERNAL_FRAME_TITLE_PANE);
446 map.put("LabelUI", LABEL);
447 map.put("ListUI", LIST);
448 map.put("MenuUI", MENU);
449 map.put("MenuBarUI", MENU_BAR);
465 map.put("SplitPaneUI", SPLIT_PANE);
466 map.put("TabbedPaneUI", TABBED_PANE);
467 map.put("TableUI", TABLE);
468 map.put("TableHeaderUI", TABLE_HEADER);
469 map.put("TextAreaUI", TEXT_AREA);
470 map.put("TextFieldUI", TEXT_FIELD);
471 map.put("TextPaneUI", TEXT_PANE);
472 map.put("ToggleButtonUI", TOGGLE_BUTTON);
473 map.put("ToolBarUI", TOOL_BAR);
474 map.put("ToolTipUI", TOOL_TIP);
475 map.put("ToolBarSeparatorUI", TOOL_BAR_SEPARATOR);
476 map.put("TreeUI", TREE);
477 map.put("ViewportUI", VIEWPORT);
478 context.put(UI_TO_REGION_MAP_KEY, map);
479 }
480 return map;
481 }
482
483 private static Map<Region, String> getLowerCaseNameMap() {
484 AppContext context = AppContext.getAppContext();
485 Map<Region, String> map = (Map<Region, String>) context.get(LOWER_CASE_NAME_MAP_KEY);
486 if (map == null) {
487 map = new HashMap<Region, String>();
488 context.put(LOWER_CASE_NAME_MAP_KEY, map);
489 }
490 return map;
491 }
492
493 static Region getRegion(JComponent c) {
494 return getUItoRegionMap().get(c.getUIClassID());
495 }
496
497 static void registerUIs(UIDefaults table) {
498 for (Object key : getUItoRegionMap().keySet()) {
499 table.put(key, "javax.swing.plaf.synth.SynthLookAndFeel");
500 }
501 }
502
503 private final String name;
504 private final boolean subregion;
|
410 /**
411 * Tree region. To bind a style to this <code>Region</code> use the name
412 * <code>Tree</code>.
413 */
414 public static final Region TREE = new Region("Tree", false);
415
416 /**
417 * Region of the Tree for one cell. To bind a style to this
418 * <code>Region</code> use the name <code>TreeCell</code>.
419 */
420 public static final Region TREE_CELL = new Region("TreeCell", true);
421
422 /**
423 * Viewport region. To bind a style to this <code>Region</code> use
424 * the name <code>Viewport</code>.
425 */
426 public static final Region VIEWPORT = new Region("Viewport", false);
427
428 private static Map<String, Region> getUItoRegionMap() {
429 AppContext context = AppContext.getAppContext();
430 @SuppressWarnings("unchecked")
431 Map<String, Region> map = (Map<String, Region>) context.get(UI_TO_REGION_MAP_KEY);
432 if (map == null) {
433 map = new HashMap<String, Region>();
434 map.put("ArrowButtonUI", ARROW_BUTTON);
435 map.put("ButtonUI", BUTTON);
436 map.put("CheckBoxUI", CHECK_BOX);
437 map.put("CheckBoxMenuItemUI", CHECK_BOX_MENU_ITEM);
438 map.put("ColorChooserUI", COLOR_CHOOSER);
439 map.put("ComboBoxUI", COMBO_BOX);
440 map.put("DesktopPaneUI", DESKTOP_PANE);
441 map.put("DesktopIconUI", DESKTOP_ICON);
442 map.put("EditorPaneUI", EDITOR_PANE);
443 map.put("FileChooserUI", FILE_CHOOSER);
444 map.put("FormattedTextFieldUI", FORMATTED_TEXT_FIELD);
445 map.put("InternalFrameUI", INTERNAL_FRAME);
446 map.put("InternalFrameTitlePaneUI", INTERNAL_FRAME_TITLE_PANE);
447 map.put("LabelUI", LABEL);
448 map.put("ListUI", LIST);
449 map.put("MenuUI", MENU);
450 map.put("MenuBarUI", MENU_BAR);
466 map.put("SplitPaneUI", SPLIT_PANE);
467 map.put("TabbedPaneUI", TABBED_PANE);
468 map.put("TableUI", TABLE);
469 map.put("TableHeaderUI", TABLE_HEADER);
470 map.put("TextAreaUI", TEXT_AREA);
471 map.put("TextFieldUI", TEXT_FIELD);
472 map.put("TextPaneUI", TEXT_PANE);
473 map.put("ToggleButtonUI", TOGGLE_BUTTON);
474 map.put("ToolBarUI", TOOL_BAR);
475 map.put("ToolTipUI", TOOL_TIP);
476 map.put("ToolBarSeparatorUI", TOOL_BAR_SEPARATOR);
477 map.put("TreeUI", TREE);
478 map.put("ViewportUI", VIEWPORT);
479 context.put(UI_TO_REGION_MAP_KEY, map);
480 }
481 return map;
482 }
483
484 private static Map<Region, String> getLowerCaseNameMap() {
485 AppContext context = AppContext.getAppContext();
486 @SuppressWarnings("unchecked")
487 Map<Region, String> map = (Map<Region, String>) context.get(LOWER_CASE_NAME_MAP_KEY);
488 if (map == null) {
489 map = new HashMap<Region, String>();
490 context.put(LOWER_CASE_NAME_MAP_KEY, map);
491 }
492 return map;
493 }
494
495 static Region getRegion(JComponent c) {
496 return getUItoRegionMap().get(c.getUIClassID());
497 }
498
499 static void registerUIs(UIDefaults table) {
500 for (Object key : getUItoRegionMap().keySet()) {
501 table.put(key, "javax.swing.plaf.synth.SynthLookAndFeel");
502 }
503 }
504
505 private final String name;
506 private final boolean subregion;
|