001    package market.stdform;
002    
003    import java.awt.GridLayout;
004    
005    import javax.swing.Box;
006    import javax.swing.BoxLayout;
007    import javax.swing.JComponent;
008    import javax.swing.JLabel;
009    import javax.swing.JPanel;
010    
011    import market.swing.ComponentFactory;
012    import sale.FormSheet;
013    import sale.FormSheetContentCreator;
014    
015    /**
016     * This FormSheet displays a worker information, with the count of
017     * unexecuted orders and the number of workers, that are logged on to the system.
018     */
019    public class FSWorkerDefault extends FormSheet{
020    
021        /**
022         * @param sCaption the caption of this FormSheet.
023         * @param jcmpComponent will be set as the component.
024         */
025        public FSWorkerDefault(String sCaption,
026                     JComponent jcmpComponent) {
027            super(sCaption, jcmpComponent);
028        }
029    
030        /**
031         * @param order the count of unexecuted orders.
032         * @param worker the number of logged on workers.
033         */
034        public FSWorkerDefault(final int order, final int worker) {
035            super("Lager", null);
036            this.addContentCreator(new FormSheetContentCreator(){
037                protected void createFormSheetContent(FormSheet fs) {
038                    JPanel jp_main = new JPanel();
039                    jp_main.setLayout(new BoxLayout(jp_main, BoxLayout.Y_AXIS));
040                    JPanel jp_information = new JPanel();
041                    jp_information.setBorder(ComponentFactory.createInsetBorder("Information"));
042                    jp_information.setLayout(new GridLayout(2,1));
043                    jp_information.setAlignmentX(Box.CENTER_ALIGNMENT);
044                    jp_information.setAlignmentY(Box.CENTER_ALIGNMENT);
045    
046                    JLabel jl_order = new JLabel("Es sind momentan "+order+" Lieferungen zusammenzustellen.");
047                    JLabel jl_worker = new JLabel(worker+" Arbeiter sind mit Lieferungen beschäftigt.");
048    
049                    jp_information.add(jl_order);
050                    jp_information.add(jl_worker);
051    
052                    jp_main.add(Box.createVerticalStrut(160));
053                    jp_main.add(jp_information);
054                    jp_main.add(Box.createVerticalStrut(160));
055    
056                    fs.setComponent(jp_main);
057                    fs.removeAllButtons();
058                    fs.addButton("Lieferung zusammenstellen", ButtonIDs.BTN_OK, null);
059                }
060            });
061        }
062    }