/*
* Copyright (c) 2007 BUSINESS OBJECTS SOFTWARE LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Business Objects nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* GemCutterSplashScreen.java
* Creation date: (10/23/00 4:28:43 PM)
* By: Luke Evans
*/
package org.openquark.gems.client;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JWindow;
/**
* This type was generated by a SmartGuide.
*/
public class GemCutterSplashScreen extends JWindow {
private static final long serialVersionUID = -2500312203965502569L;
private final IvjEventHandler ivjEventHandler = new IvjEventHandler();
private JLabel ivjJLabel1 = null;
private JPanel ivjJWindowContentPane = null;
private JProgressBar progressBar = null;
class IvjEventHandler implements WindowListener {
public void windowActivated(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
if (e.getSource() == GemCutterSplashScreen.this) {
connEtoC1();
}
}
public void windowDeactivated(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowOpened(WindowEvent e) {}
}
/**
* GemCutterSplashScreen constructor comment.
*/
public GemCutterSplashScreen() {
super();
initialize();
}
/**
* GemCutterSplashScreen constructor comment.
* @param owner Frame
*/
public GemCutterSplashScreen(Frame owner) {
super(owner);
initialize();
}
/**
* GemCutterSplashScreen constructor comment.
* @param owner Window
*/
public GemCutterSplashScreen(Window owner) {
super(owner);
}
/**
* connEtoC1: (GemCutterSplashScreen.window.windowClosing(WindowEvent) --> GemCutterSplashScreen.dispose()V)
*/
private void connEtoC1() {
try {
this.dispose();
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
/**
* Return the JLabel1 property value.
* @return JLabel
*/
private JLabel getJLabel1() {
if (ivjJLabel1 == null) {
try {
ivjJLabel1 = new JLabel();
ivjJLabel1.setName("JLabel1");
ivjJLabel1.setIcon(new ImageIcon(getClass().getResource("/Resources/GemsSplash.png")));
ivjJLabel1.setText("");
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjJLabel1;
}
/**
* Return the progress bar on the splash screen.
* @return JProgressBar
*/
private JProgressBar getProgressBar() {
if (progressBar == null) {
try {
progressBar = new JProgressBar();
progressBar.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
progressBar.setString(GemCutter.getResourceString("SPLASH_ProgressBarInit"));
progressBar.setStringPainted(true);
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return progressBar;
}
/**
* Return the JWindowContentPane property value.
* @return JPanel
*/
private JPanel getJWindowContentPane() {
if (ivjJWindowContentPane == null) {
try {
ivjJWindowContentPane = new JPanel();
ivjJWindowContentPane.setName("JWindowContentPane");
ivjJWindowContentPane.setBorder(BorderFactory.createEtchedBorder());
ivjJWindowContentPane.setLayout(new BorderLayout());
getJWindowContentPane().add(getJLabel1(), BorderLayout.CENTER);
getJWindowContentPane().add(getProgressBar(), BorderLayout.SOUTH);
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjJWindowContentPane;
}
/**
* Called whenever the part throws an exception.
* @param exception Throwable
*/
private void handleException(Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */
System.out.println("--------- UNCAUGHT EXCEPTION ---------");
exception.printStackTrace(System.out);
}
/**
* Initializes connections
* @exception Exception The exception description.
*/
private void initConnections() throws Exception {
this.addWindowListener(ivjEventHandler);
}
/**
* Initialize the class.
*/
private void initialize() {
try {
setName("GemCutterSplashScreen");
setSize(363, 246);
setContentPane(getJWindowContentPane());
initConnections();
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
/**
* Sets the value at which the progress bar appears full
* @param maxValue the maximum value of the progress bar
*/
public void setProgressBarMaxValue(int maxValue) {
getProgressBar().setMaximum(maxValue);
}
/**
* Increases progress bar and displays string provided
* @param newLabel String to display on progress bar
*/
public void increaseProgressBar(String newLabel) {
getProgressBar().setString(newLabel);
increaseProgressBar();
}
/**
* Increases progress bar
*
*/
public void increaseProgressBar() {
getProgressBar().setValue(getProgressBar().getValue() + 1);
}
/**
* Resets the progress bar to a state indicating no progress has occurred.
*
*/
public void resetProgressBar() {
getProgressBar().setValue(getProgressBar().getMinimum());
getProgressBar().setString(GemCutter.getResourceString("SPLASH_ProgressBarInit"));
}
/**
* main entrypoint - starts the part when it is run as an application
* @param args String[]
*/
public static void main(String[] args) {
try {
GemCutterSplashScreen aGemCutterSplashScreen;
aGemCutterSplashScreen = new GemCutterSplashScreen();
aGemCutterSplashScreen.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
aGemCutterSplashScreen.setVisible(true);
Insets insets = aGemCutterSplashScreen.getInsets();
aGemCutterSplashScreen.setSize(aGemCutterSplashScreen.getWidth() + insets.left + insets.right, aGemCutterSplashScreen.getHeight() + insets.top + insets.bottom);
aGemCutterSplashScreen.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of JWindow");
exception.printStackTrace(System.out);
}
}
}