001: /*
002: * @(#)AquaJideUtils.java
003: *
004: * Copyright 2002 JIDE Software Inc. All rights reserved.
005: */
006: package com.jidesoft.plaf.aqua;
007:
008: import com.jidesoft.icons.IconsFactory;
009: import com.jidesoft.icons.JideIconsFactory;
010: import com.jidesoft.plaf.ExtWindowsDesktopProperty;
011: import com.jidesoft.plaf.LookAndFeelFactory;
012: import com.jidesoft.plaf.UIDefaultsLookup;
013: import com.jidesoft.plaf.WindowsDesktopProperty;
014: import com.jidesoft.plaf.basic.BasicRangeSliderUI;
015: import com.jidesoft.plaf.vsnet.ConvertListener;
016: import com.jidesoft.plaf.vsnet.VsnetLookAndFeelExtension;
017: import com.jidesoft.swing.JideSwingUtilities;
018: import com.jidesoft.swing.JideTabbedPane;
019:
020: import javax.swing.*;
021: import javax.swing.plaf.BorderUIResource;
022: import javax.swing.plaf.ColorUIResource;
023: import javax.swing.plaf.DimensionUIResource;
024: import javax.swing.plaf.InsetsUIResource;
025: import javax.swing.plaf.basic.BasicBorders;
026: import java.awt.*;
027:
028: /**
029: * AquaJideUtils to add Jide extension to AquaLookAndFeel
030: */
031: public class AquaJideUtils extends VsnetLookAndFeelExtension {
032: /**
033: * Initializes class defaults.
034: *
035: * @param table
036: */
037: public static void initClassDefaults(UIDefaults table) {
038: VsnetLookAndFeelExtension.initClassDefaults(table);
039:
040: final String aquaPackageName = "com.jidesoft.plaf.aqua.";
041:
042: int products = LookAndFeelFactory.getProductsUsed();
043:
044: table.put("JideSplitButtonUI", aquaPackageName
045: + "AquaJideSplitButtonUI");
046: table.put("JidePopupMenuUI", aquaPackageName
047: + "AquaJidePopupMenuUI");
048: table.put("JideTabbedPaneUI", aquaPackageName
049: + "AquaJideTabbedPaneUI");
050: table.put("GripperUI", aquaPackageName + "AquaGripperUI");
051:
052: if ((products & PRODUCT_GRIDS) != 0) {
053: table.put("JideTableUI", aquaPackageName
054: + "AquaJideTableUI");
055: table.put("CellSpanTableUI", aquaPackageName
056: + "AquaCellSpanTableUI");
057: table.put("HierarchicalTableUI", aquaPackageName
058: + "AquaHierarchicalTableUI");
059: table.put("NestedTableHeaderUI", aquaPackageName
060: + "AquaNestedTableHeaderUI");
061: table.put("EditableTableHeaderUI", aquaPackageName
062: + "AquaEditableTableHeaderUI");
063: }
064:
065: if ((products & PRODUCT_DOCK) != 0) {
066: table.put("SidePaneUI", aquaPackageName + "AquaSidePaneUI");
067: table.put("DockableFrameUI", aquaPackageName
068: + "AquaDockableFrameUI");
069: }
070:
071: if ((products & PRODUCT_ACTION) != 0) {
072: table.put("CommandBarUI", aquaPackageName
073: + "AquaCommandBarUI");
074: }
075: }
076:
077: /**
078: * Initializes components defaults.
079: *
080: * @param table
081: */
082: public static void initComponentDefaults(UIDefaults table) {
083: Toolkit toolkit = Toolkit.getDefaultToolkit();
084:
085: WindowsDesktopProperty defaultTextColor = new WindowsDesktopProperty(
086: "win.button.textColor", table.get("controlText"),
087: toolkit);
088:
089: Object defaultBackgroundColor = table.get("Panel.background"); // AquaImageFactory.getWindowBackgroundColorUIResource();
090:
091: WindowsDesktopProperty defaultLightColor = new WindowsDesktopProperty(
092: "win.3d.lightColor", table.get("controlHighlight"),
093: toolkit);
094: WindowsDesktopProperty defaultHighlightColor = new WindowsDesktopProperty(
095: "win.3d.highlightColor", table
096: .get("controlLtHighlight"), toolkit);
097: WindowsDesktopProperty defaultShadowColor = new WindowsDesktopProperty(
098: "win.3d.shadowColor", table.get("controlShadow"),
099: toolkit);
100: WindowsDesktopProperty defaultDarkShadowColor = new WindowsDesktopProperty(
101: "win.3d.darkShadowColor", table.get("controlDkShadow"),
102: toolkit);
103:
104: Object mdiBackgroundColor = table.get("Panel.background"); // AquaImageFactory.getWindowBackgroundColorUIResource();
105:
106: Object controlFont = table.get("Button.font"); // new UIDefaults.ProxyLazyValue("apple.laf.AquaLookAndFeel", "getControlTextFont");
107:
108: Object controlSmallFont = table.get("TabbedPane.smallFont"); // new UIDefaults.ProxyLazyValue("apple.laf.AquaLookAndFeel", "getControlTextSmallFont");
109:
110: Object boldFont = table.get("Button.font"); // new UIDefaults.ProxyLazyValue("apple.laf.AquaLookAndFeel", "getControlTextFont");
111:
112: Object resizeBorder = BorderFactory.createLineBorder(new Color(
113: 230, 230, 230), 2);
114:
115: Object defaultFormBackground = new ExtWindowsDesktopProperty(
116: // Not exactly right
117: new String[] { "win.3d.shadowColor" },
118: new Object[] { table.get("control") }, toolkit,
119: new ConvertListener() {
120: public Object convert(Object[] obj) {
121: return obj[0];
122: }
123: });
124:
125: Object inactiveTabForground = new ExtWindowsDesktopProperty(
126: // Not exactly right
127: new String[] { "win.3d.shadowColor" },
128: new Object[] { table.get("controlShadow") }, toolkit,
129: new ConvertListener() {
130: public Object convert(Object[] obj) {
131: return ((Color) obj[0]).darker();
132: }
133: });
134:
135: Object focusedButtonColor = table
136: .get("Menu.selectionBackground"); // AquaImageFactory.getMenuSelectionBackgroundColorUIResource();
137:
138: Object selectedAndFocusedButtonColor = table
139: .get("Menu.selectionBackground"); // AquaImageFactory.getMenuSelectionBackgroundColorUIResource();
140:
141: Object selectedButtonColor = table
142: .get("Menu.selectionBackground"); // AquaImageFactory.getMenuSelectionBackgroundColorUIResource();
143:
144: Object selectionBackgroundColor = table
145: .get("TextField.selectionBackground"); // AquaImageFactory.getTextSelectionBackgroundColorUIResource();
146:
147: Object buttonBorder = new BasicBorders.MarginBorder();
148:
149: ImageIcon sliderHorizontalImage = IconsFactory
150: .getImageIcon(BasicRangeSliderUI.class,
151: "icons/slider_horizontal.gif");
152: ImageIcon sliderVerticalalImage = IconsFactory.getImageIcon(
153: BasicRangeSliderUI.class, "icons/slider_vertical.gif");
154:
155: Object uiDefaults[] = {
156: "JideButton.selectedAndFocusedBackground",
157: selectedAndFocusedButtonColor,
158: "JideButton.focusedBackground",
159: focusedButtonColor,
160: "JideButton.selectedBackground",
161: selectedButtonColor,
162: "JideButton.borderColor",
163: selectionBackgroundColor,
164:
165: "JideButton.font",
166: controlFont,
167: "JideButton.background",
168: defaultBackgroundColor,
169: "JideButton.foreground",
170: table.get("controlText"),
171: "JideButton.shadow",
172: table.getColor("controlShadow"),
173: "JideButton.darkShadow",
174: table.getColor("controlDkShadow"),
175: "JideButton.light",
176: table.getColor("controlHighlight"),
177: "JideButton.highlight",
178: table.getColor("controlLtHighlight"),
179:
180: "JideButton.border",
181: buttonBorder,
182: "JideButton.margin",
183: new InsetsUIResource(3, 3, 3, 3),
184: "JideButton.textIconGap",
185: 4,
186: "JideButton.textShiftOffset",
187: 0,
188: "JideButton.focusInputMap",
189: new UIDefaults.LazyInputMap(new Object[] { "SPACE",
190: "pressed", "released SPACE", "released",
191: "ENTER", "pressed", "released ENTER",
192: "released" }),
193:
194: "JideSplitPane.dividerSize",
195: 3,
196: "JideSplitPaneDivider.border",
197: new BorderUIResource(BorderFactory.createEmptyBorder()),
198: "JideSplitPaneDivider.background",
199: defaultBackgroundColor,
200:
201: "JideTabbedPane.defaultTabShape",
202: JideTabbedPane.SHAPE_VSNET,
203: "JideTabbedPane.defaultResizeMode",
204: JideTabbedPane.RESIZE_MODE_NONE,
205: "JideTabbedPane.defaultTabColorTheme",
206: JideTabbedPane.COLOR_THEME_VSNET,
207:
208: "JideTabbedPane.tabRectPadding",
209: 2,
210: "JideTabbedPane.closeButtonMarginHorizonal",
211: 3,
212: "JideTabbedPane.closeButtonMarginVertical",
213: 3,
214: "JideTabbedPane.textMarginVertical",
215: 4,
216: "JideTabbedPane.noIconMargin",
217: 2,
218: "JideTabbedPane.iconMargin",
219: 5,
220: "JideTabbedPane.textPadding",
221: 6,
222: "JideTabbedPane.buttonSize",
223: 18,
224: "JideTabbedPane.buttonMargin",
225: 5,
226: "JideTabbedPane.fitStyleBoundSize",
227: 8,
228: "JideTabbedPane.fitStyleFirstTabMargin",
229: 4,
230: "JideTabbedPane.fitStyleIconMinWidth",
231: 24,
232: "JideTabbedPane.fitStyleTextMinWidth",
233: 16,
234: "JideTabbedPane.compressedStyleNoIconRectSize",
235: 24,
236: "JideTabbedPane.compressedStyleIconMargin",
237: 12,
238: "JideTabbedPane.compressedStyleCloseButtonMarginHorizontal",
239: 0,
240: "JideTabbedPane.compressedStyleCloseButtonMarginVertical",
241: 0,
242: "JideTabbedPane.fixedStyleRectSize",
243: 60,
244: "JideTabbedPane.closeButtonMargin",
245: 2,
246: "JideTabbedPane.gripLeftMargin",
247: 4,
248: "JideTabbedPane.closeButtonMarginSize",
249: 6,
250: "JideTabbedPane.closeButtonLeftMargin",
251: 2,
252: "JideTabbedPane.closeButtonRightMargin",
253: 2,
254:
255: "JideTabbedPane.defaultTabBorderShadowColor",
256: new ColorUIResource(115, 109, 99),
257:
258: "JideTabbedPane.border",
259: new BorderUIResource(BorderFactory.createEmptyBorder(0,
260: 0, 0, 0)),
261: "JideTabbedPane.background",
262: defaultFormBackground,
263: "JideTabbedPane.foreground",
264: defaultTextColor,
265: "JideTabbedPane.light",
266: defaultLightColor,
267: "JideTabbedPane.highlight",
268: defaultHighlightColor,
269: "JideTabbedPane.shadow",
270: defaultShadowColor,
271: "JideTabbedPane.tabInsets",
272: new InsetsUIResource(1, 4, 1, 4),
273: "JideTabbedPane.contentBorderInsets",
274: new InsetsUIResource(2, 2, 2, 2),
275: "JideTabbedPane.ignoreContentBorderInsetsIfNoTabs",
276: Boolean.FALSE,
277: "JideTabbedPane.tabAreaInsets",
278: new InsetsUIResource(2, 4, 0, 4),
279: "JideTabbedPane.tabAreaBackground",
280: defaultFormBackground,
281: "JideTabbedPane.tabRunOverlay",
282: 2,
283: "JideTabbedPane.font",
284: controlSmallFont,
285: "JideTabbedPane.selectedTabFont",
286: controlSmallFont,
287: "JideTabbedPane.darkShadow",
288: defaultTextColor,
289: "JideTabbedPane.selectedTabTextForeground",
290: defaultTextColor,
291: "JideTabbedPane.unselectedTabTextForeground",
292: inactiveTabForground,
293: "JideTabbedPane.selectedTabBackground",
294: defaultBackgroundColor,
295: "JideTabbedPane.textIconGap",
296: 4,
297: "JideTabbedPane.showIconOnTab",
298: Boolean.TRUE,
299: "JideTabbedPane.showCloseButtonOnTab",
300: Boolean.TRUE,
301: "JideTabbedPane.closeButtonAlignment",
302: SwingConstants.TRAILING,
303:
304: "JideTabbedPane.focusInputMap",
305: new UIDefaults.LazyInputMap(new Object[] { "RIGHT",
306: "navigateRight", "KP_RIGHT", "navigateRight",
307: "LEFT", "navigateLeft", "KP_LEFT",
308: "navigateLeft", "UP", "navigateUp", "KP_UP",
309: "navigateUp", "DOWN", "navigateDown",
310: "KP_DOWN", "navigateDown", "ctrl DOWN",
311: "requestFocusForVisibleComponent",
312: "ctrl KP_DOWN",
313: "requestFocusForVisibleComponent", }),
314: "JideTabbedPane.ancestorInputMap",
315: new UIDefaults.LazyInputMap(new Object[] {
316: "ctrl PAGE_DOWN", "navigatePageDown",
317: "ctrl PAGE_UP", "navigatePageUp", "ctrl UP",
318: "requestFocus", "ctrl KP_UP", "requestFocus", }),
319:
320: "Resizable.resizeBorder",
321: resizeBorder,
322:
323: "ButtonPanel.order",
324: "CA",
325: "ButtonPanel.oppositeOrder",
326: "HO",
327: "ButtonPanel.buttonGap",
328: 6,
329: "ButtonPanel.groupGap",
330: 12,
331: "ButtonPanel.minButtonWidth",
332: 69,
333:
334: "Contour.color",
335: new ColorUIResource(136, 136, 136),
336: "Contour.thickness",
337: 4,
338:
339: "Gripper.size",
340: 8,
341: "Gripper.foreground",
342: defaultShadowColor,
343:
344: "Icon.floating",
345: Boolean.FALSE,
346:
347: "JideSplitButton.font",
348: controlFont,
349: "JideSplitButton.margin",
350: new InsetsUIResource(3, 3, 3, 7),
351: "JideSplitButton.border",
352: buttonBorder,
353: "JideSplitButton.borderPainted",
354: Boolean.FALSE,
355: "JideSplitButton.textIconGap",
356: 3,
357: "JideSplitButton.focusInputMap",
358: new UIDefaults.LazyInputMap(new Object[] { "SPACE",
359: "pressed", "released SPACE", "released",
360: "ENTER", "pressed", "released ENTER",
361: "released", "DOWN", "downPressed",
362: "released DOWN", "downReleased" }),
363:
364: "RangeSlider.lowerIcon",
365: IconsFactory.getIcon(null, sliderHorizontalImage, 0, 0,
366: 9, 8),
367: "RangeSlider.upperIcon",
368: IconsFactory.getIcon(null, sliderHorizontalImage, 0, 8,
369: 9, 8),
370: "RangeSlider.middleIcon",
371: IconsFactory.getIcon(null, sliderHorizontalImage, 0,
372: 16, 9, 6),
373: "RangeSlider.lowerVIcon",
374: IconsFactory.getIcon(null, sliderVerticalalImage, 0, 0,
375: 8, 9),
376: "RangeSlider.upperVIcon",
377: IconsFactory.getIcon(null, sliderVerticalalImage, 8, 0,
378: 8, 9),
379: "RangeSlider.middleVIcon",
380: IconsFactory.getIcon(null, sliderVerticalalImage, 16,
381: 0, 6, 9),
382:
383: "Cursor.hsplit",
384: JideIconsFactory
385: .getImageIcon(JideIconsFactory.Cursor.HSPLIT),
386: "Cursor.vsplit",
387: JideIconsFactory
388: .getImageIcon(JideIconsFactory.Cursor.VSPLIT),
389:
390: "Cursor.north",
391: JideIconsFactory
392: .getImageIcon(JideIconsFactory.Cursor.NORTH),
393: "Cursor.south",
394: JideIconsFactory
395: .getImageIcon(JideIconsFactory.Cursor.SOUTH),
396: "Cursor.east",
397: JideIconsFactory
398: .getImageIcon(JideIconsFactory.Cursor.EAST),
399: "Cursor.west",
400: JideIconsFactory
401: .getImageIcon(JideIconsFactory.Cursor.WEST),
402: "Cursor.tab",
403: JideIconsFactory
404: .getImageIcon(JideIconsFactory.Cursor.TAB),
405: "Cursor.float",
406: JideIconsFactory
407: .getImageIcon(JideIconsFactory.Cursor.FLOAT),
408: "Cursor.vertical",
409: JideIconsFactory
410: .getImageIcon(JideIconsFactory.Cursor.VERTICAL),
411: "Cursor.horizontal",
412: JideIconsFactory
413: .getImageIcon(JideIconsFactory.Cursor.HORIZONTAL),
414: "Cursor.delete",
415: JideIconsFactory
416: .getImageIcon(JideIconsFactory.Cursor.DELETE),
417: "Cursor.drag",
418: JideIconsFactory
419: .getImageIcon(JideIconsFactory.Cursor.DROP),
420: "Cursor.dragStop",
421: JideIconsFactory
422: .getImageIcon(JideIconsFactory.Cursor.NODROP),
423: "Cursor.dragText",
424: JideIconsFactory
425: .getImageIcon(JideIconsFactory.Cursor.DROP_TEXT),
426: "Cursor.dragTextStop",
427: JideIconsFactory
428: .getImageIcon(JideIconsFactory.Cursor.NODROP_TEXT), };
429: table.putDefaults(uiDefaults);
430:
431: int products = LookAndFeelFactory.getProductsUsed();
432:
433: if ((products & PRODUCT_DOCK) != 0) {
434: Color slidingBorderColor = new Color(190, 190, 190);
435: Object slidingEastFrameBorder = BorderFactory
436: .createLineBorder(slidingBorderColor);
437: Object slidingWestFrameBorder = BorderFactory
438: .createLineBorder(slidingBorderColor);
439: Object slidingNorthFrameBorder = BorderFactory
440: .createLineBorder(slidingBorderColor);
441: Object slidingSouthFrameBorder = BorderFactory
442: .createLineBorder(slidingBorderColor);
443:
444: uiDefaults = new Object[] {
445: "DockableFrame.defaultIcon",
446: JideIconsFactory
447: .getImageIcon(JideIconsFactory.DockableFrame.BLANK),
448: "DockableFrame.background",
449: defaultBackgroundColor,
450: "DockableFrame.border",
451: new BorderUIResource(BorderFactory
452: .createLineBorder(Color.lightGray, 1)),
453: "DockableFrame.floatingBorder",
454: new BorderUIResource(BorderFactory
455: .createLineBorder(Color.lightGray, 1)),
456: "DockableFrame.slidingEastBorder",
457: slidingEastFrameBorder,
458: "DockableFrame.slidingWestBorder",
459: slidingWestFrameBorder,
460: "DockableFrame.slidingNorthBorder",
461: slidingNorthFrameBorder,
462: "DockableFrame.slidingSouthBorder",
463: slidingSouthFrameBorder,
464:
465: "DockableFrame.activeTitleBackground",
466: UIDefaultsLookup
467: .getColor("InternalFrame.activeTitleBackground"),
468: "DockableFrame.activeTitleForeground",
469: UIDefaultsLookup
470: .getColor("InternalFrame.activeTitleForeground"),
471: "DockableFrame.inactiveTitleBackground",
472: UIDefaultsLookup
473: .getColor("InternalFrame.inactiveTitleBackground"),
474: "DockableFrame.inactiveTitleForeground",
475: UIDefaultsLookup
476: .getColor("InternalFrame.inactiveTitleForeground"),
477: "DockableFrame.titleBorder",
478: new BorderUIResource(BorderFactory
479: .createEmptyBorder(0, 0, 0, 0)),
480: "DockableFrame.activeTitleBorderColor",
481: UIDefaultsLookup
482: .getColor("InternalFrame.activeTitleBackground"),
483: "DockableFrame.inactiveTitleBorderColor",
484: defaultShadowColor,
485: "DockableFrame.font",
486: controlFont,
487:
488: "DockableFrameTitlePane.font",
489: controlSmallFont,
490: "DockableFrameTitlePane.titleBarComponent",
491: Boolean.FALSE,
492:
493: "DockableFrameTitlePane.alwaysShowAllButtons",
494: Boolean.TRUE, // true if show all three buttons no matter if the buttons is available. false if only show buttons which is available
495: "DockableFrameTitlePane.buttonsAlignment",
496: SwingConstants.LEADING, // trailing or leading
497: "DockableFrameTitlePane.titleAlignment",
498: SwingConstants.CENTER, // trailing or leading or center
499: "DockableFrameTitlePane.buttonGap",
500: 3, // gap between buttons
501: "DockableFrameTitlePane.showIcon",
502: Boolean.FALSE, // show icon or not, the alignment is the same as titleAlignment
503: "DockableFrameTitlePane.margin",
504: new InsetsUIResource(0, 10, 0, 3), // gap
505:
506: "SidePane.margin",
507: new InsetsUIResource(2, 2, 0, 0),
508: "SidePane.iconTextGap",
509: 2,
510: "SidePane.textBorderGap",
511: 13,
512: "SidePane.itemGap",
513: 5,
514: "SidePane.groupGap",
515: 8,
516: "SidePane.foreground",
517: defaultDarkShadowColor,
518: "SidePane.background",
519: defaultFormBackground,
520: "SidePane.lineColor",
521: new Color(151, 151, 151),
522: "SidePane.buttonBackground",
523: new Color(133, 133, 133),
524: "SidePane.selectedButtonBackground",
525: new Color(133, 133, 133),
526: "SidePane.selectedButtonForeground",
527: defaultTextColor,
528: "SidePane.font",
529: controlSmallFont,
530: "SidePane.orientation",
531: 1,
532: "SidePane.showSelectedTabText",
533: Boolean.TRUE,
534: "SidePane.alwaysShowTabText",
535: Boolean.TRUE,
536:
537: "Workspace.background",
538: mdiBackgroundColor,
539:
540: "DockingFramework.changeCursor",
541: Boolean.FALSE,
542:
543: "ContentContainer.background",
544: defaultFormBackground,
545: "ContentContainer.vgap",
546: 1,
547: "ContentContainer.hgap",
548: 1,
549: "MainContainer.border",
550: new BorderUIResource(BorderFactory
551: .createEmptyBorder(0, 0, 0, 0)), };
552: table.putDefaults(uiDefaults);
553: }
554:
555: if ((products & PRODUCT_COMPONENTS) != 0) {
556: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
557: AquaJideUtils.class,
558: "icons/collapsible_pane_aqua.gif"); // 12 x 12 x 2
559: final int collapsiblePaneSize = 12;
560:
561: uiDefaults = new Object[] {
562: "CollapsiblePanes.border",
563: new BorderUIResource(BorderFactory
564: .createEmptyBorder(12, 12, 0, 12)),
565: "CollapsiblePanes.gap",
566: 15,
567:
568: "CollapsiblePane.background",
569: UIDefaultsLookup
570: .getColor("InternalFrame.inactiveTitleBackground"),
571: "CollapsiblePane.contentBackground",
572: defaultHighlightColor,
573: "CollapsiblePane.foreground",
574: UIDefaultsLookup
575: .getColor("InternalFrame.inactiveTitleForeground"),
576: "CollapsiblePane.emphasizedBackground",
577: UIDefaultsLookup
578: .getColor("InternalFrame.activeTitleBackground"),
579: "CollapsiblePane.emphasizedForeground",
580: UIDefaultsLookup
581: .getColor("InternalFrame.activeTitleForeground"),
582: "CollapsiblePane.border",
583: new BorderUIResource(BorderFactory
584: .createEmptyBorder(1, 1, 1, 1)),
585: "CollapsiblePane.font",
586: controlFont,
587:
588: "CollapsiblePane.contentBorder",
589: new BorderUIResource(BorderFactory
590: .createEmptyBorder(8, 10, 8, 10)),
591:
592: "CollapsiblePane.titleBorder",
593: new BorderUIResource(BorderFactory
594: .createEmptyBorder(3, 3, 3, 3)),
595: "CollapsiblePane.titleFont",
596: boldFont,
597: "CollapsiblePane.downIcon",
598: IconsFactory
599: .getIcon(null, collapsiblePaneImage, 0, 0,
600: collapsiblePaneSize,
601: collapsiblePaneSize),
602: "CollapsiblePane.upIcon",
603: IconsFactory.getIcon(null, collapsiblePaneImage, 0,
604: collapsiblePaneSize, collapsiblePaneSize,
605: collapsiblePaneSize),
606:
607: "StatusBarItem.border",
608: new BorderUIResource(BorderFactory
609: .createLineBorder(table
610: .getColor("controlShadow"), 1)),
611:
612: "StatusBar.border",
613: new BorderUIResource(BorderFactory
614: .createEmptyBorder(2, 0, 0, 0)),
615: "StatusBar.gap",
616: 2,
617: "StatusBar.background",
618: defaultBackgroundColor,
619: "StatusBar.font",
620: controlFont,
621:
622: "DocumentPane.groupBorder",
623: new BorderUIResource(BorderFactory
624: .createLineBorder(Color.gray)),
625: "DocumentPane.newHorizontalGroupIcon",
626: JideIconsFactory
627: .getImageIcon(JideIconsFactory.WindowMenu.NEW_HORIZONTAL_TAB),
628: "DocumentPane.newVerticalGroupIcon",
629: JideIconsFactory
630: .getImageIcon(JideIconsFactory.WindowMenu.NEW_VERTICAL_TAB),
631: "DocumentPane.boldActiveTab", Boolean.TRUE, };
632: table.putDefaults(uiDefaults);
633: }
634: if ((products & PRODUCT_ACTION) != 0) {
635: uiDefaults = new Object[] {
636:
637: "CommandBar.font",
638: controlFont,
639: "CommandBar.background",
640: defaultBackgroundColor,
641: "CommandBar.foreground",
642: table.get("controlText"),
643: "CommandBar.shadow",
644: table.getColor("controlShadow"),
645: "CommandBar.darkShadow",
646: table.getColor("controlDkShadow"),
647: "CommandBar.light",
648: table.getColor("controlHighlight"),
649: "CommandBar.highlight",
650: table.getColor("controlLtHighlight"),
651: "CommandBar.border",
652: new BorderUIResource(BorderFactory
653: .createEmptyBorder(1, 1, 1, 1)),
654: "CommandBar.borderVert",
655: new BorderUIResource(BorderFactory
656: .createEmptyBorder(1, 1, 1, 1)),
657: "CommandBar.borderFloating",
658: new BorderUIResource(BorderFactory
659: .createEmptyBorder(2, 2, 2, 2)),
660: "CommandBar.ancestorInputMap",
661: new UIDefaults.LazyInputMap(new Object[] { "UP",
662: "navigateUp", "KP_UP", "navigateUp",
663: "DOWN", "navigateDown", "KP_DOWN",
664: "navigateDown", "LEFT", "navigateLeft",
665: "KP_LEFT", "navigateLeft", "RIGHT",
666: "navigateRight", "KP_RIGHT",
667: "navigateRight" }),
668: "CommandBar.titleBarSize",
669: 17,
670: "CommandBar.titleBarButtonGap",
671: 1,
672: "CommandBar.titleBarBackground",
673: UIDefaultsLookup
674: .getColor("InternalFrame.activeTitleBackground"),
675: "CommandBar.titleBarForeground",
676: table.getColor("controlText"),
677: "CommandBar.titleBarFont",
678: boldFont,
679: "CommandBar.minimumSize",
680: new DimensionUIResource(20, 20),
681:
682: "CommandBar.separatorSize",
683: 5,
684:
685: // *** Separator
686: "CommandBarSeparator.background",
687: new Color(219, 216, 209),
688: "CommandBarSeparator.foreground",
689: new Color(166, 166, 166),
690:
691: "Chevron.size", 11, "Chevron.alwaysVisible",
692: Boolean.FALSE,
693:
694: };
695: table.putDefaults(uiDefaults);
696: }
697:
698: if ((products & PRODUCT_GRIDS) != 0) {
699: uiDefaults = new Object[] { "AbstractComboBox.useJButton",
700: Boolean.FALSE, };
701: table.putDefaults(uiDefaults);
702: }
703: table.put("Theme.painter", AquaPainter.getInstance());
704: }
705:
706: public static boolean isGraphite() {
707: String appleAquaColorVariant = AquaPreferences
708: .getString("AppleAquaColorVariant");
709: return "6".equals(appleAquaColorVariant);
710: }
711:
712: // HALF buttons have to colours
713: // lighter upper half
714: // darker lower half
715: public static final Color[] HALF_LIGHT = {
716: new Color(251, 251, 251), new Color(237, 237, 237) };
717:
718: public static final Color[] HALF_DARK = { new Color(133, 133, 133),
719: new Color(125, 125, 125) };
720:
721: // AQUA gradients consist of two gradients for each half
722: // light upper half
723: // dark upper half
724: // light lower half
725: // dark lower half
726: public static final Color[] AQUA_WHITE = {
727: new Color(252, 252, 252), new Color(236, 236, 236),
728: new Color(225, 225, 225), new Color(255, 255, 255) };
729:
730: public static final Color[] AQUA_BLUE = { new Color(221, 225, 244),
731: new Color(139, 187, 238), new Color(100, 168, 242),
732: new Color(187, 255, 255) };
733:
734: public static final Color[] AQUA_GRAPHITE = {
735: new Color(231, 233, 235), new Color(182, 188, 198),
736: new Color(158, 158, 180), new Color(231, 241, 255) };
737:
738: public static final Color[] AQUA_BANNER_WHITE = {
739: new Color(255, 255, 255), new Color(248, 248, 248),
740: new Color(228, 228, 228), new Color(239, 239, 239) };
741:
742: public static final Color[] AQUA_BANNER_BLUE = {
743: new Color(103, 159, 254), new Color(73, 132, 253),
744: new Color(51, 132, 253), new Color(84, 170, 254) };
745:
746: public static Color[] reverse(Color[] colors) {
747: Color[] reverse = new Color[colors.length];
748: for (int i = 0; i < colors.length; i++) {
749: reverse[i] = colors[colors.length - i - 1];
750: }
751: return reverse;
752: }
753:
754: public static void fillAquaGradientHorizontal(Graphics g,
755: final Shape shape, final Color[] colors) {
756: Color[] c = colors;
757: if (c == null || c.length != 4) {
758: c = AQUA_WHITE;
759: }
760:
761: Graphics2D g2d = (Graphics2D) g;
762: // cause icon and text not showing when close button is on tab.
763: // Shape oldClipShape = g2d.getClip();
764: // g2d.setClip(shape);
765: Rectangle rect = shape.getBounds();
766: Rectangle r2 = new Rectangle(rect.x, rect.y + rect.height / 2,
767: rect.width, rect.height / 2);
768: Rectangle r1 = new Rectangle(rect.x, rect.y, rect.width,
769: rect.height / 2);
770: JideSwingUtilities.fillGradient(g2d, r1, c[0], c[1], true);
771: JideSwingUtilities.fillGradient(g2d, r2, c[2], c[3], true);
772: // g2d.setClip(oldClipShape);
773: }
774:
775: public static void fillAquaGradientVertical(Graphics g,
776: final Shape shape, final Color[] colors) {
777: Color[] c = colors;
778: if (c == null || c.length != 4) {
779: c = AQUA_WHITE;
780: }
781:
782: Graphics2D g2d = (Graphics2D) g;
783: // Shape oldClipShape = g2d.getClip();
784: // g2d.setClip(shape);
785: Rectangle rect = shape.getBounds();
786: Rectangle r2 = new Rectangle(rect.x + rect.width / 2, rect.y,
787: rect.width / 2, rect.height);
788: Rectangle r1 = new Rectangle(rect.x, rect.y, rect.width / 2,
789: rect.height);
790: JideSwingUtilities.fillGradient(g2d, r1, c[0], c[1], false);
791: JideSwingUtilities.fillGradient(g2d, r2, c[2], c[3], false);
792: // g.setClip(oldClipShape);
793: }
794:
795: public static void fillSquareButtonHorizontal(Graphics g,
796: Shape shape, final Color[] colors) {
797: Color[] c = colors;
798: if (c == null || c.length != 2) {
799: c = HALF_LIGHT;
800: }
801:
802: Graphics2D g2d = (Graphics2D) g;
803: // Shape oldClipShape = g2d.getClip();
804: // g2d.setClip(shape);
805: Rectangle rect = shape.getBounds();
806: g2d.setColor(c[0]);
807: g2d.fillRect(rect.x, rect.y, rect.width, rect.height / 2);
808: g2d.setColor(c[1]);
809: g2d.fillRect(rect.x, rect.y + rect.height / 2, rect.width,
810: rect.height / 2);
811:
812: // g2d.setClip(oldClipShape);
813: }
814:
815: public static void fillSquareButtonVertical(Graphics g,
816: Shape shape, final Color[] colors) {
817: Color[] c = colors;
818: if (c == null || c.length != 2) {
819: c = HALF_LIGHT;
820: }
821:
822: Graphics2D g2d = (Graphics2D) g;
823: // Shape oldClipShape = g2d.getClip();
824: // g2d.setClip(shape);
825: Rectangle rect = shape.getBounds();
826: g.setColor(c[0]);
827: g.fillRect(rect.x, rect.y, rect.width / 2, rect.height);
828: g.setColor(c[1]);
829: g.fillRect(rect.x + rect.width / 2, rect.y, rect.width / 2,
830: rect.height);
831: // g2d.setClip(oldClipShape);
832: }
833:
834: public static void antialiasShape(Graphics g, boolean onoff) {
835: Graphics2D g2d = (Graphics2D) g;
836: g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
837: onoff ? RenderingHints.VALUE_ANTIALIAS_ON
838: : RenderingHints.VALUE_ANTIALIAS_OFF);
839:
840: }
841:
842: public static void antialiasText(Graphics g, boolean onoff) {
843: Graphics2D g2d = (Graphics2D) g;
844: g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
845: onoff ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON
846: : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
847:
848: }
849:
850: }
|