mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
checkstyle
This commit is contained in:
@@ -36,7 +36,8 @@ public class QuestStallDefinition {
|
|||||||
* @param iconName
|
* @param iconName
|
||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public QuestStallDefinition(final String name, final String displayName, final String fluff, final String iconName) {
|
public QuestStallDefinition(final String name,
|
||||||
|
final String displayName, final String fluff, final String iconName) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
this.fluff = fluff;
|
this.fluff = fluff;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class QuestStallManager {
|
|||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
* @return a {@link java.util.List} object.
|
* @return a {@link java.util.List} object.
|
||||||
*/
|
*/
|
||||||
public static List<QuestStallPurchasable> getItems(String stallName) {
|
public static List<QuestStallPurchasable> getItems(final String stallName) {
|
||||||
if (items == null) {
|
if (items == null) {
|
||||||
buildItems();
|
buildItems();
|
||||||
}
|
}
|
||||||
@@ -134,19 +134,19 @@ public class QuestStallManager {
|
|||||||
|
|
||||||
/** Constant <code>ALCHEMIST="Alchemist"</code>. */
|
/** Constant <code>ALCHEMIST="Alchemist"</code>. */
|
||||||
public static final String ALCHEMIST = "Alchemist";
|
public static final String ALCHEMIST = "Alchemist";
|
||||||
|
|
||||||
/** Constant <code>BANKER="Banker"</code>. */
|
/** Constant <code>BANKER="Banker"</code>. */
|
||||||
public static final String BANKER = "Banker";
|
public static final String BANKER = "Banker";
|
||||||
|
|
||||||
/** Constant <code>BOOKSTORE="Bookstore"</code>. */
|
/** Constant <code>BOOKSTORE="Bookstore"</code>. */
|
||||||
public static final String BOOKSTORE = "Bookstore";
|
public static final String BOOKSTORE = "Bookstore";
|
||||||
|
|
||||||
/** Constant <code>GEAR="Gear"</code>. */
|
/** Constant <code>GEAR="Gear"</code>. */
|
||||||
public static final String GEAR = "Gear";
|
public static final String GEAR = "Gear";
|
||||||
|
|
||||||
/** Constant <code>NURSERY="Nursery"</code>. */
|
/** Constant <code>NURSERY="Nursery"</code>. */
|
||||||
public static final String NURSERY = "Nursery";
|
public static final String NURSERY = "Nursery";
|
||||||
|
|
||||||
/** Constant <code>PET_SHOP="Pet Shop"</code>. */
|
/** Constant <code>PET_SHOP="Pet Shop"</code>. */
|
||||||
public static final String PET_SHOP = "Pet Shop";
|
public static final String PET_SHOP = "Pet Shop";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package forge.quest.data.bazaar;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface defines a thing that can be sold at the Bazaar.
|
* This interface defines a thing that can be sold at the Bazaar.
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -45,10 +45,10 @@ public interface QuestStallPurchasable extends Comparable<Object> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the item is available for purchase;.
|
* Returns if the item is available for purchase;.
|
||||||
*
|
*
|
||||||
* @return <code>true</code> if the item can be displayed in a store
|
* @return <code>true</code> if the item can be displayed in a store
|
||||||
* <code>false</code> if the item should not be displayed in store
|
* <code>false</code> if the item should not be displayed in store
|
||||||
* since, for example, prerequisites are not met
|
* since, for example, prerequisites are not met
|
||||||
*/
|
*/
|
||||||
boolean isAvailableForPurchase();
|
boolean isAvailableForPurchase();
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +1,74 @@
|
|||||||
package forge.quest.gui.bazaar;
|
package forge.quest.gui.bazaar;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.border.CompoundBorder;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.border.LineBorder;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
import forge.gui.MultiLineLabel;
|
import forge.gui.MultiLineLabel;
|
||||||
import forge.quest.data.bazaar.QuestStallPurchasable;
|
import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.border.CompoundBorder;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>QuestBazaarItem class.</p>
|
* <p>
|
||||||
*
|
* QuestBazaarItem class.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class QuestBazaarItem {
|
public class QuestBazaarItem {
|
||||||
|
|
||||||
|
/** The item. */
|
||||||
QuestStallPurchasable item;
|
QuestStallPurchasable item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Constructor for QuestBazaarItem.</p>
|
* <p>
|
||||||
*
|
* Constructor for QuestBazaarItem.
|
||||||
* @param purchasable a {@link forge.quest.data.bazaar.QuestStallPurchasable} object.
|
* </p>
|
||||||
|
*
|
||||||
|
* @param purchasable
|
||||||
|
* a {@link forge.quest.data.bazaar.QuestStallPurchasable}
|
||||||
|
* object.
|
||||||
*/
|
*/
|
||||||
protected QuestBazaarItem(QuestStallPurchasable purchasable) {
|
protected QuestBazaarItem(final QuestStallPurchasable purchasable) {
|
||||||
this.item = purchasable;
|
this.item = purchasable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked by the Bazaar UI when the item is purchased. The credits of the item should not be deducted here.
|
* Invoked by the Bazaar UI when the item is purchased. The credits of the
|
||||||
|
* item should not be deducted here.
|
||||||
*/
|
*/
|
||||||
public void purchaseItem() {
|
public final void purchaseItem() {
|
||||||
item.onPurchase();
|
item.onPurchase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getItemPanel.</p>
|
* <p>
|
||||||
*
|
* getItemPanel.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
* @return a {@link javax.swing.JPanel} object.
|
* @return a {@link javax.swing.JPanel} object.
|
||||||
*/
|
*/
|
||||||
protected final JPanel getItemPanel() {
|
protected final JPanel getItemPanel() {
|
||||||
ImageIcon icon = GuiUtils.getIconFromFile(item.getImageName());
|
ImageIcon icon = GuiUtils.getIconFromFile(item.getImageName());
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
// The original size was only 40 x 40 pixels.
|
// The original size was only 40 x 40 pixels.
|
||||||
// Increased the size to give added pixels for more detail.
|
// Increased the size to give added pixels for more detail.
|
||||||
icon = GuiUtils.getEmptyIcon(80, 80);
|
icon = GuiUtils.getEmptyIcon(80, 80);
|
||||||
}
|
}
|
||||||
// The original size was only 40 x 40 pixels.
|
// The original size was only 40 x 40 pixels.
|
||||||
@@ -71,10 +89,9 @@ public class QuestBazaarItem {
|
|||||||
JLabel priceLabel = new JLabel("<html><b>Cost:</b> " + item.getPrice() + " credits</html>");
|
JLabel priceLabel = new JLabel("<html><b>Cost:</b> " + item.getPrice() + " credits</html>");
|
||||||
priceLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
|
priceLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
|
||||||
|
|
||||||
|
|
||||||
JButton purchaseButton = new JButton("Buy");
|
JButton purchaseButton = new JButton("Buy");
|
||||||
purchaseButton.addActionListener(new ActionListener() {
|
purchaseButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
AllZone.getQuestData().subtractCredits(item.getPrice());
|
AllZone.getQuestData().subtractCredits(item.getPrice());
|
||||||
purchaseItem();
|
purchaseItem();
|
||||||
AllZone.getQuestData().saveData();
|
AllZone.getQuestData().saveData();
|
||||||
@@ -134,7 +151,6 @@ public class QuestBazaarItem {
|
|||||||
|
|
||||||
itemPanel.setMinimumSize(new Dimension(0, 0));
|
itemPanel.setMinimumSize(new Dimension(0, 0));
|
||||||
|
|
||||||
|
|
||||||
return itemPanel;
|
return itemPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +1,62 @@
|
|||||||
package forge.quest.gui.bazaar;
|
package forge.quest.gui.bazaar;
|
||||||
|
|
||||||
import forge.quest.data.bazaar.QuestStallManager;
|
import java.awt.BorderLayout;
|
||||||
import forge.quest.gui.QuestAbstractPanel;
|
import java.awt.CardLayout;
|
||||||
import forge.quest.gui.QuestFrame;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JToggleButton;
|
||||||
|
|
||||||
|
import forge.quest.data.bazaar.QuestStallManager;
|
||||||
|
import forge.quest.gui.QuestAbstractPanel;
|
||||||
|
import forge.quest.gui.QuestFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>QuestBazaarPanel class.</p>
|
* <p>
|
||||||
*
|
* QuestBazaarPanel class.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class QuestBazaarPanel extends QuestAbstractPanel {
|
public class QuestBazaarPanel extends QuestAbstractPanel {
|
||||||
/** Constant <code>serialVersionUID=1418913010051869222L</code> */
|
/** Constant <code>serialVersionUID=1418913010051869222L</code>. */
|
||||||
private static final long serialVersionUID = 1418913010051869222L;
|
private static final long serialVersionUID = 1418913010051869222L;
|
||||||
|
|
||||||
/** Constant <code>stallList</code> */
|
/** Constant <code>stallList</code>. */
|
||||||
static List<QuestBazaarStall> stallList = new ArrayList<QuestBazaarStall>();
|
static List<QuestBazaarStall> stallList = new ArrayList<QuestBazaarStall>();
|
||||||
|
|
||||||
|
/** The button panel. */
|
||||||
JPanel buttonPanel = new JPanel(new BorderLayout());
|
JPanel buttonPanel = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
|
/** The button panel main. */
|
||||||
JPanel buttonPanelMain = new JPanel();
|
JPanel buttonPanelMain = new JPanel();
|
||||||
|
|
||||||
|
/** The stall panel. */
|
||||||
JPanel stallPanel = new JPanel();
|
JPanel stallPanel = new JPanel();
|
||||||
|
|
||||||
|
/** The selected stall. */
|
||||||
JToggleButton selectedStall = null;
|
JToggleButton selectedStall = null;
|
||||||
|
|
||||||
|
/** The stall layout. */
|
||||||
CardLayout stallLayout = new CardLayout();
|
CardLayout stallLayout = new CardLayout();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Constructor for QuestBazaarPanel.</p>
|
* <p>
|
||||||
*
|
* Constructor for QuestBazaarPanel.
|
||||||
* @param mainFrame a {@link forge.quest.gui.QuestFrame} object.
|
* </p>
|
||||||
|
*
|
||||||
|
* @param mainFrame
|
||||||
|
* a {@link forge.quest.gui.QuestFrame} object.
|
||||||
*/
|
*/
|
||||||
public QuestBazaarPanel(QuestFrame mainFrame) {
|
public QuestBazaarPanel(final QuestFrame mainFrame) {
|
||||||
super(mainFrame);
|
super(mainFrame);
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
|
|
||||||
@@ -60,7 +77,7 @@ public class QuestBazaarPanel extends QuestAbstractPanel {
|
|||||||
for (QuestBazaarStall stall : stallList) {
|
for (QuestBazaarStall stall : stallList) {
|
||||||
JToggleButton stallButton = new JToggleButton(stall.getStallName(), stall.getStallIcon());
|
JToggleButton stallButton = new JToggleButton(stall.getStallName(), stall.getStallIcon());
|
||||||
stallButton.addActionListener(new ActionListener() {
|
stallButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
|
|
||||||
if (QuestBazaarPanel.this.selectedStall == e.getSource()) {
|
if (QuestBazaarPanel.this.selectedStall == e.getSource()) {
|
||||||
QuestBazaarPanel.this.selectedStall.setSelected(true);
|
QuestBazaarPanel.this.selectedStall.setSelected(true);
|
||||||
@@ -101,12 +118,11 @@ public class QuestBazaarPanel extends QuestAbstractPanel {
|
|||||||
button.setMinimumSize(max);
|
button.setMinimumSize(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buttonPanel.add(buttonPanelMain, BorderLayout.NORTH);
|
buttonPanel.add(buttonPanelMain, BorderLayout.NORTH);
|
||||||
JButton quitButton = new JButton("Leave Bazaar");
|
JButton quitButton = new JButton("Leave Bazaar");
|
||||||
quitButton.setSize(max);
|
quitButton.setSize(max);
|
||||||
quitButton.addActionListener(new ActionListener() {
|
quitButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
QuestBazaarPanel.this.mainFrame.showMainPane();
|
QuestBazaarPanel.this.mainFrame.showMainPane();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -119,11 +135,14 @@ public class QuestBazaarPanel extends QuestAbstractPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>showStall.</p>
|
* <p>
|
||||||
*
|
* showStall.
|
||||||
* @param source a {@link java.lang.String} object.
|
* </p>
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
private void showStall(String source) {
|
private void showStall(final String source) {
|
||||||
stallLayout.show(stallPanel, source);
|
stallLayout.show(stallPanel, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +157,7 @@ public class QuestBazaarPanel extends QuestAbstractPanel {
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void refreshState() {
|
public final void refreshState() {
|
||||||
refreshLastInstance();
|
refreshLastInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import javax.swing.border.EmptyBorder;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* <p>QuestBazaarStall class.</p>
|
* <p>QuestBazaarStall class.</p>
|
||||||
*
|
*
|
||||||
@@ -22,15 +23,24 @@ import java.util.ArrayList;
|
|||||||
public class QuestBazaarStall extends JPanel implements NewConstants {
|
public class QuestBazaarStall extends JPanel implements NewConstants {
|
||||||
/** Constant <code>serialVersionUID=-4147745071116906043L</code> */
|
/** Constant <code>serialVersionUID=-4147745071116906043L</code> */
|
||||||
private static final long serialVersionUID = -4147745071116906043L;
|
private static final long serialVersionUID = -4147745071116906043L;
|
||||||
|
|
||||||
|
/** The name. */
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
/** The stall name. */
|
||||||
String stallName;
|
String stallName;
|
||||||
|
|
||||||
|
/** The fluff. */
|
||||||
String fluff;
|
String fluff;
|
||||||
|
|
||||||
|
/** The icon. */
|
||||||
ImageIcon icon;
|
ImageIcon icon;
|
||||||
|
|
||||||
|
|
||||||
private JLabel creditLabel = new JLabel();
|
private JLabel creditLabel = new JLabel();
|
||||||
private JPanel inventoryPanel = new JPanel();
|
private JPanel inventoryPanel = new JPanel();
|
||||||
|
|
||||||
|
/** The quest data. */
|
||||||
protected QuestData questData = AllZone.getQuestData();
|
protected QuestData questData = AllZone.getQuestData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
/** Forge Card Game */
|
/** Forge Card Game. */
|
||||||
package forge.quest.gui.bazaar;
|
package forge.quest.gui.bazaar;
|
||||||
|
|||||||
Reference in New Issue
Block a user