From d6af34bb7a737ecc3b4c4cca30e2df2bde07841d Mon Sep 17 00:00:00 2001 From: David McMackins II Date: Thu, 1 Dec 2016 08:39:23 -0600 Subject: Add doc comments --- src/com/delwink/icebox/DataDir.java | 5 ++++- src/com/delwink/icebox/Inventory.java | 15 +++++++++++++++ src/com/delwink/icebox/QuantityUpdate.java | 4 ++++ src/com/delwink/icebox/swing/InventoryItemEditor.java | 9 +++++++++ src/com/delwink/icebox/swing/OrderEditor.java | 6 ++++++ src/com/delwink/icebox/swing/OrderListDialog.java | 5 +++++ src/com/delwink/icebox/swing/QuantityUpdateDialog.java | 6 +++++- src/com/delwink/icebox/swing/ReportResultsDialog.java | 11 +++++++++++ src/com/delwink/icebox/swing/SettingsDialog.java | 4 ++++ src/com/delwink/icebox/swing/SoldVsWasteReportDialog.java | 6 +++++- src/com/delwink/icebox/swing/TextChangeListener.java | 8 ++++++++ 11 files changed, 76 insertions(+), 3 deletions(-) diff --git a/src/com/delwink/icebox/DataDir.java b/src/com/delwink/icebox/DataDir.java index e1986ad..8b66ff7 100644 --- a/src/com/delwink/icebox/DataDir.java +++ b/src/com/delwink/icebox/DataDir.java @@ -25,6 +25,9 @@ import java.io.FileNotFoundException; * @author David McMackins II */ public final class DataDir { + /** + * A File object referring to the file which stores the inventory data. + */ public static final File INVENTORY_FILE = getDataFile("inventory.xml"); private static File rootDir = null; @@ -71,7 +74,7 @@ public final class DataDir { } } - private static boolean isWinblows() { + private static boolean isWinblows() { // tee hee return System.getProperty("os.name").toLowerCase().startsWith("win"); } } diff --git a/src/com/delwink/icebox/Inventory.java b/src/com/delwink/icebox/Inventory.java index 019b015..3e15549 100644 --- a/src/com/delwink/icebox/Inventory.java +++ b/src/com/delwink/icebox/Inventory.java @@ -177,6 +177,9 @@ public class Inventory { writer.flush(); } + /** + * Refreshes the quantities of items in stock based on orders and updates. + */ public void refreshQuantities() { for (InventoryItem item : ITEMS.values()) item.addStock(-item.getStock()); // clear stock before refreshing @@ -192,6 +195,10 @@ public class Inventory { addUpdate(update); } + /** + * Adds an order to this inventory stock. + * @param order The order to be added. + */ public final void addOrder(Order order) { ORDERS.add(order); @@ -208,6 +215,10 @@ public class Inventory { return ORDERS; } + /** + * Adds a quantity update to this inventory's stock. + * @param update The update to be added. + */ public final void addUpdate(QuantityUpdate update) { UPDATES.add(update); @@ -240,6 +251,10 @@ public class Inventory { return ITEMS.get(id); } + /** + * Finds the next unused item ID. + * @return The next available item ID for use. + */ public int getNextID() { Set keys = ITEMS.keySet(); for (int i = 0; i <= keys.size(); ++i) diff --git a/src/com/delwink/icebox/QuantityUpdate.java b/src/com/delwink/icebox/QuantityUpdate.java index 840cee2..1e85ab9 100644 --- a/src/com/delwink/icebox/QuantityUpdate.java +++ b/src/com/delwink/icebox/QuantityUpdate.java @@ -31,6 +31,10 @@ public class QuantityUpdate implements Iterable { protected final List RECORDS; protected Date updateDate; + /** + * Creates a new quantity update with a specific date. + * @param date The date of this update. + */ public QuantityUpdate(Date date) { RECORDS = new ArrayList<>(); updateDate = date; diff --git a/src/com/delwink/icebox/swing/InventoryItemEditor.java b/src/com/delwink/icebox/swing/InventoryItemEditor.java index 0e64a93..1c056a2 100644 --- a/src/com/delwink/icebox/swing/InventoryItemEditor.java +++ b/src/com/delwink/icebox/swing/InventoryItemEditor.java @@ -41,6 +41,10 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; +/** + * A dialog for managing inventory items. + * @author David McMackins II + */ public class InventoryItemEditor extends JDialog { private final List CHANGES; private final Inventory INVENTORY; @@ -48,6 +52,11 @@ public class InventoryItemEditor extends JDialog { private final JButton ADD_BUTTON, CANCEL_BUTTON, SAVE_BUTTON; private final JTable TABLE; + /** + * Creates a new dialog. + * @param parent The parent frame of this dialog. + * @param inventory The inventory for editing. + */ public InventoryItemEditor(Frame parent, Inventory inventory) { super(parent, Lang.get("InventoryItemEditor.title")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); diff --git a/src/com/delwink/icebox/swing/OrderEditor.java b/src/com/delwink/icebox/swing/OrderEditor.java index 3e29402..80cec0d 100644 --- a/src/com/delwink/icebox/swing/OrderEditor.java +++ b/src/com/delwink/icebox/swing/OrderEditor.java @@ -60,6 +60,12 @@ public class OrderEditor extends JDialog { private boolean orderNumberChanged = false; + /** + * Creates a new editor. + * @param parent The parent frame of this dialog. + * @param inventory The inventory to which this order applies. + * @param order The order to be edited. + */ public OrderEditor(Frame parent, Inventory inventory, Order order) { super(parent, Lang.get("OrderEditor.title")); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); diff --git a/src/com/delwink/icebox/swing/OrderListDialog.java b/src/com/delwink/icebox/swing/OrderListDialog.java index 4a5a698..c0387ab 100644 --- a/src/com/delwink/icebox/swing/OrderListDialog.java +++ b/src/com/delwink/icebox/swing/OrderListDialog.java @@ -53,6 +53,11 @@ public class OrderListDialog extends JDialog { private final JTable LIST_TABLE; private final Inventory INVENTORY; + /** + * Creates a new list dialog. + * @param parent The parent frame of this dialog. + * @param inventory The inventory whose orders will be listed. + */ public OrderListDialog(final Frame parent, Inventory inventory) { super(parent, Lang.get("OrderList.title")); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); diff --git a/src/com/delwink/icebox/swing/QuantityUpdateDialog.java b/src/com/delwink/icebox/swing/QuantityUpdateDialog.java index 1193eff..a66b2f6 100644 --- a/src/com/delwink/icebox/swing/QuantityUpdateDialog.java +++ b/src/com/delwink/icebox/swing/QuantityUpdateDialog.java @@ -54,6 +54,11 @@ public class QuantityUpdateDialog extends JDialog { private final JTable TABLE; private final QuantityUpdate UPDATE; + /** + * Creates a new quantity update for editing. + * @param parent The parent frame of this dialog. + * @param inventory The inventory to which this update will apply. + */ public QuantityUpdateDialog(Frame parent, Inventory inventory) { super(parent, Lang.get("QuantityUpdate.title")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); @@ -134,5 +139,4 @@ public class QuantityUpdateDialog extends JDialog { pack(); centorOnParent(); } - } diff --git a/src/com/delwink/icebox/swing/ReportResultsDialog.java b/src/com/delwink/icebox/swing/ReportResultsDialog.java index 6bdd83f..fefa2b1 100644 --- a/src/com/delwink/icebox/swing/ReportResultsDialog.java +++ b/src/com/delwink/icebox/swing/ReportResultsDialog.java @@ -38,10 +38,21 @@ public class ReportResultsDialog extends JDialog { private final JButton OK_BUTTON; private final JTable TABLE; + /** + * Creates a new results dialog. + * @param parent The parent frame of this dialog. + * @param model The table model to be used for the results. + */ public ReportResultsDialog(Frame parent, Model model) { this(parent, Lang.get("Report.results"), model); } + /** + * Creates a new results dialog with a custom window title. + * @param parent The parent frame of this dialog. + * @param title The title of the dialog window. + * @param model The table model to be used for the results. + */ public ReportResultsDialog(Frame parent, String title, Model model) { super(parent, title); setDefaultCloseOperation(DISPOSE_ON_CLOSE); diff --git a/src/com/delwink/icebox/swing/SettingsDialog.java b/src/com/delwink/icebox/swing/SettingsDialog.java index 80a0df7..07d67b2 100644 --- a/src/com/delwink/icebox/swing/SettingsDialog.java +++ b/src/com/delwink/icebox/swing/SettingsDialog.java @@ -36,6 +36,10 @@ public class SettingsDialog extends JDialog { private final JButton CANCEL_BUTTON, OK_BUTTON; private final JCheckBox SETLAF; + /** + * Creates a new settings dialog. + * @param parent The parent frame of this dialog. + */ public SettingsDialog(Frame parent) { super(parent, Lang.get("Setting.dialogTitle")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); diff --git a/src/com/delwink/icebox/swing/SoldVsWasteReportDialog.java b/src/com/delwink/icebox/swing/SoldVsWasteReportDialog.java index d3d69bf..acabdc5 100644 --- a/src/com/delwink/icebox/swing/SoldVsWasteReportDialog.java +++ b/src/com/delwink/icebox/swing/SoldVsWasteReportDialog.java @@ -18,7 +18,6 @@ package com.delwink.icebox.swing; import com.delwink.icebox.Inventory; -import com.delwink.icebox.InventoryItem; import com.delwink.icebox.QuantityUpdate; import com.delwink.icebox.lang.Lang; import com.github.lgooddatepicker.components.DatePicker; @@ -44,6 +43,11 @@ public class SoldVsWasteReportDialog extends JDialog { private final DatePicker START_DATE_FIELD, END_DATE_FIELD; private final JButton CANCEL_BUTTON, OK_BUTTON; + /** + * Opens a dialog for running the sold versus waste report. + * @param parent The parent frame of this dialog. + * @param inventory The inventory on which to report. + */ public SoldVsWasteReportDialog(final Frame parent, final Inventory inventory) { super(parent, Lang.get("Report.soldVsWaste")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); diff --git a/src/com/delwink/icebox/swing/TextChangeListener.java b/src/com/delwink/icebox/swing/TextChangeListener.java index 00b4feb..12d931d 100644 --- a/src/com/delwink/icebox/swing/TextChangeListener.java +++ b/src/com/delwink/icebox/swing/TextChangeListener.java @@ -20,6 +20,10 @@ package com.delwink.icebox.swing; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +/** + * A listener for text changing in a field. + * @author David McMackins II + */ public abstract class TextChangeListener implements DocumentListener { @Override public void insertUpdate(DocumentEvent e) { @@ -36,5 +40,9 @@ public abstract class TextChangeListener implements DocumentListener { textChanged(e); } + /** + * Called when text is changed. + * @param e The event captured. + */ public abstract void textChanged(DocumentEvent e); } -- cgit v1.2.3