1 21 22 package com.izforge.izpack.panels; 23 24 import net.n3.nanoxml.XMLElement; 25 26 import com.izforge.izpack.installer.AutomatedInstallData; 27 import com.izforge.izpack.installer.IUnpacker; 28 import com.izforge.izpack.installer.PanelAutomation; 29 import com.izforge.izpack.installer.PanelAutomationHelper; 30 import com.izforge.izpack.installer.UnpackerFactory; 31 import com.izforge.izpack.util.AbstractUIProgressHandler; 32 33 38 public class InstallPanelAutomationHelper extends PanelAutomationHelper implements PanelAutomation, 39 AbstractUIProgressHandler 40 { 41 42 private int noOfPacks = 0; 43 44 50 public void makeXMLData(AutomatedInstallData installData, XMLElement panelRoot) 51 { 52 } 54 55 62 public boolean runAutomated(AutomatedInstallData idata, XMLElement panelRoot) 63 { 64 68 IUnpacker unpacker = UnpackerFactory.getUnpacker(idata.info.getUnpackerClassName(), idata, this); 69 Thread unpackerthread = new Thread (unpacker, "IzPack - Unpacker thread"); 70 unpackerthread.start(); 71 boolean done = false; 72 while (!done && unpackerthread.isAlive()) 73 { 74 try 75 { 76 Thread.sleep(100); 77 } 78 catch (InterruptedException e) 79 { 80 } 82 } 83 return unpacker.getResult(); 84 } 85 86 91 public void startAction(String name, int no_of_steps) 92 { 93 System.out.println("[ Starting to unpack ]"); 94 this.noOfPacks = no_of_steps; 95 } 96 97 102 public void stopAction() 103 { 104 System.out.println("[ Unpacking finished. ]"); 105 boolean done = true; 106 } 107 108 115 public void progress(int val, String msg) 116 { 117 } 120 121 129 public void nextStep(String packName, int stepno, int stepsize) 130 { 131 System.out.print("[ Processing package: " + packName + " ("); 132 System.out.print(stepno); 133 System.out.print('/'); 134 System.out.print(this.noOfPacks); 135 System.out.println(") ]"); 136 } 137 138 } 139 | Popular Tags |