Package ui

Source Code of ui.PetStoreDashboard

/*
*PetStoreDashboard.java
*
* Copyright 2001-2004 The Apache Software Foundation.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package ui;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

import org.apache.beehive.petstore.PetstoreInventoryManager;


public class PetStoreDashboard extends JPanel {
    private static final long serialVersionUID = 1L;

  PetstoreInventoryManager store;

    private PetStoreProductView productView;

    public PetStoreDashboard(PetstoreInventoryManager store) {
        super(new GridLayout(1, 0));
        this.store = store;

        productView = new PetStoreProductView(store);

         JLabel label = new JLabel("TBD.... Events from the stroe.",
                JLabel.CENTER);
        productView.setBorder(null);

        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                productView, label);
        splitPane.setOneTouchExpandable(true);
        splitPane.setDividerLocation(280);

        //Provide minimum sizes for the two components in the split pane
        productView.setMinimumSize(new Dimension(200, 50));
        label.setMinimumSize(new Dimension(200, 30));
        add(splitPane);

    }

    private static void createAndShowGUI() {
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);

        //Create and set up the window.
        JFrame frame = new JFrame("PetStore Dashboard");
        Container content = frame.getContentPane();
        Font font = new Font("Serif", Font.ITALIC, 30);
        content.setFont(font);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        PetstoreInventoryManager store;

              try {
                store = (org.apache.beehive.petstore.PetstoreInventoryManagerSoapBindingStub)
                              new org.apache.beehive.petstore.PetstoreInventoryManagementServiceLocator().getPetstoreInventoryManager();
            }
            catch (javax.xml.rpc.ServiceException jre) {
                if(jre.getLinkedCause()!=null)
                    jre.getLinkedCause().printStackTrace();
                throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
            }
            // Time out after a minute
            ((org.apache.beehive.petstore.PetstoreInventoryManagerSoapBindingStub)store).setTimeout(60000);
           
 


        frame.getContentPane().add(new PetStoreDashboard(store));

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}
TOP

Related Classes of ui.PetStoreDashboard

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.