0001: /*
0002: * @(#)VsnetWindowsUtils.java
0003: *
0004: * Copyright 2002 JIDE Software Inc. All rights reserved.
0005: */
0006: package com.jidesoft.plaf.vsnet;
0007:
0008: import com.jidesoft.icons.IconsFactory;
0009: import com.jidesoft.icons.JideIconsFactory;
0010: import com.jidesoft.plaf.ExtWindowsDesktopProperty;
0011: import com.jidesoft.plaf.LookAndFeelFactory;
0012: import com.jidesoft.plaf.UIDefaultsLookup;
0013: import com.jidesoft.plaf.WindowsDesktopProperty;
0014: import com.jidesoft.plaf.basic.BasicPainter;
0015: import com.jidesoft.plaf.basic.BasicRangeSliderUI;
0016: import com.jidesoft.plaf.basic.Painter;
0017: import com.jidesoft.plaf.basic.ThemePainter;
0018: import com.jidesoft.swing.JideSwingUtilities;
0019: import com.jidesoft.swing.JideTabbedPane;
0020:
0021: import javax.swing.*;
0022: import javax.swing.plaf.BorderUIResource;
0023: import javax.swing.plaf.ColorUIResource;
0024: import javax.swing.plaf.DimensionUIResource;
0025: import javax.swing.plaf.InsetsUIResource;
0026: import javax.swing.plaf.basic.BasicBorders;
0027: import java.awt.*;
0028: import java.beans.Beans;
0029:
0030: /**
0031: * Initialize the uiClassID to BasicComponentUI mapping for JIDE components using Vsnet style for WindowsLookAndFeel.
0032: */
0033: public class VsnetWindowsUtils extends VsnetLookAndFeelExtension {
0034:
0035: /**
0036: * Initializes class defaults with menu components UIDefaults.
0037: *
0038: * @param table UIDefaults table
0039: */
0040: public static void initClassDefaultsWithMenu(UIDefaults table) {
0041: VsnetLookAndFeelExtension.initClassDefaultsWithMenu(table);
0042: initClassDefaults(table);
0043: }
0044:
0045: /**
0046: * Initializes class defaults.
0047: *
0048: * @param table UIDefaults table
0049: */
0050: public static void initClassDefaults(UIDefaults table) {
0051: VsnetLookAndFeelExtension.initClassDefaults(table);
0052:
0053: final String windowsPackageName = "com.jidesoft.plaf.windows.";
0054:
0055: // common
0056: table.put("JidePopupMenuUI", windowsPackageName
0057: + "WindowsJidePopupMenuUI");
0058:
0059: int products = LookAndFeelFactory.getProductsUsed();
0060:
0061: if ((products & PRODUCT_GRIDS) != 0) {
0062: // grids
0063: table.put("NestedTableHeaderUI", windowsPackageName
0064: + "WindowsNestedTableHeaderUI");
0065: table.put("EditableTableHeaderUI", windowsPackageName
0066: + "WindowsEditableTableHeaderUI");
0067: }
0068: }
0069:
0070: /**
0071: * Initializes components defaults.
0072: *
0073: * @param table UIDefaults table
0074: */
0075: public static void initComponentDefaults(UIDefaults table) {
0076: Toolkit toolkit = Toolkit.getDefaultToolkit();
0077:
0078: WindowsDesktopProperty defaultTextColor = new WindowsDesktopProperty(
0079: "win.button.textColor", table.get("controlText"),
0080: toolkit);
0081: WindowsDesktopProperty defaultBackgroundColor = new WindowsDesktopProperty(
0082: "win.3d.backgroundColor", table.get("control"), toolkit);
0083: WindowsDesktopProperty defaultHighlightColor = new WindowsDesktopProperty(
0084: "win.3d.lightColor", table.get("controlHighlight"),
0085: toolkit);
0086: WindowsDesktopProperty defaultLtHighlightColor = new WindowsDesktopProperty(
0087: "win.3d.highlightColor", table
0088: .get("controlLtHighlight"), toolkit);
0089: WindowsDesktopProperty defaultShadowColor = new WindowsDesktopProperty(
0090: "win.3d.shadowColor", table.get("controlShadow"),
0091: toolkit);
0092: WindowsDesktopProperty defaultDarkShadowColor = new WindowsDesktopProperty(
0093: "win.3d.darkShadowColor", table.get("controlDkShadow"),
0094: toolkit);
0095: WindowsDesktopProperty activeTitleTextColor = new WindowsDesktopProperty(
0096: "win.frame.captionTextColor", table
0097: .get("activeCaptionText"), toolkit);
0098: WindowsDesktopProperty activeTitleBackgroundColor = new WindowsDesktopProperty(
0099: "win.frame.activeCaptionColor", table
0100: .get("activeCaption"), toolkit);
0101: WindowsDesktopProperty mdiBackgroundColor = new WindowsDesktopProperty(
0102: "win.mdi.backgroundColor", table.get("controlShadow"),
0103: toolkit);
0104:
0105: WindowsDesktopProperty menuTextColor = new WindowsDesktopProperty(
0106: "win.menu.textColor", table.get("control"), toolkit);
0107:
0108: Object controlFont = JideSwingUtilities.getControlFont(toolkit,
0109: table);
0110: Object toolbarFont = JideSwingUtilities.getMenuFont(toolkit,
0111: table);
0112: Object boldFont = JideSwingUtilities
0113: .getBoldFont(toolkit, table);
0114:
0115: Object resizeBorder = new ExtWindowsDesktopProperty(
0116: new String[] { "win.3d.lightColor",
0117: "win.3d.highlightColor", "win.3d.shadowColor",
0118: "win.3d.darkShadowColor" }, new Object[] {
0119: table.get("control"),
0120: table.get("controlLtHighlight"),
0121: table.get("controlShadow"),
0122: table.get("controlDkShadow") }, toolkit,
0123: new ConvertListener() {
0124: public Object convert(Object[] obj) {
0125: return new ResizeFrameBorder((Color) obj[0],
0126: (Color) obj[1], (Color) obj[2],
0127: (Color) obj[3], new Insets(4, 4, 4, 4));
0128: }
0129: });
0130:
0131: Object defaultFormBackground = new ExtWindowsDesktopProperty(
0132: new String[] { "win.3d.backgroundColor" },
0133: new Object[] { table.get("control") }, toolkit,
0134: new ConvertListener() {
0135: public Object convert(Object[] obj) {
0136: return VsnetUtils
0137: .getDefaultBackgroundColor((Color) obj[0]);
0138: }
0139: });
0140:
0141: Object focusedButtonColor = new ExtWindowsDesktopProperty(
0142: new String[] { "win.item.highlightColor" },
0143: new Object[] { table.get("textHighlight") }, toolkit,
0144: new ConvertListener() {
0145: public Object convert(Object[] obj) {
0146: return new ColorUIResource(VsnetUtils
0147: .getRolloverButtonColor((Color) obj[0]));
0148: }
0149: });
0150:
0151: Object selectedAndFocusedButtonColor = new ExtWindowsDesktopProperty(
0152: new String[] { "win.item.highlightColor" },
0153: new Object[] { table.get("textHighlight") }, toolkit,
0154: new ConvertListener() {
0155: public Object convert(Object[] obj) {
0156: return new ColorUIResource(
0157: VsnetUtils
0158: .getSelectedAndRolloverButtonColor((Color) obj[0]));
0159: }
0160: });
0161:
0162: Object selectedButtonColor = new ExtWindowsDesktopProperty(
0163: new String[] { "win.item.highlightColor" },
0164: new Object[] { table.get("textHighlight") }, toolkit,
0165: new ConvertListener() {
0166: public Object convert(Object[] obj) {
0167: return new ColorUIResource(VsnetUtils
0168: .getSelectedButtonColor((Color) obj[0]));
0169: }
0170: });
0171:
0172: Object singleLineBorder = new ExtWindowsDesktopProperty(
0173: new String[] { "win.3d.shadowColor" },
0174: new Object[] { table.get("controlShadow") }, toolkit,
0175: new ConvertListener() {
0176: public Object convert(Object[] obj) {
0177: return new BorderUIResource(BorderFactory
0178: .createLineBorder((Color) obj[0]));
0179: }
0180: });
0181:
0182: Object borderColor = new ExtWindowsDesktopProperty(
0183: new String[] { "win.item.highlightColor" },
0184: new Object[] { table.get("controlShadow") }, toolkit,
0185: new ConvertListener() {
0186: public Object convert(Object[] obj) {
0187: return new ColorUIResource(VsnetUtils
0188: .getButtonBorderColor((Color) obj[0]));
0189: }
0190: });
0191:
0192: Object gripperForeground = new ExtWindowsDesktopProperty(
0193: new String[] { "win.3d.backgroundColor" },
0194: new Object[] { table.get("control") }, toolkit,
0195: new ConvertListener() {
0196: public Object convert(Object[] obj) {
0197: return new ColorUIResource(
0198: VsnetUtils
0199: .getGripperForegroundColor((Color) obj[0]));
0200: }
0201: });
0202:
0203: Painter gripperPainter = new Painter() {
0204: public void paint(JComponent c, Graphics g, Rectangle rect,
0205: int orientation, int state) {
0206: ThemePainter painter = (ThemePainter) UIDefaultsLookup
0207: .get("Theme.painter");
0208: if (painter != null) {
0209: painter
0210: .paintGripper(c, g, rect, orientation,
0211: state);
0212: }
0213: }
0214: };
0215:
0216: Object buttonBorder = new BasicBorders.MarginBorder();
0217:
0218: ImageIcon sliderHorizontalImage = IconsFactory
0219: .getImageIcon(BasicRangeSliderUI.class,
0220: "icons/slider_horizontal.gif");
0221: ImageIcon sliderVerticalalImage = IconsFactory.getImageIcon(
0222: BasicRangeSliderUI.class, "icons/slider_vertical.gif");
0223:
0224: Object uiDefaults[] = new Object[] {
0225: // common
0226: "JideButton.selectedAndFocusedBackground",
0227: selectedAndFocusedButtonColor,
0228: "JideButton.focusedBackground",
0229: focusedButtonColor,
0230: "JideButton.selectedBackground",
0231: selectedButtonColor,
0232: "JideButton.borderColor",
0233: borderColor,
0234:
0235: "JideButton.font",
0236: controlFont,
0237: "JideButton.background",
0238: defaultBackgroundColor,
0239: "JideButton.foreground",
0240: defaultTextColor,
0241: "JideButton.shadow",
0242: defaultShadowColor,
0243: "JideButton.darkShadow",
0244: defaultDarkShadowColor,
0245: "JideButton.light",
0246: defaultHighlightColor,
0247: "JideButton.highlight",
0248: defaultLtHighlightColor,
0249: "JideButton.border",
0250: buttonBorder,
0251: "JideButton.margin",
0252: new InsetsUIResource(3, 3, 3, 3),
0253: "JideButton.textIconGap",
0254: 2,
0255: "JideButton.textShiftOffset",
0256: 0,
0257: "JideButton.focusInputMap",
0258: new UIDefaults.LazyInputMap(new Object[] { "SPACE",
0259: "pressed", "released SPACE", "released",
0260: "ENTER", "pressed", "released ENTER",
0261: "released" }),
0262:
0263: "JideSplitPane.dividerSize",
0264: 3,
0265: "JideSplitPaneDivider.border",
0266: new BorderUIResource(BorderFactory.createEmptyBorder()),
0267: "JideSplitPaneDivider.background",
0268: defaultBackgroundColor,
0269: "JideSplitPaneDivider.gripperPainter",
0270: gripperPainter,
0271:
0272: "JideTabbedPane.defaultTabShape",
0273: JideTabbedPane.SHAPE_VSNET,
0274: "JideTabbedPane.defaultResizeMode",
0275: JideTabbedPane.RESIZE_MODE_NONE,
0276: "JideTabbedPane.defaultTabColorTheme",
0277: JideTabbedPane.COLOR_THEME_VSNET,
0278:
0279: "JideTabbedPane.tabRectPadding",
0280: 2,
0281: "JideTabbedPane.closeButtonMarginHorizonal",
0282: 3,
0283: "JideTabbedPane.closeButtonMarginVertical",
0284: 3,
0285: "JideTabbedPane.textMarginVertical",
0286: 4,
0287: "JideTabbedPane.noIconMargin",
0288: 2,
0289: "JideTabbedPane.iconMargin",
0290: 5,
0291: "JideTabbedPane.textPadding",
0292: 6,
0293: "JideTabbedPane.buttonSize",
0294: 18,
0295: "JideTabbedPane.buttonMargin",
0296: 5,
0297: "JideTabbedPane.fitStyleBoundSize",
0298: 8,
0299: "JideTabbedPane.fitStyleFirstTabMargin",
0300: 4,
0301: "JideTabbedPane.fitStyleIconMinWidth",
0302: 24,
0303: "JideTabbedPane.fitStyleTextMinWidth",
0304: 16,
0305: "JideTabbedPane.compressedStyleNoIconRectSize",
0306: 24,
0307: "JideTabbedPane.compressedStyleIconMargin",
0308: 12,
0309: "JideTabbedPane.compressedStyleCloseButtonMarginHorizontal",
0310: 0,
0311: "JideTabbedPane.compressedStyleCloseButtonMarginVertical",
0312: 0,
0313: "JideTabbedPane.fixedStyleRectSize",
0314: 60,
0315: "JideTabbedPane.closeButtonMargin",
0316: 2,
0317: "JideTabbedPane.gripLeftMargin",
0318: 4,
0319: "JideTabbedPane.closeButtonMarginSize",
0320: 6,
0321: "JideTabbedPane.closeButtonLeftMargin",
0322: 2,
0323: "JideTabbedPane.closeButtonRightMargin",
0324: 2,
0325:
0326: "JideTabbedPane.defaultTabBorderShadowColor",
0327: new ColorUIResource(115, 109, 99),
0328:
0329: "JideTabbedPane.gripperPainter",
0330: gripperPainter,
0331: "JideTabbedPane.border",
0332: new BorderUIResource(BorderFactory.createEmptyBorder(0,
0333: 0, 0, 0)),
0334: "JideTabbedPane.background",
0335: defaultFormBackground,
0336: "JideTabbedPane.foreground",
0337: defaultTextColor,
0338: "JideTabbedPane.light",
0339: Color.BLACK.equals(defaultBackgroundColor
0340: .createValue(table)) ? defaultBackgroundColor
0341: : defaultHighlightColor,
0342: "JideTabbedPane.highlight",
0343: defaultLtHighlightColor,
0344: "JideTabbedPane.shadow",
0345: defaultShadowColor,
0346: "JideTabbedPane.darkShadow",
0347: defaultTextColor,
0348: "JideTabbedPane.tabInsets",
0349: new InsetsUIResource(1, 4, 1, 4),
0350: "JideTabbedPane.contentBorderInsets",
0351: new InsetsUIResource(2, 2, 2, 2),
0352: "JideTabbedPane.ignoreContentBorderInsetsIfNoTabs",
0353: Boolean.FALSE,
0354: "JideTabbedPane.tabAreaInsets",
0355: new InsetsUIResource(2, 4, 0, 4),
0356: "JideTabbedPane.tabAreaBackground",
0357: defaultFormBackground,
0358: "JideTabbedPane.tabRunOverlay",
0359: 2,
0360: "JideTabbedPane.font",
0361: controlFont,
0362: "JideTabbedPane.selectedTabFont",
0363: controlFont,
0364: "JideTabbedPane.selectedTabTextForeground",
0365: defaultTextColor,
0366: "JideTabbedPane.unselectedTabTextForeground",
0367: defaultTextColor,
0368: "JideTabbedPane.selectedTabBackground",
0369: defaultBackgroundColor,
0370: "JideTabbedPane.textIconGap",
0371: 4,
0372: "JideTabbedPane.showIconOnTab",
0373: Boolean.TRUE,
0374: "JideTabbedPane.showCloseButtonOnTab",
0375: Boolean.FALSE,
0376: "JideTabbedPane.closeButtonAlignment",
0377: SwingConstants.TRAILING,
0378: "JideTabbedPane.focusInputMap",
0379: new UIDefaults.LazyInputMap(new Object[] { "RIGHT",
0380: "navigateRight", "KP_RIGHT", "navigateRight",
0381: "LEFT", "navigateLeft", "KP_LEFT",
0382: "navigateLeft", "UP", "navigateUp", "KP_UP",
0383: "navigateUp", "DOWN", "navigateDown",
0384: "KP_DOWN", "navigateDown", "ctrl DOWN",
0385: "requestFocusForVisibleComponent",
0386: "ctrl KP_DOWN",
0387: "requestFocusForVisibleComponent", }),
0388: "JideTabbedPane.ancestorInputMap",
0389: new UIDefaults.LazyInputMap(new Object[] {
0390: "ctrl PAGE_DOWN", "navigatePageDown",
0391: "ctrl PAGE_UP", "navigatePageUp", "ctrl UP",
0392: "requestFocus", "ctrl KP_UP", "requestFocus", }),
0393:
0394: "Gripper.size",
0395: 8,
0396: "Gripper.foreground",
0397: gripperForeground,
0398: "Gripper.painter",
0399: gripperPainter,
0400:
0401: "Resizable.resizeBorder",
0402: resizeBorder,
0403:
0404: "ButtonPanel.order",
0405: "ACO",
0406: "ButtonPanel.oppositeOrder",
0407: "H",
0408: "ButtonPanel.buttonGap",
0409: 6,
0410: "ButtonPanel.groupGap",
0411: 6,
0412: "ButtonPanel.minButtonWidth",
0413: 75,
0414:
0415: "JideSplitButton.font",
0416: controlFont,
0417: "JideSplitButton.margin",
0418: new InsetsUIResource(3, 3, 3, 7),
0419: "JideSplitButton.border",
0420: buttonBorder,
0421: "JideSplitButton.borderPainted",
0422: Boolean.FALSE,
0423: "JideSplitButton.textIconGap",
0424: 3,
0425: "JideSplitButton.selectionForeground",
0426: menuTextColor,
0427: "JideSplitButton.focusInputMap",
0428: new UIDefaults.LazyInputMap(new Object[] { "SPACE",
0429: "pressed", "released SPACE", "released",
0430: "ENTER", "pressed", "released ENTER",
0431: "released", "DOWN", "downPressed",
0432: "released DOWN", "downReleased" }),
0433: "RangeSlider.lowerIcon",
0434: IconsFactory.getIcon(null, sliderHorizontalImage, 0, 0,
0435: 9, 8),
0436: "RangeSlider.upperIcon",
0437: IconsFactory.getIcon(null, sliderHorizontalImage, 0, 8,
0438: 9, 8),
0439: "RangeSlider.middleIcon",
0440: IconsFactory.getIcon(null, sliderHorizontalImage, 0,
0441: 16, 9, 6),
0442: "RangeSlider.lowerVIcon",
0443: IconsFactory.getIcon(null, sliderVerticalalImage, 0, 0,
0444: 8, 9),
0445: "RangeSlider.upperVIcon",
0446: IconsFactory.getIcon(null, sliderVerticalalImage, 8, 0,
0447: 8, 9),
0448: "RangeSlider.middleVIcon",
0449: IconsFactory.getIcon(null, sliderVerticalalImage, 16,
0450: 0, 6, 9),
0451:
0452: "Cursor.hsplit",
0453: JideIconsFactory
0454: .getImageIcon(JideIconsFactory.Cursor.HSPLIT),
0455: "Cursor.vsplit",
0456: JideIconsFactory
0457: .getImageIcon(JideIconsFactory.Cursor.VSPLIT),
0458:
0459: "Cursor.north",
0460: JideIconsFactory
0461: .getImageIcon(JideIconsFactory.Cursor.NORTH),
0462: "Cursor.south",
0463: JideIconsFactory
0464: .getImageIcon(JideIconsFactory.Cursor.SOUTH),
0465: "Cursor.east",
0466: JideIconsFactory
0467: .getImageIcon(JideIconsFactory.Cursor.EAST),
0468: "Cursor.west",
0469: JideIconsFactory
0470: .getImageIcon(JideIconsFactory.Cursor.WEST),
0471: "Cursor.tab",
0472: JideIconsFactory
0473: .getImageIcon(JideIconsFactory.Cursor.TAB),
0474: "Cursor.float",
0475: JideIconsFactory
0476: .getImageIcon(JideIconsFactory.Cursor.FLOAT),
0477: "Cursor.vertical",
0478: JideIconsFactory
0479: .getImageIcon(JideIconsFactory.Cursor.VERTICAL),
0480: "Cursor.horizontal",
0481: JideIconsFactory
0482: .getImageIcon(JideIconsFactory.Cursor.HORIZONTAL),
0483: "Cursor.delete",
0484: JideIconsFactory
0485: .getImageIcon(JideIconsFactory.Cursor.DELETE),
0486: "Cursor.drag",
0487: JideIconsFactory
0488: .getImageIcon(JideIconsFactory.Cursor.DROP),
0489: "Cursor.dragStop",
0490: JideIconsFactory
0491: .getImageIcon(JideIconsFactory.Cursor.NODROP),
0492: "Cursor.dragText",
0493: JideIconsFactory
0494: .getImageIcon(JideIconsFactory.Cursor.DROP_TEXT),
0495: "Cursor.dragTextStop",
0496: JideIconsFactory
0497: .getImageIcon(JideIconsFactory.Cursor.NODROP_TEXT),
0498:
0499: "Icon.floating", Boolean.TRUE,
0500:
0501: "JideScrollPane.border", singleLineBorder,
0502:
0503: "TextArea.font", controlFont, };
0504: table.putDefaults(uiDefaults);
0505:
0506: int products = LookAndFeelFactory.getProductsUsed();
0507:
0508: if ((products & PRODUCT_DOCK) != 0) {
0509: Object slidingEastFrameBorder = new ExtWindowsDesktopProperty(
0510: new String[] { "win.3d.lightColor",
0511: "win.3d.highlightColor",
0512: "win.3d.shadowColor",
0513: "win.3d.darkShadowColor" }, new Object[] {
0514: table.get("control"),
0515: table.get("controlLtHighlight"),
0516: table.get("controlShadow"),
0517: table.get("controlDkShadow") }, toolkit,
0518: new ConvertListener() {
0519: public Object convert(Object[] obj) {
0520: return new ResizeFrameBorder(
0521: (Color) obj[0], (Color) obj[1],
0522: (Color) obj[2], (Color) obj[3],
0523: new Insets(0, 4, 0, 0));
0524: }
0525: });
0526:
0527: Object slidingWestFrameBorder = new ExtWindowsDesktopProperty(
0528: new String[] { "win.3d.lightColor",
0529: "win.3d.highlightColor",
0530: "win.3d.shadowColor",
0531: "win.3d.darkShadowColor" }, new Object[] {
0532: table.get("control"),
0533: table.get("controlLtHighlight"),
0534: table.get("controlShadow"),
0535: table.get("controlDkShadow") }, toolkit,
0536: new ConvertListener() {
0537: public Object convert(Object[] obj) {
0538: return new ResizeFrameBorder(
0539: (Color) obj[0], (Color) obj[1],
0540: (Color) obj[2], (Color) obj[3],
0541: new Insets(0, 0, 0, 4));
0542: }
0543: });
0544:
0545: Object slidingNorthFrameBorder = new ExtWindowsDesktopProperty(
0546: new String[] { "win.3d.lightColor",
0547: "win.3d.highlightColor",
0548: "win.3d.shadowColor",
0549: "win.3d.darkShadowColor" }, new Object[] {
0550: table.get("control"),
0551: table.get("controlLtHighlight"),
0552: table.get("controlShadow"),
0553: table.get("controlDkShadow") }, toolkit,
0554: new ConvertListener() {
0555: public Object convert(Object[] obj) {
0556: return new ResizeFrameBorder(
0557: (Color) obj[0], (Color) obj[1],
0558: (Color) obj[2], (Color) obj[3],
0559: new Insets(0, 0, 4, 0));
0560: }
0561: });
0562:
0563: Object slidingSouthFrameBorder = new ExtWindowsDesktopProperty(
0564: new String[] { "win.3d.lightColor",
0565: "win.3d.highlightColor",
0566: "win.3d.shadowColor",
0567: "win.3d.darkShadowColor" }, new Object[] {
0568: table.get("control"),
0569: table.get("controlLtHighlight"),
0570: table.get("controlShadow"),
0571: table.get("controlDkShadow") }, toolkit,
0572: new ConvertListener() {
0573: public Object convert(Object[] obj) {
0574: return new ResizeFrameBorder(
0575: (Color) obj[0], (Color) obj[1],
0576: (Color) obj[2], (Color) obj[3],
0577: new Insets(4, 0, 0, 0));
0578: }
0579: });
0580:
0581: ImageIcon titleButtonImage = IconsFactory.getImageIcon(
0582: VsnetWindowsUtils.class,
0583: "icons/title_buttons_windows.gif"); // 10 x 10 x 8
0584: final int titleButtonSize = 10;
0585:
0586: uiDefaults = new Object[] {
0587: // dock
0588: "Workspace.background",
0589: mdiBackgroundColor,
0590:
0591: "SidePane.margin",
0592: new InsetsUIResource(2, 2, 0, 0),
0593: "SidePane.iconTextGap",
0594: 2,
0595: "SidePane.textBorderGap",
0596: 13,
0597: "SidePane.itemGap",
0598: 5,
0599: "SidePane.groupGap",
0600: 13,
0601: "SidePane.foreground",
0602: defaultDarkShadowColor,
0603: "SidePane.background",
0604: defaultFormBackground,
0605: "SidePane.lineColor",
0606: defaultShadowColor,
0607: "SidePane.buttonBackground",
0608: defaultBackgroundColor,
0609: "SidePane.selectedButtonBackground",
0610: selectedButtonColor,
0611: "SidePane.selectedButtonForeground",
0612: defaultTextColor,
0613: "SidePane.font",
0614: controlFont,
0615: "SidePane.orientation",
0616: 1,
0617: "SidePane.showSelectedTabText",
0618: Boolean.TRUE,
0619: "SidePane.alwaysShowTabText",
0620: Boolean.FALSE,
0621:
0622: "ContentContainer.background",
0623: defaultFormBackground,
0624: "ContentContainer.vgap",
0625: 1,
0626: "ContentContainer.hgap",
0627: 1,
0628: "MainContainer.border",
0629: new BorderUIResource(BorderFactory
0630: .createEmptyBorder(0, 0, 0, 0)),
0631:
0632: "DockableFrame.defaultIcon",
0633: JideIconsFactory
0634: .getImageIcon(JideIconsFactory.DockableFrame.BLANK),
0635: "DockableFrame.background",
0636: defaultBackgroundColor,
0637: "DockableFrame.border",
0638: new BorderUIResource(BorderFactory
0639: .createEmptyBorder(0, 0, 0, 0)),
0640: "DockableFrame.floatingBorder",
0641: new BorderUIResource(BorderFactory
0642: .createEmptyBorder(0, 0, 0, 0)),
0643: "DockableFrame.slidingEastBorder",
0644: slidingEastFrameBorder,
0645: "DockableFrame.slidingWestBorder",
0646: slidingWestFrameBorder,
0647: "DockableFrame.slidingNorthBorder",
0648: slidingNorthFrameBorder,
0649: "DockableFrame.slidingSouthBorder",
0650: slidingSouthFrameBorder,
0651:
0652: "DockableFrame.activeTitleBackground",
0653: activeTitleBackgroundColor,
0654: "DockableFrame.activeTitleForeground",
0655: activeTitleTextColor,
0656: "DockableFrame.inactiveTitleBackground",
0657: defaultBackgroundColor,
0658: "DockableFrame.inactiveTitleForeground",
0659: defaultTextColor,
0660: "DockableFrame.titleBorder",
0661: new BorderUIResource(BorderFactory
0662: .createEmptyBorder(0, 0, 3, 0)),
0663: "DockableFrame.activeTitleBorderColor",
0664: activeTitleBackgroundColor,
0665: "DockableFrame.inactiveTitleBorderColor",
0666: defaultShadowColor,
0667: "DockableFrame.font",
0668: controlFont,
0669:
0670: "DockableFrameTitlePane.gripperPainter",
0671: gripperPainter,
0672: "DockableFrameTitlePane.font",
0673: controlFont,
0674: "DockableFrameTitlePane.hideIcon",
0675: IconsFactory.getIcon(null, titleButtonImage, 0, 0,
0676: titleButtonSize, titleButtonSize),
0677: "DockableFrameTitlePane.unfloatIcon",
0678: IconsFactory.getIcon(null, titleButtonImage, 0,
0679: titleButtonSize, titleButtonSize,
0680: titleButtonSize),
0681: "DockableFrameTitlePane.floatIcon",
0682: IconsFactory.getIcon(null, titleButtonImage, 0,
0683: 2 * titleButtonSize, titleButtonSize,
0684: titleButtonSize),
0685: "DockableFrameTitlePane.autohideIcon",
0686: IconsFactory.getIcon(null, titleButtonImage, 0,
0687: 3 * titleButtonSize, titleButtonSize,
0688: titleButtonSize),
0689: "DockableFrameTitlePane.stopAutohideIcon",
0690: IconsFactory.getIcon(null, titleButtonImage, 0,
0691: 4 * titleButtonSize, titleButtonSize,
0692: titleButtonSize),
0693: "DockableFrameTitlePane.hideAutohideIcon",
0694: IconsFactory.getIcon(null, titleButtonImage, 0,
0695: 5 * titleButtonSize, titleButtonSize,
0696: titleButtonSize),
0697: "DockableFrameTitlePane.maximizeIcon",
0698: IconsFactory.getIcon(null, titleButtonImage, 0,
0699: 6 * titleButtonSize, titleButtonSize,
0700: titleButtonSize),
0701: "DockableFrameTitlePane.restoreIcon",
0702: IconsFactory.getIcon(null, titleButtonImage, 0,
0703: 7 * titleButtonSize, titleButtonSize,
0704: titleButtonSize),
0705: "DockableFrameTitlePane.titleBarComponent",
0706: Boolean.FALSE,
0707:
0708: "DockableFrameTitlePane.alwaysShowAllButtons",
0709: Boolean.FALSE, // true if show all three buttons no matter if the buttons is available. false if only show buttons which is available
0710: "DockableFrameTitlePane.use3dButtons",
0711: Boolean.TRUE,
0712: "DockableFrameTitlePane.buttonsAlignment",
0713: SwingConstants.TRAILING, // trailing or leading
0714: "DockableFrameTitlePane.titleAlignment",
0715: SwingConstants.LEADING, // trailing or leading or center
0716: "DockableFrameTitlePane.buttonGap",
0717: 4, // gap between buttons
0718: "DockableFrameTitlePane.showIcon",
0719: Boolean.FALSE, // show icon or not
0720: "DockableFrameTitlePane.margin",
0721: new InsetsUIResource(0, 6, 0, 6), // gap
0722:
0723: "Contour.color",
0724: new ColorUIResource(136, 136, 136),
0725: "Contour.thickness", 4,
0726:
0727: "DockingFramework.changeCursor", Boolean.FALSE,
0728:
0729: "FrameContainer.contentBorderInsets",
0730: new InsetsUIResource(2, 0, 0, 0), };
0731: table.putDefaults(uiDefaults);
0732: }
0733:
0734: if ((products & PRODUCT_COMPONENTS) != 0) {
0735: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
0736: VsnetWindowsUtils.class,
0737: "icons/collapsible_pane_windows.gif"); // 12 x 12 x 2
0738: final int collapsiblePaneSize = 12;
0739:
0740: uiDefaults = new Object[] {
0741: // components
0742: "CollapsiblePanes.border",
0743: new BorderUIResource(BorderFactory
0744: .createEmptyBorder(12, 12, 0, 12)),
0745: "CollapsiblePanes.gap",
0746: 15,
0747:
0748: "CollapsiblePane.background",
0749: Color.BLACK.equals(defaultBackgroundColor
0750: .createValue(table)) ? defaultLtHighlightColor
0751: : defaultBackgroundColor,
0752: "CollapsiblePane.contentBackground",
0753: Color.BLACK.equals(defaultBackgroundColor
0754: .createValue(table)) ? defaultBackgroundColor
0755: : defaultLtHighlightColor,
0756: "CollapsiblePane.foreground",
0757: defaultTextColor,
0758: "CollapsiblePane.emphasizedBackground",
0759: activeTitleBackgroundColor,
0760: "CollapsiblePane.emphasizedForeground",
0761: activeTitleTextColor,
0762: "CollapsiblePane.border",
0763: new BorderUIResource(BorderFactory
0764: .createEmptyBorder(0, 0, 0, 0)),
0765: "CollapsiblePane.font",
0766: controlFont,
0767:
0768: "CollapsiblePane.contentBorder",
0769: new BorderUIResource(BorderFactory
0770: .createEmptyBorder(8, 10, 8, 10)),
0771:
0772: "CollapsiblePane.titleBorder",
0773: new BorderUIResource(BorderFactory
0774: .createEmptyBorder(3, 3, 3, 3)),
0775: "CollapsiblePane.titleFont",
0776: boldFont,
0777: "CollapsiblePane.downIcon",
0778: IconsFactory
0779: .getIcon(null, collapsiblePaneImage, 0, 0,
0780: collapsiblePaneSize,
0781: collapsiblePaneSize),
0782: "CollapsiblePane.upIcon",
0783: IconsFactory.getIcon(null, collapsiblePaneImage, 0,
0784: collapsiblePaneSize, collapsiblePaneSize,
0785: collapsiblePaneSize),
0786:
0787: "StatusBarItem.border",
0788: singleLineBorder,
0789:
0790: "StatusBar.border",
0791: new BorderUIResource(BorderFactory
0792: .createEmptyBorder(2, 0, 0, 0)),
0793: "StatusBar.gap",
0794: 2,
0795: "StatusBar.background",
0796: defaultBackgroundColor,
0797: "StatusBar.font",
0798: controlFont,
0799:
0800: "DocumentPane.groupBorder",
0801: new BorderUIResource(BorderFactory
0802: .createLineBorder(Color.gray)),
0803: "DocumentPane.newHorizontalGroupIcon",
0804: JideIconsFactory
0805: .getImageIcon(JideIconsFactory.WindowMenu.NEW_HORIZONTAL_TAB),
0806: "DocumentPane.newVerticalGroupIcon",
0807: JideIconsFactory
0808: .getImageIcon(JideIconsFactory.WindowMenu.NEW_VERTICAL_TAB),
0809: "DocumentPane.boldActiveTab", Boolean.TRUE, };
0810: table.putDefaults(uiDefaults);
0811: }
0812:
0813: if ((products & PRODUCT_ACTION) != 0) {
0814: Object commandBarBackground = new ExtWindowsDesktopProperty(
0815: new String[] { "win.3d.backgroundColor" },
0816: new Object[] { table.get("control") }, toolkit,
0817: new ConvertListener() {
0818: public Object convert(Object[] obj) {
0819: return new ColorUIResource(
0820: VsnetUtils
0821: .getToolBarBackgroundColor((Color) obj[0]));
0822: }
0823: });
0824:
0825: uiDefaults = new Object[] {
0826: // action
0827: "CommandBar.font",
0828: toolbarFont,
0829: "CommandBar.background",
0830: commandBarBackground,
0831: "CommandBar.foreground",
0832: defaultTextColor,
0833: "CommandBar.shadow",
0834: defaultShadowColor,
0835: "CommandBar.darkShadow",
0836: defaultDarkShadowColor,
0837: "CommandBar.light",
0838: defaultHighlightColor,
0839: "CommandBar.highlight",
0840: defaultLtHighlightColor,
0841: "CommandBar.border",
0842: new BorderUIResource(BorderFactory
0843: .createEmptyBorder(1, 1, 1, 1)),
0844: "CommandBar.borderVert",
0845: new BorderUIResource(BorderFactory
0846: .createEmptyBorder(1, 1, 1, 1)),
0847: "CommandBar.borderFloating",
0848: new BorderUIResource(
0849: BorderFactory
0850: .createCompoundBorder(
0851: BorderFactory
0852: .createLineBorder(
0853: (Color) activeTitleBackgroundColor
0854: .createValue(table),
0855: 2),
0856: BorderFactory
0857: .createEmptyBorder(
0858: 1, 1, 1, 1))),
0859: "CommandBar.ancestorInputMap",
0860: new UIDefaults.LazyInputMap(new Object[] { "UP",
0861: "navigateUp", "KP_UP", "navigateUp",
0862: "DOWN", "navigateDown", "KP_DOWN",
0863: "navigateDown", "LEFT", "navigateLeft",
0864: "KP_LEFT", "navigateLeft", "RIGHT",
0865: "navigateRight", "KP_RIGHT",
0866: "navigateRight" }),
0867: "CommandBar.titleBarSize", 17,
0868: "CommandBar.titleBarButtonGap", 1,
0869: "CommandBar.titleBarBackground",
0870: activeTitleBackgroundColor,
0871: "CommandBar.titleBarForeground",
0872: activeTitleTextColor, "CommandBar.titleBarFont",
0873: boldFont,
0874: "CommandBar.minimumSize",
0875: new DimensionUIResource(20, 20),
0876:
0877: "CommandBar.separatorSize",
0878: 5,
0879:
0880: // *** Separator
0881: "CommandBarSeparator.background",
0882: new Color(219, 216, 209),
0883: "CommandBarSeparator.foreground",
0884: new Color(166, 166, 166),
0885:
0886: "Chevron.size", 11, "Chevron.alwaysVisible",
0887: Boolean.FALSE, };
0888: table.putDefaults(uiDefaults);
0889: }
0890:
0891: if ((products & PRODUCT_GRIDS) != 0) {
0892: uiDefaults = new Object[] {
0893: // grid
0894: "AbstractComboBox.useJButton", Boolean.FALSE,
0895: "NestedTableHeader.cellBorder",
0896: new HeaderCellBorder(), };
0897: table.putDefaults(uiDefaults);
0898: }
0899:
0900: if (!JideSwingUtilities.shouldUseSystemFont()) {
0901: Object uiDefaultsFont[] = { "TabbedPane.font", controlFont,
0902: "TitledBorder.font", boldFont, "TableHeader.font",
0903: controlFont, "Table.font", controlFont,
0904: "List.font", controlFont, "Tree.font", controlFont,
0905: "ToolTip.font", controlFont, "CheckBox.font",
0906: controlFont, "RadioButton.font", controlFont,
0907: "Label.font", controlFont, "Panel.font",
0908: controlFont, "TextField.font", controlFont,
0909: "ComboBox.font", controlFont, "Button.font",
0910: controlFont };
0911: table.putDefaults(uiDefaultsFont);
0912: }
0913:
0914: // make the spinner has the same font as text field
0915: table.put("Spinner.font", table.get("TextField.font"));
0916: table.put("Spinner.margin", table.get("TextField.margin"));
0917: table.put("Spinner.border", table.get("TextField.border"));
0918: table.put("FormattedTextField.font", table
0919: .get("TextField.font"));
0920:
0921: table.put("Theme.painter", BasicPainter.getInstance());
0922: }
0923:
0924: /**
0925: * Initializes components defaults with menu components UIDefaults.
0926: *
0927: * @param table UIDefaults table
0928: */
0929: public static void initComponentDefaultsWithMenu(UIDefaults table) {
0930: Toolkit toolkit = Toolkit.getDefaultToolkit();
0931:
0932: initComponentDefaults(table);
0933:
0934: if (!Beans.isDesignTime()) {
0935: Object defaultLightColor = new ExtWindowsDesktopProperty(
0936: new String[] { "win.3d.lightColor" },
0937: new Object[] { table.get("controlHighlight") },
0938: toolkit, new ConvertListener() {
0939: public Object convert(Object[] obj) {
0940: return new ColorUIResource(VsnetUtils
0941: .getLighterColor((Color) obj[0]));
0942: }
0943: });
0944: Object borderColor = new ExtWindowsDesktopProperty(
0945: new String[] { "win.item.highlightColor" },
0946: new Object[] { table.get("controlShadow") },
0947: toolkit, new ConvertListener() {
0948: public Object convert(Object[] obj) {
0949: return new ColorUIResource(
0950: VsnetUtils
0951: .getButtonBorderColor((Color) obj[0]));
0952: }
0953: });
0954: WindowsDesktopProperty menuTextColor = new WindowsDesktopProperty(
0955: "win.menu.textColor", table.get("control"), toolkit);
0956:
0957: Object menuFont = JideSwingUtilities.getMenuFont(toolkit,
0958: table);
0959:
0960: Object menuSelectionBackground = new ExtWindowsDesktopProperty(
0961: //Actual color 182, 189, 210
0962: new String[] { "win.3d.lightColor" },
0963: new Object[] { table.get("controlShadow") },
0964: toolkit, new ConvertListener() {
0965: public Object convert(Object[] obj) {
0966: return new ColorUIResource(
0967: VsnetUtils
0968: .getMenuSelectionColor((Color) obj[0]));
0969: }
0970: });
0971:
0972: Object menuBackground = new ExtWindowsDesktopProperty(
0973: //Actual color 249, 248, 247
0974: new String[] { "win.3d.backgroundColor" },
0975: new Object[] { table.get("control") }, toolkit,
0976: new ConvertListener() {
0977: public Object convert(Object[] obj) {
0978: return new ColorUIResource(
0979: VsnetUtils
0980: .getMenuBackgroundColor((Color) obj[0]));
0981: }
0982: });
0983:
0984: Object separatorColor = new ExtWindowsDesktopProperty(
0985: // Not exactly right
0986: new String[] { "win.3d.shadowColor" },
0987: new Object[] { table.get("controlShadow") },
0988: toolkit, new ConvertListener() {
0989: public Object convert(Object[] obj) {
0990: return new ColorUIResource(((Color) obj[0])
0991: .brighter());
0992: }
0993: });
0994:
0995: Object uiDefaults[] = {
0996: "PopupMenuSeparator.foreground",
0997: separatorColor,
0998: "PopupMenuSeparator.background",
0999: menuBackground,
1000:
1001: "CheckBoxMenuItem.checkIcon",
1002: JideIconsFactory
1003: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
1004: "CheckBoxMenuItem.selectionBackground",
1005: menuSelectionBackground,
1006: "CheckBoxMenuItem.selectionForeground",
1007: menuTextColor,
1008: "CheckBoxMenuItem.acceleratorSelectionForeground",
1009: menuTextColor,
1010: "CheckBoxMenuItem.mouseHoverBackground",
1011: menuSelectionBackground,
1012: "CheckBoxMenuItem.mouseHoverBorder",
1013: new BorderUIResource(BorderFactory
1014: .createLineBorder(new Color(10, 36, 106))),
1015: "CheckBoxMenuItem.margin",
1016: new InsetsUIResource(3, 0, 3, 0),
1017: "CheckBoxMenuItem.font",
1018: menuFont,
1019: "CheckBoxMenuItem.acceleratorFont",
1020: menuFont,
1021: "CheckBoxMenuItem.textIconGap",
1022: 8,
1023:
1024: "RadioButtonMenuItem.checkIcon",
1025: JideIconsFactory
1026: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
1027: "RadioButtonMenuItem.selectionBackground",
1028: menuSelectionBackground,
1029: "RadioButtonMenuItem.selectionForeground",
1030: menuTextColor,
1031: "RadioButtonMenuItem.acceleratorSelectionForeground",
1032: menuTextColor,
1033: "RadioButtonMenuItem.mouseHoverBackground",
1034: menuSelectionBackground,
1035: "RadioButtonMenuItem.mouseHoverBorder",
1036: new BorderUIResource(BorderFactory
1037: .createLineBorder(new Color(10, 36, 106))),
1038: "RadioButtonMenuItem.margin",
1039: new InsetsUIResource(3, 0, 3, 0),
1040: "RadioButtonMenuItem.font",
1041: menuFont,
1042: "RadioButtonMenuItem.acceleratorFont",
1043: menuFont,
1044: "RadioButtonMenuItem.textIconGap",
1045: 8,
1046:
1047: "MenuBar.border",
1048: new BorderUIResource(BorderFactory
1049: .createEmptyBorder(2, 2, 2, 2)),
1050:
1051: "Menu.selectionBackground",
1052: menuSelectionBackground,
1053: "Menu.selectionForeground",
1054: menuTextColor,
1055: "Menu.mouseHoverBackground",
1056: menuSelectionBackground,
1057: "Menu.mouseHoverBorder",
1058: new BorderUIResource(BorderFactory
1059: .createLineBorder(new Color(10, 36, 106))),
1060: "Menu.margin",
1061: new InsetsUIResource(3, 7, 2, 7),
1062: "Menu.checkIcon",
1063: JideIconsFactory
1064: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
1065: "Menu.textIconGap",
1066: 2,
1067: "Menu.font",
1068: menuFont,
1069: "Menu.acceleratorFont",
1070: menuFont,
1071: "Menu.submenuPopupOffsetX",
1072: 0,
1073: "Menu.submenuPopupOffsetY",
1074: 0,
1075:
1076: "MenuItem.checkIcon",
1077: JideIconsFactory
1078: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
1079: "MenuItem.selectionBackground",
1080: menuSelectionBackground,
1081: "MenuItem.selectionForeground", menuTextColor,
1082: "MenuItem.acceleratorSelectionForeground",
1083: menuTextColor, "MenuItem.background",
1084: menuBackground, "MenuItem.selectionBorderColor",
1085: borderColor,
1086: "MenuItem.shadowWidth",
1087: 24,
1088: "MenuItem.shadowColor",
1089: defaultLightColor, // TODO: not exactly. The actual one a little bit brighter than it
1090: "MenuItem.textIconGap", 8, "MenuItem.accelEndGap",
1091: 18, "MenuItem.margin",
1092: new InsetsUIResource(3, 0, 3, 0), "MenuItem.font",
1093: menuFont, "MenuItem.acceleratorFont", menuFont, };
1094: table.putDefaults(uiDefaults);
1095: }
1096:
1097: // since it used BasicPainter, make sure it is after Theme.Painter is set first.
1098: Object popupMenuBorder = new ExtWindowsDesktopProperty(
1099: new String[] { "null" },
1100: new Object[] { ((BasicPainter) table
1101: .get("Theme.painter")).getMenuItemBorderColor() },
1102: toolkit, new ConvertListener() {
1103: public Object convert(Object[] obj) {
1104: return new BorderUIResource(
1105: BorderFactory
1106: .createCompoundBorder(
1107: BorderFactory
1108: .createLineBorder((Color) obj[0]),
1109: BorderFactory
1110: .createEmptyBorder(
1111: 1, 1,
1112: 1, 1)));
1113: }
1114: });
1115: table.put("PopupMenu.border", popupMenuBorder);
1116: }
1117: }
|