HowTo's - Application Architecture: SalesPoint

Implement 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 the 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.
The FormSheets could be both added with MenuSheets, which could be used to start Processes or to open other SalesPoints or to close them.

Used classes:

Related topics:

ToDo:

  1. Create a class that extends SalesPoint
  2. Add the class constructor.
    You can also set the SalesPoints frame size here for example.
  3. Implement protected FormSheet getDefaultFormSheet() to define the SalesPoints FormSheet.
    Change the FormSheet content by adding a FormSheetContentCreator. This can be done by creating a subclass of FormSheetContentCreator.
  4. Implement protected MenuSheet getDefaultMenuSheet() to define the SalesPoints MenuSheet.

Example Source Code:

SalesPoint class:


// necessary imports
import java.awt.Rectangle;

import sale.FormSheet;
import sale.MenuSheet;
import sale.SalesPoint;
			 
1
public class ArchitectureSalesPoint extends SalesPoint
{
			
    2
    public ArchitectureSalesPoint(String sPointName)
    {
        super(sPointName);
        setSalesPointFrameBounds(new Rectangle(0, 0, 640, 480));
    }
			
    3
    protected FormSheet getDefaultFormSheet()
    {
        FormSheet fs = new FormSheet("TutorialFormSheet",
                new ArchitectureSPointFormSheetCC(), false);
        return fs;
    }
			
    4
    protected MenuSheet getDefaultMenuSheet()
    {
        return null;
    }
			
}
		

FormSheetContentCreator class:

public class ArchitectureSPointFormSheetCC extends FormSheetContentCreator
{

    protected void createFormSheetContent(FormSheet fs)
    {
        fs.removeAllButtons();
        // add ui code here
    }
}
		

Back to:


Change quit behaviour

Description:
A SalesPoint quit´s with a MsgForm, asking "Are you sure, you want to close this SalesPoint? YES/NO". If you want to change this behavior, overwrite the protected boolean onCanQuit() method.

Used classes:

Related topics:

ToDo:

  1. Open the designated SalesPoint class.
  2. Implement the protected boolean onCanQuit() method to change the quit behaviour.
    The return of true will close the SalesPoint against the return of false will keep the SalesPoint opened.

Example Source Code:


1
public class ArchitectureSalesPoint extends SalesPoint
{
			
    2
    protected boolean onCanQuit()
    {
        return true;
    }
			
}
		

Back to:


previous Application Architecture: ShopApplication Architecture: Processes next


Valid HTML 4.01!