mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
UI changes + created lite mode (client without images) for remote desktop work
This commit is contained in:
parent
e40caef07b
commit
89770db58e
12 changed files with 150 additions and 85 deletions
Binary file not shown.
|
@ -47,6 +47,7 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new MageJDesktop()"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="10"/>
|
||||
</AuxValues>
|
||||
|
||||
|
@ -80,7 +81,7 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnGames">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Tables"/>
|
||||
<Property name="text" type="java.lang.String" value="Games"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder/>
|
||||
|
@ -114,6 +115,32 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator2">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnCollectionViewer">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Collection Viewer"/>
|
||||
<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="btnCollectionViewerActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator5">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnPreferences">
|
||||
<Properties>
|
||||
<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="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPreferencesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator6">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAbout">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="About"/>
|
||||
|
|
|
@ -100,6 +100,7 @@ import org.apache.log4j.Logger;
|
|||
public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(MageFrame.class);
|
||||
private final static String liteModeArg = "-lite";
|
||||
|
||||
private static Session session;
|
||||
private ConnectDialog connectDialog;
|
||||
|
@ -110,6 +111,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private final static MageVersion version = new MageVersion(0, 7, 4, "beta-2");
|
||||
private UUID clientId;
|
||||
private static MagePane activeFrame;
|
||||
private static boolean liteMode = false;
|
||||
|
||||
private static Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
||||
private static Map<UUID, GamePanel> games = new HashMap<UUID, GamePanel>();
|
||||
|
@ -131,6 +133,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public static Preferences getPreferences() {
|
||||
return prefs;
|
||||
}
|
||||
|
||||
public static boolean isLite() {
|
||||
return liteMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageVersion getVersion() {
|
||||
|
@ -205,7 +211,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public void componentResized(ComponentEvent e) {
|
||||
int width = ((JComponent) e.getSource()).getWidth();
|
||||
int height = ((JComponent) e.getSource()).getHeight();
|
||||
backgroundPane.setSize(width, height);
|
||||
if (!liteMode)
|
||||
backgroundPane.setSize(width, height);
|
||||
JPanel arrowsPanel = ArrowBuilder.getArrowsPanelRef();
|
||||
if (arrowsPanel != null) arrowsPanel.setSize(width, height);
|
||||
if (title != null) {
|
||||
|
@ -297,6 +304,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
private void setBackground() {
|
||||
if (liteMode)
|
||||
return;
|
||||
String filename = "/background.jpg";
|
||||
try {
|
||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||
|
@ -315,6 +324,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
private void addMageLabel() {
|
||||
if (liteMode)
|
||||
return;
|
||||
String filename = "/label-mage.png";
|
||||
try {
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
|
@ -557,24 +568,24 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
desktopPane = new MageJDesktop();
|
||||
mageToolbar = new javax.swing.JToolBar();
|
||||
btnConnect = new javax.swing.JButton();
|
||||
jSeparator5 = new javax.swing.JToolBar.Separator();
|
||||
btnGames = new javax.swing.JButton();
|
||||
jSeparator4 = new javax.swing.JToolBar.Separator();
|
||||
btnDeckEditor = new javax.swing.JButton();
|
||||
btnGames = new javax.swing.JButton();
|
||||
jSeparator3 = new javax.swing.JToolBar.Separator();
|
||||
btnPreferences = new javax.swing.JButton();
|
||||
btnDeckEditor = new javax.swing.JButton();
|
||||
jSeparator2 = new javax.swing.JToolBar.Separator();
|
||||
btnCollectionViewer = new javax.swing.JButton();
|
||||
jSeparator5 = new javax.swing.JToolBar.Separator();
|
||||
btnPreferences = new javax.swing.JButton();
|
||||
jSeparator6 = new javax.swing.JToolBar.Separator();
|
||||
btnAbout = new javax.swing.JButton();
|
||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||
btnExit = new javax.swing.JButton();
|
||||
lblStatus = new javax.swing.JLabel();
|
||||
jSeparator6 = new javax.swing.JToolBar.Separator();
|
||||
btnCollectionViewer = new JButton();
|
||||
jSeparator7 = new javax.swing.JToolBar.Separator();
|
||||
btnChallenges = new JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
//setMinimumSize(new java.awt.Dimension(1024, 768));
|
||||
setMinimumSize(new java.awt.Dimension(1024, 768));
|
||||
|
||||
desktopPane.setBackground(new java.awt.Color(204, 204, 204));
|
||||
|
||||
mageToolbar.setFloatable(false);
|
||||
mageToolbar.setRollover(true);
|
||||
|
@ -592,7 +603,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(btnConnect);
|
||||
mageToolbar.add(jSeparator4);
|
||||
|
||||
btnGames.setText("Tables");
|
||||
btnGames.setText("Games");
|
||||
btnGames.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
btnGames.setFocusable(false);
|
||||
btnGames.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
|
@ -619,7 +630,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
mageToolbar.add(jSeparator2);
|
||||
|
||||
btnCollectionViewer.setText("Collection Viewer");
|
||||
btnCollectionViewer.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
btnCollectionViewer.setFocusable(false);
|
||||
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
|
@ -629,23 +639,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
});
|
||||
mageToolbar.add(btnCollectionViewer);
|
||||
mageToolbar.add(jSeparator6);
|
||||
|
||||
/*btnChallenges.setText("Challenges");
|
||||
btnChallenges.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
btnChallenges.setFocusable(false);
|
||||
btnChallenges.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnChallenges.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnChallenges.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnChallengesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnChallenges);
|
||||
mageToolbar.add(jSeparator7);*/
|
||||
mageToolbar.add(jSeparator5);
|
||||
|
||||
btnPreferences.setText("Preferences");
|
||||
btnPreferences.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
btnPreferences.setFocusable(false);
|
||||
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
|
@ -655,7 +651,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
});
|
||||
mageToolbar.add(btnPreferences);
|
||||
mageToolbar.add(jSeparator5);
|
||||
mageToolbar.add(jSeparator6);
|
||||
|
||||
btnAbout.setText("About");
|
||||
btnAbout.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
@ -689,16 +685,16 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1144, Short.MAX_VALUE)
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, 1144, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1144, Short.MAX_VALUE)
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, 1144, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 880, Short.MAX_VALUE))
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 880, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
@ -708,10 +704,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
showDeckEditor(DeckEditorMode.Constructed, null, null, 0);
|
||||
}//GEN-LAST:event_btnDeckEditorActionPerformed
|
||||
|
||||
private void btnCollectionViewerActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
showCollectionViewer();
|
||||
}
|
||||
|
||||
private void btnChallengesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
TableView table;
|
||||
try {
|
||||
|
@ -737,10 +729,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
private void btnPreferencesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
PhasesDialog.main(new String[]{});
|
||||
}
|
||||
|
||||
private void btnGamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGamesActionPerformed
|
||||
this.tablesPane.setVisible(true);
|
||||
this.tablesPane.showTables();
|
||||
|
@ -768,6 +756,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
aboutDialog.showDialog(version);
|
||||
}//GEN-LAST:event_btnAboutActionPerformed
|
||||
|
||||
private void btnCollectionViewerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCollectionViewerActionPerformed
|
||||
showCollectionViewer();
|
||||
}//GEN-LAST:event_btnCollectionViewerActionPerformed
|
||||
|
||||
private void btnPreferencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPreferencesActionPerformed
|
||||
PhasesDialog.main(new String[]{});
|
||||
}//GEN-LAST:event_btnPreferencesActionPerformed
|
||||
|
||||
public void exitApp() {
|
||||
session.disconnect(false);
|
||||
Plugins.getInstance().shutdown();
|
||||
|
@ -832,7 +828,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
public static void main(final String args[]) {
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
|
@ -841,13 +837,20 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
});
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
final SplashScreen splash = SplashScreen.getSplashScreen();
|
||||
if (splash != null) {
|
||||
Graphics2D g = splash.createGraphics();
|
||||
if (g != null) {
|
||||
renderSplashFrame(g);
|
||||
for (String arg: args) {
|
||||
if (arg.startsWith(liteModeArg)) {
|
||||
liteMode = true;
|
||||
}
|
||||
}
|
||||
if (!liteMode) {
|
||||
final SplashScreen splash = SplashScreen.getSplashScreen();
|
||||
if (splash != null) {
|
||||
Graphics2D g = splash.createGraphics();
|
||||
if (g != null) {
|
||||
renderSplashFrame(g);
|
||||
}
|
||||
splash.update();
|
||||
}
|
||||
splash.update();
|
||||
}
|
||||
new MageFrame().setVisible(true);
|
||||
}
|
||||
|
@ -856,21 +859,19 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnAbout;
|
||||
private javax.swing.JButton btnCollectionViewer;
|
||||
private javax.swing.JButton btnConnect;
|
||||
private javax.swing.JButton btnDeckEditor;
|
||||
private javax.swing.JButton btnCollectionViewer;
|
||||
private javax.swing.JButton btnChallenges;
|
||||
private javax.swing.JButton btnPreferences;
|
||||
private javax.swing.JButton btnExit;
|
||||
private javax.swing.JButton btnGames;
|
||||
private static MageJDesktop desktopPane;
|
||||
private javax.swing.JButton btnPreferences;
|
||||
private static javax.swing.JDesktopPane desktopPane;
|
||||
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.JLabel lblStatus;
|
||||
private javax.swing.JToolBar mageToolbar;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
@ -50,6 +50,9 @@ import java.awt.image.BufferedImage;
|
|||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import org.jdesktop.swingx.JXPanel;
|
||||
|
||||
/**
|
||||
* Table Model for card list.
|
||||
|
@ -244,15 +247,28 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
private void showImage(int row) {
|
||||
CardView card = view.get(row);
|
||||
if (!card.getId().equals(bigCard.getCardId())) {
|
||||
Image image = Plugins.getInstance().getOriginalImage(card);
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth());
|
||||
bigCard.setCard(card.getId(), image, new ArrayList<String>(), false);
|
||||
if (!MageFrame.isLite()) {
|
||||
Image image = Plugins.getInstance().getOriginalImage(card);
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth());
|
||||
bigCard.setCard(card.getId(), image, new ArrayList<String>(), false);
|
||||
} else {
|
||||
drawCardText(card);
|
||||
}
|
||||
} else {
|
||||
drawCardText(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawCardText(CardView card) {
|
||||
JXPanel panel = GuiDisplayUtil.getDescription(card, bigCard.getWidth(), bigCard.getHeight());
|
||||
panel.setVisible(true);
|
||||
bigCard.hideTextComponent();
|
||||
bigCard.addJXPanel(card.getId(), panel);
|
||||
}
|
||||
|
||||
public List<CardView> getCardsView() {
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import javax.swing.JComponent;
|
|||
import mage.cards.MageCard;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.impl.EmptyCallback;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Card;
|
||||
import mage.client.cards.Permanent;
|
||||
|
@ -67,13 +68,13 @@ public class Plugins implements MagePlugins {
|
|||
|
||||
@Override
|
||||
public void updateGamePanel(Map<String, JComponent> ui) {
|
||||
if (themePlugin == null) return;
|
||||
if (MageFrame.isLite() || themePlugin == null) return;
|
||||
themePlugin.applyInGame(ui);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent updateTablePanel(Map<String, JComponent> ui) {
|
||||
if (themePlugin == null) return null;
|
||||
if (MageFrame.isLite() || themePlugin == null) return null;
|
||||
return themePlugin.updateTable(ui);
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class Plugins implements MagePlugins {
|
|||
if (cardPlugin != null) {
|
||||
mageActionCallback.refreshSession();
|
||||
mageActionCallback.setCardPreviewComponent(bigCard);
|
||||
return cardPlugin.getMagePermanent(card, dimension, gameId, mageActionCallback, canBeFoil);
|
||||
return cardPlugin.getMagePermanent(card, dimension, gameId, mageActionCallback, canBeFoil, !MageFrame.isLite());
|
||||
} else {
|
||||
return new Permanent(card, bigCard, Config.dimensions, gameId);
|
||||
}
|
||||
|
@ -93,7 +94,7 @@ public class Plugins implements MagePlugins {
|
|||
if (cardPlugin != null) {
|
||||
mageActionCallback.refreshSession();
|
||||
mageActionCallback.setCardPreviewComponent(bigCard);
|
||||
return cardPlugin.getMageCard(card, dimension, gameId, mageActionCallback, canBeFoil);
|
||||
return cardPlugin.getMageCard(card, dimension, gameId, mageActionCallback, canBeFoil, !MageFrame.isLite());
|
||||
} else {
|
||||
return new Card(card, bigCard, Config.dimensions, gameId);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ import javax.swing.table.AbstractTableModel;
|
|||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
@ -97,10 +99,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
int modelRow = Integer.valueOf( e.getActionCommand() );
|
||||
UUID tableId = (UUID)tableModel.getValueAt(modelRow, 8);
|
||||
UUID gameId = (UUID)tableModel.getValueAt(modelRow, 7);
|
||||
UUID tableId = (UUID)tableModel.getValueAt(modelRow, 9);
|
||||
UUID gameId = (UUID)tableModel.getValueAt(modelRow, 8);
|
||||
String state = (String)tableModel.getValueAt(modelRow, 5);
|
||||
boolean isTournament = (Boolean)tableModel.getValueAt(modelRow, 6);
|
||||
boolean isTournament = (Boolean)tableModel.getValueAt(modelRow, 7);
|
||||
String owner = (String)tableModel.getValueAt(modelRow, 1);
|
||||
|
||||
if (state.equals("Join")) {
|
||||
|
@ -148,7 +150,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
};
|
||||
|
||||
ButtonColumn buttonColumn = new ButtonColumn(tableTables, join, 5);
|
||||
ButtonColumn buttonColumn = new ButtonColumn(tableTables, join, 6);
|
||||
|
||||
jSplitPane1.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
|
@ -394,9 +396,9 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
class TableTableModel extends AbstractTableModel {
|
||||
private String[] columnNames = new String[]{"Table Name", "Owner", "Game Type", "Deck Type", "Status", "Action"};
|
||||
private String[] columnNames = new String[]{"Match Name", "Owner", "Game Type", "Deck Type", "Status", "Created", "Action"};
|
||||
private TableView[] tables = new TableView[0];
|
||||
|
||||
private static final DateFormat timeFormatter = SimpleDateFormat.getTimeInstance(SimpleDateFormat.SHORT);
|
||||
|
||||
public void loadData(Collection<TableView> tables) throws MageRemoteException {
|
||||
this.tables = tables.toArray(new TableView[0]);
|
||||
|
@ -427,6 +429,8 @@ class TableTableModel extends AbstractTableModel {
|
|||
case 4:
|
||||
return tables[arg0].getTableState().toString();
|
||||
case 5:
|
||||
return timeFormatter.format(tables[arg0].getCreateTime());
|
||||
case 6:
|
||||
switch (tables[arg0].getTableState()) {
|
||||
case WAITING:
|
||||
return "Join";
|
||||
|
@ -437,13 +441,13 @@ class TableTableModel extends AbstractTableModel {
|
|||
default:
|
||||
return "";
|
||||
}
|
||||
case 6:
|
||||
return tables[arg0].isTournament();
|
||||
case 7:
|
||||
return tables[arg0].isTournament();
|
||||
case 8:
|
||||
if (!tables[arg0].getGames().isEmpty())
|
||||
return tables[arg0].getGames().get(0);
|
||||
return null;
|
||||
case 8:
|
||||
case 9:
|
||||
return tables[arg0].getTableId();
|
||||
}
|
||||
return "";
|
||||
|
@ -466,7 +470,7 @@ class TableTableModel extends AbstractTableModel {
|
|||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
if (columnIndex != 5)
|
||||
if (columnIndex != 6)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import net.xeoh.plugins.base.Plugin;
|
|||
* @author nantuko
|
||||
*/
|
||||
public interface CardPlugin extends Plugin {
|
||||
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil);
|
||||
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil);
|
||||
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
||||
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
||||
void sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> cards);
|
||||
void downloadImages(Set<Card> allCards);
|
||||
void downloadSymbols();
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.view;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.TableState;
|
||||
|
@ -49,6 +50,7 @@ public class TableView implements Serializable {
|
|||
private String deckType;
|
||||
private String tableName;
|
||||
private String controllerName;
|
||||
private Date createTime;
|
||||
private TableState tableState;
|
||||
private boolean isTournament;
|
||||
private List<SeatView> seats = new ArrayList<SeatView>();
|
||||
|
@ -59,6 +61,7 @@ public class TableView implements Serializable {
|
|||
this.gameType = table.getGameType();
|
||||
this.tableName = table.getName();
|
||||
this.controllerName = table.getControllerName();
|
||||
this.createTime = table.getCreateTime();
|
||||
this.deckType = table.getDeckType();
|
||||
this.tableState = table.getState();
|
||||
this.isTournament = table.isTournament();
|
||||
|
@ -91,6 +94,10 @@ public class TableView implements Serializable {
|
|||
public String getDeckType() {
|
||||
return deckType;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public TableState getTableState() {
|
||||
return tableState;
|
||||
|
|
|
@ -592,7 +592,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
@Override
|
||||
public Image getImage() {
|
||||
return ImageCache.getImageOriginal(gameCard);
|
||||
if (this.hasImage)
|
||||
return ImageCache.getImageOriginal(gameCard);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -79,9 +79,9 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil) {
|
||||
public MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
|
||||
boolean foil = canBeFoil && (new Random()).nextInt(5) == 0;
|
||||
CardPanel cardPanel = new CardPanel(permanent, gameId, true, callback, foil);
|
||||
CardPanel cardPanel = new CardPanel(permanent, gameId, loadImage, callback, foil);
|
||||
cardPanel.setCardBounds(0, 0, dimension.width, dimension.height);
|
||||
boolean implemented = !permanent.getRarity().equals(mage.Constants.Rarity.NA);
|
||||
cardPanel.setShowCastingCost(implemented);
|
||||
|
@ -89,9 +89,9 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil) {
|
||||
public MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
|
||||
boolean foil = canBeFoil && (new Random()).nextInt(5) == 0;
|
||||
CardPanel cardPanel = new CardPanel(permanent, gameId, true, callback, foil);
|
||||
CardPanel cardPanel = new CardPanel(permanent, gameId, loadImage, callback, foil);
|
||||
cardPanel.setCardBounds(0, 0, dimension.width, dimension.height);
|
||||
boolean implemented = !permanent.getRarity().equals(mage.Constants.Rarity.NA);
|
||||
cardPanel.setShowCastingCost(implemented);
|
||||
|
|
|
@ -52,11 +52,11 @@ public class RateThread extends Thread {
|
|||
Card card1 = getRandomUniqueNonLandCard(null);
|
||||
Card card2 = getRandomUniqueNonLandCard(card1);
|
||||
|
||||
mageCard1 = impl.getMageCard(new CardView(card1), cardDimension, UUID.randomUUID(), new RateCallback(card1, card2, this, bigCard), false);
|
||||
mageCard1 = impl.getMageCard(new CardView(card1), cardDimension, UUID.randomUUID(), new RateCallback(card1, card2, this, bigCard), false, true);
|
||||
mageCard1.setCardBounds(bigCardDimension.frameWidth + 80, 10, dimensions.frameWidth, dimensions.frameHeight);
|
||||
frame.add(mageCard1);
|
||||
|
||||
mageCard2 = impl.getMageCard(new CardView(card2), cardDimension, UUID.randomUUID(), new RateCallback(card2, card1, this, bigCard), false);
|
||||
mageCard2 = impl.getMageCard(new CardView(card2), cardDimension, UUID.randomUUID(), new RateCallback(card2, card1, this, bigCard), false, true);
|
||||
mageCard2.setCardBounds(bigCardDimension.frameWidth + 80 + dimensions.frameWidth + 30, 10, dimensions.frameWidth, dimensions.frameHeight);
|
||||
frame.add(mageCard2);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
package mage.game;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.TableState;
|
||||
|
@ -51,6 +52,7 @@ public class Table implements Serializable {
|
|||
private String name;
|
||||
private String controllerName;
|
||||
private String gameType;
|
||||
private Date createTime;
|
||||
private Seat[] seats;
|
||||
private int numSeats;
|
||||
private boolean isTournament;
|
||||
|
@ -80,6 +82,7 @@ public class Table implements Serializable {
|
|||
this.gameType = gameType;
|
||||
this.name = name;
|
||||
this.controllerName = controllerName;
|
||||
this.createTime = new Date();
|
||||
createSeats(playerTypes);
|
||||
this.validator = validator;
|
||||
}
|
||||
|
@ -129,6 +132,10 @@ public class Table implements Serializable {
|
|||
return validator.getName();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public boolean isTournament() {
|
||||
return this.isTournament;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue