Großmarkt

market
Class SMarket

java.lang.Object
  |
  +--sale.Shop
        |
        +--market.SMarket
All Implemented Interfaces:
EventListener, Serializable, SerializableListener

public class SMarket
extends Shop

The Shop of this sale-application.

See Also:
Serialized Form

Field Summary
static String CAT_ARTICLECATALOG
           
static String CAT_COMPLETE_SALESSTATS
           
static String CAT_CUSTOMER
           
static String CAT_OPENPURCHASE
           
static String MARKET_CLOSED
           
static String MARKET_CLOSES_LONG
           
static String MARKET_CLOSES_NOT
           
static String MARKET_CLOSES_SHORT
           
static String MARKET_OPENED
           
static String STK_OFFER
           
static String STK_TILLQUEUE
           
static String STK_WAREHOUSEQUEUE
           
 
Fields inherited from class sale.Shop
DEAD, LOAD_TAG, m_jfShopFrame, m_lphProcesses, m_lspSalesPoints, m_mpToPersistify, m_rShopFrameBounds, m_sShopFrameTitle, m_trTimer, QUIT_SHOP_TAG, RUNNING, SAVE_TAG, SEPARATOR_ONE_TAG, SEPARATOR_TWO_TAG, SET_CURRENT_SP_TAG, SHOP_MENU_TAG, SUSPENDED
 
Constructor Summary
SMarket(Time time)
          Creates an SMarket, initiates global Catalogs, Stocks and other settings.
 
Method Summary
static void addEventListener(MarketEventListener e)
          Adds a new EventListener to the market.
 void addSalesPoint(SalesPoint sp)
          Adds a SalesPoint to the market attaches a MarketEventListener to it.
static void addToAccount(Value money)
          Adds a Value to the markets account.
 MenuSheet createShopMenuSheet()
          Creates the MenuSheet of the SMarket
static void fireMarketClosed()
          Fires an event to all listeners: The market has just closed.
static void fireMarketClosing()
          Fires an event to all listeners: The market is about to close.
static void fireMarketNotClosing()
          Fires an event to all listeners: The market isn't about to close anymore.
static void fireMarketOpened()
          Fires an event to all listeners: The market has just opened.
static void fireTimeAdvanced()
          Fires an event to all listeners: The time has advanced..
static void fireUpdateWorkerScreen()
          Fires an event to all listeners: The number of workers or orders to process has changed.
static Value getAccount()
           
static CArticleCatalog getArticleCatalog()
          Shortcut for catalog with all articles.
static Object[] getArticleCategories()
          Returns Categories of all available Articles.
static CCompleteStats getCompleteSalesStats()
          Shortcut to the statistics catalog
static Catalog getCustomers()
          Shortcut to the catalog that holds all customers of the market.
static CCustomerStats getCustomerStats()
          Shortcut to the customer stats catalog
static CSalesStats getDailySalesStats()
          Shortcut to the catalog that holds the current day's statistics.
static Calendar getDateOfOpening()
           
static int getMonth()
          Convenience method.
static CSalesStats getMonthlySalesStats()
          Shortcut to the catalog that holds the current month's statistics.
static CSOffer getOffer()
          Shortcut to the market's current stock.
static COpenPurchaseOrders getOpenPurchaseOrder()
          Shortcut to the catalog that holds the market's purchases which have not yet arrived.
static Options getOptions()
           
 JFrame getShopFrame()
          Returns the JFrame of the Shop window.
static SMarket getTheMarket()
           
static SSListenable getTillQueue()
          Shortcut for the queue of customers who want to pay.
static Calendar getTime()
          Convenience method
static SSListenable getWarehouseQueue()
          Shortcut for the queue of orders waiting at the warehouse.
static int getYear()
          Convencience method.
static boolean hasTimeAdvanced()
           
static boolean isOpen()
           
static boolean isToBeClosed()
           
 void quit()
          Closes the SMarket.
static void removeEventListener(MarketEventListener e)
          Removes an EventListener from the market.
 void removeSalesPoint(SalesPoint sp)
          Removes a SalesPoint to the market detachses its MarketEventListener.
 void resume()
          Sets the icon when market is loaded from persistence file.
static void setNextDay()
          Advances the market's time by 1 day.
 void setOpen(int i)
          Sets the market's state.
static void setTime(Calendar newTime)
          Sets the market's time to a new date.
 void start()
          Starts the Shop and initializes statistics items.
static void subtractFromAccount(Value money)
          Subtracts a Value from the markets account.
 
Methods inherited from class sale.Shop
addCatalog, addStock, canShutdown, clearInternalStructures, createShopFrame, getCatalog, getCurrentSalesPoint, getPersistentObject, getPersistentObjects, getProcessesLock, getSalesPoint, getSalesPoints, getSalesPointsLock, getShopFrameBounds, getShopFrameTitle, getShopState, getStock, getTheShop, getTimer, isCurrentSalesPointAdjusting, log, makePersistent, onLoadFrames, onSalesPointAdded, onSalesPointRemoved, onSaveFrames, removeCatalog, removeStatusDisplay, removeStock, resetCurrentSalesPointIsAdjusting, restore, retrievePersistenceInStream, retrievePersistenceOutStream, runBackgroundProcess, runProcess, setCurrentSalesPoint, setCurrentSalesPointIsAdjusting, setObjectPersistent, setObjectTransient, setShopFrameBounds, setShopFrameTitle, setTheShop, setTimer, setViewMode, shutdown, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAT_ARTICLECATALOG

public static final String CAT_ARTICLECATALOG
See Also:
Constant Field Values

CAT_OPENPURCHASE

public static final String CAT_OPENPURCHASE
See Also:
Constant Field Values

CAT_CUSTOMER

public static final String CAT_CUSTOMER
See Also:
Constant Field Values

CAT_COMPLETE_SALESSTATS

public static final String CAT_COMPLETE_SALESSTATS
See Also:
Constant Field Values

STK_OFFER

public static final String STK_OFFER
See Also:
Constant Field Values

STK_TILLQUEUE

public static final String STK_TILLQUEUE
See Also:
Constant Field Values

STK_WAREHOUSEQUEUE

public static final String STK_WAREHOUSEQUEUE
See Also:
Constant Field Values

MARKET_CLOSES_SHORT

public static final String MARKET_CLOSES_SHORT
See Also:
Constant Field Values

MARKET_CLOSES_LONG

public static final String MARKET_CLOSES_LONG
See Also:
Constant Field Values

MARKET_CLOSES_NOT

public static final String MARKET_CLOSES_NOT
See Also:
Constant Field Values

MARKET_CLOSED

public static final String MARKET_CLOSED
See Also:
Constant Field Values

MARKET_OPENED

public static final String MARKET_OPENED
See Also:
Constant Field Values
Constructor Detail

SMarket

public SMarket(Time time)
Creates an SMarket, initiates global Catalogs, Stocks and other settings.

Method Detail

getShopFrame

public JFrame getShopFrame()
Returns the JFrame of the Shop window. The difference to the Shop's getShopFrame() method is, that this one is public, as the Shop's window is needed by a dialog.

Overrides:
getShopFrame in class Shop
Returns:
the Shop's frame.
See Also:
JDDShowMessage.showMessageDialog(String, String)

start

public void start()
Starts the Shop and initializes statistics items.

Overrides:
start in class Shop

quit

public void quit()
Closes the SMarket.

Overrides:
quit in class Shop

resume

public void resume()
Sets the icon when market is loaded from persistence file.

Overrides:
resume in class Shop

createShopMenuSheet

public MenuSheet createShopMenuSheet()
Creates the MenuSheet of the SMarket

Overrides:
createShopMenuSheet in class Shop
Returns:
the MenuSheet of the SMarket

addSalesPoint

public void addSalesPoint(SalesPoint sp)
Adds a SalesPoint to the market attaches a MarketEventListener to it.

Overrides:
addSalesPoint in class Shop
Parameters:
sp - the SalesPoint to be added.

removeSalesPoint

public void removeSalesPoint(SalesPoint sp)
Removes a SalesPoint to the market detachses its MarketEventListener.

Overrides:
removeSalesPoint in class Shop
Parameters:
sp - the SalesPoint to be removed.

addToAccount

public static void addToAccount(Value money)
Adds a Value to the markets account.

Parameters:
money - the Value that will be added.

subtractFromAccount

public static void subtractFromAccount(Value money)
Subtracts a Value from the markets account.

Parameters:
money - the Value that will be substracted.

getAccount

public static Value getAccount()
Returns:
the account of the market as Value.

getOptions

public static Options getOptions()

getTheMarket

public static SMarket getTheMarket()
Returns:
the singleton instance of SMarket.

getArticleCatalog

public static CArticleCatalog getArticleCatalog()
Shortcut for catalog with all articles.


getOffer

public static CSOffer getOffer()
Shortcut to the market's current stock.


getOpenPurchaseOrder

public static COpenPurchaseOrders getOpenPurchaseOrder()
Shortcut to the catalog that holds the market's purchases which have not yet arrived.


getCustomers

public static Catalog getCustomers()
Shortcut to the catalog that holds all customers of the market. This catalog is needed as a base for till- and warehouse-queue.


getTillQueue

public static SSListenable getTillQueue()
Shortcut for the queue of customers who want to pay.


getWarehouseQueue

public static SSListenable getWarehouseQueue()
Shortcut for the queue of orders waiting at the warehouse.


getDailySalesStats

public static CSalesStats getDailySalesStats()
Shortcut to the catalog that holds the current day's statistics.


getMonthlySalesStats

public static CSalesStats getMonthlySalesStats()
Shortcut to the catalog that holds the current month's statistics.


getCompleteSalesStats

public static CCompleteStats getCompleteSalesStats()
Shortcut to the statistics catalog


getCustomerStats

public static CCustomerStats getCustomerStats()
Shortcut to the customer stats catalog


getArticleCategories

public static Object[] getArticleCategories()
Returns Categories of all available Articles. This method is used by dropdown filters for initialization.


setOpen

public void setOpen(int i)
Sets the market's state.

Parameters:
i -
  • 0: The market is open, customers can buy
  • 1: The market is about to close, customers cannot login nor start new purchases, even if they are already logged in.
  • 2: The market is closed, only the manager can log in

isOpen

public static boolean isOpen()
Returns:
whether the market is currently open or not.

isToBeClosed

public static boolean isToBeClosed()
Returns:
whether the manager has announced the market's closing or not.

hasTimeAdvanced

public static boolean hasTimeAdvanced()
Returns:
whether the time has advanced or not.
See Also:
#timeAdvanced

getTime

public static Calendar getTime()
Convenience method

Returns:
the current date.

getDateOfOpening

public static Calendar getDateOfOpening()
Returns:
the date that the market has started its business.

getYear

public static int getYear()
Convencience method.

Returns:
the current year.

getMonth

public static int getMonth()
Convenience method.

Returns:
the current month.

setTime

public static void setTime(Calendar newTime)
Sets the market's time to a new date.

Parameters:
newTime - the new date to be set.

setNextDay

public static void setNextDay()
Advances the market's time by 1 day.


addEventListener

public static void addEventListener(MarketEventListener e)
Adds a new EventListener to the market.


removeEventListener

public static void removeEventListener(MarketEventListener e)
Removes an EventListener from the market.


fireMarketClosing

public static void fireMarketClosing()
Fires an event to all listeners: The market is about to close. (Which means, the manager pressed his "Closing-Time" button.)


fireMarketNotClosing

public static void fireMarketNotClosing()
Fires an event to all listeners: The market isn't about to close anymore. (Which means, the manager canceled closing time.)


fireMarketClosed

public static void fireMarketClosed()
Fires an event to all listeners: The market has just closed.


fireMarketOpened

public static void fireMarketOpened()
Fires an event to all listeners: The market has just opened.


fireTimeAdvanced

public static void fireTimeAdvanced()
Fires an event to all listeners: The time has advanced..


fireUpdateWorkerScreen

public static void fireUpdateWorkerScreen()
Fires an event to all listeners: The number of workers or orders to process has changed.


Großmarkt