home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
SummaryPanel.java
< prev
next >
Wrap
Text File
|
1998-10-06
|
4KB
|
122 lines
package com.symantec.itools.frameworks.wizard;
import java.awt.*;
import com.sun.java.swing.*;
import java.util.Enumeration;
import java.util.Vector;
import java.util.Locale;
/**
* @author Symantec Internet Tools Division
* @version 1.0
* @since VCafe 3.0
*/
public class SummaryPanel extends WizardPanel
{
public SummaryPanel()
{
summaryDescription = new String(summaryPanelResource.getResourceString("SP_Description"));
// Set the SummaryPanel layout to BorderLayout
setLayout(new BorderLayout());
// Setup the description label
summaryDescriptionLabel = new JLabel();
summaryDescriptionLabel.setText(summaryDescription);
summaryDescriptionLabel.setForeground(SystemColor.controlText);
summaryDescriptionLabel.setBackground(SystemColor.control);
insetDescriptionPanel = new BorderPanel(summaryDescriptionLabel, 6, 0, 6, 0, SystemColor.control);
// Panel containing all summaries, is contained within a scrollpane
summaryContainerPanel = new JPanel();
summaryContainerPanel.setBounds(10, 10, SUMMARY_WIDTH, 300);
summaryContainerPanel.setLayout(new GridLayout(0, 1)); // any number of rows within one column
// Put the summaryContainerPanel on a Scrollpane
scroller = new JScrollPane(summaryContainerPanel);
insetSummaryPanel = new BorderPanel(scroller, 6, 6, 6, 6, SystemColor.control);
//scroller.getViewport().add(summaryContainerPanel);
// Panel to hold description and summary
centerPanel = new JPanel();
centerPanel.setLayout(new BorderLayout());
centerPanel.add(insetDescriptionPanel, "North");
centerPanel.add(insetSummaryPanel, "Center");
add(centerPanel, "Center");
}
/**
* @since VCafe 3.0
*/
public String getPanelTitle()
{
return summaryPanelResource.getResourceString("SP_Title");
}
/**
* Called by controller before the panel is displayed.
* Only current panel is called.
* @since VCafe 3.0
*/
public void entering()
{
Vector summaries = controller.getSummary();
summaryContainerPanel.removeAll();
// Put summaries into summaryContainerPanel
Enumeration e1 = summaries.elements();
while(e1.hasMoreElements())
addSummary( (Summary) e1.nextElement() );
controller.getWizard().setNextEnabled(false);
invalidate();
validate();
repaint();
}
private void addSummary( Summary s )
{
if (summaryElements == null)
summaryElements = new Vector();
// if there is a summary panel and either it is preferred or no preference is given,
// use the summary panel
if (s.hasPanelSummary() && ( (s.getPreferredSummary() == Summary.PANEL_SUMMARY) ||
(s.getPreferredSummary() == Summary.NO_PREFERENCE) ) )
{
summaryContainerPanel.add( s.getPanelSummary() );
summaryElements.addElement( s.getPanelSummary() );
}
// or if there is a string, put it on a JTextArea
else if ( s.hasStringSummary() )
{
JTextArea t = new JTextArea(s.getStringSummary());
t.setForeground(SystemColor.controlText);
t.setBackground(SystemColor.window);
summaryContainerPanel.add(t);
summaryElements.addElement(t);
}
}
private JPanel westPanel = null;
private JPanel centerPanel = null;
private BorderPanel insetSummaryPanel = null;
private BorderPanel insetDescriptionPanel = null;
private JPanel summaryContainerPanel = null;
private JScrollPane scroller = null;
private String summaryCaption = null;
private String summaryDescription = null;
private JLabel summaryCaptionLabel = null;
private JLabel summaryDescriptionLabel = null;
private Vector summaryElements = null;
private static WizardResourceBundle summaryPanelResource = new WizardResourceBundle("com.symantec.itools.frameworks.wizard.WizardResource", Locale.getDefault());
private final static int SUMMARY_WIDTH = 550;
}