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.UIManager;
19 import javax.swing.plaf.ColorUIResource;
20
21 import com.eviware.soapui.settings.UISettings;
22 import com.eviware.soapui.support.components.BrowserComponent;
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.teamdev.xpcom.Xpcom;
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
61 public void initSoapUILookAndFeel()
62 {
63 try
64 {
65 if( !BrowserComponent.isJXBrowserDisabled() && Xpcom.isLinux() && !Xpcom.isSilentMode())
66 {
67 javax.swing.UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
68 }
69 else if( getSettings().getBoolean( UISettings.NATIVE_LAF ) )
70 {
71 javax.swing.UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
72 }
73 else
74 {
75 SoapUITheme theme = new SoapUITheme();
76
77 PlasticXPLookAndFeel.setCurrentTheme( theme );
78 PlasticXPLookAndFeel.setTabStyle( "Metal" );
79
80 UIManager.setLookAndFeel( new PlasticXPLookAndFeel() );
81 UIManager.put( "TabbedPane.tabAreaInsets", new Insets( 3, 2, 0, 0 ) );
82 UIManager.put( "TabbedPane.unselectedBackground", new Color( 220, 220, 220 ) );
83 UIManager.put( "TabbedPane.selected", new Color( 240, 240, 240 ) );
84
85 PlasticXPLookAndFeel.setPlasticTheme( theme );
86 }
87 }
88 catch( Throwable e )
89 {
90 System.err.println( "Error initializing PlasticXPLookAndFeel; " + e.getMessage() );
91 }
92 }
93
94 /***
95 * Adapted theme for soapUI Look and Feel
96 *
97 * @author ole.matzura
98 */
99
100 public static class SoapUITheme extends SkyBluer
101 {
102 public static final Color BACKGROUND_COLOR = new Color( 240, 240, 240 );
103
104 public ColorUIResource getControl()
105 {
106 return new ColorUIResource( BACKGROUND_COLOR );
107 }
108
109 public ColorUIResource getMenuBackground()
110 {
111 return getControl();
112 }
113
114 public ColorUIResource getMenuItemBackground()
115 {
116 return new ColorUIResource( new Color( 248, 248, 248 ) );
117 }
118 }
119 }