SalesPoint Framework v3.1

sale
Class Shop.ProcessHandle

java.lang.Object
  extended bysale.Shop.ProcessHandle
All Implemented Interfaces:
ProcessContext, Serializable
Enclosing class:
Shop

protected static class Shop.ProcessHandle
extends Object
implements ProcessContext

A ProcessContext for one remote or background process.

See Also:
Serialized Form

Field Summary
protected  Display m_d
          The display to be used.
protected  DataBasket m_db
          The DataBasket to be used.
protected  SaleProcess m_p
          The process for which this is the context.
protected  User m_usr
          The user to be used as the current user for the process.
 
Constructor Summary
Shop.ProcessHandle(SaleProcess p, Display d, User usr, DataBasket db)
          Create a new ProcessHandle.
 
Method Summary
 boolean canShutdown(boolean fContextDestroy)
          Check whether the process that is handled by this ProcessHandle can be quitted.
 Catalog getCatalog(String sName)
          Get a Catalog by its name.
 User getCurrentUser(SaleProcess p)
          Get the user currently associated with the given process.
 Stock getStock(String sName)
          Get a Stock by its name.
 boolean hasUseableDisplay(SaleProcess p)
          True if the ProcessContext has a useable display for the given process.
 void log(SaleProcess p, Loggable la)
          Put an entry into the ProcessContext's log stream for a process.
 void popUpFormSheet(SaleProcess p, FormSheet fs)
          Pop up a FormSheet for a process.
 void processFinished(SaleProcess p)
          Notification that a process was finished in this ProcessContext.
 void processStarted(SaleProcess p)
          Notification that a process was started in this ProcessContext.
 void resume()
          Resume the process that is handled by this ProcessHandle.
 void setFormSheet(SaleProcess p, FormSheet fs)
          Set a FormSheet for a process.
 void setMenuSheet(SaleProcess p, MenuSheet ms)
          Set a MenuSheet for a process.
 void suspend()
          Suspend the process that is handled by this ProcessHandle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_p

protected SaleProcess m_p
The process for which this is the context.


m_d

protected Display m_d
The display to be used. Defaults to NullDisplay.s_ndGlobal.


m_usr

protected User m_usr
The user to be used as the current user for the process.


m_db

protected DataBasket m_db
The DataBasket to be used.

Constructor Detail

Shop.ProcessHandle

public Shop.ProcessHandle(SaleProcess p,
                          Display d,
                          User usr,
                          DataBasket db)
Create a new ProcessHandle.

Method Detail

setFormSheet

public void setFormSheet(SaleProcess p,
                         FormSheet fs)
                  throws InterruptedException
Description copied from interface: ProcessContext
Set a FormSheet for a process.

The FormSheet will be displayed on the ProcessContext's display for the given process, if there is one and it is useable. Setting a null FormSheet will remove any FormSheet currently being displayed.

Specified by:
setFormSheet in interface ProcessContext
Parameters:
p - the process that wishes to set a FormSheet
fs - the FormSheet that is to be set.
Throws:
InterruptedException - if an interrupt occurred while waiting for the FormSheet to be closed. See Display.setFormSheet for details.
See Also:
Display.setFormSheet(sale.FormSheet)

popUpFormSheet

public void popUpFormSheet(SaleProcess p,
                           FormSheet fs)
                    throws InterruptedException
Description copied from interface: ProcessContext
Pop up a FormSheet for a process.

The FormSheet will be popped up on the ProcessContext's display for the given process, if there is one and it is useable.

Specified by:
popUpFormSheet in interface ProcessContext
Parameters:
p - the process that wishes to pop up a FormSheet
fs - the FormSheet that is to be set.
Throws:
InterruptedException - if an interrupt occurred while waiting for the FormSheet to be closed. See Display.popUpFormSheet for details.
See Also:
Display.popUpFormSheet(sale.FormSheet)

setMenuSheet

public void setMenuSheet(SaleProcess p,
                         MenuSheet ms)
Description copied from interface: ProcessContext
Set a MenuSheet for a process.

The MenuSheet will be displayed on the ProcessContext's display for the given process, if there is one and it is useable. Setting a null MenuSheet will remove any MenuSheet currently being displayed.

Specified by:
setMenuSheet in interface ProcessContext
Parameters:
p - the process that wishes to set a MenuSheet
ms - the MenuSheet that is to be set.
See Also:
Display.setMenuSheet(sale.MenuSheet)

hasUseableDisplay

public boolean hasUseableDisplay(SaleProcess p)
Description copied from interface: ProcessContext
True if the ProcessContext has a useable display for the given process.

Specified by:
hasUseableDisplay in interface ProcessContext
Parameters:
p - the process whose display is to be checked.
See Also:
Display.isUseableDisplay()

log

public void log(SaleProcess p,
                Loggable la)
         throws IOException
Description copied from interface: ProcessContext
Put an entry into the ProcessContext's log stream for a process.

Specified by:
log in interface ProcessContext
Parameters:
p - the process that wishes to put data into the log stream.
la - the information that is to be logged.
Throws:
IOException - if any problems occurred while writing to the log stream.

getCurrentUser

public User getCurrentUser(SaleProcess p)
Description copied from interface: ProcessContext
Get the user currently associated with the given process.

Specified by:
getCurrentUser in interface ProcessContext
Parameters:
p - the process that wishes to know its current user.
Returns:
the current user for the given process.

getStock

public Stock getStock(String sName)
Description copied from interface: ProcessContext
Get a Stock by its name.

The Stock's name is resolved relative to the ProcessContext, so that the same call can result in different Stocks in different ProcessContexts.

Specified by:
getStock in interface ProcessContext
Parameters:
sName - the name of the Stock to be returned.
Returns:
the Stock that was found for the given name, if any.

getCatalog

public Catalog getCatalog(String sName)
Description copied from interface: ProcessContext
Get a Catalog by its name.

The Catalog's name is resolved relative to the ProcessContext, so that the same call can result in different Catalogs in different ProcessContexts.

Specified by:
getCatalog in interface ProcessContext
Parameters:
sName - the name of the Catalog to be returned.
Returns:
the Catalog that was found for the given name, if any.

processStarted

public void processStarted(SaleProcess p)
Description copied from interface: ProcessContext
Notification that a process was started in this ProcessContext.

This method is usually not called directly, but rather the Framework calls it as appropriate.

Specified by:
processStarted in interface ProcessContext
Parameters:
p - the process that was started.

processFinished

public void processFinished(SaleProcess p)
Description copied from interface: ProcessContext
Notification that a process was finished in this ProcessContext.

This method is usually not called directly, but rather the Framework calls it as appropriate.

Specified by:
processFinished in interface ProcessContext
Parameters:
p - the process that was finished.

suspend

public void suspend()
             throws InterruptedException
Suspend the process that is handled by this ProcessHandle.

Throws:
InterruptedException
Override:
Never

resume

public void resume()
Resume the process that is handled by this ProcessHandle.

Override:
Never

canShutdown

public boolean canShutdown(boolean fContextDestroy)
Check whether the process that is handled by this ProcessHandle can be quitted.

The default implementation simply calls

   m_p.canQuit (fContextDestroy);
 
Called by canShutdown(boolean).

Override:
Sometimes

SalesPoint Framework v3.1