UI: added what's new button to message of the day panel and connection dialog;

This commit is contained in:
Oleg Agafonov 2019-03-29 10:41:49 +04:00
parent ad9ba216f2
commit 6606b586a4
5 changed files with 172 additions and 90 deletions

View file

@ -23,7 +23,7 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lblUserName" alignment="0" max="32767" attributes="0"/>
<Component id="lblServer" alignment="0" max="32767" attributes="0"/>
@ -33,15 +33,10 @@
</Group>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jProxySettingsButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="lblStatus" alignment="1" max="32767" attributes="0"/>
<Component id="chkForceUpdateDB" alignment="0" max="32767" attributes="0"/>
<Component id="chkAutoConnect" alignment="0" max="32767" attributes="0"/>
<Component id="txtUserName" alignment="0" max="32767" attributes="0"/>
<Component id="txtPassword" alignment="0" max="32767" attributes="0"/>
<Component id="panelFlag" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="btnConnect" max="32767" attributes="0"/>
@ -55,10 +50,21 @@
</Group>
<Component id="panelFast" alignment="0" max="32767" attributes="0"/>
<Component id="panelServer" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jProxySettingsButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnWhatsNew" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="txtPassword" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="filler2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -84,13 +90,16 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="txtPassword" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtPassword" alignment="3" max="32767" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="lblPassword" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="filler2" pref="53" max="32767" attributes="0"/>
<Component id="filler2" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelFlag" min="-2" pref="20" max="-2" attributes="0"/>
<Component id="lblFlag" min="-2" pref="18" max="-2" attributes="0"/>
@ -100,10 +109,13 @@
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="chkForceUpdateDB" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jProxySettingsButton" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jProxySettingsButton" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
<Component id="btnWhatsNew" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="lblStatus" min="-2" pref="24" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="btnRegister" max="32767" attributes="0"/>
@ -312,13 +324,13 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="btnFindMain" min="-2" pref="75" max="-2" attributes="0"/>
<Component id="btnFindMain" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btnFindUs" min="-2" pref="75" max="-2" attributes="0"/>
<Component id="btnFindUs" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btnFindBeta" min="-2" pref="75" max="-2" attributes="0"/>
<Component id="btnFindBeta" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btnFindLocal" min="-2" pref="75" max="-2" attributes="0"/>
<Component id="btnFindLocal" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnFindOther" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
@ -330,11 +342,11 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnFindMain" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnFindLocal" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnFindUs" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnFindBeta" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnFindOther" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnFindMain" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
<Component id="btnFindLocal" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
<Component id="btnFindUs" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
<Component id="btnFindBeta" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
<Component id="btnFindOther" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
@ -371,8 +383,8 @@
</Component>
<Component class="javax.swing.JButton" name="btnFindLocal">
<Properties>
<Property name="text" type="java.lang.String" value="LOCAL"/>
<Property name="toolTipText" type="java.lang.String" value="Connect to localhost (local server)"/>
<Property name="text" type="java.lang.String" value="LOCAL, AI"/>
<Property name="toolTipText" type="java.lang.String" value="Connect to localhost, AI enabled (run local server from launcher)"/>
<Property name="actionCommand" type="java.lang.String" value="connectLocalhost"/>
<Property name="alignmentY" type="float" value="0.0"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
@ -390,8 +402,8 @@
</Component>
<Component class="javax.swing.JButton" name="btnFindBeta">
<Properties>
<Property name="text" type="java.lang.String" value="BETA"/>
<Property name="toolTipText" type="java.lang.String" value="Connect to BETA server (use any username without registration)"/>
<Property name="text" type="java.lang.String" value="BETA, AI"/>
<Property name="toolTipText" type="java.lang.String" value="Connect to BETA server, AI enabled (use any username without registration)"/>
<Property name="alignmentY" type="float" value="0.0"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
@ -451,7 +463,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="txtPort" min="-2" pref="75" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCheckStatus" pref="141" max="32767" attributes="0"/>
<Component id="btnCheckStatus" pref="205" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
@ -523,5 +535,18 @@
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalStrut"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="btnWhatsNew">
<Properties>
<Property name="text" type="java.lang.String" value="Show what&apos;s new"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnWhatsNewActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="(use empty password for servers without registration)"/>
</Properties>
</Component>
</SubComponents>
</Form>

View file

@ -130,6 +130,8 @@ public class ConnectDialog extends MageDialog {
lblPort = new javax.swing.JLabel();
btnCheckStatus = new javax.swing.JButton();
filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 50), new java.awt.Dimension(0, 50), new java.awt.Dimension(32767, 50));
btnWhatsNew = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setTitle("Connect to server");
@ -251,8 +253,8 @@ public class ConnectDialog extends MageDialog {
}
});
btnFindLocal.setText("LOCAL");
btnFindLocal.setToolTipText("Connect to localhost (local server)");
btnFindLocal.setText("LOCAL, AI");
btnFindLocal.setToolTipText("Connect to localhost, AI enabled (run local server from launcher)");
btnFindLocal.setActionCommand("connectLocalhost");
btnFindLocal.setAlignmentY(0.0F);
btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
@ -265,8 +267,8 @@ public class ConnectDialog extends MageDialog {
}
});
btnFindBeta.setText("BETA");
btnFindBeta.setToolTipText("Connect to BETA server (use any username without registration)");
btnFindBeta.setText("BETA, AI");
btnFindBeta.setToolTipText("Connect to BETA server, AI enabled (use any username without registration)");
btnFindBeta.setAlignmentY(0.0F);
btnFindBeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindBeta.setMargin(new java.awt.Insets(2, 2, 2, 2));
@ -307,13 +309,13 @@ public class ConnectDialog extends MageDialog {
panelFastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelFastLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(btnFindMain, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindMain, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnFindUs, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindUs, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnFindBeta, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindBeta, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnFindLocal, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindLocal, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnFindOther, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0))
@ -323,11 +325,11 @@ public class ConnectDialog extends MageDialog {
.addGroup(panelFastLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelFastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnFindMain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindLocal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindUs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindBeta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindOther))
.addComponent(btnFindMain, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindLocal, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindUs, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindBeta, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnFindOther, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0))
);
@ -363,7 +365,7 @@ public class ConnectDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCheckStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
.addComponent(btnCheckStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
panelServerLayout.setVerticalGroup(
@ -377,6 +379,15 @@ public class ConnectDialog extends MageDialog {
.addComponent(btnCheckStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
btnWhatsNew.setText("Show what's new");
btnWhatsNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnWhatsNewActionPerformed(evt);
}
});
jLabel1.setText("(use empty password for servers without registration)");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@ -391,14 +402,10 @@ public class ConnectDialog extends MageDialog {
.addComponent(lblFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jProxySettingsButton)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtUserName)
.addComponent(txtPassword)
.addComponent(panelFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(btnConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@ -409,7 +416,16 @@ public class ConnectDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(panelFast, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelServer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(panelServer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jProxySettingsButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnWhatsNew)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(txtPassword)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filler2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
@ -433,9 +449,11 @@ public class ConnectDialog extends MageDialog {
.addComponent(lblUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtPassword)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPassword)
.addComponent(jLabel1))
.addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(filler2, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
.addComponent(filler2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -445,7 +463,9 @@ public class ConnectDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(chkForceUpdateDB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jProxySettingsButton)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jProxySettingsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnWhatsNew, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
@ -773,6 +793,10 @@ public class ConnectDialog extends MageDialog {
}
}//GEN-LAST:event_btnCheckStatusActionPerformed
private void btnWhatsNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWhatsNewActionPerformed
MageFrame.getInstance().getWhatsNewDialog().checkUpdatesAndShow(true);
}//GEN-LAST:event_btnWhatsNewActionPerformed
private void doFastFlagSearch() {
Choice choice = new ChoiceImpl(false);
@ -828,11 +852,13 @@ public class ConnectDialog extends MageDialog {
private javax.swing.JButton btnFlagSearch;
private javax.swing.JButton btnForgotPassword;
private javax.swing.JButton btnRegister;
private javax.swing.JButton btnWhatsNew;
private mage.client.util.gui.countryBox.CountryComboBox cbFlag;
private javax.swing.JCheckBox chkAutoConnect;
private javax.swing.JCheckBox chkForceUpdateDB;
private javax.swing.Box.Filler filler1;
private javax.swing.Box.Filler filler2;
private javax.swing.JLabel jLabel1;
private javax.swing.JButton jProxySettingsButton;
private javax.swing.JLabel lblFastConnect;
private javax.swing.JLabel lblFlag;

View file

@ -40,7 +40,8 @@ public class WhatsNewDialog extends MageDialog {
private static final String WHATS_NEW_VERSION_PAGE = "https://jaydi85.github.io/xmage-web-news/news_version.html"; // increment version=123 to auto-shown for all users
private static final int WHATS_NEW_LOAD_TIMEOUT_SECS = 20; // timeout for page loading
final JFXPanel fxPanel;
private final JFXPanel fxPanel;
private WebView webView;
private WebEngine engine;
private boolean isPageReady = false;
@ -128,6 +129,8 @@ public class WhatsNewDialog extends MageDialog {
fxPanel = new JFXPanel();
panelData.add(fxPanel);
webView = null;
engine = null;
createWebView();
}
@ -257,10 +260,10 @@ public class WhatsNewDialog extends MageDialog {
@Override
public void run() {
WebView view = new WebView();
engine = view.getEngine();
webView = new WebView();
engine = webView.getEngine();
engine.setUserAgent(engine.getUserAgent() + " XMage/" + clientVersion.toString(false));
view.contextMenuEnabledProperty().setValue(false);
webView.contextMenuEnabledProperty().setValue(false);
CookieManager cookieManager = new CookieManager(new PersistentCookieStore(), CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(cookieManager);
@ -324,7 +327,7 @@ public class WhatsNewDialog extends MageDialog {
}
});
fxPanel.setScene(new Scene(view));
fxPanel.setScene(new Scene(webView));
}
});
}

View file

@ -668,18 +668,29 @@
<Property name="alignment" type="int" value="0"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButtonFooterNext">
<Component class="javax.swing.JButton" name="buttonWhatsNew">
<Properties>
<Property name="text" type="java.lang.String" value="Next"/>
<Property name="text" type="java.lang.String" value="Show that&apos;s new"/>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonFooterNextActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonWhatsNewActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelFooterLabel">
<Component class="javax.swing.JButton" name="buttonNextMessage">
<Properties>
<Property name="text" type="java.lang.String" value="Next message"/>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonNextMessageActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="labelMessageHeader">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="1"/>
@ -689,7 +700,7 @@
<Property name="alignmentY" type="float" value="0.3"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelFooterText">
<Component class="javax.swing.JLabel" name="labelMessageText">
<Properties>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="You are playing Mage version 0.7.5. Welcome! -- Mage dev team --"/>

View file

@ -568,9 +568,9 @@ public class TablesPanel extends javax.swing.JPanel {
Dimension newDimension = new Dimension((int) jPanelBottom.getPreferredSize().getWidth(), GUISizeHelper.menuFont.getSize() + 28);
jPanelBottom.setMinimumSize(newDimension);
jPanelBottom.setPreferredSize(newDimension);
jButtonFooterNext.setFont(GUISizeHelper.menuFont);
jLabelFooterLabel.setFont(new Font(GUISizeHelper.menuFont.getName(), Font.BOLD, GUISizeHelper.menuFont.getSize()));
jLabelFooterText.setFont(GUISizeHelper.menuFont);
buttonNextMessage.setFont(GUISizeHelper.menuFont);
labelMessageHeader.setFont(new Font(GUISizeHelper.menuFont.getName(), Font.BOLD, GUISizeHelper.menuFont.getSize()));
labelMessageText.setFont(GUISizeHelper.menuFont);
}
private void saveDividerLocations() {
@ -720,9 +720,9 @@ public class TablesPanel extends javax.swing.JPanel {
this.jPanelBottom.setVisible(false);
} else {
this.jPanelBottom.setVisible(true);
URLHandler.RemoveMouseAdapter(jLabelFooterText);
URLHandler.handleMessage(this.messages.get(0), this.jLabelFooterText);
this.jButtonFooterNext.setVisible(this.messages.size() > 1);
URLHandler.RemoveMouseAdapter(labelMessageText);
URLHandler.handleMessage(this.messages.get(0), this.labelMessageText);
this.buttonNextMessage.setVisible(this.messages.size() > 1);
}
}
@ -964,9 +964,10 @@ public class TablesPanel extends javax.swing.JPanel {
tableCompleted = new javax.swing.JTable();
chatPanelMain = new mage.client.table.PlayersChatPanel();
jPanelBottom = new javax.swing.JPanel();
jButtonFooterNext = new javax.swing.JButton();
jLabelFooterLabel = new javax.swing.JLabel();
jLabelFooterText = new javax.swing.JLabel();
buttonWhatsNew = new javax.swing.JButton();
buttonNextMessage = new javax.swing.JButton();
labelMessageHeader = new javax.swing.JLabel();
labelMessageText = new javax.swing.JLabel();
setLayout(new java.awt.GridBagLayout());
@ -1474,26 +1475,37 @@ public class TablesPanel extends javax.swing.JPanel {
jPanelBottom.setPreferredSize(new java.awt.Dimension(516, 37));
jPanelBottom.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jButtonFooterNext.setText("Next");
jButtonFooterNext.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButtonFooterNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonFooterNext.setOpaque(false);
jButtonFooterNext.addActionListener(new java.awt.event.ActionListener() {
buttonWhatsNew.setText("Show that's new");
buttonWhatsNew.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
buttonWhatsNew.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonWhatsNew.setOpaque(false);
buttonWhatsNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonFooterNextActionPerformed(evt);
buttonWhatsNewActionPerformed(evt);
}
});
jPanelBottom.add(jButtonFooterNext);
jPanelBottom.add(buttonWhatsNew);
jLabelFooterLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabelFooterLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabelFooterLabel.setText("Message of the Day:");
jLabelFooterLabel.setAlignmentY(0.3F);
jPanelBottom.add(jLabelFooterLabel);
buttonNextMessage.setText("Next message");
buttonNextMessage.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
buttonNextMessage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonNextMessage.setOpaque(false);
buttonNextMessage.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonNextMessageActionPerformed(evt);
}
});
jPanelBottom.add(buttonNextMessage);
jLabelFooterText.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabelFooterText.setText("You are playing Mage version 0.7.5. Welcome! -- Mage dev team --");
jPanelBottom.add(jLabelFooterText);
labelMessageHeader.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
labelMessageHeader.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
labelMessageHeader.setText("Message of the Day:");
labelMessageHeader.setAlignmentY(0.3F);
jPanelBottom.add(labelMessageHeader);
labelMessageText.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
labelMessageText.setText("You are playing Mage version 0.7.5. Welcome! -- Mage dev team --");
jPanelBottom.add(labelMessageText);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
@ -1544,7 +1556,7 @@ public class TablesPanel extends javax.swing.JPanel {
newTableDialog.showDialog(roomId);
}//GEN-LAST:event_btnNewTableActionPerformed
private void jButtonFooterNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFooterNextActionPerformed
private void buttonNextMessageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonNextMessageActionPerformed
synchronized (this) {
if (messages != null && !messages.isEmpty()) {
currentMessage++;
@ -1552,11 +1564,11 @@ public class TablesPanel extends javax.swing.JPanel {
currentMessage = 0;
}
URLHandler.RemoveMouseAdapter(jLabelFooterText);
URLHandler.handleMessage(messages.get(currentMessage), this.jLabelFooterText);
URLHandler.RemoveMouseAdapter(labelMessageText);
URLHandler.handleMessage(messages.get(currentMessage), this.labelMessageText);
}
}
}//GEN-LAST:event_jButtonFooterNextActionPerformed
}//GEN-LAST:event_buttonNextMessageActionPerformed
private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFilterActionPerformed
setTableFilter();
@ -1587,6 +1599,10 @@ public class TablesPanel extends javax.swing.JPanel {
setTableFilter();
}//GEN-LAST:event_btnFormatVintageActionPerformed
private void buttonWhatsNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonWhatsNewActionPerformed
MageFrame.getInstance().getWhatsNewDialog().checkUpdatesAndShow(true);
}//GEN-LAST:event_buttonWhatsNewActionPerformed
private void handleError(Exception ex) {
LOGGER.fatal("Error loading deck: ", ex);
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
@ -1619,12 +1635,11 @@ public class TablesPanel extends javax.swing.JPanel {
private javax.swing.JToggleButton btnTypeTourneyConstructed;
private javax.swing.JToggleButton btnTypeTourneyLimited;
private javax.swing.JToggleButton btnUnrated;
private javax.swing.JButton buttonNextMessage;
private javax.swing.JButton buttonWhatsNew;
private mage.client.table.PlayersChatPanel chatPanelMain;
private javax.swing.JToolBar filterBar1;
private javax.swing.JToolBar filterBar2;
private javax.swing.JButton jButtonFooterNext;
private javax.swing.JLabel jLabelFooterLabel;
private javax.swing.JLabel jLabelFooterText;
private javax.swing.JPanel jPanelBottom;
private javax.swing.JPanel jPanelTables;
private javax.swing.JPanel jPanelTop;
@ -1638,6 +1653,8 @@ public class TablesPanel extends javax.swing.JPanel {
private javax.swing.JToolBar.Separator jSeparator6;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JSplitPane jSplitPaneTables;
private javax.swing.JLabel labelMessageHeader;
private javax.swing.JLabel labelMessageText;
private javax.swing.JTable tableCompleted;
private javax.swing.JTable tableTables;
// End of variables declaration//GEN-END:variables