1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui;
14
15 import java.awt.Color;
16 import java.awt.Insets;
17
18 import javax.swing.ToolTipManager;
19 import javax.swing.UIManager;
20 import javax.swing.plaf.ColorUIResource;
21
22 import com.eviware.soapui.settings.UISettings;
23 import com.eviware.soapui.ui.desktop.DesktopRegistry;
24 import com.eviware.soapui.ui.desktop.standalone.StandaloneDesktopFactory;
25 import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
26 import com.jgoodies.looks.plastic.theme.SkyBluer;
27 import com.jniwrapper.PlatformContext;
28
29 public class StandaloneSoapUICore extends SwingSoapUICore
30 {
31
32 public StandaloneSoapUICore( boolean init )
33 {
34 super();
35
36 if( init )
37 init( DEFAULT_SETTINGS_FILE );
38 }
39
40 public StandaloneSoapUICore( String settingsFile )
41 {
42 super( null, settingsFile );
43 }
44
45 public StandaloneSoapUICore( boolean init, boolean settingPassword, String soapUISettingsPassword )
46 {
47 super( true, soapUISettingsPassword );
48
49 if( init )
50 init( DEFAULT_SETTINGS_FILE );
51 }
52
53 public void prepareUI()
54 {
55 super.prepareUI();
56
57 initSoapUILookAndFeel();
58 DesktopRegistry.getInstance().addDesktop( SoapUI.DEFAULT_DESKTOP, new StandaloneDesktopFactory() );
59
60 ToolTipManager.sharedInstance().setEnabled( !getSettings().getBoolean( UISettings.DISABLE_TOOLTIPS ) );
61 }
62
63 public void initSoapUILookAndFeel()
64 {
65 try
66 {
67
68 if( !SoapUI.isJXBrowserDisabled() && PlatformContext.isMacOS() )
69 {
70 javax.swing.UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
71 }
72 else if( getSettings().getBoolean( UISettings.NATIVE_LAF ) )
73 {
74 javax.swing.UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
75 }
76 else
77 {
78 SoapUITheme theme = new SoapUITheme();
79
80 PlasticXPLookAndFeel.setCurrentTheme( theme );
81 PlasticXPLookAndFeel.setTabStyle( "Metal" );
82
83 UIManager.setLookAndFeel( new PlasticXPLookAndFeel() );
84 UIManager.put( "TabbedPane.tabAreaInsets", new Insets( 3, 2, 0, 0 ) );
85 UIManager.put( "TabbedPane.unselectedBackground", new Color( 220, 220, 220 ) );
86 UIManager.put( "TabbedPane.selected", new Color( 240, 240, 240 ) );
87
88 PlasticXPLookAndFeel.setPlasticTheme( theme );
89 }
90 }
91 catch( Throwable e )
92 {
93 System.err.println( "Error initializing PlasticXPLookAndFeel; " + e.getMessage() );
94 }
95 }
96
97 /***
98 * Adapted theme for soapUI Look and Feel
99 *
100 * @author ole.matzura
101 */
102
103 public static class SoapUITheme extends SkyBluer
104 {
105 public static final Color BACKGROUND_COLOR = new Color( 240, 240, 240 );
106
107 public ColorUIResource getControl()
108 {
109 return new ColorUIResource( BACKGROUND_COLOR );
110 }
111
112 public ColorUIResource getMenuBackground()
113 {
114 return getControl();
115 }
116
117 public ColorUIResource getMenuItemBackground()
118 {
119 return new ColorUIResource( new Color( 248, 248, 248 ) );
120 }
121 }
122 }