SOURCECODE |
How to... define the StatusMenuSheet for a SalesPoint
Description:
SalesPoints are being displayed in a separate window but also have a StatusDisplay at the Shop, which is the TabbedPane in the Shop's Frame, labled the name of the Salespoint. By bringing it on top, it shows what is defined as the StatusDisplay in your SalesPoint instance and also adds the Menu defined as StatusMenuSheet in the SalesPoint instance to the Shop's MenuSheet. By default, both, the SformSheet and the StatusMenuSheet are empty.
Feel free to use the StatusDisplay and MenuSheet, which are equally handled to the DefaultFormSheet and the DefaultMenuSheet except that due to the strong division of the Shop and it's Salespoints it is not possible to have processes running on it. You may trigger a Processes on it, but they will always be displayed by the SalesPoint's window. Therefor a more suitable name would be "Statical Display". For further information on Processes refer to the section "Processes".
This example describes how to define a MenuSheet as the SalesPoint's StatusMenuSheet. For more information on how to create a MenuSheet, take a close look at "How to create a MenuSheet"
ToDo's:
- Create your own subclass of SalesPoint
- Redefine the method
getDefaultStatusMenuSheet()
by creating your own MenuSheet
For more information about MenuSheets, take a look at "How to define a MenuSheet"
Uses:
SalesPoint MenuSheet
import sale.*;
import sale.events.*;
import sale.stdforms.*;
import data.events.*;
import data.ooimpl.*;
import log.*;
import log.stdforms.*;
import users.*;
import users.swing.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.io.*;
//...
1
public class Office extends SalesPoint {
2
//in order to define the StatusMenuSheet in the Shop, you have to
//overwrite the getDefaultStatusMenuSheet() method
public MenuSheet getDefaultStatusMenuSheet() {
//create a new MenuSheet to be the horizontal menu
MenuSheet msMenu = new MenuSheet("office menu");
//create a new MenuSheet to be a submenu
MenuSheet msSubMenu = new MenuSheet("Maintenance");
//create a new MenuSheetItem to be displayed in the submenu above
MenuSheetItem msi1 = new MenuSheetItem ("Advance time", //the caption
new sale.Action() {
//the action to be performed when the MenuSheetItem is being chosen
public void doAction(SaleProcess p, SalesPoint sp) {
Shop.getTheShop().getTimer().goAhead();
}
});
//add the MenuSheetItem to the msSubMenu
msSubMenu.add(msi1);
// add the msSubMenu to the first MenuSheet
msMenu.add(msSubMenu);
//return the first MenuSheet
return msMenu;
}
}