Skip to content

Commit

Permalink
Merge pull request #242 from SmartBear/java8-and-global-prefs-layout
Browse files Browse the repository at this point in the history
Updated to use java 1.8 and fixed layout of global preferences dialog
  • Loading branch information
spindelmanne committed Jan 11, 2017
2 parents e1b1d1b + b1e515c commit 17e9389
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 64 deletions.
14 changes: 9 additions & 5 deletions pom.xml
Expand Up @@ -66,8 +66,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -97,7 +97,7 @@
<rules>
<!-- http://mojo.codehaus.org/extra-enforcer-rules/enforceBytecodeVersion.html -->
<enforceBytecodeVersion>
<maxJdkVersion>1.7</maxJdkVersion>
<maxJdkVersion>1.8</maxJdkVersion>
</enforceBytecodeVersion>
</rules>
<fail>true</fail>
Expand All @@ -115,15 +115,19 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.9</version>
<version>1.15</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<!-- currently, we cannot use java16 1.1 because some classes depends on the sun specific
implementation (com.sun.java.swing.plaf.windows) -->
<artifactId>java17</artifactId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<ignores>
<ignore>javafx.*</ignore>
<ignore>netscape.*</ignore>
</ignores>
</configuration>
<executions>
<execution>
Expand Down
17 changes: 0 additions & 17 deletions soapui/pom.xml
Expand Up @@ -584,21 +584,4 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>javafx.dependency</id>
<activation>
<jdk>[1.6,1.8]</jdk>
</activation>
<dependencies>
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
<version>${javafx.version}</version>
<scope>system</scope>
<systemPath>${javafx.runtime.lib.jar}</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
@@ -1,40 +1,34 @@
/*
* SoapUI, Copyright (C) 2004-2016 SmartBear Software
* Copyright 2004-2014 SmartBear Software
*
* Licensed under the EUPL, Version 1.1 or - as soon as they will be approved by the European Commission - subsequent
* versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under the Licence is
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the Licence for the specific language governing permissions and limitations
* under the Licence.
*/
* Licensed under the EUPL, Version 1.1 or - as soon as they will be approved by the European Commission - subsequent
* versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under the Licence is
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the Licence for the specific language governing permissions and limitations
* under the Licence.
*/

package com.eviware.soapui.actions;

import com.eviware.soapui.SoapUI;
import com.eviware.soapui.impl.wsdl.support.HelpUrls;
import com.eviware.soapui.model.settings.Settings;
import com.eviware.soapui.settings.HttpSettings;
import com.eviware.soapui.settings.SSLSettings;
import com.eviware.soapui.settings.SecuritySettings;
import com.eviware.soapui.settings.VersionUpdateSettings;
import com.eviware.soapui.settings.WSISettings;
import com.eviware.soapui.settings.WsaSettings;
import com.eviware.soapui.settings.WsdlSettings;
import com.eviware.soapui.settings.*;
import com.eviware.soapui.support.UISupport;
import com.eviware.soapui.support.components.SwingConfigurationDialogImpl;
import com.eviware.soapui.support.factory.SoapUIFactoryRegistryListener;
import com.eviware.soapui.support.types.StringToStringMap;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -61,11 +55,12 @@ public class SoapUIPreferencesAction extends AbstractAction implements SoapUIFac
public static final String GLOBAL_SENSITIVE_INFORMATION_TOKENS = "Global Sensitive Information Tokens";
public static final String VERSIONUPDATE_SETTINGS = "Version Update Settings";
private SwingConfigurationDialogImpl dialog;
private JTabbedPane tabs;
private List<Prefs> prefs = new ArrayList<Prefs>();
private Map<PrefsFactory, Prefs> prefsFactories = new HashMap<PrefsFactory, Prefs>();

private static SoapUIPreferencesAction instance;
private DefaultListModel<String> prefsListModel;
private JPanel prefsPanel;

public SoapUIPreferencesAction() {
super("Preferences");
Expand Down Expand Up @@ -102,8 +97,9 @@ public void addPrefsFactory(PrefsFactory factory) {
addPrefs( pref );

prefsFactories.put( factory, pref );
if( tabs != null )
addPrefToTabs( pref );
if (prefsPanel != null) {
addPrefToTabs(pref);
}
}

public void removePrefsFactory( PrefsFactory factory )
Expand All @@ -112,11 +108,13 @@ public void removePrefsFactory( PrefsFactory factory )
if( pref != null )
{
prefsFactories.remove( factory );
if( tabs != null )
if (prefsPanel != null)
{
int ix = tabs.indexOfTab( pref.getTitle() );
if( ix != -1 )
tabs.removeTabAt( ix );
int ix = prefsListModel.indexOf(pref.getTitle());
if (ix != -1) {
prefsListModel.remove(ix);
prefsPanel.remove(ix);
}
}

prefs.remove( pref );
Expand Down Expand Up @@ -166,11 +164,8 @@ public boolean show(String initialTab) {
pref.setFormValues(settings);
}

if (initialTab != null) {
int ix = tabs.indexOfTab(initialTab);
if (ix != -1) {
tabs.setSelectedIndex(ix);
}
if (prefsPanel != null && initialTab != null) {
selectPrefs(initialTab);
}

if (dialog.show(new StringToStringMap())) {
Expand All @@ -184,22 +179,41 @@ public boolean show(String initialTab) {
return false;
}

public void selectPrefs(String initialTab) {
CardLayout cl = (CardLayout) (prefsPanel.getLayout());
cl.show(prefsPanel, initialTab);
}

private void buildDialog() {
dialog = new SwingConfigurationDialogImpl("SoapUI Preferences", HelpUrls.PREFERENCES_HELP_URL,
"Set global SoapUI settings", UISupport.OPTIONS_ICON);
dialog.setSize(new Dimension(1000, 700));

prefsListModel = new DefaultListModel<String>();
JList prefItems = new JList(prefsListModel);
prefItems.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
prefsPanel = new JPanel(new CardLayout());

tabs = new JTabbedPane();
tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
tabs.setTabPlacement(JTabbedPane.LEFT);
for (Prefs pref : prefs) {
addPrefToTabs(pref);
}

dialog.setContent(UISupport.createTabPanel(tabs, false));
prefItems.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
selectPrefs(prefsListModel.get(prefItems.getSelectedIndex()));
}
});

JSplitPane split = UISupport.createHorizontalSplit(new JScrollPane(prefItems), new JScrollPane(prefsPanel));
split.setDividerLocation(250);
split.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
dialog.setContent(split);
}

private void addPrefToTabs(Prefs pref) {
tabs.addTab(pref.getTitle(), new JScrollPane(pref.getForm().getPanel()));
prefsPanel.add(pref.getForm().getPanel(), pref.getTitle());
prefsListModel.addElement(pref.getTitle());
}

}
Expand Up @@ -47,7 +47,8 @@ public JsonPathFacade(String targetJson) {
}

public String readStringValue(String jsonPathExpression) {
return String.valueOf(readObjectValue(jsonPathExpression));
Object data = readObjectValue(jsonPathExpression);
return String.valueOf(data);
}

public void writeValue(String jsonPathExpression, Object value) {
Expand Down

0 comments on commit 17e9389

Please sign in to comment.