forked from External/mage
Merge branch 'master' into migrate-google-collections-to-guava
This commit is contained in:
commit
f76efb2b65
483 changed files with 2270 additions and 1997 deletions
|
|
@ -6,6 +6,7 @@ import java.awt.event.KeyEvent;
|
|||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -35,18 +36,12 @@ import org.mage.card.arcane.CardRenderer;
|
|||
*/
|
||||
public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarget {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(DragCardGrid.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(DragCardGrid.class);
|
||||
private Constants.DeckEditorMode mode;
|
||||
|
||||
@Override
|
||||
public Collection<CardView> dragCardList() {
|
||||
ArrayList<CardView> selectedCards = new ArrayList<>();
|
||||
for (CardView card : allCards) {
|
||||
if (card.isSelected()) {
|
||||
selectedCards.add(card);
|
||||
}
|
||||
}
|
||||
return selectedCards;
|
||||
return allCards.stream().filter(CardView::isSelected).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -62,8 +57,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// Don't remove the cards, no target
|
||||
} else {
|
||||
// Remove dragged cards
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (int i = 0; i < stack.size(); ++i) {
|
||||
CardView card = stack.get(i);
|
||||
if (card.isSelected()) {
|
||||
|
|
@ -160,7 +155,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
}
|
||||
|
||||
// Get the appropirate stack
|
||||
ArrayList<CardView> stack;
|
||||
List<CardView> stack;
|
||||
if (rowIndex < cardGrid.size() && col < cardGrid.get(0).size()) {
|
||||
stack = cardGrid.get(rowIndex).get(col);
|
||||
} else {
|
||||
|
|
@ -200,8 +195,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// If we're dragging onto ourself, erase the old cards (just null them out, we will
|
||||
// compact the grid removing the null gaps / empty rows & cols later)
|
||||
if (source == this) {
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (int i = 0; i < stack.size(); ++i) {
|
||||
if (cards.contains(stack.get(i))) {
|
||||
stack.set(i, null);
|
||||
|
|
@ -241,7 +236,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
// Add a new row if needed
|
||||
if (rowIndex >= cardGrid.size()) {
|
||||
ArrayList<ArrayList<CardView>> newRow = new ArrayList<>();
|
||||
List<List<CardView>> newRow = new ArrayList<>();
|
||||
if (!cardGrid.isEmpty()) {
|
||||
for (int colIndex = 0; colIndex < cardGrid.get(0).size(); ++colIndex) {
|
||||
newRow.add(new ArrayList<>());
|
||||
|
|
@ -286,7 +281,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
// Add a new row if needed
|
||||
if (rowIndex >= cardGrid.size()) {
|
||||
ArrayList<ArrayList<CardView>> newRow = new ArrayList<>();
|
||||
List<List<CardView>> newRow = new ArrayList<>();
|
||||
if (!cardGrid.isEmpty()) {
|
||||
for (int colIndex = 0; colIndex < cardGrid.get(0).size(); ++colIndex) {
|
||||
newRow.add(new ArrayList<>());
|
||||
|
|
@ -304,7 +299,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
}
|
||||
|
||||
// Get the appropirate stack
|
||||
ArrayList<CardView> stack = cardGrid.get(rowIndex).get(col);
|
||||
List<CardView> stack = cardGrid.get(rowIndex).get(col);
|
||||
|
||||
// Figure out position in the stack based on the offsetIntoRow
|
||||
int stackInsertIndex = (offsetIntoStack + cardTopHeight / 2) / cardTopHeight;
|
||||
|
|
@ -375,8 +370,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
}
|
||||
|
||||
public void removeSelection() {
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (int i = 0; i < stack.size(); ++i) {
|
||||
CardView card = stack.get(i);
|
||||
if (card.isSelected()) {
|
||||
|
|
@ -394,11 +389,11 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
public DeckCardLayout getCardLayout() {
|
||||
// 2D Array to put entries into
|
||||
java.util.List<java.util.List<java.util.List<DeckCardInfo>>> info = new ArrayList<>();
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
java.util.List<java.util.List<DeckCardInfo>> row = new ArrayList<>();
|
||||
List<List<List<DeckCardInfo>>> info = new ArrayList<>();
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
List<List<DeckCardInfo>> row = new ArrayList<>();
|
||||
info.add(row);
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
row.add(stack.stream()
|
||||
.map(card -> new DeckCardInfo(card.getName(), card.getCardNumber(), card.getExpansionSetCode()))
|
||||
.collect(Collectors.toList()));
|
||||
|
|
@ -544,12 +539,12 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
public static final int COUNT_LABEL_HEIGHT = 20;
|
||||
public static final int GRID_PADDING = 10;
|
||||
|
||||
private final static ImageIcon INSERT_ROW_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_row.png"));
|
||||
private final static ImageIcon INSERT_COL_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_col.png"));
|
||||
private static final ImageIcon INSERT_ROW_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_row.png"));
|
||||
private static final ImageIcon INSERT_COL_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_col.png"));
|
||||
|
||||
// All of the current card views
|
||||
private final Map<UUID, MageCard> cardViews = new LinkedHashMap<>();
|
||||
private final ArrayList<CardView> allCards = new ArrayList<>();
|
||||
private final List<CardView> allCards = new ArrayList<>();
|
||||
|
||||
// Card listeners
|
||||
private final CardEventSource eventSource = new CardEventSource();
|
||||
|
|
@ -578,8 +573,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
final JSlider cardSizeSlider;
|
||||
final JLabel cardSizeSliderLabel;
|
||||
|
||||
final Map<Sort, AbstractButton> sortButtons = new HashMap<>();
|
||||
final HashMap<CardType, AbstractButton> selectByTypeButtons = new HashMap<>();
|
||||
final Map<Sort, AbstractButton> sortButtons = new EnumMap<>(Sort.class);
|
||||
final Map<CardType, AbstractButton> selectByTypeButtons = new EnumMap<>(CardType.class);
|
||||
|
||||
final JLabel deckNameAndCountLabel;
|
||||
final JLabel landCountLabel;
|
||||
|
|
@ -611,11 +606,11 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// The outermost array contains multiple rows of stacks of cards
|
||||
// The next inner array represents a row of stacks of cards
|
||||
// The innermost array represents a single vertical stack of cards
|
||||
private ArrayList<ArrayList<ArrayList<CardView>>> cardGrid;
|
||||
private ArrayList<Integer> maxStackSize = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<JLabel>> stackCountLabels = new ArrayList<>();
|
||||
private List<List<List<CardView>>> cardGrid;
|
||||
private List<Integer> maxStackSize = new ArrayList<>();
|
||||
private final List<List<JLabel>> stackCountLabels = new ArrayList<>();
|
||||
private Sort cardSort = Sort.CMC;
|
||||
private final ArrayList<CardType> selectByTypeSelected = new ArrayList<>();
|
||||
private final List<CardType> selectByTypeSelected = new ArrayList<>();
|
||||
private boolean separateCreatures = true;
|
||||
|
||||
public enum Role {
|
||||
|
|
@ -639,7 +634,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
public boolean separateCreatures;
|
||||
public int cardSize;
|
||||
|
||||
private final static Pattern parser = Pattern.compile("\\(([^,]*),([^,]*),([^)]*)\\)");
|
||||
private static final Pattern parser = Pattern.compile("\\(([^,]*),([^,]*),([^)]*)\\)");
|
||||
|
||||
public static Settings parse(String str) {
|
||||
Matcher m = parser.matcher(str);
|
||||
|
|
@ -810,7 +805,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
insertArrow = new JLabel();
|
||||
insertArrow.setSize(20, 20);
|
||||
insertArrow.setVisible(false);
|
||||
cardContent.add(insertArrow, new Integer(1000));
|
||||
cardContent.add(insertArrow, 1000);
|
||||
|
||||
// Selection panel
|
||||
selectionPanel = new SelectionBox();
|
||||
|
|
@ -917,7 +912,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
ButtonGroup selectByTypeModeGroup = new ButtonGroup();
|
||||
for (final CardType cardType : CardType.values()) {
|
||||
|
||||
if (cardType == cardType.CONSPIRACY) {
|
||||
if (cardType == CardType.CONSPIRACY) {
|
||||
multiplesButton = new JToggleButton("Multiples");
|
||||
selectByTypeButtons.put(cardType, multiplesButton);
|
||||
selectByTypeMode.add(multiplesButton);
|
||||
|
|
@ -1045,8 +1040,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
* Deselect all cards in this DragCardGrid
|
||||
*/
|
||||
public void deselectAll() {
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
if (card.isSelected()) {
|
||||
card.setSelected(false);
|
||||
|
|
@ -1166,9 +1161,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
} else {
|
||||
stackEndIndex = (y2 - curY) / cardTopHeight;
|
||||
}
|
||||
ArrayList<ArrayList<CardView>> gridRow = cardGrid.get(rowIndex);
|
||||
List<List<CardView>> gridRow = cardGrid.get(rowIndex);
|
||||
for (int col = 0; col < gridRow.size(); ++col) {
|
||||
ArrayList<CardView> stack = gridRow.get(col);
|
||||
List<CardView> stack = gridRow.get(col);
|
||||
int stackBottomBegin = curY + cardTopHeight * (stack.size());
|
||||
int stackBottomEnd = curY + cardTopHeight * (stack.size() - 1) + cardHeight;
|
||||
for (int i = 0; i < stack.size(); ++i) {
|
||||
|
|
@ -1201,8 +1196,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// Resort the existing cards based on the current sort
|
||||
public void resort() {
|
||||
// First null out the grid and trim it down
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
stack.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -1243,8 +1238,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (cardType == CardType.CONSPIRACY) {
|
||||
HashMap<String, CardView> cardNames = new HashMap<>();
|
||||
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
if (cardNames.get(card.getName()) == null) {
|
||||
cardNames.put(card.getName(), card);
|
||||
|
|
@ -1262,10 +1257,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
continue;
|
||||
}
|
||||
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
boolean s = card.isSelected() | card.getCardTypes().contains(cardType);
|
||||
boolean s = card.isSelected() || card.getCardTypes().contains(cardType);
|
||||
card.setSelected(s);
|
||||
cardViews.get(card.getId()).update(card);
|
||||
}
|
||||
|
|
@ -1276,13 +1271,13 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
}
|
||||
|
||||
if (useText) {
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
boolean s = card.isSelected();
|
||||
// Name
|
||||
if (!s) {
|
||||
s |= card.getName().toLowerCase(Locale.ENGLISH).contains(searchStr);
|
||||
s = card.getName().toLowerCase(Locale.ENGLISH).contains(searchStr);
|
||||
}
|
||||
// Sub & Super Types
|
||||
if (!s) {
|
||||
|
|
@ -1354,21 +1349,13 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
qtys.put("wastes", 0);
|
||||
manaCounts = new HashMap<>();
|
||||
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
// Type line
|
||||
String t = "";
|
||||
for (CardType type : card.getCardTypes()) {
|
||||
t += ' ' + type.toString();
|
||||
}
|
||||
// Sub & Super Types
|
||||
for (SuperType type : card.getSuperTypes()) {
|
||||
t += ' ' + type.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
for (SubType str : card.getSubTypes()) {
|
||||
t += " " + str.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
String t = card.getCardTypes().stream().map(CardType::toString).collect(Collectors.joining(" "));
|
||||
t += card.getSuperTypes().stream().map(st -> st.toString().toLowerCase(Locale.ENGLISH)).collect(Collectors.joining(" "));
|
||||
t += card.getSubTypes().stream().map(st -> st.toString().toLowerCase(Locale.ENGLISH)).collect(Collectors.joining(" "));
|
||||
|
||||
for (String qty : qtys.keySet()) {
|
||||
int value = qtys.get(qty);
|
||||
|
|
@ -1494,7 +1481,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
}
|
||||
|
||||
public void blingDeck() {
|
||||
if (!(this.mode == Constants.DeckEditorMode.FREE_BUILDING)) {
|
||||
if (this.mode != Constants.DeckEditorMode.FREE_BUILDING) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1503,8 +1490,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
return;
|
||||
}
|
||||
|
||||
HashMap<String, Integer> pimpedSets = new HashMap<>();
|
||||
HashMap<CardView, Integer> pimpedCards = new HashMap<>();
|
||||
Map<String, Integer> pimpedSets = new HashMap<>();
|
||||
Map<CardView, Integer> pimpedCards = new HashMap<>();
|
||||
pimpedSets.put("CP", 1);
|
||||
pimpedSets.put("JR", 1);
|
||||
pimpedSets.put("MPS", 1);
|
||||
|
|
@ -1529,8 +1516,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
String[] sets = pimpedSets.keySet().toArray(new String[pimpedSets.keySet().size()]);
|
||||
Boolean didModify = false;
|
||||
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
if (card.getSuperTypes().contains(SuperType.BASIC)) {
|
||||
continue;
|
||||
|
|
@ -1580,9 +1567,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// Remove all of the cards not in the cardsView
|
||||
boolean didModify = false; // Until contested
|
||||
for (int i = 0; i < cardGrid.size(); ++i) {
|
||||
ArrayList<ArrayList<CardView>> gridRow = cardGrid.get(i);
|
||||
List<List<CardView>> gridRow = cardGrid.get(i);
|
||||
for (int j = 0; j < gridRow.size(); ++j) {
|
||||
ArrayList<CardView> stack = gridRow.get(j);
|
||||
List<CardView> stack = gridRow.get(j);
|
||||
for (int k = 0; k < stack.size(); ++k) {
|
||||
CardView card = stack.get(k);
|
||||
if (!cardsView.containsKey(card.getId())) {
|
||||
|
|
@ -1626,21 +1613,21 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
loadSettings(Settings.parse(layout.getSettings()));
|
||||
|
||||
// Traverse the cards once and track them so we can pick ones to insert into the grid
|
||||
Map<String, Map<String, ArrayList<CardView>>> trackedCards = new HashMap<>();
|
||||
Map<String, Map<String, List<CardView>>> trackedCards = new HashMap<>();
|
||||
for (CardView newCard : cardsView.values()) {
|
||||
if (!cardViews.containsKey(newCard.getId())) {
|
||||
// Add the new card
|
||||
addCardView(newCard, false);
|
||||
|
||||
// Add the new card to tracking
|
||||
Map<String, ArrayList<CardView>> forSetCode;
|
||||
Map<String, List<CardView>> forSetCode;
|
||||
if (trackedCards.containsKey(newCard.getExpansionSetCode())) {
|
||||
forSetCode = trackedCards.get(newCard.getExpansionSetCode());
|
||||
} else {
|
||||
forSetCode = new HashMap<>();
|
||||
trackedCards.put(newCard.getExpansionSetCode(), forSetCode);
|
||||
}
|
||||
ArrayList<CardView> list;
|
||||
List<CardView> list;
|
||||
if (forSetCode.containsKey(newCard.getCardNumber())) {
|
||||
list = forSetCode.get(newCard.getCardNumber());
|
||||
} else {
|
||||
|
|
@ -1654,16 +1641,16 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// Now go through the layout and use it to build the cardGrid
|
||||
cardGrid = new ArrayList<>();
|
||||
maxStackSize = new ArrayList<>();
|
||||
for (java.util.List<java.util.List<DeckCardInfo>> row : layout.getCards()) {
|
||||
ArrayList<ArrayList<CardView>> gridRow = new ArrayList<>();
|
||||
for (List<List<DeckCardInfo>> row : layout.getCards()) {
|
||||
List<List<CardView>> gridRow = new ArrayList<>();
|
||||
int thisMaxStackSize = 0;
|
||||
cardGrid.add(gridRow);
|
||||
for (java.util.List<DeckCardInfo> stack : row) {
|
||||
for (List<DeckCardInfo> stack : row) {
|
||||
ArrayList<CardView> gridStack = new ArrayList<>();
|
||||
gridRow.add(gridStack);
|
||||
for (DeckCardInfo info : stack) {
|
||||
if (trackedCards.containsKey(info.getSetCode()) && trackedCards.get(info.getSetCode()).containsKey(info.getCardNum())) {
|
||||
ArrayList<CardView> candidates
|
||||
List<CardView> candidates
|
||||
= trackedCards.get(info.getSetCode()).get(info.getCardNum());
|
||||
if (!candidates.isEmpty()) {
|
||||
gridStack.add(candidates.remove(0));
|
||||
|
|
@ -1678,8 +1665,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// Check that there aren't any "orphans" not referenced in the layout. There should
|
||||
// never be any under normal operation, but as a failsafe in case the user screwed with
|
||||
// the file in an invalid way, sort them into the grid so that they aren't just left hanging.
|
||||
for (Map<String, ArrayList<CardView>> tracked : trackedCards.values()) {
|
||||
for (ArrayList<CardView> orphans : tracked.values()) {
|
||||
for (Map<String, List<CardView>> tracked : trackedCards.values()) {
|
||||
for (List<CardView> orphans : tracked.values()) {
|
||||
for (CardView orphan : orphans) {
|
||||
LOGGER.info("Orphan when setting with layout: ");
|
||||
sortIntoGrid(orphan);
|
||||
|
|
@ -1733,7 +1720,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
AbstractButton button = selectByTypeButtons.get(cardType);
|
||||
String text = cardType.toString();
|
||||
int numCards = getCount(cardType);
|
||||
if (cardType == cardType.CONSPIRACY) {
|
||||
if (cardType == CardType.CONSPIRACY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1908,7 +1895,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
maxStackSize.add(0, 0);
|
||||
}
|
||||
// What row to add it to?
|
||||
ArrayList<ArrayList<CardView>> targetRow;
|
||||
List<List<CardView>> targetRow;
|
||||
if (separateCreatures && !newCard.isCreature()) {
|
||||
// Ensure row 2 exists
|
||||
if (cardGrid.size() < 2) {
|
||||
|
|
@ -1929,7 +1916,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
for (int currentColumn = 0; currentColumn < cardGrid.get(0).size(); ++currentColumn) {
|
||||
// Find an item from this column
|
||||
CardView cardInColumn = null;
|
||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (CardView card : gridRow.get(currentColumn)) {
|
||||
cardInColumn = card;
|
||||
break;
|
||||
|
|
@ -1974,9 +1961,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
private void trimGrid() {
|
||||
// Compact stacks and rows
|
||||
for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) {
|
||||
ArrayList<ArrayList<CardView>> gridRow = cardGrid.get(rowIndex);
|
||||
List<List<CardView>> gridRow = cardGrid.get(rowIndex);
|
||||
int rowMaxStackSize = 0;
|
||||
for (ArrayList<CardView> stack : gridRow) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
// Clear out nulls in the stack
|
||||
for (int i = 0; i < stack.size(); ++i) {
|
||||
if (stack.get(i) == null) {
|
||||
|
|
@ -2000,15 +1987,15 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (!cardGrid.isEmpty()) {
|
||||
for (int colIndex = 0; colIndex < cardGrid.get(0).size(); ++colIndex) {
|
||||
boolean hasContent = false; // Until contested
|
||||
for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) {
|
||||
if (!cardGrid.get(rowIndex).get(colIndex).isEmpty()) {
|
||||
for (List<List<CardView>> aCardGrid : cardGrid) {
|
||||
if (!aCardGrid.get(colIndex).isEmpty()) {
|
||||
hasContent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasContent) {
|
||||
for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) {
|
||||
cardGrid.get(rowIndex).remove(colIndex);
|
||||
for (List<List<CardView>> aCardGrid : cardGrid) {
|
||||
aCardGrid.remove(colIndex);
|
||||
}
|
||||
--colIndex;
|
||||
}
|
||||
|
|
@ -2017,13 +2004,13 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
// Clean up extra column header count labels
|
||||
while (stackCountLabels.size() > cardGrid.size()) {
|
||||
ArrayList<JLabel> labels = stackCountLabels.remove(cardGrid.size());
|
||||
List<JLabel> labels = stackCountLabels.remove(cardGrid.size());
|
||||
for (JLabel label : labels) {
|
||||
cardContent.remove(label);
|
||||
}
|
||||
}
|
||||
int colCount = cardGrid.isEmpty() ? 0 : cardGrid.get(0).size();
|
||||
for (ArrayList<JLabel> labels : stackCountLabels) {
|
||||
for (List<JLabel> labels : stackCountLabels) {
|
||||
while (labels.size() > colCount) {
|
||||
cardContent.remove(labels.remove(colCount));
|
||||
}
|
||||
|
|
@ -2056,9 +2043,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
int maxWidth = 0;
|
||||
for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) {
|
||||
int rowMaxStackSize = 0;
|
||||
ArrayList<ArrayList<CardView>> gridRow = cardGrid.get(rowIndex);
|
||||
List<List<CardView>> gridRow = cardGrid.get(rowIndex);
|
||||
for (int colIndex = 0; colIndex < gridRow.size(); ++colIndex) {
|
||||
ArrayList<CardView> stack = gridRow.get(colIndex);
|
||||
List<CardView> stack = gridRow.get(colIndex);
|
||||
|
||||
// Stack count label
|
||||
if (stackCountLabels.size() <= rowIndex) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ import java.util.UUID;
|
|||
|
||||
public final class LocalCommands {
|
||||
|
||||
|
||||
private LocalCommands(){}
|
||||
|
||||
/**
|
||||
* Handler for commands that do not require server interaction, i.e settings etc
|
||||
* @param chatId
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ public class MageRoundPane extends JPanel {
|
|||
private int Y_OFFSET = 30;
|
||||
private final Color defaultBackgroundColor = new Color(141, 130, 112, 200); // color of the frame of the popup window
|
||||
private Color backgroundColor = defaultBackgroundColor;
|
||||
private static final int alpha = 0;
|
||||
private static final SoftValuesLoadingCache<ShadowKey, BufferedImage> SHADOW_IMAGE_CACHE;
|
||||
private static final SoftValuesLoadingCache<Key, BufferedImage> IMAGE_CACHE;
|
||||
|
||||
|
|
@ -36,7 +35,7 @@ public class MageRoundPane extends JPanel {
|
|||
IMAGE_CACHE = ImageCaches.register(SoftValuesLoadingCache.from(MageRoundPane::createImage));
|
||||
}
|
||||
|
||||
private final static class ShadowKey {
|
||||
private static final class ShadowKey {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
@ -76,7 +75,7 @@ public class MageRoundPane extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private final static class Key {
|
||||
private static final class Key {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
@ -163,8 +162,8 @@ public class MageRoundPane extends JPanel {
|
|||
/**
|
||||
* Add white translucent substrate
|
||||
*/
|
||||
/*if (alpha != 0) {
|
||||
g2.setColor(new Color(255, 255, 255, alpha));
|
||||
/*if (ALPHA != 0) {
|
||||
g2.setColor(new Color(255, 255, 255, ALPHA));
|
||||
g2.fillRoundRect(x, y, w, h, arc, arc);
|
||||
}*/
|
||||
g2.setColor(key.backgroundColor);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class BackgroundPainter extends AbstractPainter {
|
|||
|
||||
private final Color bgColor = Color.black;
|
||||
|
||||
static final float bgalpha = 0.6f;
|
||||
static final float BACKGROUND_ALPHA = 0.6f;
|
||||
|
||||
public BackgroundPainter() {
|
||||
super();
|
||||
|
|
@ -25,7 +25,7 @@ public class BackgroundPainter extends AbstractPainter {
|
|||
|
||||
@Override
|
||||
protected void doPaint(Graphics2D g2, Object o, int i, int i1) {
|
||||
float alpha = bgalpha;
|
||||
float alpha = BACKGROUND_ALPHA;
|
||||
Component c = (Component)o;
|
||||
Composite composite = g2.getComposite();
|
||||
if (composite instanceof AlphaComposite) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package mage.client.components.ext;
|
||||
|
||||
public enum MessageDialogType {
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
FLASH_INFO
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package mage.client.components.ext;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class MessageDlg {
|
||||
|
||||
MessageDlg() {}
|
||||
|
||||
public enum Types {
|
||||
Info, Warning, Error, FlashInfo
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package mage.client.components.ext.dlg;
|
||||
|
||||
import mage.client.components.ext.MessageDlg;
|
||||
import mage.client.components.ext.MessageDialogType;
|
||||
import mage.client.components.ext.dlg.impl.ChoiceDialog;
|
||||
import mage.client.components.ext.dlg.impl.StackDialog;
|
||||
|
||||
|
|
@ -37,146 +37,99 @@ public class DialogContainer extends JPanel {
|
|||
setLayout(null);
|
||||
drawContainer = true;
|
||||
|
||||
if (dialogType == DialogManager.MTGDialogs.MessageDialog) {
|
||||
//backgroundColor = new Color(0, 255, 255, 60);
|
||||
if (params.type == MessageDlg.Types.Warning) {
|
||||
backgroundColor = new Color(255, 0, 0, 90);
|
||||
} else {
|
||||
backgroundColor = new Color(0, 0, 0, 90);
|
||||
switch (dialogType) {
|
||||
case MESSAGE:
|
||||
//backgroundColor = new Color(0, 255, 255, 60);
|
||||
if (params.type == MessageDialogType.WARNING) {
|
||||
backgroundColor = new Color(255, 0, 0, 90);
|
||||
} else {
|
||||
backgroundColor = new Color(0, 0, 0, 90);
|
||||
}
|
||||
alpha = 0;
|
||||
//MessageDlg dlg = new MessageDlg(params);
|
||||
//add(dlg);
|
||||
//dlg.setLocation(X_OFFSET + 10, Y_OFFSET);
|
||||
//dlg.updateSize(params.rect.width, params.rect.height);
|
||||
break;
|
||||
case STACK: {
|
||||
//backgroundColor = new Color(0, 255, 255, 60);
|
||||
backgroundColor = new Color(0, 0, 0, 50);
|
||||
alpha = 0;
|
||||
StackDialog dlg = new StackDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
//int width = Math.min(params.rect.width - 80, 600);
|
||||
int width = params.rect.width;
|
||||
int height = params.rect.height - 80;
|
||||
dlg.updateSize(width, height);
|
||||
break;
|
||||
}
|
||||
alpha = 0;
|
||||
//MessageDlg dlg = new MessageDlg(params);
|
||||
//add(dlg);
|
||||
//dlg.setLocation(X_OFFSET + 10, Y_OFFSET);
|
||||
//dlg.updateSize(params.rect.width, params.rect.height);
|
||||
} else if (dialogType == DialogManager.MTGDialogs.StackDialog) {
|
||||
//backgroundColor = new Color(0, 255, 255, 60);
|
||||
backgroundColor = new Color(0, 0, 0, 50);
|
||||
alpha = 0;
|
||||
StackDialog dlg = new StackDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
//int width = Math.min(params.rect.width - 80, 600);
|
||||
int width = params.rect.width;
|
||||
int height = params.rect.height - 80;
|
||||
dlg.updateSize(width, height);
|
||||
}
|
||||
/*
|
||||
else if (dialogType == DialogManager.MTGDialogs.CombatDialog) {
|
||||
else if (dialogType == DialogManager.MTGDialogs.COMBAT) {
|
||||
backgroundColor = new Color(0, 0, 0, 60);
|
||||
alpha = 0;
|
||||
CombatDialog dlg = new CombatDialog(params);
|
||||
COMBAT dlg = new COMBAT(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
}*/ else if (dialogType == DialogManager.MTGDialogs.ChoiceDialog) {
|
||||
}*/
|
||||
case CHOICE: {
|
||||
|
||||
//backgroundColor = new Color(200, 200, 172, 120);
|
||||
//backgroundColor = new Color(180, 150, 200, 120);
|
||||
//backgroundColor = new Color(0, 255, 0, 60);
|
||||
//backgroundColor = new Color(200, 200, 172, 120);
|
||||
//backgroundColor = new Color(180, 150, 200, 120);
|
||||
//backgroundColor = new Color(0, 255, 0, 60);
|
||||
|
||||
//backgroundColor = new Color(139, 46, 173, 20);
|
||||
backgroundColor = new Color(0, 0, 0, 110);
|
||||
//backgroundColor = new Color(139, 46, 173, 0);
|
||||
//backgroundColor = new Color(139, 46, 173, 20);
|
||||
backgroundColor = new Color(0, 0, 0, 110);
|
||||
//backgroundColor = new Color(139, 46, 173, 0);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Choose");
|
||||
add(dlg);
|
||||
//GameManager.getManager().setCurrentChoiceDlg(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Choose");
|
||||
add(dlg);
|
||||
//GameManager.getManager().setCurrentChoiceDlg(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.GraveDialog) {
|
||||
|
||||
backgroundColor = new Color(0, 0, 0, 110);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Graveyard");
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ExileDialog) {
|
||||
|
||||
backgroundColor = new Color(250, 250, 250, 50);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Exile");
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.EmblemsDialog) {
|
||||
|
||||
backgroundColor = new Color(0, 0, 50, 110);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Command Zone (Commander, Emblems and Planes)");
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} /*else if (dialogType == DialogManager.MTGDialogs.GraveDialog) {
|
||||
backgroundColor = new Color(20, 20, 20, 120);
|
||||
alpha = 0;
|
||||
GraveDialog dlg = new GraveDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.RevealDialog) {
|
||||
backgroundColor = new Color(90, 135, 190, 80);
|
||||
alpha = 0;
|
||||
RevealDialog dlg = new RevealDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.AssignDamageDialog) {
|
||||
backgroundColor = new Color(255, 255, 255, 130);
|
||||
alpha = 0;
|
||||
AssignDamageDialog dlg = new AssignDamageDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ManaChoiceDialog) {
|
||||
backgroundColor = new Color(0, 255, 255, 60);
|
||||
alpha = 20;
|
||||
ManaChoiceDialog dlg = new ManaChoiceDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
//isGradient = true;
|
||||
gradient = ImageManager.getGradientImage();
|
||||
if (gradient != null) {
|
||||
b = ImageToBufferedImage.toBufferedImage(gradient);
|
||||
b = Transparency.makeImageTranslucent(b, 0.35);
|
||||
Rectangle2D tr = new Rectangle2D.Double(0, 0, params.rect.width, params.rect.height);
|
||||
//gradient = gradient.getScaledInstance(w, h, Image.SCALE_SMOOTH);
|
||||
tp = new TexturePaint(b, tr);
|
||||
break;
|
||||
}
|
||||
case GRAVEYARD: {
|
||||
|
||||
backgroundColor = new Color(0, 0, 0, 110);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Graveyard");
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
break;
|
||||
}
|
||||
case EXILE: {
|
||||
|
||||
backgroundColor = new Color(250, 250, 250, 50);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Exile");
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
break;
|
||||
}
|
||||
case EMBLEMS: {
|
||||
|
||||
backgroundColor = new Color(0, 0, 50, 110);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params, "Command Zone (Commander, Emblems and Planes)");
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
break;
|
||||
}
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ChooseDeckDialog) {
|
||||
MWDeckPanel deckPanel = new MWDeckPanel(params.getDeckList(), params.isAI);
|
||||
deckPanel.setVisible(true);
|
||||
deckPanel.setBounds(0,0,480,320);
|
||||
add(deckPanel);
|
||||
drawContainer = false;
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ChooseCommonDialog) {
|
||||
MWChoosePanel choosePanel = new MWChoosePanel(params.getObjectList(), params.getTitle());
|
||||
choosePanel.setVisible(true);
|
||||
choosePanel.setBounds(0,0,440,240);
|
||||
add(choosePanel);
|
||||
drawContainer = false;
|
||||
} else if (dialogType == DialogManager.MTGDialogs.AboutDialog) {
|
||||
backgroundColor = new Color(255, 255, 255, 120);
|
||||
alpha = 0;
|
||||
AboutDialog dlg = new AboutDialog();
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
|||
public class DialogManager extends JComponent implements MouseListener,
|
||||
MouseMotionListener {
|
||||
|
||||
private final static Map<UUID, DialogManager> dialogManagers = new HashMap<>();
|
||||
private static final Map<UUID, DialogManager> dialogManagers = new HashMap<>();
|
||||
|
||||
public static DialogManager getManager(UUID gameId) {
|
||||
if (!dialogManagers.containsKey(gameId)) {
|
||||
|
|
@ -39,8 +39,8 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
}
|
||||
|
||||
public enum MTGDialogs {
|
||||
none, AboutDialog, MessageDialog, StackDialog, AssignDamageDialog, ManaChoiceDialog, ChoiceDialog, EmblemsDialog, GraveDialog, DialogContainer, CombatDialog,
|
||||
ChooseDeckDialog, ChooseCommonDialog, RevealDialog, ExileDialog
|
||||
NONE, ABOUT, MESSAGE, STACK, ASSIGN_DAMAGE, MANA_CHOICE, CHOICE, EMBLEMS, GRAVEYARD, DialogContainer, COMBAT,
|
||||
CHOOSE_DECK, CHOOSE_COMMON, REVEAL, EXILE
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +58,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
}
|
||||
}
|
||||
|
||||
private MTGDialogs currentDialog = MTGDialogs.none;
|
||||
private MTGDialogs currentDialog = MTGDialogs.NONE;
|
||||
|
||||
private DialogContainer dialogContainer = null;
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
params.gameId = gameId;
|
||||
params.feedbackPanel = feedbackPanel;
|
||||
params.setCards(cards);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.StackDialog, params);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.STACK, params);
|
||||
dialogContainer.setVisible(true);
|
||||
add(dialogContainer);
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
params.gameId = gameId;
|
||||
//params.feedbackPanel = feedbackPanel;
|
||||
params.setCards(cards);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.GraveDialog, params);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.GRAVEYARD, params);
|
||||
dialogContainer.setVisible(true);
|
||||
add(dialogContainer);
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
params.bigCard = bigCard;
|
||||
params.gameId = gameId;
|
||||
params.setCards(cards);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.ExileDialog, params);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.EXILE, params);
|
||||
dialogContainer.setVisible(true);
|
||||
add(dialogContainer);
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
params.gameId = gameId;
|
||||
//params.feedbackPanel = feedbackPanel;
|
||||
params.setCards(cards);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.EmblemsDialog, params);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.EMBLEMS, params);
|
||||
dialogContainer.setVisible(true);
|
||||
add(dialogContainer);
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
removeAll();
|
||||
}
|
||||
|
||||
this.currentDialog = MTGDialogs.none;
|
||||
this.currentDialog = MTGDialogs.NONE;
|
||||
|
||||
setVisible(false);
|
||||
|
||||
|
|
@ -312,6 +312,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -360,7 +361,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
int notches = e.getWheelRotation();
|
||||
// System.out.println("outx:"+notches);
|
||||
// if (currentDialog != null && currentDialog.equals(MTGDialogs.ChooseCommonDialog)) {
|
||||
// if (currentDialog != null && currentDialog.equals(MTGDialogs.CHOOSE_COMMON)) {
|
||||
// System.out.println("out:"+1);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
package mage.client.components.ext.dlg;
|
||||
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.ext.MessageDlg;
|
||||
import mage.client.components.ext.MessageDialogType;
|
||||
import mage.client.game.FeedbackPanel;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -18,7 +19,7 @@ import java.util.UUID;
|
|||
public class DlgParams {
|
||||
|
||||
public Rectangle rect;
|
||||
public MessageDlg.Types type;
|
||||
public MessageDialogType type;
|
||||
public BigCard bigCard;
|
||||
public FeedbackPanel feedbackPanel;
|
||||
public UUID gameId;
|
||||
|
|
@ -26,19 +27,19 @@ public class DlgParams {
|
|||
private int playerID;
|
||||
|
||||
private CardsView cards;
|
||||
private ArrayList<String> stringList;
|
||||
private java.util.List<String> stringList;
|
||||
//private ArrayList<DeckInfo> deckList;
|
||||
private ArrayList<Object> objectList;
|
||||
private java.util.List<Object> objectList;
|
||||
|
||||
private String title;
|
||||
private int opponentID;
|
||||
boolean isOptional = false;
|
||||
boolean isChooseAbility = false;
|
||||
boolean isCancelStopsPlaying = true;
|
||||
private boolean isOptional = false;
|
||||
private boolean isChooseAbility = false;
|
||||
private boolean isCancelStopsPlaying = true;
|
||||
|
||||
boolean isAI = false;
|
||||
private boolean isAI = false;
|
||||
|
||||
public HashSet<String> manaChoices = new HashSet<>();
|
||||
private Set<String> manaChoices = new HashSet<>();
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
|
|
@ -74,11 +75,11 @@ public class DlgParams {
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
public HashSet<String> getManaChoices() {
|
||||
public Set<String> getManaChoices() {
|
||||
return manaChoices;
|
||||
}
|
||||
|
||||
public void setManaChoices(HashSet<String> manaChoices) {
|
||||
public void setManaChoices(Set<String> manaChoices) {
|
||||
this.manaChoices = manaChoices;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ public class DlgParams {
|
|||
this.isChooseAbility = isChooseAbility;
|
||||
}
|
||||
|
||||
public ArrayList<String> getStringList() {
|
||||
public java.util.List<String> getStringList() {
|
||||
return stringList;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ public class DlgParams {
|
|||
this.deckList = deckList;
|
||||
}*/
|
||||
|
||||
public ArrayList<Object> getObjectList() {
|
||||
public java.util.List<Object> getObjectList() {
|
||||
return objectList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.awt.*;
|
|||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
abstract public class IDialogPanel extends JXPanel {
|
||||
public abstract class IDialogPanel extends JXPanel {
|
||||
|
||||
private DlgParams params;
|
||||
private Dimension cardDimension;
|
||||
|
|
|
|||
|
|
@ -50,11 +50,12 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
private boolean isCancelStopsPlaying = true;
|
||||
|
||||
private final DlgParams params;
|
||||
|
||||
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*
|
||||
* @param params
|
||||
* @param title
|
||||
*/
|
||||
|
|
@ -130,18 +131,18 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
return;
|
||||
}
|
||||
|
||||
ArrayList<Component> toRemove = new ArrayList<>();
|
||||
java.util.List<Component> toRemove = new ArrayList<>();
|
||||
for (int i = getComponentCount() - 1; i > 0; i--) {
|
||||
Component o = getComponent(i);
|
||||
if (o instanceof MageCard) {
|
||||
toRemove.add(o);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < toRemove.size(); i++) {
|
||||
remove(toRemove.get(i));
|
||||
for (Component aToRemove : toRemove) {
|
||||
remove(aToRemove);
|
||||
}
|
||||
|
||||
ArrayList<CardView> cardList = new ArrayList<>(cards.values());
|
||||
java.util.List<CardView> cardList = new ArrayList<>(cards.values());
|
||||
|
||||
int width = SettingsManager.instance.getCardSize().width;
|
||||
int height = SettingsManager.instance.getCardSize().height;
|
||||
|
|
@ -163,7 +164,7 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
CardView card = cardList.get(i);
|
||||
MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, getCardDimension(), gameId, true, true);
|
||||
|
||||
cardImg.setLocation(dx, dy + j*(height + 30));
|
||||
cardImg.setLocation(dx, dy + j * (height + 30));
|
||||
add(cardImg);
|
||||
|
||||
dx += (width + 20);
|
||||
|
|
@ -237,11 +238,8 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
int h = getDlgParams().rect.height - 90;
|
||||
jButtonNextPage.setBounds(new Rectangle(w / 2 + 45, h - 50, 60, 60));
|
||||
|
||||
if (maxPages > 1) {
|
||||
jButtonNextPage.setVisible(true);
|
||||
} else {
|
||||
jButtonNextPage.setVisible(false);
|
||||
}
|
||||
jButtonNextPage.setVisible(maxPages > 1);
|
||||
|
||||
|
||||
jButtonNextPage.setObserver(new Command() {
|
||||
private static final long serialVersionUID = -3174360416099554104L;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ public enum MageTray {
|
|||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
log.error("TrayIcon could not be added: ", e);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package mage.client.deck.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum DeckGeneratorCMC {
|
||||
|
||||
|
|
@ -51,11 +52,11 @@ public enum DeckGeneratorCMC {
|
|||
this.poolCMCs40 = CMCs40;
|
||||
}
|
||||
|
||||
public ArrayList<CMC> get40CardPoolCMC() {
|
||||
public List<CMC> get40CardPoolCMC() {
|
||||
return this.poolCMCs40;
|
||||
}
|
||||
|
||||
public ArrayList<CMC> get60CardPoolCMC() {
|
||||
public List<CMC> get60CardPoolCMC() {
|
||||
return this.poolCMCs60;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
|
||||
private static JLabel createChangingPercentageLabel(final JSlider slider) {
|
||||
|
||||
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + '%');
|
||||
final JLabel label = new JLabel(" " + slider.getValue() + '%');
|
||||
|
||||
slider.addChangeListener(e -> {
|
||||
String value = String.valueOf(slider.getValue());
|
||||
|
|
|
|||
|
|
@ -72,15 +72,12 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
currentView = mainModel; // by default we use List View
|
||||
|
||||
listCodeSelected = new CheckBoxList();
|
||||
// remove the all option
|
||||
boolean is_removeFinish = false;
|
||||
|
||||
String[] setCodes = ConstructedFormats.getTypes();
|
||||
java.util.List<String> result = new ArrayList<>();
|
||||
|
||||
for (int i = 0; (i < setCodes.length) && (!is_removeFinish); i++) {
|
||||
String item = setCodes[i];
|
||||
if (!item.equals(ConstructedFormats.ALL)) {
|
||||
for (String item : setCodes) {
|
||||
if (!item.equals(ConstructedFormats.ALL_SETS)) {
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
|
|
@ -360,9 +357,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
for (int itemIndex : choiseValue) {
|
||||
|
||||
java.util.List<String> listReceived = ConstructedFormats.getSetsByFormat(x.getElementAt(itemIndex).toString());
|
||||
listReceived.stream().filter((item) -> (setCodes.contains(item) == false)).forEachOrdered((item) -> {
|
||||
setCodes.add(item);
|
||||
});
|
||||
listReceived.stream().filter(item -> !setCodes.contains(item)).forEachOrdered(setCodes::add);
|
||||
}
|
||||
criteria.setCodes(setCodes.toArray(new String[0]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
public int dividerLocationLimited;
|
||||
public int dividerLocationNormal;
|
||||
|
||||
private final static Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
|
||||
private static final Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
|
||||
|
||||
public static Settings parse(String s) {
|
||||
Matcher m = parser.matcher(s);
|
||||
|
|
|
|||
|
|
@ -1119,12 +1119,12 @@ class ImportFilter extends FileFilter {
|
|||
ext = s.substring(i + 1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
if (ext != null) {
|
||||
if (ext.toLowerCase(Locale.ENGLISH).equals("dec")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("mwdeck")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("txt")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("dek")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("cod")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("o8d")) {
|
||||
if (ext.equalsIgnoreCase("dec")
|
||||
|| ext.equalsIgnoreCase("mwdeck")
|
||||
|| ext.equalsIgnoreCase("txt")
|
||||
|| ext.equalsIgnoreCase("dek")
|
||||
|| ext.equalsIgnoreCase("cod")
|
||||
|| ext.equalsIgnoreCase("o8d")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
|
||||
public class SortSettingBase extends SortSetting {
|
||||
|
||||
private final static SortSettingBase instance = new SortSettingBase();
|
||||
private static final SortSettingBase instance = new SortSettingBase();
|
||||
|
||||
public static SortSettingBase getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
|
||||
public class SortSettingDeck extends SortSetting {
|
||||
|
||||
private final static SortSettingDeck instance = new SortSettingDeck();
|
||||
private static final SortSettingDeck instance = new SortSettingDeck();
|
||||
|
||||
public static SortSettingDeck getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
*/
|
||||
public class SortSettingDraft extends SortSetting {
|
||||
|
||||
private final static SortSettingDraft instance = new SortSettingDraft();
|
||||
private static final SortSettingDraft instance = new SortSettingDraft();
|
||||
|
||||
public static SortSettingDraft getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public class MageBook extends JComponent {
|
|||
public int showTokens() {
|
||||
jLayeredPane.removeAll();
|
||||
List<Token> tokens = getTokens(currentPage, currentSet);
|
||||
if (tokens != null && tokens.size() > 0) {
|
||||
if (tokens != null && !tokens.isEmpty()) {
|
||||
int size = tokens.size();
|
||||
Rectangle rectangle = new Rectangle();
|
||||
rectangle.translate(OFFSET_X, OFFSET_Y);
|
||||
|
|
@ -295,7 +295,7 @@ public class MageBook extends JComponent {
|
|||
public int showEmblems(int numTokens) {
|
||||
List<Emblem> emblems = getEmblems(currentPage, currentSet, numTokens);
|
||||
int numEmblems = 0;
|
||||
if (emblems != null && emblems.size() > 0) {
|
||||
if (emblems != null && !emblems.isEmpty()) {
|
||||
int size = emblems.size();
|
||||
numEmblems = size;
|
||||
Rectangle rectangle = new Rectangle();
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class ConnectDialog extends MageDialog {
|
|||
MagePreferences.setServerAddress(serverAddress);
|
||||
MagePreferences.setServerPort(Integer.parseInt(txtPort.getText().trim()));
|
||||
MagePreferences.setUserName(serverAddress, txtUserName.getText().trim());
|
||||
MagePreferences.setPassword(serverAddress, txtPassword.getText().trim());
|
||||
MagePreferences.setPassword(serverAddress, String.valueOf(txtPassword.getPassword()).trim());
|
||||
MageFrame.getPreferences().put(KEY_CONNECT_AUTO_CONNECT, Boolean.toString(chkAutoConnect.isSelected()));
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ public class ConnectDialog extends MageDialog {
|
|||
connection.setHost(this.txtServer.getText().trim());
|
||||
connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
|
||||
connection.setUsername(this.txtUserName.getText().trim());
|
||||
connection.setPassword(this.txtPassword.getText().trim());
|
||||
connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim());
|
||||
// force to redownload db
|
||||
boolean redownloadDatabase = (ExpansionRepository.instance.getSetByCode("GRN") == null || CardRepository.instance.findCard("Island") == null);
|
||||
connection.setForceDBComparison(this.chkForceUpdateDB.isSelected() || redownloadDatabase);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
private boolean isRandomDraft;
|
||||
private boolean isRichManDraft;
|
||||
private String title = "";
|
||||
public final static String randomDraftDescription = ("The selected packs will be randomly distributed to players. Each player may open different packs. Duplicates will be avoided.");
|
||||
public static final String randomDraftDescription = ("The selected packs will be randomly distributed to players. Each player may open different packs. Duplicates will be avoided.");
|
||||
|
||||
public RandomPacksSelectorDialog(boolean isRandomDraft, boolean isRichManDraft) {
|
||||
initComponents();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
package mage.client.dialog;
|
||||
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import javax.swing.SwingWorker;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.preference.MagePreferences;
|
||||
import mage.remote.Connection;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class RegisterUserDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ConnectDialog.class);
|
||||
|
|
@ -106,73 +108,73 @@ public class RegisterUserDialog extends MageDialog {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPasswordConfirmationReasoning)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(lblUserName)
|
||||
.addComponent(lblPort)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(lblPasswordConfirmation)
|
||||
.addComponent(lblEmail))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPasswordConfirmation, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(lblEmailReasoning)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(btnRegister)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)))
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(22, Short.MAX_VALUE))
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPasswordConfirmationReasoning)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(lblUserName)
|
||||
.addComponent(lblPort)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(lblPasswordConfirmation)
|
||||
.addComponent(lblEmail))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPasswordConfirmation, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(lblEmailReasoning)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(btnRegister)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)))
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(22, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(9, 9, 9)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPort)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblUserName)
|
||||
.addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtPasswordConfirmation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPasswordConfirmation))
|
||||
.addComponent(lblPasswordConfirmationReasoning)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblEmail)
|
||||
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblEmailReasoning)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnCancel)
|
||||
.addComponent(btnRegister))
|
||||
.addContainerGap())
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(9, 9, 9)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPort)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblUserName)
|
||||
.addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtPasswordConfirmation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPasswordConfirmation))
|
||||
.addComponent(lblPasswordConfirmationReasoning)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblEmail)
|
||||
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblEmailReasoning)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnCancel)
|
||||
.addComponent(btnRegister))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
|
|
@ -187,7 +189,7 @@ public class RegisterUserDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btnCancelActionPerformed
|
||||
|
||||
private void btnRegisterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegisterActionPerformed
|
||||
if (!this.txtPassword.getText().equals(this.txtPasswordConfirmation.getText())) {
|
||||
if (!Arrays.equals(this.txtPassword.getPassword(), this.txtPasswordConfirmation.getPassword())) {
|
||||
MageFrame.getInstance().showError("Passwords don't match.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -195,7 +197,7 @@ public class RegisterUserDialog extends MageDialog {
|
|||
connection.setHost(this.txtServer.getText().trim());
|
||||
connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
|
||||
connection.setUsername(this.txtUserName.getText().trim());
|
||||
connection.setPassword(this.txtPassword.getText().trim());
|
||||
connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim());
|
||||
connection.setEmail(this.txtEmail.getText().trim());
|
||||
PreferencesDialog.setProxyInformation(connection);
|
||||
task = new ConnectTask();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
package mage.client.dialog;
|
||||
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import javax.swing.SwingWorker;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.preference.MagePreferences;
|
||||
import mage.remote.Connection;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class ResetPasswordDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ResetPasswordDialog.class);
|
||||
|
|
@ -97,51 +99,51 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel6)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(lblAuthToken, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblPasswordConfirmation, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtAuthToken)
|
||||
.addComponent(txtPassword)
|
||||
.addComponent(txtPasswordConfirmation)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addGap(0, 204, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPasswordConfirmationReasoning, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(btnSubmitNewPassword, javax.swing.GroupLayout.Alignment.TRAILING))))
|
||||
.addContainerGap())
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel6)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(lblAuthToken, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblPasswordConfirmation, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtAuthToken)
|
||||
.addComponent(txtPassword)
|
||||
.addComponent(txtPasswordConfirmation)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addGap(0, 204, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPasswordConfirmationReasoning, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(btnSubmitNewPassword, javax.swing.GroupLayout.Alignment.TRAILING))))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel6)
|
||||
.addGap(24, 24, 24)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblAuthToken)
|
||||
.addComponent(txtAuthToken, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPasswordConfirmation)
|
||||
.addComponent(txtPasswordConfirmation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPasswordConfirmationReasoning)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(btnSubmitNewPassword)
|
||||
.addContainerGap(9, Short.MAX_VALUE))
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel6)
|
||||
.addGap(24, 24, 24)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblAuthToken)
|
||||
.addComponent(txtAuthToken, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPasswordConfirmation)
|
||||
.addComponent(txtPasswordConfirmation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPasswordConfirmationReasoning)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(btnSubmitNewPassword)
|
||||
.addContainerGap(9, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
|
@ -158,33 +160,33 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel5)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(lblEmail)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtEmail))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnGetAuthToken)))
|
||||
.addContainerGap())
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel5)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(lblEmail)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtEmail))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnGetAuthToken)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel5)
|
||||
.addGap(24, 24, 24)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblEmail)
|
||||
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnGetAuthToken)
|
||||
.addContainerGap())
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel5)
|
||||
.addGap(24, 24, 24)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblEmail)
|
||||
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnGetAuthToken)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
btnCancel.setText("Cancel");
|
||||
|
|
@ -199,46 +201,46 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnCancel))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(lblPort))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtServer)
|
||||
.addComponent(txtPort))))
|
||||
.addContainerGap())
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnCancel))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(lblPort))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtServer)
|
||||
.addComponent(txtPort))))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPort))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPort))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
|
@ -269,11 +271,11 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
MageFrame.getInstance().showError("Please enter an auth token.");
|
||||
return;
|
||||
}
|
||||
if (this.txtPassword.getText().isEmpty()) {
|
||||
if (String.valueOf(this.txtPassword.getPassword()).trim().isEmpty()) {
|
||||
MageFrame.getInstance().showError("Please enter a new password.");
|
||||
return;
|
||||
}
|
||||
if (!this.txtPassword.getText().equals(this.txtPasswordConfirmation.getText())) {
|
||||
if (!Arrays.equals(this.txtPassword.getPassword(), this.txtPasswordConfirmation.getPassword())) {
|
||||
MageFrame.getInstance().showError("Passwords don't match.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -284,7 +286,7 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
PreferencesDialog.setProxyInformation(connection);
|
||||
connection.setEmail(this.txtEmail.getText().trim());
|
||||
connection.setAuthToken(this.txtAuthToken.getText().trim());
|
||||
connection.setPassword(this.txtPassword.getText().trim());
|
||||
connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim());
|
||||
|
||||
resetPasswordTask = new ResetPasswordTask();
|
||||
resetPasswordTask.execute();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.apache.log4j.Logger;
|
|||
import org.mage.card.arcane.CardRendererUtils;
|
||||
import org.ocpsoft.prettytime.Duration;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import org.ocpsoft.prettytime.TimeFormat;
|
||||
import org.ocpsoft.prettytime.units.JustNow;
|
||||
|
||||
import javax.swing.*;
|
||||
|
|
@ -82,7 +83,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
final JToggleButton[] filterButtons;
|
||||
|
||||
// time formater
|
||||
private PrettyTime timeFormater = new PrettyTime();
|
||||
private PrettyTime timeFormater = new PrettyTime(Locale.ENGLISH);
|
||||
|
||||
// time ago renderer
|
||||
TableCellRenderer timeAgoCellRenderer = new DefaultTableCellRenderer() {
|
||||
|
|
@ -219,9 +220,12 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
// tableModel.setSession(session);
|
||||
|
||||
// formater
|
||||
timeFormater.setLocale(Locale.ENGLISH);
|
||||
JustNow jn = timeFormater.getUnit(JustNow.class);
|
||||
jn.setMaxQuantity(1000L * 30L); // 30 seconds gap (show "just now" from 0 to 30 secs)
|
||||
// change default just now from 60 to 30 secs
|
||||
// see workaround for 4.0 versions: https://github.com/ocpsoft/prettytime/issues/152
|
||||
TimeFormat timeFormat = timeFormater.removeUnit(JustNow.class);
|
||||
JustNow newJustNow = new JustNow();
|
||||
newJustNow.setMaxQuantity(1000L * 30L); // 30 seconds gap (show "just now" from 0 to 30 secs)
|
||||
timeFormater.registerUnit(newJustNow, timeFormat);
|
||||
|
||||
// 1. TABLE CURRENT
|
||||
tableTables.createDefaultColumnsFromModel();
|
||||
|
|
@ -1377,35 +1381,35 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
javax.swing.GroupLayout jPanelTopLayout = new javax.swing.GroupLayout(jPanelTop);
|
||||
jPanelTop.setLayout(jPanelTopLayout);
|
||||
jPanelTopLayout.setHorizontalGroup(
|
||||
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelTopLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnNewTable)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(btnNewTournament)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnQuickStart)
|
||||
.addContainerGap(792, Short.MAX_VALUE))
|
||||
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelTopLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnNewTable)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(btnNewTournament)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnQuickStart)
|
||||
.addContainerGap(792, Short.MAX_VALUE))
|
||||
);
|
||||
jPanelTopLayout.setVerticalGroup(
|
||||
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelTopLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnNewTable)
|
||||
.addComponent(btnNewTournament))
|
||||
.addGroup(jPanelTopLayout.createSequentialGroup()
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnQuickStart))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelTopLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnNewTable)
|
||||
.addComponent(btnNewTournament))
|
||||
.addGroup(jPanelTopLayout.createSequentialGroup()
|
||||
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnQuickStart))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
|
|
@ -1442,12 +1446,12 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
javax.swing.GroupLayout jPanelTablesLayout = new javax.swing.GroupLayout(jPanelTables);
|
||||
jPanelTables.setLayout(jPanelTablesLayout);
|
||||
jPanelTablesLayout.setHorizontalGroup(
|
||||
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
|
||||
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
|
||||
);
|
||||
jPanelTablesLayout.setVerticalGroup(
|
||||
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 672, Short.MAX_VALUE)
|
||||
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 672, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jSplitPane1.setLeftComponent(jPanelTables);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
|
||||
/*
|
||||
* CombatDialog.java
|
||||
* COMBAT.java
|
||||
*
|
||||
* Created on Feb 10, 2010, 3:35:02 PM
|
||||
*/
|
||||
|
|
@ -33,7 +33,7 @@ public class CombatDialog extends MageDialog {
|
|||
private int lastX = 500;
|
||||
private int lastY = 300;
|
||||
|
||||
/** Creates new form CombatDialog */
|
||||
/** Creates new form COMBAT */
|
||||
public CombatDialog() {
|
||||
|
||||
JPanel contentPane = new JPanel() {
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ import org.mage.card.arcane.CardRenderer;
|
|||
public final class GUISizeHelper {
|
||||
|
||||
// relate the native image card size to a value of the size scale
|
||||
final static int CARD_IMAGE_WIDTH = 312;
|
||||
final static int CARD_IMAGE_HEIGHT = 445;
|
||||
final static int CARD_IMAG_VALUE = 42;
|
||||
static final int CARD_IMAGE_WIDTH = 312;
|
||||
static final int CARD_IMAGE_HEIGHT = 445;
|
||||
static final int CARD_IMAG_VALUE = 42;
|
||||
|
||||
public static String basicSymbolSize = "small";
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.mortennobel.imagescaling.ResampleOp;
|
|||
*/
|
||||
public final class TransformedImageCache {
|
||||
|
||||
private final static class Key {
|
||||
private static final class Key {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.*;
|
|||
*/
|
||||
public final class ConstructedFormats {
|
||||
|
||||
public static final String ALL = "- All Sets";
|
||||
public static final String ALL_SETS = "- All Sets";
|
||||
public static final String STANDARD = "- Standard";
|
||||
public static final String EXTENDED = "- Extended";
|
||||
public static final String FRONTIER = "- Frontier";
|
||||
|
|
@ -65,7 +65,7 @@ public final class ConstructedFormats {
|
|||
}
|
||||
|
||||
public static List<String> getSetsByFormat(final String format) {
|
||||
if (!format.equals(ALL)) {
|
||||
if (!format.equals(ALL_SETS)) {
|
||||
return underlyingSetCodesPerFormat.get(format);
|
||||
}
|
||||
return all;
|
||||
|
|
@ -244,7 +244,7 @@ public final class ConstructedFormats {
|
|||
formats.add(0, EXTENDED);
|
||||
formats.add(0, STANDARD);
|
||||
}
|
||||
formats.add(0, ALL);
|
||||
formats.add(0, ALL_SETS);
|
||||
}
|
||||
|
||||
private static String getBlockDisplayName(String blockName) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue