* UI: fixed error message window for long text (auto-size), improved wrong version message;

This commit is contained in:
Oleg Agafonov 2019-03-18 09:00:27 +04:00
parent 410fd68996
commit 2a0d2d125b
3 changed files with 40 additions and 46 deletions

View file

@ -1,22 +1,15 @@
/*
* ErrorDialog.java
*
* Created on Dec 23, 2009, 11:01:32 AM
*/
package mage.client.dialog; package mage.client.dialog;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JComponent;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import mage.constants.PlayerAction; import mage.constants.PlayerAction;
import mage.view.UserRequestMessage; import mage.view.UserRequestMessage;
import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.*;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class UserRequestDialog extends MageDialog { public class UserRequestDialog extends MageDialog {
@ -34,7 +27,7 @@ public class UserRequestDialog extends MageDialog {
private void setGUISize() { private void setGUISize() {
Font font = GUISizeHelper.gameRequestsFont; Font font = GUISizeHelper.gameRequestsFont;
lblText.setFont(font); lblText.setFont(font);
lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5)); lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 200 + font.getSize() * 5));
lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5)); lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5)); lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
btn1.setFont(font); btn1.setFont(font);
@ -58,7 +51,7 @@ public class UserRequestDialog extends MageDialog {
public void showDialog(UserRequestMessage userRequestMessage) { public void showDialog(UserRequestMessage userRequestMessage) {
this.userRequestMessage = userRequestMessage; this.userRequestMessage = userRequestMessage;
this.setTitle(userRequestMessage.getTitel()); this.setTitle(userRequestMessage.getTitle());
String text = "<html><p style=\"text-align:center; margin-left:10px; margin-right:10px\">" + userRequestMessage.getMessage() + "</p></html>"; String text = "<html><p style=\"text-align:center; margin-left:10px; margin-right:10px\">" + userRequestMessage.getMessage() + "</p></html>";
this.lblText.setText(text); this.lblText.setText(text);
if (userRequestMessage.getButton1Text() != null) { if (userRequestMessage.getButton1Text() != null) {
@ -128,30 +121,30 @@ public class UserRequestDialog extends MageDialog {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE))) .addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)))
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(btn3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(12, 12, 12)) .addGap(12, 12, 12))
); );
pack(); pack();

View file

@ -1,11 +1,9 @@
package mage.remote; package mage.remote;
import mage.MageException; import mage.MageException;
import mage.utils.MageVersion; import mage.utils.MageVersion;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class MageVersionException extends MageException { public class MageVersionException extends MageException {
@ -13,7 +11,11 @@ public class MageVersionException extends MageException {
private final MageVersion serverVersion; private final MageVersion serverVersion;
public MageVersionException(MageVersion clientVersion, MageVersion serverVersion) { public MageVersionException(MageVersion clientVersion, MageVersion serverVersion) {
super("Wrong client version " + clientVersion + ", expecting version " + serverVersion + ". \r\n\r\nPlease download needed version from http://XMage.de or http://www.slightlymagic.net/forum/viewforum.php?f=70"); super("Wrong client version."
+ "<br/>Your version: " + clientVersion
+ "<br/>Server version: " + serverVersion
+ "<br/>Release app download: http://xmage.de"
+ "<br/>BETA app download: http://xmage.today");
this.serverVersion = serverVersion; this.serverVersion = serverVersion;
} }

View file

@ -1,19 +1,18 @@
package mage.view; package mage.view;
import mage.constants.PlayerAction;
import java.io.Serializable; import java.io.Serializable;
import java.util.UUID; import java.util.UUID;
import mage.constants.PlayerAction;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class UserRequestMessage implements Serializable { public class UserRequestMessage implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final String titel; private final String title;
private final String message; private final String message;
private UUID relatedUserId; private UUID relatedUserId;
private String relatedUserName; private String relatedUserName;
@ -32,8 +31,8 @@ public class UserRequestMessage implements Serializable {
private String button3Text; private String button3Text;
private PlayerAction button3Action; private PlayerAction button3Action;
public UserRequestMessage(String titel, String message) { public UserRequestMessage(String title, String message) {
this.titel = titel; this.title = title;
this.message = message; this.message = message;
this.button1Action = null; this.button1Action = null;
this.button2Action = null; this.button2Action = null;
@ -68,8 +67,8 @@ public class UserRequestMessage implements Serializable {
this.button3Action = buttonAction; this.button3Action = buttonAction;
} }
public String getTitel() { public String getTitle() {
return titel; return title;
} }
public static long getSerialVersionUID() { public static long getSerialVersionUID() {