mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
GUI, preferences: improved proxy tab, removed un-used servers list
This commit is contained in:
parent
3b188340fa
commit
e3dee4eac1
4 changed files with 117 additions and 319 deletions
|
|
@ -108,78 +108,9 @@ public class ConnectDialog extends MageDialog {
|
|||
BufferedReader in = null;
|
||||
Writer output = null;
|
||||
try {
|
||||
String serverUrl = PreferencesDialog.getCachedValue(KEY_CONNECTION_URL_SERVER_LIST, "http://xmage.de/files/server-list.txt");
|
||||
if (serverUrl.contains("xmage.info/files/")) {
|
||||
serverUrl = serverUrl.replace("xmage.info/files/", "xmage.de/files/"); // replace old URL if still saved
|
||||
PreferencesDialog.saveValue(KEY_CONNECTION_URL_SERVER_LIST, serverUrl);
|
||||
}
|
||||
URL serverListURL = new URL(serverUrl);
|
||||
|
||||
Connection.ProxyType configProxyType = Connection.ProxyType.valueByText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));
|
||||
Proxy p = null;
|
||||
Proxy.Type type = Proxy.Type.DIRECT;
|
||||
switch (configProxyType) {
|
||||
case HTTP:
|
||||
type = Proxy.Type.HTTP;
|
||||
break;
|
||||
case SOCKS:
|
||||
type = Proxy.Type.SOCKS;
|
||||
break;
|
||||
case NONE:
|
||||
default:
|
||||
p = Proxy.NO_PROXY;
|
||||
break;
|
||||
}
|
||||
|
||||
if (p == null || !p.equals(Proxy.NO_PROXY)) {
|
||||
try {
|
||||
String address = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_ADDRESS, "");
|
||||
Integer port = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_PORT, "80"));
|
||||
p = new Proxy(type, new InetSocketAddress(address, port));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Gui_DownloadPictures : error 1 - " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (p == null) {
|
||||
JOptionPane.showMessageDialog(null, "Couldn't configure Proxy object!", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean URLNotFound = false;
|
||||
try {
|
||||
in = new BufferedReader(new InputStreamReader(serverListURL.openConnection(p).getInputStream()));
|
||||
} catch (SocketTimeoutException | FileNotFoundException | UnknownHostException ex) {
|
||||
logger.warn("Could not read serverlist from: " + serverListURL.toString());
|
||||
File f = new File("serverlist.txt");
|
||||
if (f.exists() && !f.isDirectory()) {
|
||||
logger.info("Using buffered serverlist: serverlist.txt");
|
||||
URLNotFound = true;
|
||||
in = new BufferedReader(new FileReader("serverlist.txt"));
|
||||
}
|
||||
}
|
||||
List<String> servers = new ArrayList<>();
|
||||
if (in != null) {
|
||||
|
||||
if (!URLNotFound) {
|
||||
// write serverlist to be able to read if URL is not available
|
||||
File file = new File("serverlist.txt");
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
file.delete();
|
||||
}
|
||||
output = new BufferedWriter(new FileWriter(file));
|
||||
}
|
||||
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
logger.debug("Found server: " + inputLine);
|
||||
servers.add(inputLine);
|
||||
if (output != null) {
|
||||
output.append(inputLine).append('\n');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: add recent servers list here
|
||||
|
||||
if (servers.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null, "Couldn't find any server.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JSlider" name="tooltipDelay">
|
||||
<Properties>
|
||||
<Property name="majorTickSpacing" type="int" value="1000"/>
|
||||
<Property name="majorTickSpacing" type="int" value="500"/>
|
||||
<Property name="maximum" type="int" value="5000"/>
|
||||
<Property name="minorTickSpacing" type="int" value="100"/>
|
||||
<Property name="paintLabels" type="boolean" value="true"/>
|
||||
|
|
@ -5657,8 +5657,8 @@
|
|||
<Container class="javax.swing.JPanel" name="tabConnection">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Connection">
|
||||
<Property name="tabTitle" type="java.lang.String" value="Connection"/>
|
||||
<JTabbedPaneConstraints tabName="Proxy">
|
||||
<Property name="tabTitle" type="java.lang.String" value="Proxy"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
|
@ -5666,17 +5666,9 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="pnlProxySettings" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblProxyType" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="cbProxyType" min="-2" pref="126" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="connection_servers" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="connection_Proxy" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -5684,26 +5676,18 @@
|
|||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="connection_Proxy" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="connection_servers" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblProxyType" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbProxyType" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="pnlProxySettings" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="connection_servers">
|
||||
<Container class="javax.swing.JPanel" name="connection_Proxy">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Servers">
|
||||
<TitledBorder title="Proxy for server connection and images download">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
|
|
@ -5716,97 +5700,14 @@
|
|||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblURLServerList" min="-2" pref="96" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtURLServerList" min="-2" pref="370" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="141" max="-2" attributes="0"/>
|
||||
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbProxyType" min="-2" pref="126" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="629" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="pnlProxy" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="lblURLServerList" max="32767" attributes="0"/>
|
||||
<Component id="txtURLServerList" pref="26" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="lblURLServerList">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="text" type="java.lang.String" value="URL server list:"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
<Property name="horizontalTextPosition" type="int" value="10"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 16]"/>
|
||||
</Property>
|
||||
<Property name="verticalTextPosition" type="int" value="1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtURLServerList">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="The URL XMage tries to read a server list from."/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 22]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel17">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="10" style="2"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="e.g.: http://XMage.de/files/server-list.txt"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="lblProxyType">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Proxy:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="cbProxyType">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbProxyTypeActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ProxyType>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="pnlProxySettings">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
|
||||
</AccessibilityProperties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlProxy" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -5814,13 +5715,24 @@
|
|||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="pnlProxy" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbProxyType" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="pnlProxy" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="cbProxyType">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbProxyTypeActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ProxyType>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="pnlProxy">
|
||||
|
||||
<Layout>
|
||||
|
|
@ -5829,31 +5741,38 @@
|
|||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="rememberPswd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="47" max="-2" attributes="0"/>
|
||||
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="lblProxyServer" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
|
||||
<Component id="txtProxyServer" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblProxyPort" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblProxyPassword" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblProxyServer" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblProxyUserName" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtProxyPort" alignment="0" min="-2" pref="58" max="-2" attributes="1"/>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="txtPasswordField" alignment="0" max="32767" attributes="1"/>
|
||||
<Component id="txtProxyUserName" alignment="0" min="-2" pref="148" max="-2" attributes="1"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblProxyPort" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblProxyPassword" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblProxyUserName" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtProxyPort" alignment="0" min="-2" pref="58" max="-2" attributes="1"/>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="txtPasswordField" alignment="0" max="32767" attributes="1"/>
|
||||
<Component id="txtProxyUserName" alignment="0" min="-2" pref="148" max="-2" attributes="1"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="rememberPswd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="txtProxyServer" alignment="0" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -5880,12 +5799,12 @@
|
|||
<Component id="txtPasswordField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblProxyPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="rememberPswd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="18" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import mage.client.util.ImageHelper;
|
|||
import mage.client.util.audio.MusicPlayer;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import static mage.constants.Constants.*;
|
||||
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.players.net.UserData;
|
||||
import mage.players.net.UserGroup;
|
||||
import mage.players.net.UserSkipPrioritySteps;
|
||||
|
|
@ -299,7 +301,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_PROXY_REMEMBER = "proxyRemember";
|
||||
public static final String KEY_PROXY_TYPE = "proxyType";
|
||||
public static final String KEY_PROXY_PSWD = "proxyPassword";
|
||||
public static final String KEY_CONNECTION_URL_SERVER_LIST = "connectionURLServerList";
|
||||
|
||||
// news
|
||||
public static final String KEY_NEWS_PAGE_LAST_VERSION = "newsPageLastVersion";
|
||||
|
|
@ -592,13 +593,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
jPanel32 = new javax.swing.JPanel();
|
||||
jPanel33 = new javax.swing.JPanel();
|
||||
tabConnection = new javax.swing.JPanel();
|
||||
connection_servers = new javax.swing.JPanel();
|
||||
lblURLServerList = new javax.swing.JLabel();
|
||||
txtURLServerList = new javax.swing.JTextField();
|
||||
jLabel17 = new javax.swing.JLabel();
|
||||
lblProxyType = new javax.swing.JLabel();
|
||||
connection_Proxy = new javax.swing.JPanel();
|
||||
cbProxyType = new javax.swing.JComboBox<>();
|
||||
pnlProxySettings = new javax.swing.JPanel();
|
||||
pnlProxy = new javax.swing.JPanel();
|
||||
lblProxyServer = new javax.swing.JLabel();
|
||||
txtProxyServer = new javax.swing.JTextField();
|
||||
|
|
@ -694,7 +690,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
tooltipDelayLabel.setText("Delay in milliseconds for showing the card tooltip text (0 value will disable tooltip)");
|
||||
tooltipDelayLabel.setToolTipText("<HTML>The time the appearance of the tooltip window for a card is delayed.<br>\nIf set to zero, the tooltip window won't be shown at all.");
|
||||
|
||||
tooltipDelay.setMajorTickSpacing(1000);
|
||||
tooltipDelay.setMajorTickSpacing(500);
|
||||
tooltipDelay.setMaximum(5000);
|
||||
tooltipDelay.setMinorTickSpacing(100);
|
||||
tooltipDelay.setPaintLabels(true);
|
||||
|
|
@ -2336,48 +2332,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
tabsPanel.addTab("Avatars", tabAvatars);
|
||||
|
||||
connection_servers.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Servers"));
|
||||
|
||||
lblURLServerList.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
lblURLServerList.setText("URL server list:");
|
||||
lblURLServerList.setToolTipText("");
|
||||
lblURLServerList.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
|
||||
lblURLServerList.setPreferredSize(new java.awt.Dimension(110, 16));
|
||||
lblURLServerList.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
|
||||
|
||||
txtURLServerList.setToolTipText("The URL XMage tries to read a server list from.");
|
||||
txtURLServerList.setPreferredSize(new java.awt.Dimension(300, 22));
|
||||
|
||||
jLabel17.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
|
||||
jLabel17.setText("e.g.: http://XMage.de/files/server-list.txt");
|
||||
|
||||
org.jdesktop.layout.GroupLayout connection_serversLayout = new org.jdesktop.layout.GroupLayout(connection_servers);
|
||||
connection_servers.setLayout(connection_serversLayout);
|
||||
connection_serversLayout.setHorizontalGroup(
|
||||
connection_serversLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(connection_serversLayout.createSequentialGroup()
|
||||
.add(connection_serversLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(connection_serversLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(lblURLServerList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 96, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(txtURLServerList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 370, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(connection_serversLayout.createSequentialGroup()
|
||||
.add(141, 141, 141)
|
||||
.add(jLabel17)))
|
||||
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
connection_serversLayout.setVerticalGroup(
|
||||
connection_serversLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(connection_serversLayout.createSequentialGroup()
|
||||
.add(connection_serversLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
|
||||
.add(lblURLServerList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(txtURLServerList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jLabel17))
|
||||
);
|
||||
|
||||
lblProxyType.setText("Proxy:");
|
||||
connection_Proxy.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Proxy for server connection and images download"));
|
||||
|
||||
cbProxyType.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
|
@ -2385,8 +2340,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
});
|
||||
|
||||
pnlProxySettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
lblProxyServer.setText("Server:");
|
||||
|
||||
lblProxyPort.setText("Port:");
|
||||
|
|
@ -2408,24 +2361,28 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addContainerGap()
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(pnlProxyLayout.createSequentialGroup()
|
||||
.add(rememberPswd)
|
||||
.add(47, 47, 47)
|
||||
.add(jLabel11)
|
||||
.add(34, 34, 34))
|
||||
.add(lblProxyServer)
|
||||
.add(39, 39, 39)
|
||||
.add(txtProxyServer))
|
||||
.add(pnlProxyLayout.createSequentialGroup()
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(lblProxyPort)
|
||||
.add(lblProxyPassword)
|
||||
.add(lblProxyServer)
|
||||
.add(lblProxyUserName))
|
||||
.add(19, 19, 19)
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(txtProxyPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, txtPasswordField)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, txtProxyUserName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 148, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(txtProxyServer))
|
||||
.addContainerGap())))
|
||||
.add(pnlProxyLayout.createSequentialGroup()
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(lblProxyPort)
|
||||
.add(lblProxyPassword)
|
||||
.add(lblProxyUserName))
|
||||
.add(19, 19, 19)
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(txtProxyPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, txtPasswordField)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, txtProxyUserName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 148, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
|
||||
.add(pnlProxyLayout.createSequentialGroup()
|
||||
.add(rememberPswd)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(jLabel11)))
|
||||
.add(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
pnlProxyLayout.setVerticalGroup(
|
||||
pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
|
|
@ -2446,26 +2403,33 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(txtPasswordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblProxyPassword))
|
||||
.add(18, 18, 18)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(pnlProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(rememberPswd)
|
||||
.add(jLabel11))
|
||||
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(18, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
org.jdesktop.layout.GroupLayout pnlProxySettingsLayout = new org.jdesktop.layout.GroupLayout(pnlProxySettings);
|
||||
pnlProxySettings.setLayout(pnlProxySettingsLayout);
|
||||
pnlProxySettingsLayout.setHorizontalGroup(
|
||||
pnlProxySettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(pnlProxySettingsLayout.createSequentialGroup()
|
||||
org.jdesktop.layout.GroupLayout connection_ProxyLayout = new org.jdesktop.layout.GroupLayout(connection_Proxy);
|
||||
connection_Proxy.setLayout(connection_ProxyLayout);
|
||||
connection_ProxyLayout.setHorizontalGroup(
|
||||
connection_ProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(connection_ProxyLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(pnlProxy, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(connection_ProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(connection_ProxyLayout.createSequentialGroup()
|
||||
.add(cbProxyType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(0, 629, Short.MAX_VALUE))
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, pnlProxy, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
pnlProxySettingsLayout.setVerticalGroup(
|
||||
pnlProxySettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(pnlProxySettingsLayout.createSequentialGroup()
|
||||
.add(pnlProxy, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
connection_ProxyLayout.setVerticalGroup(
|
||||
connection_ProxyLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(connection_ProxyLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(cbProxyType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(pnlProxy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
|
|
@ -2473,34 +2437,19 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
tabConnection.setLayout(tabConnectionLayout);
|
||||
tabConnectionLayout.setHorizontalGroup(
|
||||
tabConnectionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, tabConnectionLayout.createSequentialGroup()
|
||||
.add(tabConnectionLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(tabConnectionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
|
||||
.add(pnlProxySettings, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, tabConnectionLayout.createSequentialGroup()
|
||||
.add(lblProxyType)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(cbProxyType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(connection_servers, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.add(connection_Proxy, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
tabConnectionLayout.setVerticalGroup(
|
||||
tabConnectionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(tabConnectionLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(connection_servers, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(tabConnectionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(lblProxyType)
|
||||
.add(cbProxyType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(18, 18, 18)
|
||||
.add(pnlProxySettings, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.add(connection_Proxy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pnlProxySettings.getAccessibleContext().setAccessibleDescription("");
|
||||
|
||||
tabsPanel.addTab("Connection", tabConnection);
|
||||
tabsPanel.addTab("Proxy", tabConnection);
|
||||
|
||||
labelNextTurn.setText("Next Turn:");
|
||||
|
||||
|
|
@ -2872,7 +2821,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
char[] input = txtPasswordField.getPassword();
|
||||
prefs.put(KEY_PROXY_PSWD, new String(input));
|
||||
}
|
||||
save(prefs, dialog.txtURLServerList, KEY_CONNECTION_URL_SERVER_LIST);
|
||||
|
||||
// controls
|
||||
save(prefs, dialog.keyConfirm);
|
||||
|
|
@ -3110,17 +3058,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private void showProxySettings() {
|
||||
Connection.ProxyType proxyType = (Connection.ProxyType) cbProxyType.getSelectedItem();
|
||||
switch (proxyType) {
|
||||
case SOCKS:
|
||||
this.pnlProxy.setVisible(true);
|
||||
this.pnlProxySettings.setVisible(true);
|
||||
break;
|
||||
case HTTP:
|
||||
this.pnlProxy.setVisible(true);
|
||||
this.pnlProxySettings.setVisible(true);
|
||||
case SOCKS:
|
||||
GuiDisplayUtil.setPanelEnabled(this.pnlProxy, true);
|
||||
break;
|
||||
case NONE:
|
||||
this.pnlProxy.setVisible(false);
|
||||
this.pnlProxySettings.setVisible(false);
|
||||
GuiDisplayUtil.setPanelEnabled(this.pnlProxy, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -3383,7 +3326,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
if (dialog.rememberPswd.isSelected()) {
|
||||
load(prefs, dialog.txtPasswordField, KEY_PROXY_PSWD, "");
|
||||
}
|
||||
load(prefs, dialog.txtURLServerList, KEY_CONNECTION_URL_SERVER_LIST, "http://XMage.de/files/server-list.txt");
|
||||
}
|
||||
|
||||
private static void loadControlSettings(Preferences prefs) {
|
||||
|
|
@ -3900,7 +3842,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JCheckBox checkBoxMainYou;
|
||||
private javax.swing.JCheckBox checkBoxUpkeepOthers;
|
||||
private javax.swing.JCheckBox checkBoxUpkeepYou;
|
||||
private javax.swing.JPanel connection_servers;
|
||||
private javax.swing.JPanel connection_Proxy;
|
||||
private javax.swing.JLabel controlsDescriptionLabel;
|
||||
private javax.swing.JCheckBox displayLifeOnAvatar;
|
||||
private javax.swing.JButton exitButton;
|
||||
|
|
@ -3909,7 +3851,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JPanel guiSizeGame;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel16;
|
||||
private javax.swing.JLabel jLabel17;
|
||||
private javax.swing.JLabel jLabelBeforeCombat;
|
||||
private javax.swing.JLabel jLabelDraw;
|
||||
private javax.swing.JLabel jLabelEndOfTurn;
|
||||
|
|
@ -3986,10 +3927,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JLabel lblProxyPassword;
|
||||
private javax.swing.JLabel lblProxyPort;
|
||||
private javax.swing.JLabel lblProxyServer;
|
||||
private javax.swing.JLabel lblProxyType;
|
||||
private javax.swing.JLabel lblProxyUserName;
|
||||
private javax.swing.JLabel lblTargetAutoChoose;
|
||||
private javax.swing.JLabel lblURLServerList;
|
||||
private javax.swing.JLabel lebelSkip;
|
||||
private javax.swing.JPanel main_battlefield;
|
||||
private javax.swing.JPanel main_card;
|
||||
|
|
@ -4001,7 +3940,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JPanel panelCardStyles;
|
||||
private javax.swing.JPanel phases_stopSettings;
|
||||
private javax.swing.JPanel pnlProxy;
|
||||
private javax.swing.JPanel pnlProxySettings;
|
||||
private javax.swing.JCheckBox rememberPswd;
|
||||
private javax.swing.JButton saveButton;
|
||||
private javax.swing.JCheckBox showAbilityPickerForced;
|
||||
|
|
@ -4044,7 +3982,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JTextField txtProxyPort;
|
||||
private javax.swing.JTextField txtProxyServer;
|
||||
private javax.swing.JTextField txtProxyUserName;
|
||||
private javax.swing.JTextField txtURLServerList;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private static final PreferencesDialog dialog = new PreferencesDialog(new javax.swing.JFrame(), true);
|
||||
|
|
|
|||
|
|
@ -441,4 +441,15 @@ public final class GuiDisplayUtil {
|
|||
}
|
||||
return types.trim();
|
||||
}
|
||||
|
||||
public static void setPanelEnabled(JPanel panel, Boolean isEnabled) {
|
||||
panel.setEnabled(isEnabled);
|
||||
Component[] components = panel.getComponents();
|
||||
for (Component component : components) {
|
||||
if (component instanceof JPanel) {
|
||||
setPanelEnabled((JPanel) component, isEnabled);
|
||||
}
|
||||
component.setEnabled(isEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue