001: /*
002: * @(#)XertoMetalUtils.java 11/3/2005
003: *
004: * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
005: */
006: package com.jidesoft.plaf.xerto;
007:
008: import com.jidesoft.icons.IconsFactory;
009: import com.jidesoft.icons.JideIconsFactory;
010: import com.jidesoft.plaf.LookAndFeelFactory;
011: import com.jidesoft.plaf.basic.BasicPainter;
012: import com.jidesoft.plaf.basic.BasicRangeSliderUI;
013: import com.jidesoft.plaf.basic.Painter;
014: import com.jidesoft.plaf.vsnet.ResizeFrameBorder;
015: import com.jidesoft.plaf.vsnet.VsnetLookAndFeelExtension;
016: import com.jidesoft.swing.JideSwingUtilities;
017: import com.jidesoft.swing.JideTabbedPane;
018: import com.jidesoft.utils.SecurityUtils;
019:
020: import javax.swing.*;
021: import javax.swing.plaf.BorderUIResource;
022: import javax.swing.plaf.ColorUIResource;
023: import javax.swing.plaf.InsetsUIResource;
024: import javax.swing.plaf.basic.BasicBorders;
025: import java.awt.*;
026:
027: /**
028: * Initialize the uiClassID to BasicComponentUI mapping for JIDE components using Xerto style for MetalLookAndFeel.
029: * Xerto Style is designed by Xerto at http://www.xerto.com.
030: */
031: public class XertoMetalUtils extends VsnetLookAndFeelExtension {
032:
033: /**
034: * Initializes class defaults with menu components UIDefaults.
035: *
036: * @param table
037: */
038: public static void initClassDefaultsWithMenu(UIDefaults table) {
039: VsnetLookAndFeelExtension.initClassDefaultsWithMenu(table);
040: initClassDefaultsForXerto(table);
041: }
042:
043: /**
044: * Initializes class defaults with menu components UIDefaults.
045: *
046: * @param table
047: */
048: public static void initClassDefaults(UIDefaults table) {
049: VsnetLookAndFeelExtension.initClassDefaults(table);
050: initClassDefaultsForXerto(table);
051: }
052:
053: private static void initClassDefaultsForXerto(UIDefaults table) {
054: int products = LookAndFeelFactory.getProductsUsed();
055:
056: final String xertoPackageName = "com.jidesoft.plaf.xerto.";
057:
058: if ((products & PRODUCT_COMPONENTS) != 0) {
059: table.put("CollapsiblePaneUI", xertoPackageName
060: + "XertoCollapsiblePaneUI");
061: table
062: .put("StatusBarSeparatorUI",
063: "com.jidesoft.plaf.office2003.Office2003StatusBarSeparatorUI");
064: }
065:
066: if ((products & PRODUCT_DOCK) != 0) {
067: table.put("SidePaneUI", xertoPackageName
068: + "XertoSidePaneUI");
069: table.put("DockableFrameUI", xertoPackageName
070: + "XertoDockableFrameUI");
071: }
072: }
073:
074: /**
075: * Initializes components defaults.
076: *
077: * @param table
078: */
079: public static void initComponentDefaultsWithMenu(UIDefaults table) {
080: /// always want shading
081: System.setProperty("shadingtheme", "true");
082:
083: Toolkit toolkit = Toolkit.getDefaultToolkit();
084:
085: Object defaultHighlightColor = table.get("controlHighlight");
086: Object selectionBackgroundColor = table.get("controlShadow");
087: Object menuTextColor = table.get("control");
088:
089: Object menuFont = JideSwingUtilities
090: .getMenuFont(toolkit, table);
091:
092: Object menuSelectionBackground = new ColorUIResource(XertoUtils
093: .getMenuSelectionColor(table.getColor("controlShadow")));
094:
095: Object menuBackground = new ColorUIResource(XertoUtils
096: .getMenuBackgroundColor(table.getColor("control")));
097:
098: Object separatorColor = new ColorUIResource(table.getColor(
099: "controlShadow").brighter());
100:
101: Object[] uiDefaults = {
102: "PopupMenuSeparator.foreground",
103: separatorColor,
104: "PopupMenuSeparator.background",
105: menuBackground,
106:
107: "CheckBoxMenuItem.checkIcon",
108: JideIconsFactory
109: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
110: "CheckBoxMenuItem.selectionBackground",
111: menuSelectionBackground,
112: "CheckBoxMenuItem.selectionForeground",
113: menuTextColor,
114: "CheckBoxMenuItem.acceleratorSelectionForeground",
115: menuTextColor,
116: "CheckBoxMenuItem.mouseHoverBackground",
117: menuSelectionBackground,
118: "CheckBoxMenuItem.mouseHoverBorder",
119: new BorderUIResource(BorderFactory
120: .createLineBorder(new Color(10, 36, 106))),
121: "CheckBoxMenuItem.margin",
122: new InsetsUIResource(3, 0, 3, 0),
123: "CheckBoxMenuItem.font",
124: menuFont,
125: "CheckBoxMenuItem.acceleratorFont",
126: menuFont,
127: "CheckBoxMenuItem.textIconGap",
128: 8,
129:
130: "RadioButtonMenuItem.checkIcon",
131: JideIconsFactory
132: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
133: "RadioButtonMenuItem.selectionBackground",
134: menuSelectionBackground,
135: "RadioButtonMenuItem.selectionForeground",
136: menuTextColor,
137: "RadioButtonMenuItem.acceleratorSelectionForeground",
138: menuTextColor,
139: "RadioButtonMenuItem.mouseHoverBackground",
140: menuSelectionBackground,
141: "RadioButtonMenuItem.mouseHoverBorder",
142: new BorderUIResource(BorderFactory
143: .createLineBorder(new Color(10, 36, 106))),
144: "RadioButtonMenuItem.margin",
145: new InsetsUIResource(3, 0, 3, 0),
146: "RadioButtonMenuItem.font",
147: menuFont,
148: "RadioButtonMenuItem.acceleratorFont",
149: menuFont,
150: "RadioButtonMenuItem.textIconGap",
151: 8,
152:
153: "MenuBar.border",
154: new BorderUIResource(BorderFactory.createEmptyBorder(2,
155: 2, 2, 2)),
156: // "MenuBar.border", new BorderUIResource(BorderFactory.createCompoundBorder(
157: // new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.SOUTH),
158: // BorderFactory.createEmptyBorder(2, 2, 2, 2))),
159:
160: "Menu.selectionBackground",
161: menuSelectionBackground,
162: "Menu.selectionForeground",
163: menuTextColor,
164: "Menu.mouseHoverBackground",
165: menuSelectionBackground,
166: "Menu.mouseHoverBorder",
167: new BorderUIResource(BorderFactory
168: .createLineBorder(new Color(10, 36, 106))),
169: "Menu.margin",
170: new InsetsUIResource(2, 7, 1, 7),
171: "Menu.checkIcon",
172: JideIconsFactory
173: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
174: "Menu.textIconGap",
175: 2,
176: "Menu.font",
177: menuFont,
178: "Menu.acceleratorFont",
179: menuFont,
180: "Menu.submenuPopupOffsetX",
181: 0,
182: "Menu.submenuPopupOffsetY",
183: 0,
184:
185: "PopupMenu.border",
186: new BorderUIResource(BorderFactory
187: .createCompoundBorder(BorderFactory
188: .createLineBorder(new Color(102, 102,
189: 102)), BorderFactory
190: .createEmptyBorder(1, 1, 1, 1))),
191:
192: "MenuItem.checkIcon",
193: JideIconsFactory
194: .getImageIcon(JideIconsFactory.MENU_CHECKBOX_VSNET),
195: "MenuItem.selectionBackground",
196: menuSelectionBackground,
197: "MenuItem.selectionForeground", menuTextColor,
198: "MenuItem.acceleratorSelectionForeground",
199: menuTextColor, "MenuItem.background", menuBackground,
200: "MenuItem.selectionBorderColor",
201: selectionBackgroundColor,
202: "MenuItem.shadowWidth",
203: 24,
204: "MenuItem.shadowColor",
205: defaultHighlightColor, // TODO: not exactly. The actual one a little bit brighter than it
206: "MenuItem.textIconGap", 8, "MenuItem.accelEndGap", 18,
207: "MenuItem.margin", new InsetsUIResource(4, 0, 3, 0),
208: "MenuItem.font", menuFont, "MenuItem.acceleratorFont",
209: menuFont };
210: table.putDefaults(uiDefaults);
211: initComponentDefaults(table);
212:
213: table.put("Theme.painter", XertoPainter.getInstance());
214:
215: // since it used BasicPainter, make sure it is after Theme.Painter is set first.
216: Object popupMenuBorder = new BorderUIResource(BorderFactory
217: .createCompoundBorder(BorderFactory
218: .createLineBorder(((BasicPainter) table
219: .get("Theme.painter"))
220: .getMenuItemBorderColor()),
221: BorderFactory.createEmptyBorder(1, 1, 1, 1)));
222: table.put("PopupMenu.border", popupMenuBorder);
223: }
224:
225: /**
226: * Initializes components defaults with menu components UIDefaults.
227: *
228: * @param table
229: */
230: public static void initComponentDefaults(UIDefaults table) {
231: /// always want shading
232: System.setProperty("shadingtheme", "true");
233:
234: Toolkit toolkit = Toolkit.getDefaultToolkit();
235:
236: Object defaultBackgroundColor = table.get("control");
237: Object defaultTextColor = table.get("controlText");
238: Object defaultShadowColor = table.get("controlShadow");
239: Object defaultDarkShadowColor = table.get("controlDkShadow");
240: Object defaultHighlightColor = table.get("controlHighlight");
241: Object defaultLtHighlightColor = table
242: .get("controlLtHighlight");
243: Object activeTitleBackgroundColor = table.get("activeCaption");
244: Object activeTitleTextColor = table.get("activeCaptionText");
245: Object selectionBackgroundColor = defaultShadowColor;
246: Object mdiBackgroundColor = defaultShadowColor;
247: Object menuTextColor = defaultTextColor;
248:
249: Object singleLineBorder = new BorderUIResource(BorderFactory
250: .createLineBorder(table.getColor("controlShadow")));
251:
252: Object controlFont = JideSwingUtilities.getControlFont(toolkit,
253: table);
254: Object toolbarFont = JideSwingUtilities.getMenuFont(toolkit,
255: table);
256: Object boldFont = JideSwingUtilities
257: .getBoldFont(toolkit, table);
258:
259: Object resizeBorder = new XertoFrameBorder(new Insets(4, 4, 4,
260: 4));
261:
262: Object defaultFormBackground = XertoUtils
263: .getDefaultBackgroundColor(table.getColor("control"));
264:
265: Object inactiveTabForground = (table.getColor("controlShadow"))
266: .darker();
267:
268: Object focusedButtonColor = new ColorUIResource(XertoUtils
269: .getFocusedButtonColor(table.getColor("textHighlight")));
270:
271: Object selectedAndFocusedButtonColor = new ColorUIResource(
272: XertoUtils.getSelectedAndFocusedButtonColor(table
273: .getColor("textHighlight")));
274:
275: Object selectedButtonColor = new ColorUIResource(
276: XertoUtils.getSelectedButtonColor(table
277: .getColor("textHighlight")));
278:
279: Object gripperForeground = new ColorUIResource(XertoUtils
280: .getGripperForegroundColor(table.getColor("control")));
281:
282: Object commandBarBackground = new ColorUIResource(XertoUtils
283: .getToolBarBackgroundColor(table.getColor("control")));
284:
285: Painter gripperPainter = new Painter() {
286: public void paint(JComponent c, Graphics g, Rectangle rect,
287: int orientation, int state) {
288: XertoPainter.getInstance().paintGripper(c, g, rect,
289: orientation, state);
290: }
291: };
292:
293: Object buttonBorder = new BasicBorders.MarginBorder();
294:
295: ImageIcon sliderHorizontalImage = IconsFactory
296: .getImageIcon(BasicRangeSliderUI.class,
297: "icons/slider_horizontal.gif");
298: ImageIcon sliderVerticalalImage = IconsFactory.getImageIcon(
299: BasicRangeSliderUI.class, "icons/slider_vertical.gif");
300:
301: Object[] uiDefaults = new Object[] {
302: "JideScrollPane.border",
303: singleLineBorder,
304:
305: "JideButton.selectedAndFocusedBackground",
306: selectedAndFocusedButtonColor,
307: "JideButton.focusedBackground",
308: focusedButtonColor,
309: "JideButton.selectedBackground",
310: selectedButtonColor,
311: "JideButton.borderColor",
312: selectionBackgroundColor,
313:
314: "JideButton.font",
315: controlFont,
316: "JideButton.background",
317: defaultBackgroundColor,
318: "JideButton.foreground",
319: defaultTextColor,
320: "JideButton.shadow",
321: defaultShadowColor,
322: "JideButton.darkShadow",
323: defaultDarkShadowColor,
324: "JideButton.light",
325: defaultHighlightColor,
326: "JideButton.highlight",
327: defaultLtHighlightColor,
328: "JideButton.border",
329: buttonBorder,
330: "JideButton.margin",
331: new InsetsUIResource(3, 3, 3, 3),
332: "JideButton.textIconGap",
333: 2,
334: "JideButton.textShiftOffset",
335: 0,
336: "JideButton.focusInputMap",
337: new UIDefaults.LazyInputMap(new Object[] { "SPACE",
338: "pressed", "released SPACE", "released",
339: // "ENTER", "pressed",
340: // "released ENTER", "released" // no last two for metal
341: }),
342:
343: "JideSplitPane.dividerSize",
344: 3,
345: "JideSplitPaneDivider.border",
346: new BorderUIResource(BorderFactory.createEmptyBorder()),
347: "JideSplitPaneDivider.background",
348: defaultBackgroundColor,
349: "JideSplitPaneDivider.gripperPainter",
350: gripperPainter,
351:
352: "JideTabbedPane.defaultTabShape",
353: JideTabbedPane.SHAPE_ROUNDED_VSNET,
354: "JideTabbedPane.defaultResizeMode",
355: JideTabbedPane.RESIZE_MODE_NONE,
356: "JideTabbedPane.defaultTabColorTheme",
357: JideTabbedPane.COLOR_THEME_OFFICE2003,
358:
359: "JideTabbedPane.tabRectPadding",
360: 2,
361: "JideTabbedPane.closeButtonMarginHorizonal",
362: 3,
363: "JideTabbedPane.closeButtonMarginVertical",
364: 3,
365: "JideTabbedPane.textMarginVertical",
366: 4,
367: "JideTabbedPane.noIconMargin",
368: 2,
369: "JideTabbedPane.iconMargin",
370: 5,
371: "JideTabbedPane.textPadding",
372: 6,
373: "JideTabbedPane.buttonSize",
374: 18,
375: "JideTabbedPane.buttonMargin",
376: 5,
377: "JideTabbedPane.fitStyleBoundSize",
378: 8,
379: "JideTabbedPane.fitStyleFirstTabMargin",
380: 4,
381: "JideTabbedPane.fitStyleIconMinWidth",
382: 24,
383: "JideTabbedPane.fitStyleTextMinWidth",
384: 16,
385: "JideTabbedPane.compressedStyleNoIconRectSize",
386: 24,
387: "JideTabbedPane.compressedStyleIconMargin",
388: 12,
389: "JideTabbedPane.compressedStyleCloseButtonMarginHorizontal",
390: 0,
391: "JideTabbedPane.compressedStyleCloseButtonMarginVertical",
392: 0,
393: "JideTabbedPane.fixedStyleRectSize",
394: 60,
395: "JideTabbedPane.closeButtonMargin",
396: 2,
397: "JideTabbedPane.gripLeftMargin",
398: 4,
399: "JideTabbedPane.closeButtonMarginSize",
400: 6,
401: "JideTabbedPane.closeButtonLeftMargin",
402: 2,
403: "JideTabbedPane.closeButtonRightMargin",
404: 2,
405:
406: "JideTabbedPane.defaultTabBorderShadowColor",
407: new ColorUIResource(115, 109, 99),
408:
409: "JideTabbedPane.gripperPainter",
410: gripperPainter,
411: "JideTabbedPane.border",
412: new BorderUIResource(BorderFactory.createEmptyBorder(0,
413: 0, 0, 0)),
414: "JideTabbedPane.background",
415: new ColorUIResource(XertoUtils.getControlColor()),
416: "JideTabbedPane.foreground",
417: new ColorUIResource(XertoUtils.getTabForgroundColor()),
418: "JideTabbedPane.light",
419: defaultHighlightColor,
420: "JideTabbedPane.highlight",
421: defaultLtHighlightColor,
422: "JideTabbedPane.shadow",
423: defaultShadowColor,
424: "JideTabbedPane.darkShadow",
425: new ColorUIResource(Color.GRAY),
426: "JideTabbedPane.tabInsets",
427: new InsetsUIResource(1, 4, 1, 4),
428: "JideTabbedPane.contentBorderInsets",
429: new InsetsUIResource(0, 0, 0, 0),
430: "JideTabbedPane.ignoreContentBorderInsetsIfNoTabs",
431: Boolean.FALSE,
432: "JideTabbedPane.tabAreaInsets",
433: new InsetsUIResource(2, 4, 0, 4),
434: "JideTabbedPane.tabAreaBackground",
435: new ColorUIResource(XertoUtils
436: .getApplicationFrameBackgroundColor()),
437: "JideTabbedPane.tabRunOverlay",
438: 2,
439: "JideTabbedPane.font",
440: controlFont,
441: "JideTabbedPane.selectedTabFont",
442: controlFont,
443: "JideTabbedPane.selectedTabTextForeground",
444: new ColorUIResource(XertoUtils.getTabForgroundColor()),
445: "JideTabbedPane.unselectedTabTextForeground",
446: inactiveTabForground,
447: "JideTabbedPane.selectedTabBackground",
448: new ColorUIResource(XertoUtils
449: .getSelectedTabBackgroundColor()),
450: "JideTabbedPane.textIconGap",
451: 4,
452: "JideTabbedPane.showIconOnTab",
453: Boolean.TRUE,
454: "JideTabbedPane.showCloseButtonOnTab",
455: Boolean.FALSE,
456: "JideTabbedPane.closeButtonAlignment",
457: SwingConstants.TRAILING,
458: "JideTabbedPane.focusInputMap",
459: new UIDefaults.LazyInputMap(new Object[] { "RIGHT",
460: "navigateRight", "KP_RIGHT", "navigateRight",
461: "LEFT", "navigateLeft", "KP_LEFT",
462: "navigateLeft", "UP", "navigateUp", "KP_UP",
463: "navigateUp", "DOWN", "navigateDown",
464: "KP_DOWN", "navigateDown", "ctrl DOWN",
465: "requestFocusForVisibleComponent",
466: "ctrl KP_DOWN",
467: "requestFocusForVisibleComponent", }),
468: "JideTabbedPane.ancestorInputMap",
469: new UIDefaults.LazyInputMap(new Object[] {
470: "ctrl PAGE_DOWN", "navigatePageDown",
471: "ctrl PAGE_UP", "navigatePageUp", "ctrl UP",
472: "requestFocus", "ctrl KP_UP", "requestFocus", }),
473:
474: "ButtonPanel.order",
475: "ACO",
476: "ButtonPanel.oppositeOrder",
477: "H",
478: "ButtonPanel.buttonGap",
479: 6,
480: "ButtonPanel.groupGap",
481: 6,
482: "ButtonPanel.minButtonWidth",
483: 75,
484:
485: "RangeSlider.lowerIcon",
486: IconsFactory.getIcon(null, sliderHorizontalImage, 0, 0,
487: 9, 8),
488: "RangeSlider.upperIcon",
489: IconsFactory.getIcon(null, sliderHorizontalImage, 0, 8,
490: 9, 8),
491: "RangeSlider.middleIcon",
492: IconsFactory.getIcon(null, sliderHorizontalImage, 0,
493: 16, 9, 6),
494: "RangeSlider.lowerVIcon",
495: IconsFactory.getIcon(null, sliderVerticalalImage, 0, 0,
496: 8, 9),
497: "RangeSlider.upperVIcon",
498: IconsFactory.getIcon(null, sliderVerticalalImage, 8, 0,
499: 8, 9),
500: "RangeSlider.middleVIcon",
501: IconsFactory.getIcon(null, sliderVerticalalImage, 16,
502: 0, 6, 9),
503:
504: "Cursor.hsplit",
505: JideIconsFactory
506: .getImageIcon(JideIconsFactory.Cursor.HSPLIT),
507: "Cursor.vsplit",
508: JideIconsFactory
509: .getImageIcon(JideIconsFactory.Cursor.VSPLIT),
510:
511: "Cursor.north",
512: JideIconsFactory
513: .getImageIcon(JideIconsFactory.Cursor.NORTH),
514: "Cursor.south",
515: JideIconsFactory
516: .getImageIcon(JideIconsFactory.Cursor.SOUTH),
517: "Cursor.east",
518: JideIconsFactory
519: .getImageIcon(JideIconsFactory.Cursor.EAST),
520: "Cursor.west",
521: JideIconsFactory
522: .getImageIcon(JideIconsFactory.Cursor.WEST),
523: "Cursor.tab",
524: JideIconsFactory
525: .getImageIcon(JideIconsFactory.Cursor.TAB),
526: "Cursor.float",
527: JideIconsFactory
528: .getImageIcon(JideIconsFactory.Cursor.FLOAT),
529: "Cursor.vertical",
530: JideIconsFactory
531: .getImageIcon(JideIconsFactory.Cursor.VERTICAL),
532: "Cursor.horizontal",
533: JideIconsFactory
534: .getImageIcon(JideIconsFactory.Cursor.HORIZONTAL),
535: "Cursor.delete",
536: JideIconsFactory
537: .getImageIcon(JideIconsFactory.Cursor.DELETE),
538: "Cursor.drag",
539: JideIconsFactory
540: .getImageIcon(JideIconsFactory.Cursor.DROP),
541: "Cursor.dragStop",
542: JideIconsFactory
543: .getImageIcon(JideIconsFactory.Cursor.NODROP),
544: "Cursor.dragText",
545: JideIconsFactory
546: .getImageIcon(JideIconsFactory.Cursor.DROP_TEXT),
547: "Cursor.dragTextStop",
548: JideIconsFactory
549: .getImageIcon(JideIconsFactory.Cursor.NODROP_TEXT),
550:
551: "Gripper.size",
552: 8,
553: "Gripper.foreground",
554: gripperForeground,
555: "Gripper.painter",
556: gripperPainter,
557:
558: "Icon.floating",
559: Boolean.FALSE,
560:
561: "Resizable.resizeBorder",
562: resizeBorder,
563:
564: "JideSplitButton.font",
565: controlFont,
566: "JideSplitButton.margin",
567: new InsetsUIResource(3, 3, 3, 7),
568: "JideSplitButton.border",
569: buttonBorder,
570: "JideSplitButton.borderPainted",
571: Boolean.FALSE,
572: "JideSplitButton.textIconGap",
573: 3,
574: "JideSplitButton.selectionForeground",
575: menuTextColor,
576: "JideSplitButton.focusInputMap",
577: new UIDefaults.LazyInputMap(new Object[] { "SPACE",
578: "pressed", "released SPACE",
579: "released",
580: // "ENTER", "pressed",
581: // "released ENTER", "released", // no these two for metal
582: "DOWN", "downPressed", "released DOWN",
583: "downReleased" }), };
584: table.putDefaults(uiDefaults);
585:
586: int products = LookAndFeelFactory.getProductsUsed();
587:
588: if ((products & PRODUCT_DOCK) != 0) {
589: ImageIcon titleButtonImage = IconsFactory.getImageIcon(
590: XertoWindowsUtils.class,
591: "icons/title_buttons_xerto.gif"); // 10 x 10 x 8
592: final int titleButtonSize = 10;
593:
594: FrameBorder frameBorder = new FrameBorder();
595:
596: boolean useShadowBorder = "true".equals(SecurityUtils
597: .getProperty("jide.shadeSlidingBorder", "false"));
598:
599: Object slidingEastFrameBorder = new SlidingFrameBorder(
600: table.getColor("control"), table
601: .getColor("controlLtHighlight"), table
602: .getColor("controlShadow"), table
603: .getColor("controlDkShadow"), new Insets(1,
604: SlidingFrameBorder.SHADOW_SIZE + 5, 1, 0));
605:
606: Object slidingWestFrameBorder = new SlidingFrameBorder(
607: table.getColor("control"), table
608: .getColor("controlLtHighlight"), table
609: .getColor("controlShadow"), table
610: .getColor("controlDkShadow"), new Insets(1,
611: 0, 1, SlidingFrameBorder.SHADOW_SIZE + 5));
612:
613: Object slidingNorthFrameBorder = new SlidingFrameBorder(
614: table.getColor("control"), table
615: .getColor("controlLtHighlight"), table
616: .getColor("controlShadow"), table
617: .getColor("controlDkShadow"), new Insets(0,
618: 1, SlidingFrameBorder.SHADOW_SIZE + 5, 1));
619:
620: Object slidingSouthFrameBorder = new SlidingFrameBorder(
621: table.getColor("control"), table
622: .getColor("controlLtHighlight"), table
623: .getColor("controlShadow"), table
624: .getColor("controlDkShadow"),
625: new Insets(SlidingFrameBorder.SHADOW_SIZE + 5, 1,
626: 0, 1));
627:
628: Object slidingEastFrameBorder2 = new ResizeFrameBorder(
629: table.getColor("control"), table
630: .getColor("controlLtHighlight"), table
631: .getColor("controlShadow"), table
632: .getColor("controlDkShadow"), new Insets(0,
633: 4, 0, 0));
634:
635: Object slidingWestFrameBorder2 = new ResizeFrameBorder(
636: table.getColor("control"), table
637: .getColor("controlLtHighlight"), table
638: .getColor("controlShadow"), table
639: .getColor("controlDkShadow"), new Insets(0,
640: 0, 0, 4));
641:
642: Object slidingNorthFrameBorder2 = new ResizeFrameBorder(
643: table.getColor("control"), table
644: .getColor("controlLtHighlight"), table
645: .getColor("controlShadow"), table
646: .getColor("controlDkShadow"), new Insets(0,
647: 0, 4, 0));
648:
649: Object slidingSouthFrameBorder2 = new ResizeFrameBorder(
650: table.getColor("control"), table
651: .getColor("controlLtHighlight"), table
652: .getColor("controlShadow"), table
653: .getColor("controlDkShadow"), new Insets(4,
654: 0, 0, 0));
655:
656: uiDefaults = new Object[] {
657: // dock
658: "Workspace.background",
659: mdiBackgroundColor,
660:
661: "SidePane.margin",
662: new InsetsUIResource(2, 2, 0, 0),
663: "SidePane.iconTextGap",
664: 2,
665: "SidePane.textBorderGap",
666: 13,
667: "SidePane.itemGap",
668: 5,
669: "SidePane.groupGap",
670: 13,
671: "SidePane.foreground",
672: defaultDarkShadowColor,
673: "SidePane.background",
674: new ColorUIResource(XertoUtils
675: .getApplicationFrameBackgroundColor()),
676: "SidePane.lineColor",
677: defaultShadowColor,
678: "SidePane.buttonBackground",
679: new ColorUIResource(XertoUtils
680: .getLightControlColor()),
681: "SidePane.selectedButtonBackground",
682: selectedButtonColor,
683: "SidePane.selectedButtonForeground",
684: defaultTextColor,
685: "SidePane.font",
686: controlFont,
687: "SidePane.orientation",
688: 1,
689: "SidePane.showSelectedTabText",
690: Boolean.TRUE,
691: "SidePane.alwaysShowTabText",
692: Boolean.FALSE,
693:
694: "DockableFrame.defaultIcon",
695: JideIconsFactory
696: .getImageIcon(JideIconsFactory.DockableFrame.BLANK),
697: "DockableFrame.background",
698: defaultBackgroundColor,
699: "DockableFrame.border",
700: frameBorder,
701: "DockableFrame.floatingBorder",
702: new BorderUIResource(BorderFactory
703: .createLineBorder(XertoUtils
704: .getFrameBorderColor())),
705: "DockableFrame.slidingEastBorder",
706: useShadowBorder ? slidingEastFrameBorder
707: : slidingEastFrameBorder2,
708: "DockableFrame.slidingWestBorder",
709: useShadowBorder ? slidingWestFrameBorder
710: : slidingWestFrameBorder2,
711: "DockableFrame.slidingNorthBorder",
712: useShadowBorder ? slidingNorthFrameBorder
713: : slidingNorthFrameBorder2,
714: "DockableFrame.slidingSouthBorder",
715: useShadowBorder ? slidingSouthFrameBorder
716: : slidingSouthFrameBorder2,
717:
718: "DockableFrame.activeTitleBackground",
719: activeTitleBackgroundColor,
720: "DockableFrame.activeTitleForeground",
721: new ColorUIResource(Color.WHITE),
722: "DockableFrame.inactiveTitleBackground",
723: defaultBackgroundColor,
724: "DockableFrame.inactiveTitleForeground",
725: new ColorUIResource(Color.WHITE),
726: "DockableFrame.titleBorder",
727: new BorderUIResource(BorderFactory
728: .createEmptyBorder(1, 0, 1, 0)),
729: "DockableFrame.activeTitleBorderColor",
730: activeTitleBackgroundColor,
731: "DockableFrame.inactiveTitleBorderColor",
732: defaultShadowColor,
733: "DockableFrame.font",
734: controlFont,
735:
736: "DockableFrameTitlePane.gripperPainter",
737: gripperPainter,
738: "DockableFrameTitlePane.font",
739: controlFont,
740: "DockableFrameTitlePane.hideIcon",
741: IconsFactory.getIcon(null, titleButtonImage, 0, 0,
742: titleButtonSize, titleButtonSize),
743: "DockableFrameTitlePane.unfloatIcon",
744: IconsFactory.getIcon(null, titleButtonImage, 0,
745: titleButtonSize, titleButtonSize,
746: titleButtonSize),
747: "DockableFrameTitlePane.floatIcon",
748: IconsFactory.getIcon(null, titleButtonImage, 0,
749: 2 * titleButtonSize, titleButtonSize,
750: titleButtonSize),
751: "DockableFrameTitlePane.autohideIcon",
752: IconsFactory.getIcon(null, titleButtonImage, 0,
753: 3 * titleButtonSize, titleButtonSize,
754: titleButtonSize),
755: "DockableFrameTitlePane.stopAutohideIcon",
756: IconsFactory.getIcon(null, titleButtonImage, 0,
757: 4 * titleButtonSize, titleButtonSize,
758: titleButtonSize),
759: "DockableFrameTitlePane.hideAutohideIcon",
760: IconsFactory.getIcon(null, titleButtonImage, 0,
761: 5 * titleButtonSize, titleButtonSize,
762: titleButtonSize),
763: "DockableFrameTitlePane.maximizeIcon",
764: IconsFactory.getIcon(null, titleButtonImage, 0,
765: 6 * titleButtonSize, titleButtonSize,
766: titleButtonSize),
767: "DockableFrameTitlePane.restoreIcon",
768: IconsFactory.getIcon(null, titleButtonImage, 0,
769: 7 * titleButtonSize, titleButtonSize,
770: titleButtonSize),
771: "DockableFrameTitlePane.titleBarComponent",
772: Boolean.FALSE,
773:
774: "DockableFrameTitlePane.alwaysShowAllButtons",
775: Boolean.FALSE, // true if show all three buttons no matter if the buttons is available. false if only show buttons which is available
776: "DockableFrameTitlePane.buttonsAlignment",
777: SwingConstants.TRAILING, // trailing or leading
778: "DockableFrameTitlePane.titleAlignment",
779: SwingConstants.LEADING, // trailing or leading or center
780: "DockableFrameTitlePane.buttonGap",
781: 0, // gap between buttons
782: "DockableFrameTitlePane.showIcon",
783: Boolean.TRUE, // show icon or not, the alignment is the same as titleAlignment
784: "DockableFrameTitlePane.margin",
785: new InsetsUIResource(0, 3, 0, 3), // gap
786:
787: "Contour.color",
788: new ColorUIResource(136, 136, 136),
789: "Contour.thickness", 4,
790:
791: "ContentContainer.background",
792: defaultFormBackground, "ContentContainer.vgap", 3,
793: "ContentContainer.hgap", 3,
794:
795: "DockingFramework.changeCursor", Boolean.FALSE, };
796: table.putDefaults(uiDefaults);
797: }
798:
799: if ((products & PRODUCT_COMPONENTS) != 0) {
800: ColorUIResource collapsiblePaneBackground = new ColorUIResource(
801: 236, 234, 217);
802: final int SIZE = 12;
803: final int MASK_SIZE = 12;
804: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
805: XertoMetalUtils.class,
806: "icons/collapsible_pane_xerto.png"); // 12 x 12
807: ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(
808: XertoMetalUtils.class,
809: "icons/collapsible_pane_mask.png"); // 12 x 12
810: ImageIcon normalIcon = IconsFactory.getIcon(null,
811: collapsiblePaneImage, 0, 0, SIZE, SIZE);
812: ImageIcon emphasizedIcon = IconsFactory.getIcon(null,
813: collapsiblePaneImage, SIZE, 0, SIZE, SIZE);
814: ImageIcon upMark = IconsFactory.getIcon(null,
815: collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE);
816: ImageIcon downMark = IconsFactory.getIcon(null,
817: collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE,
818: MASK_SIZE);
819:
820: uiDefaults = new Object[] {
821: // components
822: "CollapsiblePanes.border",
823: new BorderUIResource(BorderFactory
824: .createEmptyBorder(12, 12, 0, 12)),
825: "CollapsiblePanes.gap",
826: 5,
827:
828: "CollapsiblePane.background",
829: collapsiblePaneBackground,
830: "CollapsiblePane.contentBackground",
831: defaultLtHighlightColor,
832: "CollapsiblePane.foreground",
833: new ColorUIResource(XertoUtils
834: .getTextColor(collapsiblePaneBackground)),
835: "CollapsiblePane.emphasizedBackground",
836: collapsiblePaneBackground,
837: "CollapsiblePane.emphasizedForeground",
838: new ColorUIResource(
839: XertoUtils
840: .getTextColor(XertoUtils
841: .getEmBaseColor(collapsiblePaneBackground))),
842: // "CollapsiblePane.border", new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0)),
843: "CollapsiblePane.border",
844: new BorderUIResource(BorderFactory
845: .createLineBorder(new Color(172, 168, 153))),
846:
847: "CollapsiblePane.font",
848: controlFont,
849:
850: "CollapsiblePane.contentBorder",
851: new BorderUIResource(BorderFactory
852: .createEmptyBorder(8, 10, 8, 10)),
853:
854: "CollapsiblePane.titleBorder",
855: new BorderUIResource(BorderFactory
856: .createEmptyBorder()),
857: "CollapsiblePane.titleFont",
858: boldFont,
859:
860: "CollapsiblePane.downIcon",
861: IconsFactory.getOverlayIcon(null, normalIcon,
862: downMark, SwingConstants.CENTER),
863: "CollapsiblePane.upIcon",
864: IconsFactory.getOverlayIcon(null, normalIcon,
865: upMark, SwingConstants.CENTER),
866: "CollapsiblePane.downIcon.emphasized",
867: IconsFactory.getOverlayIcon(null, emphasizedIcon,
868: downMark, SwingConstants.CENTER),
869: "CollapsiblePane.upIcon.emphasized",
870: IconsFactory.getOverlayIcon(null, emphasizedIcon,
871: upMark, SwingConstants.CENTER),
872: "CollapsiblePane.titleButtonBackground",
873: normalIcon,
874: "CollapsiblePane.titleButtonBackground.emphasized",
875: emphasizedIcon,
876:
877: "StatusBarItem.border",
878: new BorderUIResource(BorderFactory
879: .createEmptyBorder(0, 1, 0, 1)),
880:
881: "StatusBar.border",
882: new StatusBarBorder(),
883: "StatusBar.gap",
884: 2,
885: "StatusBar.background",
886: defaultBackgroundColor,
887: "StatusBar.font",
888: controlFont,
889:
890: "DocumentPane.groupBorder",
891: new BorderUIResource(BorderFactory
892: .createLineBorder(Color.gray)),
893: "DocumentPane.newHorizontalGroupIcon",
894: JideIconsFactory
895: .getImageIcon(JideIconsFactory.WindowMenu.NEW_HORIZONTAL_TAB),
896: "DocumentPane.newVerticalGroupIcon",
897: JideIconsFactory
898: .getImageIcon(JideIconsFactory.WindowMenu.NEW_VERTICAL_TAB),
899: "DocumentPane.boldActiveTab", Boolean.FALSE, };
900: table.putDefaults(uiDefaults);
901: }
902:
903: if ((products & PRODUCT_ACTION) != 0) {
904: uiDefaults = new Object[] {
905: // action
906: "CommandBar.font",
907: toolbarFont,
908: "CommandBar.background",
909: commandBarBackground,
910: "CommandBar.foreground",
911: defaultTextColor,
912: "CommandBar.shadow",
913: defaultShadowColor,
914: "CommandBar.darkShadow",
915: defaultDarkShadowColor,
916: "CommandBar.light",
917: defaultHighlightColor,
918: "CommandBar.highlight",
919: defaultLtHighlightColor,
920: "CommandBar.border",
921: new BorderUIResource(BorderFactory
922: .createEmptyBorder(1, 1, 1, 1)),
923: "CommandBar.borderVert",
924: new BorderUIResource(BorderFactory
925: .createEmptyBorder(1, 1, 1, 1)),
926: "CommandBar.borderFloating",
927: new BorderUIResource(BorderFactory
928: .createCompoundBorder(BorderFactory
929: .createLineBorder(table
930: .getColor("activeCaption"),
931: 2), BorderFactory
932: .createEmptyBorder(1, 1, 1, 1))),
933: "CommandBar.ancestorInputMap",
934: new UIDefaults.LazyInputMap(new Object[] { "UP",
935: "navigateUp", "KP_UP", "navigateUp",
936: "DOWN", "navigateDown", "KP_DOWN",
937: "navigateDown", "LEFT", "navigateLeft",
938: "KP_LEFT", "navigateLeft", "RIGHT",
939: "navigateRight", "KP_RIGHT",
940: "navigateRight" }),
941: "CommandBar.titleBarSize", 17,
942: "CommandBar.titleBarButtonGap", 1,
943: "CommandBar.titleBarBackground",
944: activeTitleBackgroundColor,
945: "CommandBar.titleBarForeground",
946: activeTitleTextColor, "CommandBar.titleBarFont",
947: boldFont,
948:
949: "CommandBar.separatorSize",
950: 5,
951:
952: // *** Separator
953: "CommandBarSeparator.background",
954: XertoUtils.getControlColor(),
955: "CommandBarSeparator.foreground",
956: XertoUtils.getControlMidShadowColor(),
957:
958: "Chevron.size", 11, };
959: table.putDefaults(uiDefaults);
960: }
961:
962: if ((products & PRODUCT_DOCK) != 0) {
963: uiDefaults = new Object[] {
964: // grid
965: "NestedTableHeader.cellBorder",
966: table.getBorder("TableHeader.cellBorder"), };
967: table.putDefaults(uiDefaults);
968: }
969:
970: if (!JideSwingUtilities.shouldUseSystemFont()) {
971: Object uiDefaultsFont[] = { "TabbedPane.font", controlFont,
972: "TitledBorder.font", boldFont, "TableHeader.font",
973: controlFont, "Table.font", controlFont,
974: "List.font", controlFont, "Tree.font", controlFont,
975: "ToolTip.font", controlFont, "CheckBox.font",
976: controlFont, "RadioButton.font", controlFont,
977: "Label.font", controlFont, "Panel.font",
978: controlFont, "TextField.font", controlFont,
979: "ComboBox.font", controlFont, "Button.font",
980: controlFont };
981: table.putDefaults(uiDefaultsFont);
982: }
983:
984: table.put("Theme.painter", XertoPainter.getInstance());
985:
986: // since it used BasicPainter, make sure it is after Theme.Painter is set first.
987: Object popupMenuBorder = new BorderUIResource(BorderFactory
988: .createCompoundBorder(BorderFactory
989: .createLineBorder(((BasicPainter) table
990: .get("Theme.painter"))
991: .getMenuItemBorderColor()),
992: BorderFactory.createEmptyBorder(1, 1, 1, 1)));
993: table.put("PopupMenu.border", popupMenuBorder);
994: }
995: }
|