Class Product

java.lang.Object
  |
  +--Product

public class Product
extends java.lang.Object

A simple helper class for the course T-106.233 assignment 2 (GUI). This class is specifically for the purposes of the assignment and is not meant to serve any greater good.


Constructor Summary
Product()
          Constructs a new Product and initializes it's name, size, color, price, amount available and supplier by making up some values.
 
Method Summary
 java.lang.String getAmountAvailable()
           
 java.lang.String getPrice()
           
 java.lang.String getPriceWithEuroSign()
           
 java.lang.String getProductInfo()
           
 java.lang.String getSupplier()
          Use this if you use a JTextField instead of a JComboBox for changing the supplier.
 int getSupplierIndex()
          This method is intended for use with the JComboBox in the part 3 of the assignment.
 java.util.Vector getSuppliers()
          This method is intended for use with the JComboBox in the part 3 of the assignment.
 void setAmountAvailable(java.lang.String newAmountAvailable)
          Sets a new amount available for this Product
 void setPrice(java.lang.String newPrice)
          Sets a new price for this Product.
 void setSupplier(int newIndex)
          Sets a new supplier for this Product.
 void setSupplier(java.lang.String newSupplier)
          Sets a new supplier for this Product.
 java.lang.String toString()
          This method takes care of the String representation of this Product in a JList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Product

public Product()
Constructs a new Product and initializes it's name, size, color, price, amount available and supplier by making up some values.

Method Detail

getAmountAvailable

public java.lang.String getAmountAvailable()
Returns:
the amount available of this product.

getPrice

public java.lang.String getPrice()
Returns:
the price of this Product.

getPriceWithEuroSign

public java.lang.String getPriceWithEuroSign()
Returns:
the price of this Product followed by a Euro sign.

getProductInfo

public java.lang.String getProductInfo()
Returns:
the information of this Product, each attribute on it's own line.

getSupplier

public java.lang.String getSupplier()
Use this if you use a JTextField instead of a JComboBox for changing the supplier.

Returns:
the name of the current supplier

getSupplierIndex

public int getSupplierIndex()
This method is intended for use with the JComboBox in the part 3 of the assignment.

Returns:
the index of the current supplier of this Product.

getSuppliers

public java.util.Vector getSuppliers()
This method is intended for use with the JComboBox in the part 3 of the assignment.

Returns:
all the possible suppliers for this product.

setAmountAvailable

public void setAmountAvailable(java.lang.String newAmountAvailable)
Sets a new amount available for this Product

Parameters:
newAmountAvailable - the new amount available that you propably got from a JTextField.

setPrice

public void setPrice(java.lang.String newPrice)
Sets a new price for this Product.

Parameters:
newPrice - the new price that you propably got from a JTextField.

setSupplier

public void setSupplier(int newIndex)
Sets a new supplier for this Product. This method is intended for use with the JComboBox in the part 3 of the assignment.

Parameters:
newIndex - the new index that is supposed to come from the selection in a JComboBox.

setSupplier

public void setSupplier(java.lang.String newSupplier)
Sets a new supplier for this Product. Use this if you use a JTextField instead of a JComboBox for changing the supplier.

Parameters:
newSupplier - the name of the new supplier.

toString

public java.lang.String toString()
This method takes care of the String representation of this Product in a JList. Called automatically when you add this product as an element to the JList.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Product.