|
SalesPoint Framework v3.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sale.SalesPoint
A single point of sale in a shop.
SalesPoints represent single points of sale in a Shop
at which user interaction occurs.
Examples for such SalesPoints are cash counters, box offices, ticket vending machines etc.
Normally, you will have at least one SalesPoint in your application.
Services available at SalesPoints are implemented as processes. There can be at most one process running at a SalesPoint at any given point of time.
SalesPoints are process contexts to the processes running at them. They provide data and log access, as well as a display and current user. When a SalesPoint is created, a display is attached to it, which will be used by the process.
A user can be attached to the SalesPoint. Its capabilities will determine what can and cannot be done at the SalesPoint.
Field Summary | |
protected SaleProcess |
m_pCurProcess
The process currently running on this SalesPoint, if any. |
Constructor Summary | |
SalesPoint(String sName)
Create a new SalesPoint. |
Method Summary | |
DataBasket |
attach(DataBasket db)
Attach a DataBasket to this SalesPoint. |
Display |
attach(Display d)
Attach a new display to the SalesPoint. |
User |
attach(User usr)
Attach a user to this SalesPoint. |
protected Display |
attachStatusDisplay(Display dStatus)
Attach a status display to the SalesPoint. |
protected boolean |
canQuit(boolean fNoPersistence)
Check whether this SalesPoint can be closed. |
DataBasket |
detachBasket()
Detach any DataBasket currently attached to this SalesPoint. |
Display |
detachDisplay()
Detach the current display. |
protected Display |
detachStatusDisplay()
Detach the current status display. |
User |
detachUser()
Detach any user currently attached to this SalesPoint. |
void |
formSheetRemoved(FormSheetEvent e)
Implemented to make sure there always is a FormSheet. |
void |
formSheetSet(FormSheetEvent e)
Dummy interface to conform by the FormSheetListener interface. |
DataBasket |
getBasket()
Get the DataBasket currently attached to this SalesPoint. |
Catalog |
getCatalog(String sName)
Return a Catalog for a given name. |
SaleProcess |
getCurrentProcess()
Get the process currently running on this SalesPoint, if any. |
User |
getCurrentUser(SaleProcess p)
Get the current user for the given process. |
protected FormSheet |
getDefaultFormSheet()
Get the default FormSheet for this SalesPoint. |
protected MenuSheet |
getDefaultMenuSheet()
Get the default MenuSheet for this SalesPoint. |
protected FormSheet |
getDefaultStatusFormSheet()
Get the default status FormSheet for this SalesPoint. |
protected MenuSheet |
getDefaultStatusMenuSheet()
Get the default status MenuSheet for this SalesPoint. |
Display |
getDisplay()
Return the display of this SalesPoint. |
String |
getName()
Return the name of this SalesPoint. |
protected Object |
getProcessLock()
Return the monitor synchronizing process access. |
Rectangle |
getSalesPointFrameBounds()
Returns the Framebounds of the SalesPoints assoziated Display(JDisplayFrame). |
Stock |
getStock(String sName)
Return a Stock for a given name. |
User |
getUser()
Get the user currently attached to this SalesPoint. |
boolean |
hasUseableDisplay(SaleProcess p)
True, if the SalesPoint currently has a display and this display is useable. |
void |
log(SaleProcess p,
Loggable la)
Log the given Loggable. |
protected void |
logSalesPointClosed()
Hook method called when the SalesPoint is removed from a Shop. |
protected void |
logSalesPointOpened()
Hook method called when the SalesPoint is added to a Shop. |
protected boolean |
onCanQuit()
Hook method called to determine whether a SalesPoint with no process running on it can be closed by an explicit quit call. |
void |
popUpFormSheet(SaleProcess p,
FormSheet fs)
Allow a process to pop up a FormSheet on the SalesPoint's current display. |
void |
processFinished(SaleProcess p)
Notification that a process finished running on this SalesPoint. |
void |
processStarted(SaleProcess p)
Notification that a process started on a SalesPoint. |
void |
quit()
Close the SalesPoint. |
void |
resume()
Resume the SalesPoint. |
void |
runProcess(SaleProcess p)
Start a process on this SalesPoint. |
void |
setFormSheet(SaleProcess p,
FormSheet fs)
Allow a process to set a FormSheet on the SalesPoint's current display. |
void |
setMenuSheet(SaleProcess p,
MenuSheet ms)
Allow a process to set a MenuSheet on the SalesPoint's current display. |
void |
setSalesPointFrameBounds(Rectangle r)
Sets the Framebounds of the SalesPoints assoziated Display (JDisplayFrame). |
protected void |
setStatusFormSheet(FormSheet fs)
Set a FormSheet in the SalesPoint's status display. |
protected void |
setStatusMenuSheet(MenuSheet ms)
Set a MenuSheet in the SalesPoint's status display. |
void |
suspend()
Suspend the SalesPoint. |
String |
toString()
Return a String description of this SalesPoint: the name. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected SaleProcess m_pCurProcess
Constructor Detail |
public SalesPoint(String sName)
sName
- the name of the SalesPoint.Method Detail |
protected final Object getProcessLock()
public String getName()
protected boolean canQuit(boolean fNoPersistence)
canQuit
the result of this method may not
be reliable.
By default, if a process runs on the SalesPoint its canQuit
method is called. If no process is running, and fNoPersistence
is true
,
onCanQuit()
is called which opens a MsgForm to ask the user whether he/she really wants to close
the SalesPoint. If fNoPersistence
is false
and no process is running on the
SalesPoint, the default implementation always returns true
.
This method is usually not called directly.
fNoPersistence
- true
if the call to canQuit
resulted from an
explicit call to quit()
or from a call to Shop.shutdown (false). If
fNoPersistence == false
you can assume, the state of the SalesPoint will be made persistent
before it is closed.protected boolean onCanQuit()
MsgForm
asking the user if
they really want to close the SalesPoint.public void quit()
First suspends the SalesPoint, then calls canQuit(boolean)
. If that returns
false
, quit
will resume()
the SalesPoint and return. Otherwise,
it quits the current process, if any, and
removes the SalesPoint from the Shop.
protected void logSalesPointOpened()
Shop.addSalesPoint(sale.SalesPoint)
,
Log
,
LogEntry
protected void logSalesPointClosed()
Shop.removeSalesPoint(sale.SalesPoint)
,
Log
,
LogEntry
public final void runProcess(SaleProcess p)
The process will run in the context of this SalesPoint, and with the DataBasket attached to this SalesPoint.
Although there can only be one process at a time running on this SalesPoint, no exception is thrown if a process already runs. Instead, the new process is silently ignored.
p
- the process to be run.public final SaleProcess getCurrentProcess()
public void suspend() throws InterruptedException
If a process is running on the SalesPoint, it is suspended. The method will only return when the SalesPoint has been properly suspended.
public void resume()
If a process is running on the SalesPoint, it is resumed.
public User attach(User usr)
The user attached to a SalesPoint can be accessed by processes running on the SalesPoint an can be used to determine capabilities etc.
usr
- the user to be attached.public User detachUser()
public User getUser()
public DataBasket attach(DataBasket db)
db
- the DataBasket to be attached.public DataBasket detachBasket()
public DataBasket getBasket()
protected Display attachStatusDisplay(Display dStatus)
This display can be used to give status information about the SalesPoint. It can also be used to trigger background processes for the SalesPoint. It should not be used to trigger processes on the SalesPoint.
If the given display is not null
, it must be useable.
dStatus
- the new status display for this SalesPoint.protected Display detachStatusDisplay()
protected void setStatusFormSheet(FormSheet fs)
Status display FormSheet's are always nonmodal, which is why this method returns immediately after setting the FormSheet and can never throw an InterruptedException.
fs
- the FormSheet to be set.protected void setStatusMenuSheet(MenuSheet ms)
ms
- the MenuSheet to be set.protected MenuSheet getDefaultStatusMenuSheet()
Unless you specify differently through an explicit call to setStatusMenuSheet(sale.MenuSheet)
, the Framework
will use this MenuSheet for the SalesPoint's status display.
null
to indicate no MenuSheet.attachStatusDisplay(sale.Display)
protected FormSheet getDefaultStatusFormSheet()
Unless you specify differently through an explicit call to setStatusFormSheet(sale.FormSheet)
, the Framework
will use this FormSheet for the SalesPoint's status display.
attachStatusDisplay(sale.Display)
public Display attach(Display d)
Any Form- or MenuSheets displayed on the current display will be removed, and the SalesPoint's default sheets will be set on the new display.
d
- the new displaygetDefaultFormSheet()
,
getDefaultMenuSheet()
public Display detachDisplay()
Any Form- or MenuSheet on the current display will be removed before detaching the display.
public Display getDisplay()
protected FormSheet getDefaultFormSheet()
The default FormSheet will be displayed whenever there is a current user (and, thus, a display), but no process is running and no other FormSheet is being displayed.
protected MenuSheet getDefaultMenuSheet()
The default MenuSheet will be displayed whenever there is a current user (and, thus, a display), but no process is running.
null
indicating no MenuSheet.public void setFormSheet(SaleProcess p, FormSheet fs) throws InterruptedException
The process launching the FormSheet as well as this SalesPoint will be attached to the FormSheet prior to displaying it. Thus, Actions triggered by the FormSheet will run in the correct context and will be able to access the process and the SalesPoint.
If the FormSheet requests that the Framework wait for it being closed,
setFormSheet()
will block until the FormSheet was closed or an interrupt occured.
p
- the process that wants to display the FormSheet.fs
- the FormSheet to be displayed.Action
,
FormSheet.waitResponse()
public void setSalesPointFrameBounds(Rectangle r)
Example:
sp.setSalesPointFrameBounds (new Rectangle (10,10,200,200));
This moves the SalesPointFrame to Position (10,10) with a size of (200,200).
public Rectangle getSalesPointFrameBounds()
public void popUpFormSheet(SaleProcess p, FormSheet fs) throws InterruptedException
The process launching the FormSheet as well as this SalesPoint will be attached to the FormSheet prior to displaying it. Thus, Actions triggered by the FormSheet will run in the correct context and will be able to access the process and the SalesPoint.
If the FormSheet requests that the Framework wait for it being closed,
popUpFormSheet
will block until the FormSheet was closed or an interrupt occured.
p
- the process that wants to display the FormSheet.fs
- the FormSheet to be displayed.Action
,
FormSheet.waitResponse()
public void setMenuSheet(SaleProcess p, MenuSheet ms)
The process setting the MenuSheet as well as this SalesPoint will be attached to the MenuSheet prior to displaying it. Thus, Actions triggered by the MenuSheet will run in the correct context and will be able to access the process and the SalesPoint.
p
- the process that wants to display the MenuSheet.ms
- the MenuSheet to be displayed.Action
public boolean hasUseableDisplay(SaleProcess p)
p
- the process querying, unused.Display.isUseableDisplay()
public void log(SaleProcess p, Loggable la) throws IOException
The given loggable object will be logged into the global log file unless you override this method.
p
- the SalesProcess demanding logging, unused.la
- the object to be logged.public final User getCurrentUser(SaleProcess p)
attach(User)
method.p
- the process querying, unused.getUser()
public Stock getStock(String sName)
sName
- the name of the Stock.public Catalog getCatalog(String sName)
sName
- the name of the Catalog.public void processStarted(SaleProcess p)
This will remove all SalesPoint owned Form- and MenuSheets from the display, as to make room for the process' sheets.
p
- the process that was just launched.public void processFinished(SaleProcess p)
This will restore the SalesPoint's default sheets.
public void formSheetSet(FormSheetEvent e)
public void formSheetRemoved(FormSheetEvent e)
public String toString()
|
SalesPoint Framework v3.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |