001: /**
002: * $RCSfile: XuiInstallPanel.java,v $
003: * @creation 01/02/00
004: * @modification $Date: 2004/02/02 20:57:58 $
005: */package com.memoire.vainstall.xui;
006:
007: import java.awt.*;
008: import javax.swing.*;
009: import javax.swing.border.*;
010: import com.memoire.vainstall.VAInstallStep;
011: import com.memoire.vainstall.VAGlobals;
012:
013: /**
014: * @version $Id: XuiInstallPanel.java,v 1.5 2004/02/02 20:57:58 deniger Exp $
015: * @author Guillaume Desnoix
016: */
017:
018: public class XuiInstallPanel extends XuiAbstractPanel implements
019: VAInstallStep {
020: JLabel lbDetails_, lbStatus_;
021: JProgressBar pbProgress_;
022:
023: public XuiInstallPanel() {
024: super ();
025:
026: setLayout(new BorderLayout());
027:
028: JPanel pnMain = new XuiPanel();
029: pnMain.setLayout(new BorderLayout(2, 2));
030: pnMain.setBorder(new EmptyBorder(5, 5, 5, 5));
031: pnMain.setForeground(new Color(128, 255, 255));
032:
033: JPanel pnDetails = new XuiPanel();
034: pnDetails.setLayout(new BorderLayout(2, 2));
035: pnDetails.setOpaque(false);
036:
037: lbDetails_ = new XuiLabel(VAGlobals.i18n("UI_ClickNextToStart"));
038: // lbDetails_.setOpaque(true);
039: pnDetails.add(BorderLayout.CENTER, lbDetails_);
040:
041: pbProgress_ = new JProgressBar();
042: pbProgress_.setBackground(new Color(255, 255, 224));
043: pbProgress_.setForeground(new Color(128, 192, 192));
044: pbProgress_.setBorder(new LineBorder(Color.black, 2));
045: pnDetails.add(BorderLayout.SOUTH, pbProgress_);
046:
047: lbStatus_ = new XuiLabel(VAGlobals.i18n("UI_ReadyToStart"));
048: // lbStatus_.setOpaque(true);
049:
050: String s;
051: switch (VAGlobals.OPERATION) {
052: case VAGlobals.INSTALL:
053: s = VAGlobals.i18n("UI_Installation");
054: break;
055: case VAGlobals.UPDATE:
056: s = VAGlobals.i18n("UI_Update");
057: break;
058: case VAGlobals.UNINSTALL:
059: s = VAGlobals.i18n("UI_Uninstallation");
060: break;
061: default:
062: s = "";
063: break;
064: }
065: XuiTitle lbTitle = new XuiTitle(s, XuiTitle.LEFT);
066: lbTitle.setFont(new Font("SansSerif", Font.PLAIN, 16));
067:
068: JPanel q = new JPanel();
069: q.setOpaque(false);
070: q.setBorder(null);
071: q.setLayout(new BorderLayout());
072: q.add(lbTitle, BorderLayout.NORTH);
073: q.add(lbStatus_, BorderLayout.CENTER);
074:
075: pnMain.add(q, BorderLayout.NORTH);
076: pnMain.add(pnDetails, BorderLayout.SOUTH);
077:
078: JPanel pnImage = XuiImagePanel.IMAGE_PANEL;
079: // pnMain.setPreferredSize(new Dimension(200, pnImage.getPreferredSize().height));
080: add(pnImage, BorderLayout.WEST);
081: add(pnMain, BorderLayout.CENTER);
082: }
083:
084: public void details(String msg) {
085: int index = msg.lastIndexOf(System
086: .getProperty("file.separator"));
087: if (index > -1)
088: msg = msg.substring(index + 1);
089: lbDetails_.setText(msg);
090: //RepaintManager.currentManager(lbDetails_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
091: }
092:
093: public void status(String msg) {
094: lbStatus_.setText(msg);
095: //RepaintManager.currentManager(lbStatus_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
096: }
097:
098: public void setProgression(int n) {
099: pbProgress_.setValue(n);
100: //RepaintManager.currentManager(pbProgress_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
101: if (n >= 100) {
102: details(VAGlobals.i18n("UI_DecompressionFinished"));
103: }
104: }
105:
106: public int getProgression() {
107: return pbProgress_.getValue();
108: }
109: }
|