added timeout on sideboard + show construct and/or sideboard on reconnect

This commit is contained in:
BetaSteward 2011-09-03 21:44:05 -04:00
parent a4ed12b47b
commit ea44fc973f
18 changed files with 161 additions and 53 deletions

View file

@ -848,12 +848,30 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
}
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
String name;
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited)
name = "Deck Editor - " + tableId.toString();
else {
if (deck != null)
name = "Deck Editor - " + deck.getName();
else
name = "Deck Editor";
}
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
for (JInternalFrame window : windows) {
if (window instanceof DeckEditorPane) {
if (window.getTitle().equals(name)) {
setActive((MagePane)window);
return;
}
}
}
try {
DeckEditorPane deckEditorPane = new DeckEditorPane();
desktopPane.add(deckEditorPane, JLayeredPane.DEFAULT_LAYER);
deckEditorPane.setMaximum(true);
deckEditorPane.setVisible(true);
deckEditorPane.show(mode, deck, tableId, time);
deckEditorPane.show(mode, deck, name, tableId, time);
setActive(deckEditorPane);
} catch (PropertyVetoException ex) {
logger.fatal(null, ex);

View file

@ -73,11 +73,15 @@ public class DeckEditorPane extends MagePane {
}
}
public void show(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
if (deck != null)
this.setTitle("Deck Editor - " + deck.getName());
else
this.setTitle("Deck Editor");
public void show(DeckEditorMode mode, Deck deck, String name, UUID tableId, int time) {
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited)
this.setTitle("Deck Editor - " + tableId.toString());
else {
if (deck != null)
this.setTitle("Deck Editor - " + deck.getName());
else
this.setTitle("Deck Editor");
}
this.deckEditorPanel1.showDeckEditor(mode, deck, tableId, time);
this.repaint();
}

View file

@ -102,6 +102,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
else {
setTimeout("0");
countdown.stop();
hideDeckEditor();
}
}
}