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