01: /*
02: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
03: *
04: * http://izpack.org/
05: * http://izpack.codehaus.org/
06: *
07: * Copyright 2005 Klaus Bartz
08: *
09: * Licensed under the Apache License, Version 2.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.apache.org/licenses/LICENSE-2.0
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: */
21:
22: package com.izforge.izpack.panels;
23:
24: import javax.swing.JEditorPane;
25: import javax.swing.JScrollPane;
26:
27: import com.izforge.izpack.gui.IzPanelLayout;
28: import com.izforge.izpack.installer.InstallData;
29: import com.izforge.izpack.installer.InstallerFrame;
30: import com.izforge.izpack.installer.IzPanel;
31: import com.izforge.izpack.util.SummaryProcessor;
32:
33: /**
34: * Summary panel to use before InstallPanel. This panel calls the {@link SummaryProcessor} which
35: * calls all declared panels for a summary and shows the given captiond and messaged in a
36: * <code>JEditorPane</code>.
37: *
38: * @author Klaus Bartz
39: *
40: */
41: public class SummaryPanel extends IzPanel {
42:
43: /**
44: *
45: */
46: private static final long serialVersionUID = 3832626166401282361L;
47:
48: /** The text area. */
49: private JEditorPane textArea;
50:
51: /**
52: * The constructor.
53: *
54: * @param parent The parent.
55: * @param idata The installation data.
56: */
57: public SummaryPanel(InstallerFrame parent, InstallData idata) {
58: super (parent, idata, new IzPanelLayout());
59: add(createMultiLineLabelLang("SummaryPanel.info"));
60: try {
61: textArea = new JEditorPane();
62: textArea.setContentType("text/html");
63: textArea.setEditable(false);
64: JScrollPane scroller = new JScrollPane(textArea);
65: add(scroller, NEXT_LINE);
66: } catch (Exception err) {
67: err.printStackTrace();
68: }
69: getLayoutHelper().completeLayout();
70: }
71:
72: /*
73: * (non-Javadoc)
74: *
75: * @see com.izforge.izpack.installer.IzPanel#panelActivate()
76: */
77: public void panelActivate() {
78: super .panelActivate();
79: textArea.setText(SummaryProcessor.getSummary(idata));
80: textArea.setCaretPosition(0);
81: }
82:
83: }
|