mirror of
https://github.com/correl/mage.git
synced 2025-04-08 01:01:04 -09:00
* Some client menu changes.
This commit is contained in:
parent
1085529b98
commit
d051cb7b42
13 changed files with 226 additions and 197 deletions
Mage.Client/src/main
java
mage/client
org/mage/plugins/card/dl/beans
resources/menu
|
@ -26,8 +26,8 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="desktopPane" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="mageToolbar" alignment="0" pref="697" max="32767" attributes="0"/>
|
||||
<Component id="desktopPane" alignment="0" pref="769" max="32767" attributes="0"/>
|
||||
<Component id="mageToolbar" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
@ -78,9 +78,12 @@
|
|||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="btnPreferences">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/preferences.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Preferences"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
@ -91,35 +94,36 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnConnect">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Connect"/>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/connect.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Connect to or disconnect from a XMage server."/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnConnectActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator3">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnGames">
|
||||
<Component class="javax.swing.JLabel" name="lblStatus">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Games"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="text" type="java.lang.String" value="Not connected"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
<Property name="inheritsPopupMenu" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnGamesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnDeckEditor">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/deck_editor.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Deck Editor"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
@ -130,9 +134,12 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnCollectionViewer">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Collection Viewer"/>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/collection.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Viewer"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
@ -143,9 +150,12 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnSendFeedback">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/feedback.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Feedback"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
@ -154,11 +164,48 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator6">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnSymbols">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/symbol.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Symbols"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>Load symbols from the internet.<br>
You need to do that only once."/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSymbolsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparatorSymbols">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnImages">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/images.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Images"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>Load card images from external sources."/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnImagesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparatorImages">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAbout">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/about.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="About"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
@ -167,30 +214,15 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator7">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnExit">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Exit"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnExitActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jMemUsageLabel">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/menu/memory.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="100% Free mem"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_AddingCodePre" type="java.lang.String" value="mageToolbar.add(Box.createHorizontalGlue());"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator8">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblStatus">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Not connected "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
|
|
|
@ -63,7 +63,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.prefs.Preferences;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JButton;
|
||||
|
@ -79,7 +78,6 @@ import javax.swing.JOptionPane;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.JToolBar.Separator;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
@ -357,41 +355,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
balloonTip.setPositioner(new LeftAbovePositioner(0, 0));
|
||||
balloonTip.setVisible(false);
|
||||
|
||||
mageToolbar.add(new javax.swing.JToolBar.Separator());
|
||||
mageToolbar.add(createWindowsButton());
|
||||
|
||||
//TODO: move to plugin impl
|
||||
if (Plugins.getInstance().isCardPluginLoaded()) {
|
||||
Separator separator = new javax.swing.JToolBar.Separator();
|
||||
mageToolbar.add(separator);
|
||||
|
||||
JButton btnDownloadSymbols = new JButton("Symbols");
|
||||
btnDownloadSymbols.setFocusable(false);
|
||||
btnDownloadSymbols.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnDownloadSymbols.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnDownloadSymbols.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnSymbolsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnDownloadSymbols);
|
||||
|
||||
separator = new javax.swing.JToolBar.Separator();
|
||||
mageToolbar.add(separator);
|
||||
|
||||
JButton btnDownload = new JButton("Images");
|
||||
btnDownload.setFocusable(false);
|
||||
btnDownload.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnDownload.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnDownload.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnImagesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnDownload);
|
||||
}
|
||||
mageToolbar.add(createSwitchPanelsButton(), 0);
|
||||
mageToolbar.add(new javax.swing.JToolBar.Separator(), 1);
|
||||
|
||||
if (Plugins.getInstance().isCounterPluginLoaded()) {
|
||||
int i = Plugins.getInstance().getGamesPlayed();
|
||||
|
@ -402,8 +367,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
label.setBounds(0, 0, 180, 30);
|
||||
}
|
||||
|
||||
UI.addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
|
||||
setGUISize();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
@ -567,22 +530,22 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
setIconImage(image);
|
||||
}
|
||||
|
||||
private AbstractButton createWindowsButton() {
|
||||
final JToggleButton windowButton = new JToggleButton("Windows");
|
||||
windowButton.addItemListener(new ItemListener() {
|
||||
private AbstractButton createSwitchPanelsButton() {
|
||||
final JToggleButton switchPanelsButton = new JToggleButton("Switch panels");
|
||||
switchPanelsButton.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
createAndShowMenu((JComponent) e.getSource(), windowButton);
|
||||
createAndShowSwitchPanelsMenu((JComponent) e.getSource(), switchPanelsButton);
|
||||
}
|
||||
}
|
||||
});
|
||||
windowButton.setFocusable(false);
|
||||
windowButton.setHorizontalTextPosition(SwingConstants.LEADING);
|
||||
return windowButton;
|
||||
switchPanelsButton.setFocusable(false);
|
||||
switchPanelsButton.setHorizontalTextPosition(SwingConstants.LEADING);
|
||||
return switchPanelsButton;
|
||||
}
|
||||
|
||||
private void createAndShowMenu(final JComponent component, final AbstractButton windowButton) {
|
||||
private void createAndShowSwitchPanelsMenu(final JComponent component, final AbstractButton windowButton) {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
MagePaneMenuItem menuItem;
|
||||
|
@ -641,18 +604,16 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
public void btnImagesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(new CardCriteria());
|
||||
DownloadPictures.startDownload(null, cards);
|
||||
}
|
||||
|
||||
public void btnSymbolsActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UserRequestMessage message = new UserRequestMessage("Download additional resources", "Do you want to download game symbols and additional image files?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_DOWNLOAD_SYMBOLS);
|
||||
showUserRequestDialog(message);
|
||||
}
|
||||
|
||||
// public void btnImagesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
// List<CardInfo> cards = CardRepository.instance.findCards(new CardCriteria());
|
||||
// DownloadPictures.startDownload(null, cards);
|
||||
// }
|
||||
// public void btnSymbolsActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
// UserRequestMessage message = new UserRequestMessage("Download additional resources", "Do you want to download game symbols and additional image files?");
|
||||
// message.setButton1("No", null);
|
||||
// message.setButton2("Yes", PlayerAction.CLIENT_DOWNLOAD_SYMBOLS);
|
||||
// showUserRequestDialog(message);
|
||||
// }
|
||||
public static void setActive(MagePane frame) {
|
||||
if (frame == null) {
|
||||
activeFrame = null;
|
||||
|
@ -888,8 +849,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
btnPreferences = new javax.swing.JButton();
|
||||
jSeparator4 = new javax.swing.JToolBar.Separator();
|
||||
btnConnect = new javax.swing.JButton();
|
||||
jSeparator3 = new javax.swing.JToolBar.Separator();
|
||||
btnGames = new javax.swing.JButton();
|
||||
lblStatus = new javax.swing.JLabel();
|
||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||
btnDeckEditor = new javax.swing.JButton();
|
||||
jSeparator2 = new javax.swing.JToolBar.Separator();
|
||||
|
@ -897,12 +857,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
jSeparator5 = new javax.swing.JToolBar.Separator();
|
||||
btnSendFeedback = new javax.swing.JButton();
|
||||
jSeparator6 = new javax.swing.JToolBar.Separator();
|
||||
btnSymbols = new javax.swing.JButton();
|
||||
jSeparatorSymbols = new javax.swing.JToolBar.Separator();
|
||||
btnImages = new javax.swing.JButton();
|
||||
jSeparatorImages = new javax.swing.JToolBar.Separator();
|
||||
btnAbout = new javax.swing.JButton();
|
||||
jSeparator7 = new javax.swing.JToolBar.Separator();
|
||||
btnExit = new javax.swing.JButton();
|
||||
jMemUsageLabel = new javax.swing.JLabel();
|
||||
jSeparator8 = new javax.swing.JToolBar.Separator();
|
||||
lblStatus = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
setMinimumSize(new java.awt.Dimension(1024, 768));
|
||||
|
@ -916,9 +877,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.setMinimumSize(new java.awt.Dimension(566, 60));
|
||||
mageToolbar.setPreferredSize(new java.awt.Dimension(614, 60));
|
||||
|
||||
btnPreferences.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/preferences.png"))); // NOI18N
|
||||
btnPreferences.setText("Preferences");
|
||||
btnPreferences.setFocusable(false);
|
||||
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnPreferences.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -928,9 +890,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(btnPreferences);
|
||||
mageToolbar.add(jSeparator4);
|
||||
|
||||
btnConnect.setText("Connect");
|
||||
btnConnect.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/connect.png"))); // NOI18N
|
||||
btnConnect.setToolTipText("Connect to or disconnect from a XMage server.");
|
||||
btnConnect.setFocusable(false);
|
||||
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -938,23 +901,18 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
});
|
||||
mageToolbar.add(btnConnect);
|
||||
mageToolbar.add(jSeparator3);
|
||||
|
||||
btnGames.setText("Games");
|
||||
btnGames.setFocusable(false);
|
||||
btnGames.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnGames.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnGames.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnGamesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnGames);
|
||||
lblStatus.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
lblStatus.setText("Not connected");
|
||||
lblStatus.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
lblStatus.setInheritsPopupMenu(false);
|
||||
mageToolbar.add(lblStatus);
|
||||
mageToolbar.add(jSeparator1);
|
||||
|
||||
btnDeckEditor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/deck_editor.png"))); // NOI18N
|
||||
btnDeckEditor.setText("Deck Editor");
|
||||
btnDeckEditor.setFocusable(false);
|
||||
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -964,9 +922,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(btnDeckEditor);
|
||||
mageToolbar.add(jSeparator2);
|
||||
|
||||
btnCollectionViewer.setText("Collection Viewer");
|
||||
btnCollectionViewer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/collection.png"))); // NOI18N
|
||||
btnCollectionViewer.setText("Viewer");
|
||||
btnCollectionViewer.setFocusable(false);
|
||||
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnCollectionViewer.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -976,9 +935,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(btnCollectionViewer);
|
||||
mageToolbar.add(jSeparator5);
|
||||
|
||||
btnSendFeedback.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/feedback.png"))); // NOI18N
|
||||
btnSendFeedback.setText("Feedback");
|
||||
btnSendFeedback.setFocusable(false);
|
||||
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnSendFeedback.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -988,9 +948,38 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(btnSendFeedback);
|
||||
mageToolbar.add(jSeparator6);
|
||||
|
||||
btnSymbols.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/symbol.png"))); // NOI18N
|
||||
btnSymbols.setText("Symbols");
|
||||
btnSymbols.setToolTipText("<HTML>Load symbols from the internet.<br>\nYou need to do that only once.");
|
||||
btnSymbols.setFocusable(false);
|
||||
btnSymbols.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnSymbols.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnSymbols.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnSymbolsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnSymbols);
|
||||
mageToolbar.add(jSeparatorSymbols);
|
||||
|
||||
btnImages.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/images.png"))); // NOI18N
|
||||
btnImages.setText("Images");
|
||||
btnImages.setToolTipText("<HTML>Load card images from external sources.");
|
||||
btnImages.setFocusable(false);
|
||||
btnImages.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnImages.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnImages.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnImagesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnImages);
|
||||
mageToolbar.add(jSeparatorImages);
|
||||
|
||||
btnAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/about.png"))); // NOI18N
|
||||
btnAbout.setText("About");
|
||||
btnAbout.setFocusable(false);
|
||||
btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
btnAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnAbout.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -1000,31 +989,19 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(btnAbout);
|
||||
mageToolbar.add(jSeparator7);
|
||||
|
||||
btnExit.setText("Exit");
|
||||
btnExit.setFocusable(false);
|
||||
btnExit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnExit.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnExitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnExit);
|
||||
|
||||
jMemUsageLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
jMemUsageLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/memory.png"))); // NOI18N
|
||||
jMemUsageLabel.setText("100% Free mem");
|
||||
mageToolbar.add(Box.createHorizontalGlue());
|
||||
jMemUsageLabel.setFocusable(false);
|
||||
jMemUsageLabel.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
mageToolbar.add(jMemUsageLabel);
|
||||
mageToolbar.add(jSeparator8);
|
||||
|
||||
lblStatus.setText("Not connected ");
|
||||
mageToolbar.add(lblStatus);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(desktopPane)
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 769, Short.MAX_VALUE)
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -1041,14 +1018,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
showDeckEditor(DeckEditorMode.FREE_BUILDING, null, null, 0);
|
||||
}//GEN-LAST:event_btnDeckEditorActionPerformed
|
||||
|
||||
private void btnGamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGamesActionPerformed
|
||||
this.showGames(true);
|
||||
}//GEN-LAST:event_btnGamesActionPerformed
|
||||
|
||||
private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
|
||||
exitApp();
|
||||
}//GEN-LAST:event_btnExitActionPerformed
|
||||
|
||||
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
|
||||
if (SessionHandler.isConnected()) {
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm disconnect", "Are you sure you want to disconnect?");
|
||||
|
@ -1090,6 +1059,26 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
FeedbackDialog.main(new String[]{});
|
||||
}//GEN-LAST:event_btnSendFeedbackActionPerformed
|
||||
|
||||
private void btnSymbolsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSymbolsActionPerformed
|
||||
downloadAdditionalResources();
|
||||
}//GEN-LAST:event_btnSymbolsActionPerformed
|
||||
|
||||
public void downloadAdditionalResources() {
|
||||
UserRequestMessage message = new UserRequestMessage("Download additional resources", "Do you want to download game symbols and additional image files?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_DOWNLOAD_SYMBOLS);
|
||||
showUserRequestDialog(message);
|
||||
}
|
||||
|
||||
private void btnImagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImagesActionPerformed
|
||||
downloadImages();
|
||||
}//GEN-LAST:event_btnImagesActionPerformed
|
||||
|
||||
public void downloadImages() {
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(new CardCriteria());
|
||||
DownloadPictures.startDownload(null, cards);
|
||||
}
|
||||
|
||||
public void exitApp() {
|
||||
if (SessionHandler.isConnected()) {
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm disconnect", "You are currently connected. Are you sure you want to disconnect?");
|
||||
|
@ -1106,15 +1095,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
public void enableButtons() {
|
||||
btnConnect.setEnabled(true);
|
||||
btnConnect.setText("Disconnect");
|
||||
btnGames.setEnabled(true);
|
||||
btnDeckEditor.setEnabled(true);
|
||||
}
|
||||
|
||||
public void disableButtons() {
|
||||
btnConnect.setEnabled(true);
|
||||
btnConnect.setText("Connect");
|
||||
btnGames.setEnabled(false);
|
||||
btnDeckEditor.setEnabled(true);
|
||||
}
|
||||
|
||||
|
@ -1131,9 +1116,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (setActive) {
|
||||
setActive(tablesPane);
|
||||
} else // if other panel was already shown, mamke sure it's topmost again
|
||||
if (topPanebefore != null) {
|
||||
setActive(topPanebefore);
|
||||
}
|
||||
if (topPanebefore != null) {
|
||||
setActive(topPanebefore);
|
||||
}
|
||||
}
|
||||
|
||||
public void hideGames() {
|
||||
|
@ -1305,20 +1290,20 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private javax.swing.JButton btnCollectionViewer;
|
||||
private javax.swing.JButton btnConnect;
|
||||
private javax.swing.JButton btnDeckEditor;
|
||||
private javax.swing.JButton btnExit;
|
||||
private javax.swing.JButton btnGames;
|
||||
private javax.swing.JButton btnImages;
|
||||
private javax.swing.JButton btnPreferences;
|
||||
private javax.swing.JButton btnSendFeedback;
|
||||
private javax.swing.JButton btnSymbols;
|
||||
private static javax.swing.JDesktopPane desktopPane;
|
||||
private javax.swing.JLabel jMemUsageLabel;
|
||||
private javax.swing.JToolBar.Separator jSeparator1;
|
||||
private javax.swing.JToolBar.Separator jSeparator2;
|
||||
private javax.swing.JToolBar.Separator jSeparator3;
|
||||
private javax.swing.JToolBar.Separator jSeparator4;
|
||||
private javax.swing.JToolBar.Separator jSeparator5;
|
||||
private javax.swing.JToolBar.Separator jSeparator6;
|
||||
private javax.swing.JToolBar.Separator jSeparator7;
|
||||
private javax.swing.JToolBar.Separator jSeparator8;
|
||||
private javax.swing.JToolBar.Separator jSeparatorImages;
|
||||
private javax.swing.JToolBar.Separator jSeparatorSymbols;
|
||||
private javax.swing.JLabel lblStatus;
|
||||
private javax.swing.JToolBar mageToolbar;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
@ -1330,7 +1315,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
public void setStatusText(String status) {
|
||||
this.lblStatus.setText(status);
|
||||
changeGUISize(); // Needed to layout the tooltbar after text length chnage
|
||||
changeGUISize(); // Needed to layout the tooltbar after text length change
|
||||
this.lblStatus.repaint();
|
||||
this.lblStatus.revalidate();
|
||||
}
|
||||
|
||||
public static MageUI getUI() {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package mage.client.components.tray;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import mage.client.MageFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
|
@ -63,14 +62,14 @@ public class MageTray {
|
|||
imagesItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MageFrame.getInstance().btnImagesActionPerformed(null);
|
||||
MageFrame.getInstance().downloadImages();
|
||||
}
|
||||
});
|
||||
|
||||
iconsItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MageFrame.getInstance().btnSymbolsActionPerformed(null);
|
||||
MageFrame.getInstance().downloadAdditionalResources();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,39 +1,37 @@
|
|||
/**
|
||||
* EventListenerList.java
|
||||
*
|
||||
*
|
||||
* Created on 08.04.2010
|
||||
*/
|
||||
|
||||
package org.mage.plugins.card.dl.beans;
|
||||
|
||||
|
||||
import static java.util.Arrays.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import static java.util.Arrays.*;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The class EventListenerList.
|
||||
*
|
||||
*
|
||||
* @version V0.0 08.04.2010
|
||||
* @author Clemens Koza
|
||||
*/
|
||||
public class EventListenerList extends javax.swing.event.EventListenerList {
|
||||
|
||||
private static final long serialVersionUID = -7545754245081842909L;
|
||||
|
||||
/**
|
||||
* Returns an iterable over all listeners for the specified classes. the listener classes are in the specified
|
||||
* order. for every class, listeners are in the reverse order of registering. A listener contained multiple
|
||||
* times (for a single or multiple classes) is only returned the first time it occurs.
|
||||
* Returns an iterable over all listeners for the specified classes. the
|
||||
* listener classes are in the specified order. for every class, listeners
|
||||
* are in the reverse order of registering. A listener contained multiple
|
||||
* times (for a single or multiple classes) is only returned the first time
|
||||
* it occurs.
|
||||
*/
|
||||
public <T extends EventListener> Iterable<T> getIterable(final Class<? extends T>... listenerClass) {
|
||||
//transform class -> iterable
|
||||
|
@ -51,22 +49,30 @@ public class EventListenerList extends javax.swing.event.EventListenerList {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator over all listeners for the specified classes. the listener classes are in the specified
|
||||
* order. for every class, listeners are in the reverse order of registering. A listener contained multiple
|
||||
* times (for a single or multiple classes) is only returned the first time it occurs.
|
||||
* Returns an iterator over all listeners for the specified classes. the
|
||||
* listener classes are in the specified order. for every class, listeners
|
||||
* are in the reverse order of registering. A listener contained multiple
|
||||
* times (for a single or multiple classes) is only returned the first time
|
||||
* it occurs.
|
||||
*
|
||||
* @param <T>
|
||||
* @param listenerClass
|
||||
* @return
|
||||
*/
|
||||
public <T extends EventListener> Iterator<T> getIterator(Class<? extends T>... listenerClass) {
|
||||
return getIterable(listenerClass).iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates backwards over the listeners registered for a class by using the original array. The Listener runs
|
||||
* backwards, just as listener notification usually works.
|
||||
* Iterates backwards over the listeners registered for a class by using the
|
||||
* original array. The Listener runs backwards, just as listener
|
||||
* notification usually works.
|
||||
*/
|
||||
private class ListenerIterator<T> extends AbstractIterator<T> {
|
||||
|
||||
private final Class<? extends T> listenerClass;
|
||||
private Object[] listeners = listenerList;
|
||||
private int index = listeners.length;
|
||||
private Object[] listeners = listenerList;
|
||||
private int index = listeners.length;
|
||||
|
||||
private ListenerIterator(Class<? extends T> listenerClass) {
|
||||
this.listenerClass = listenerClass;
|
||||
|
@ -75,8 +81,10 @@ public class EventListenerList extends javax.swing.event.EventListenerList {
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected T computeNext() {
|
||||
for(index -= 2; index >= 0; index -= 2) {
|
||||
if(listenerClass == listeners[index]) return (T) listeners[index + 1];
|
||||
for (index -= 2; index >= 0; index -= 2) {
|
||||
if (listenerClass == listeners[index]) {
|
||||
return (T) listeners[index + 1];
|
||||
}
|
||||
}
|
||||
return endOfData();
|
||||
}
|
||||
|
@ -98,22 +106,25 @@ public class EventListenerList extends javax.swing.event.EventListenerList {
|
|||
}
|
||||
|
||||
/**
|
||||
* Filters the delegate iterator so that every but the first occurrence of every element is ignored.
|
||||
* Filters the delegate iterator so that every but the first occurrence of
|
||||
* every element is ignored.
|
||||
*/
|
||||
private static class SingletonIterator<T> extends AbstractIterator<T> {
|
||||
|
||||
private Iterator<T> it;
|
||||
private HashSet<T> previous = new HashSet<T>();
|
||||
private HashSet<T> previous = new HashSet<T>();
|
||||
|
||||
public SingletonIterator(Iterator<T> it) {
|
||||
this.it = it;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected T computeNext() {
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
T next = it.next();
|
||||
if(previous.add(next)) return next;
|
||||
if (previous.add(next)) {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
return endOfData();
|
||||
}
|
||||
|
|
BIN
Mage.Client/src/main/resources/menu/about.png
Normal file
BIN
Mage.Client/src/main/resources/menu/about.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 860 B |
BIN
Mage.Client/src/main/resources/menu/collection.png
Normal file
BIN
Mage.Client/src/main/resources/menu/collection.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 366 B |
BIN
Mage.Client/src/main/resources/menu/connect.png
Normal file
BIN
Mage.Client/src/main/resources/menu/connect.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 636 B |
BIN
Mage.Client/src/main/resources/menu/deck_editor.png
Normal file
BIN
Mage.Client/src/main/resources/menu/deck_editor.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 271 B |
BIN
Mage.Client/src/main/resources/menu/feedback.png
Normal file
BIN
Mage.Client/src/main/resources/menu/feedback.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 547 B |
BIN
Mage.Client/src/main/resources/menu/images.png
Normal file
BIN
Mage.Client/src/main/resources/menu/images.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 811 B |
BIN
Mage.Client/src/main/resources/menu/memory.png
Normal file
BIN
Mage.Client/src/main/resources/menu/memory.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 675 B |
BIN
Mage.Client/src/main/resources/menu/preferences.png
Normal file
BIN
Mage.Client/src/main/resources/menu/preferences.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 512 B |
BIN
Mage.Client/src/main/resources/menu/symbol.png
Normal file
BIN
Mage.Client/src/main/resources/menu/symbol.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 376 B |
Loading…
Add table
Reference in a new issue