01: /**
02: * $RCSfile: VAInstallPanel.java,v $
03: * @creation 01/02/00
04: * @modification $Date: 2004/02/02 20:57:58 $
05: */package com.memoire.vainstall.gui;
06:
07: import java.awt.*;
08: import javax.swing.*;
09: import javax.swing.border.*;
10: import com.memoire.vainstall.VAInstallStep;
11: import com.memoire.vainstall.VAGlobals;
12:
13: /**
14: * @version $Id: VAInstallPanel.java,v 1.5 2004/02/02 20:57:58 deniger Exp $
15: * @author Axel von Arnim
16: */
17:
18: public class VAInstallPanel extends VAPanel implements VAInstallStep {
19: JLabel lbDetails_, lbStatus_;
20: JProgressBar pbProgress_;
21:
22: public VAInstallPanel() {
23: super ();
24:
25: setLayout(new BoxLayout(this , BoxLayout.X_AXIS));
26:
27: JPanel pnMain = new JPanel();
28: pnMain.setBorder(new CompoundBorder(new EtchedBorder(),
29: new EmptyBorder(new Insets(5, 5, 5, 5))));
30: pnMain.setLayout(new BoxLayout(pnMain, BoxLayout.Y_AXIS));
31:
32: JPanel pnHaut = new JPanel();
33: pnHaut.setLayout(new BorderLayout());
34:
35: JLabel lbTitle = new JLabel(
36: VAGlobals.OPERATION == VAGlobals.INSTALL ? VAGlobals
37: .i18n("UI_Installation")
38: : VAGlobals.OPERATION == VAGlobals.UPDATE ? VAGlobals
39: .i18n("UI_Update")
40: : VAGlobals.OPERATION == VAGlobals.UNINSTALL ? VAGlobals
41: .i18n("UI_Uninstallation")
42: : VAGlobals
43: .i18n("UI_UnknownOperation"));
44: lbTitle.setFont(lbTitle.getFont().deriveFont(Font.BOLD, 20));
45: lbTitle.setOpaque(true);
46: lbTitle.setBorder(new EmptyBorder(new Insets(5, 0, 5, 0)));
47: lbTitle.setBackground(pnMain.getBackground().darker());
48: lbTitle.setForeground(Color.white);
49: pnHaut.add(BorderLayout.NORTH, lbTitle);
50:
51: lbDetails_ = new JLabel();
52: lbDetails_.setText(VAGlobals.i18n("UI_ClickNextToStart"));
53: lbDetails_.setOpaque(true);
54: pnHaut.add(BorderLayout.SOUTH, lbDetails_);
55:
56: JPanel pnBas = new JPanel();
57: pnBas.setLayout(new BorderLayout());
58: pbProgress_ = new JProgressBar();
59: pnBas.add(BorderLayout.NORTH, pbProgress_);
60: lbStatus_ = new JLabel();
61: lbStatus_.setText(VAGlobals.i18n("UI_ReadyToStart"));
62: lbStatus_.setOpaque(true);
63: lbStatus_.setBackground(pnMain.getBackground().brighter());
64: pnBas.add(BorderLayout.SOUTH, lbStatus_);
65:
66: pnMain.add(pnHaut);
67: pnMain.add(pnBas);
68:
69: JComponent pnImage = VAImagePanel.IMAGE_PANEL;
70: add(pnImage);
71: add(pnMain);
72: }
73:
74: public void details(String msg) {
75: int index = msg.lastIndexOf(System
76: .getProperty("file.separator"));
77: if (index > -1)
78: msg = msg.substring(index + 1);
79: lbDetails_.setText(msg);
80: //RepaintManager.currentManager(lbDetails_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
81: }
82:
83: public void status(String msg) {
84: lbStatus_.setText(msg);
85: //RepaintManager.currentManager(lbStatus_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
86: }
87:
88: public void setProgression(int n) {
89: pbProgress_.setValue(n);
90: //RepaintManager.currentManager(pbProgress_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
91: if (n >= 100) {
92: details(VAGlobals.i18n("UI_DecompressionFinished"));
93: }
94: }
95:
96: public int getProgression() {
97: return pbProgress_.getValue();
98: }
99: }
|