001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
006 * 
007 * Copyright 2004 Klaus Bartz
008 * 
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *     http://www.apache.org/licenses/LICENSE-2.0
014 *     
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 */
021
022package com.izforge.izpack.panels;
023
024import com.izforge.izpack.installer.InstallData;
025import com.izforge.izpack.installer.InstallerFrame;
026import com.izforge.izpack.util.ExtendedUIProgressHandler;
027
028/**
029 * The install panel class. Launches the actual installation job with extensions for custom actions.
030 * 
031 * @author Klaus Bartz
032 */
033public class ExtendedInstallPanel extends InstallPanel implements ExtendedUIProgressHandler
034{
035
036    private static final long serialVersionUID = 3257291344052500789L;
037
038    protected int currentStep = 0;
039
040    /**
041     * The constructor.
042     * 
043     * @param parent The parent window.
044     * @param idata The installation data.
045     */
046    public ExtendedInstallPanel(InstallerFrame parent, InstallData idata)
047    {
048        super(parent, idata);
049    }
050
051    /*
052     * (non-Javadoc)
053     * 
054     * @see com.izforge.izpack.util.ExtendedUIProgressHandler#startAction(java.lang.String,
055     * java.lang.String, java.lang.String, int)
056     */
057    public void restartAction(String name, String overallMsg, String tipMsg, int no_of_steps)
058    {
059        overallOpLabel.setText(overallMsg);
060        tipLabel.setText(tipMsg);
061        currentStep = 0;
062        startAction(name, no_of_steps);
063    }
064
065    /**
066     * Normal progress indicator.
067     * 
068     * @param val The progression value.
069     * @param msg The progression message.
070     */
071    public void progress(int val, String msg)
072    {
073        packProgressBar.setValue(val + 1);
074        packOpLabel.setText(msg);
075        currentStep++;
076    }
077
078    /*
079     * (non-Javadoc)
080     * 
081     * @see com.izforge.izpack.util.ExtendedUIProgressHandler#progress(java.lang.String,
082     * java.lang.String)
083     */
084    public void progress(String stepMessage)
085    {
086        packOpLabel.setText(stepMessage);
087        currentStep++;
088        packProgressBar.setValue(currentStep);
089    }
090
091    /**
092     * Pack changing.
093     * 
094     * @param packName The pack name.
095     * @param stepno The number of the pack.
096     * @param max The new maximum progress.
097     */
098    public void nextStep(String packName, int stepno, int max)
099    {
100        currentStep = 0;
101        super.nextStep(packName, stepno, max);
102    }
103
104}