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