/*
* 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.
*/
/*
* GemCutterAboutBox.java
* Created: ??
* By: ??
*/
package org.openquark.gems.client;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import org.openquark.cal.compiler.Version;
/**
* This type was generated by a SmartGuide.
*/
public class GemCutterAboutBox extends JDialog {
private static final long serialVersionUID = 4489190446711438274L;
private JLabel ivjAppName = null;
private JPanel ivjButtonPane = null;
private JLabel ivjCopyright = null;
private JLabel ivjIconLabel = null;
private JPanel ivjIconPane = null;
private JPanel ivjJDialogContentPane = null;
private JButton ivjOkButton = null;
private JPanel ivjTextPane = null;
private JLabel ivjCopyright2 = null;
private JLabel ivjVersion = null;
/**
* GemCutterAboutBox constructor comment.
*/
public GemCutterAboutBox() {
super();
initialize();
}
/**
* GemCutterAboutBox constructor.
* @param owner Frame
* @param modal boolean
*/
public GemCutterAboutBox(Frame owner, boolean modal) {
super(owner, modal);
initialize();
}
/**
* Return the AppName property value.
* @return JLabel
*/
private JLabel getAppName() {
if (ivjAppName == null) {
try {
ivjAppName = new JLabel();
ivjAppName.setName("AppName");
ivjAppName.setText(GemCutter.getResourceString("AboutBox_AppName"));
Font currentFont = ivjAppName.getFont();
ivjAppName.setFont(currentFont.deriveFont(Font.BOLD, currentFont.getSize2D() * 2));
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjAppName;
}
/**
* Return the ButtonPane property value.
* @return JPanel
*/
private JPanel getButtonPane() {
if (ivjButtonPane == null) {
try {
ivjButtonPane = new JPanel();
ivjButtonPane.setName("ButtonPane");
ivjButtonPane.setLayout(new FlowLayout());
getButtonPane().add(getOkButton(), getOkButton().getName());
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjButtonPane;
}
/**
* Return the Copyright property value.
* @return JLabel
*/
private JLabel getCopyright() {
if (ivjCopyright == null) {
try {
ivjCopyright = new JLabel();
ivjCopyright.setName("Copyright");
ivjCopyright.setText(GemCutter.getResourceString("AboutBox_CopyrightNotice"));
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjCopyright;
}
/**
* Return the IconLabel property value.
* @return JLabel
*/
private JLabel getIconLabel() {
if (ivjIconLabel == null) {
try {
ivjIconLabel = new JLabel();
ivjIconLabel.setName("IconLabel");
ivjIconLabel.setIcon(new ImageIcon(getClass().getResource("/Resources/gemcutter_32.gif")));
ivjIconLabel.setText("");
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjIconLabel;
}
/**
* Return the IconPane property value.
* @return JPanel
*/
private JPanel getIconPane() {
if (ivjIconPane == null) {
try {
ivjIconPane = new JPanel();
ivjIconPane.setName("IconPane");
ivjIconPane.setLayout(new FlowLayout());
getIconPane().add(getIconLabel(), getIconLabel().getName());
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjIconPane;
}
/**
* Return the JDialogContentPane property value.
* @return JPanel
*/
private JPanel getJDialogContentPane() {
if (ivjJDialogContentPane == null) {
try {
ivjJDialogContentPane = new JPanel();
ivjJDialogContentPane.setName("JDialogContentPane");
ivjJDialogContentPane.setLayout(new BorderLayout());
getJDialogContentPane().add(getButtonPane(), "South");
getJDialogContentPane().add(getTextPane(), "Center");
getJDialogContentPane().add(getIconPane(), "West");
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjJDialogContentPane;
}
/**
* Return the OkButton property value.
* @return JButton
*/
private JButton getOkButton() {
if (ivjOkButton == null) {
try {
ivjOkButton = new JButton();
ivjOkButton.setName("OkButton");
ivjOkButton.setText(GemCutter.getResourceString("OKButton"));
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjOkButton;
}
/**
* Return the TextPane property value.
* @return JPanel
*/
private JPanel getTextPane() {
if (ivjTextPane == null) {
try {
ivjTextPane = new JPanel();
ivjTextPane.setName("TextPane");
ivjTextPane.setLayout(new BoxLayout(ivjTextPane, BoxLayout.Y_AXIS));
getTextPane().add(Box.createVerticalStrut(10));
getTextPane().add(getAppName(), getAppName().getName());
getTextPane().add(Box.createVerticalStrut(10));
getTextPane().add(getVersion(), getVersion().getName());
getTextPane().add(Box.createVerticalStrut(10));
getTextPane().add(getCopyright(), getCopyright().getName());
getTextPane().add(getCopyright2(), getCopyright2().getName());
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjTextPane;
}
/**
* Return the Copyright property value.
* @return JLabel
*/
private JLabel getCopyright2() {
if (ivjCopyright2 == null) {
try {
ivjCopyright2 = new JLabel();
ivjCopyright2.setName("UserName");
ivjCopyright2.setText(GemCutter.getResourceString("AboutBox_CopyrightNotice2"));
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjCopyright2;
}
/**
* Return the Version property value.
* @return JLabel
*/
private JLabel getVersion() {
if (ivjVersion == null) {
try {
ivjVersion = new JLabel();
ivjVersion.setName("Version");
ivjVersion.setText(GemCutter.getResourceString("AboutBox_VersionInfo", Version.CURRENT));
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjVersion;
}
/**
* 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);
}
/**
* Initialize the class.
*/
private void initialize() {
try {
setName("GemCutterAboutBox");
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setSize(350, 200);
setTitle(GemCutter.getResourceString("AboutBox_Title"));
setContentPane(getJDialogContentPane());
getOkButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
GemCutterAboutBox.this.dispose();
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
});
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
/**
* main entrypoint - starts the part when it is run as an application
* @param args String[]
*/
public static void main(String[] args) {
try {
GemCutterAboutBox aGemCutterAboutBox;
aGemCutterAboutBox = new GemCutterAboutBox();
aGemCutterAboutBox.setModal(true);
aGemCutterAboutBox.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
aGemCutterAboutBox.setVisible(true);
Insets insets = aGemCutterAboutBox.getInsets();
aGemCutterAboutBox.setSize(aGemCutterAboutBox.getWidth() + insets.left + insets.right, aGemCutterAboutBox.getHeight() + insets.top + insets.bottom);
aGemCutterAboutBox.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of JDialog");
exception.printStackTrace(System.out);
}
}
}