home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
OptionsDialog.java
< prev
next >
Wrap
Text File
|
1998-11-05
|
9KB
|
280 lines
// Copyright (c) 1997, 1998 Symantec, Inc. All Rights Reserved.
import java.awt.*;
import symantec.itools.awt.ImagePanel;
import symantec.itools.awt.Label3D;
import symantec.itools.awt.Wizard;
import symantec.itools.awt.TabPanel;
import symantec.itools.awt.util.spinner.NumericSpinner;
/**
* This dialog was added to this project by dragging a Dialog form component
* into the project.
* It was then customized with Cafe's visual tools, including the Interaction
* Wizard.
* Then it was manually customized to
* 1) initialize component values from report data
* 2) save the results.
*/
public class OptionsDialog extends Dialog
{
/*
Sets the initial component values from the program data.
*/
void initializeComponentsFromData() {
WebLogAnalyzer wla = (WebLogAnalyzer)getParent();
try {
sessionLimitSpinner.setCurrent(wla.data.userSessionIdleLimit);
ignoreLogFileErrors.setState(wla.data.ignoreUnexpectedLogFileErrors);
} catch(java.beans.PropertyVetoException x) {
}
}
// -- AUTOMATICALLY GENERATED/MAINTAINED CODE FRAMEWORK BELOW THIS LINE --
/**
* Constructs this dialog.
* Initializes components the components.
* Registers component listeners.
* All of the code in this routine except the last line are
* automatically generated/maintained by Visual Cafe.
*/
public OptionsDialog(Frame parent, boolean modal)
{
super(parent, modal);
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(null);
setBackground(java.awt.Color.lightGray);
setSize(441,348);
setVisible(false);
try {
imagePanel1.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-wizardb.jpg"));
}
catch (java.net.MalformedURLException error) { }
catch(java.beans.PropertyVetoException e) { }
imagePanel1.setLayout(null);
add(imagePanel1);
imagePanel1.setBackground(new java.awt.Color(64,128,128));
imagePanel1.setBounds(8,7,418,40);
try {
label3D1.setBevelStyle(symantec.itools.awt.Label3D.BEVEL_LOWERED);
}
catch(java.beans.PropertyVetoException e) { }
try {
label3D1.setText("Program Options");
}
catch(java.beans.PropertyVetoException e) { }
imagePanel1.add(label3D1);
label3D1.setBackground(java.awt.Color.lightGray);
label3D1.setBounds(11,8,111,24);
try {
{
String[] tempString = new String[2];
tempString[0] = "General";
tempString[1] = "";
tabPanel1.setPanelLabels(tempString);
}
}
catch(java.beans.PropertyVetoException e) { }
add(tabPanel1);
tabPanel1.setBounds(1,54,435,247);
panel1.setLayout(null);
tabPanel1.add(panel1);
panel1.setBounds(12,33,411,203);
sessionLimitLabel.setText("User Session Idle Limit (minutes)");
panel1.add(sessionLimitLabel);
sessionLimitLabel.setBounds(13,13,214,36);
try {
sessionLimitSpinner.setMin(1);
}
catch(java.beans.PropertyVetoException e) { }
try {
sessionLimitSpinner.setCurrent(30);
}
catch(java.beans.PropertyVetoException e) { }
try {
sessionLimitSpinner.setMax(100);
}
catch(java.beans.PropertyVetoException e) { }
try {
sessionLimitSpinner.setEditable(true);
}
catch(java.beans.PropertyVetoException e) { }
panel1.add(sessionLimitSpinner);
sessionLimitSpinner.setBounds(234,20,69,25);
ignoreLogFileErrors.setLabel("Ignore unexpected log file errors");
panel1.add(ignoreLogFileErrors);
ignoreLogFileErrors.setBounds(13,56,280,24);
try {
tabPanel1.setCurrentPanelNdx(0);
}
catch(java.beans.PropertyVetoException e) { }
panel6.setLayout(new GridLayout(1,1,8,0));
add(panel6);
panel6.setBounds(303,305,121,25);
okButton.setLabel("OK");
panel6.add(okButton);
okButton.setFont(new Font("Dialog", Font.BOLD, 12));
okButton.setBounds(0,0,56,25);
cancelButton.setLabel("Cancel");
panel6.add(cancelButton);
cancelButton.setBounds(64,0,56,25);
setTitle("Program Options");
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
cancelButton.addActionListener(lSymAction);
okButton.addActionListener(lSymAction);
//}}
// Initialize the component values
initializeComponentsFromData();
// Center this dialog within its parent's bounds
WLAUtil.centerInParent(this);
}
/**
* Tells this component that it has been added to a container.
* This is a standard Java AWT method which gets called by the AWT when
* this component is added to a container.
* Typically, it is used to create this component's peer. <br>
* It has been OVERRIDDEN here to adjust the position of components as needed
* for the container's insets. <br>
* This method is automatically generated by Visual Cafe.
*/
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension d = getSize();
super.addNotify();
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
Insets insets = getInsets();
setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height);
Component components[] = getComponents();
for (int i = 0; i < components.length; i++)
{
Point p = components[i].getLocation();
p.translate(insets.left, insets.top);
components[i].setLocation(p);
}
fComponentsAdjusted = true;
}
// Used for addNotify check.
boolean fComponentsAdjusted = false;
/**
* Constructs this Dialog with the given title.
* This routine was automatically generated by Visual Cafe, and is not
* actually used.
*/
public OptionsDialog(Frame parent, String title, boolean modal)
{
this(parent, modal);
setTitle(title);
}
//{{DECLARE_CONTROLS
symantec.itools.awt.ImagePanel imagePanel1 = new symantec.itools.awt.ImagePanel();
symantec.itools.awt.Label3D label3D1 = new symantec.itools.awt.Label3D();
symantec.itools.awt.TabPanel tabPanel1 = new symantec.itools.awt.TabPanel();
java.awt.Panel panel1 = new java.awt.Panel();
java.awt.Label sessionLimitLabel = new java.awt.Label();
symantec.itools.awt.util.spinner.NumericSpinner sessionLimitSpinner = new symantec.itools.awt.util.spinner.NumericSpinner();
java.awt.Checkbox ignoreLogFileErrors = new java.awt.Checkbox();
java.awt.Panel panel6 = new java.awt.Panel();
java.awt.Button okButton = new java.awt.Button();
java.awt.Button cancelButton = new java.awt.Button();
//}}
/**
* This is an event listener created by Visual Cafe to handle WindowEvents.
*/
class SymWindow extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == OptionsDialog.this)
OptionsDialog_WindowClosing(event);
}
}
/**
* Handles the WINDOW_CLOSING WindowEvent.
* This method is automatically added when the Dialog form was added to
* this project.
*/
void OptionsDialog_WindowClosing(java.awt.event.WindowEvent event)
{
dispose();
}
/**
* This is an event listener created by Visual Cafe to handle ActionEvents.
* It was created by the Interaction Wizard.
*/
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == cancelButton)
cancelButton_Action(event);
else if (object == okButton)
okButton_Action(event);
}
}
/**
* This handles the ActionEvents generated by the Cancel button.
* Created using the Interaction Wizard.
*/
void cancelButton_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
//{{CONNECTION
// Hide the Dialog
setVisible(false);
//}}
}
/**
* This handles the ActionEvents generated by the OK button.
* Created using the Interaction Wizard, then the modified to
* save changes to the program options.
*/
void okButton_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
// Save The Options
WebLogAnalyzer wla = (WebLogAnalyzer)getParent();
wla.data.userSessionIdleLimit = sessionLimitSpinner.getCurrent();
wla.data.ignoreUnexpectedLogFileErrors = ignoreLogFileErrors.getState();
//{{CONNECTION
// Hide the Dialog
setVisible(false);
//}}
}
}