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             * ID for serialization.
023             */
024            private static final long serialVersionUID = 7606090315402030341L;
025    
026            /**
027         * @param sCaption the caption of this FormSheet.
028         * @param jcmpComponent will be set as the component.
029         */
030        public FSWorkerDefault(String sCaption,
031                     JComponent jcmpComponent) {
032            super(sCaption, jcmpComponent);
033        }
034    
035        /**
036         * @param order the count of unexecuted orders.
037         * @param worker the number of logged on workers.
038         */
039        public FSWorkerDefault(final int order, final int worker) {
040            super("Lager", null);
041            this.addContentCreator(new FormSheetContentCreator(){
042                            private static final long serialVersionUID = -291009028081566242L;
043                            protected void createFormSheetContent(FormSheet fs) {
044                    JPanel jp_main = new JPanel();
045                    jp_main.setLayout(new BoxLayout(jp_main, BoxLayout.Y_AXIS));
046                    JPanel jp_information = new JPanel();
047                    jp_information.setBorder(ComponentFactory.createInsetBorder("Information"));
048                    jp_information.setLayout(new GridLayout(2,1));
049                    jp_information.setAlignmentX(Box.CENTER_ALIGNMENT);
050                    jp_information.setAlignmentY(Box.CENTER_ALIGNMENT);
051    
052                    JLabel jl_order = new JLabel("Es sind momentan "+order+" Lieferungen zusammenzustellen.");
053                    JLabel jl_worker = new JLabel(worker+" Arbeiter sind mit Lieferungen beschäftigt.");
054    
055                    jp_information.add(jl_order);
056                    jp_information.add(jl_worker);
057    
058                    jp_main.add(Box.createVerticalStrut(160));
059                    jp_main.add(jp_information);
060                    jp_main.add(Box.createVerticalStrut(160));
061    
062                    fs.setComponent(jp_main);
063                    fs.removeAllButtons();
064                    fs.addButton("Lieferung zusammenstellen", ButtonIDs.BTN_OK, null);
065                }
066            });
067        }
068    }