SOURCECODE |
How to... incorporate a SalesPoint
Description:
The SalesPoint is a part of the Shop. A Shop usually consists of one SalesPoint at least. SaleProcesses take place at a Point of Sale in most cases. They could be startet easily with public void runProcess(SaleProcess p)
method.
The SalesPoint appeares in a seperate Frame, a JDisplayFrame. In the JTabbedPane of the Shop appeares the SalesPoints StatusDisplay. It could be used for different purposes.
(See also: HowTo..define a FormSheet for a SalesPoint, HowTo..define the StatusFormSheet for a SalesPoint )
The FormSheets could be both added with MenuSheets, which could be used to start Processes or to open other SalesPoints or to close them.
(See also: HowTo..define a MenuSheet in a SalesPoint, HowTo..define the StatusMenuSheet for a SalesPoint )
ToDo's:
- Incorporate a subclass of SalesPoint.
- Add constructor (it is usefull to set the SalesPoint´s name equal to it´s class name).
- Implement
protected FormSheet getDefaultFormSheet()
to define SalesPoint´s FormSheet.
- Implement
protected MenuSheet getDefaultMenuSheet()
to define SalesPoint´s MenuSheet.
- Eventuelly implement
public FormSheet getDefaultStatusFormSheet()
to define SalesPoint´s StatusFormSheet.
- Eventuelly implement
public MenuSheet getDefaultStatusMenuSheet()
to define SalesPoint´s StatusMenuSheet.
Uses:
SalesPoint SaleProcess FormSheet FormSheetContentCreator SingleTableFormSheet TwoTableFormSheet MenuSheet
import sale.SalesPoint;
import sale.SaleProcess;
import sale.FormSheet;
import sale.FormSheetContentCreator;
import sale.MenuSheet;
1
// Main Class
public class VideoCounter extends SalesPoint
{
2
// Constructor
public VideoCounter()
{
super("VideoCounter");
}
3
// Method to define FormSheet in the JDisplayFrame of the SalesPoint
// It should be defined in most cases
protected FormSheet getDefaultFormSheet()
{
// The use of FormSheetContentCreators makes FormSheets serialisable
FormSheetContentCreator fscc =
new FormSheetContentCreator()
{
protected void createFormSheetContent(FormSheet fs)
{
// FormSheet will be stripped of standard OK/Cancel - Buttons
fs.removeAllButtons();
// FormButton called "RentProcess" will invoke RentProcess
fs.addButton("RentProcess", 101,
new sale.Action()
{
public void doAction (SaleProcess p, SalesPoint sp)
{
sp.runProcess(new RentProcess());
}
});
}
};
// FormSheet of the SalesPoint defined with FSCC
FormSheet fs = new FormSheet("VideoCounter", // caption of FormSheet
fscc, // the used FormSheetContentCreator
false); // application will not be blocked until SalesPointFrame is closed
// return defined FormSheet
return fs;
}
4
// Method to define MenuSheet in the JDisplayFrame of the SalesPoint
// It could be defined
protected MenuSheet getDefaultMenuSheet()
{
return null;
}
5
// Method to define FormSheet in the JTabbedPane, named like the SalesPoint, in the ShopFrame
// Since Version 3.0, definition makes not really sense,
// because you should use the Methods above.
public FormSheet getDefaultStatusFormSheet()
{
return null;
}
6
// Method to define MenuSheet in the JTabbedPane, named like the SalesPoint, in the ShopFrame
// Since Version 3.0, definition makes not really sense,
// because you should use the Methods above.
public MenuSheet getDefaultStatusMenuSheet()
{
return null;
}
}