1 package de.webman.wminstaller.screens; 2 3 import de.webman.wminstaller.app.*; 4 import javax.swing.*; 5 import java.awt.event.*; 6 import java.awt.*; 7 import java.io.*; 8 import java.net.URL ; 9 import java.beans.*; 10 import de.webman.wminstaller.install.*; 11 12 18 public class ScreenFinish extends InstallerScreen 19 implements PropertyChangeListener 20 { 21 22 private JEditorPane details = null; 23 24 27 private int cardIdx = 0; 28 private JPanel wmPanel; 29 30 public ScreenFinish( Installer wmi, int bt) { 31 super( wmi, bt); 32 33 JPanel wmPanel = new JPanel( new BorderLayout( 0, 12)); 34 35 36 49 50 details = new JEditorPane(); 51 details.setEditable(false); 52 details.setContentType("text/html"); 53 JScrollPane sp2 = new JScrollPane(details); 54 55 wmPanel.add(sp2, BorderLayout.CENTER); 56 57 wmi.getPCL().addPropertyChangeListener(EventConstants.ENTER_SCREEN, this); 58 59 cardIdx = addScreen("Beginn der Installation\n" + 60 "Webman wird nun auf Ihrem System installiert.\n" + 61 "Dieser Vorgang beschränkt sich auf die Erzeugung\n" + 62 "von Dateien im vorgegebenen Verzeichnis.\n" + 63 "Weitergehende Systemeingriffe erfolgen nicht.", wmPanel); 64 } 65 66 public boolean storeValues() { 67 return true; 69 } 70 71 public boolean startInstallation() { 72 try { 73 new InstallationMgr().run(wmi.getDictionary()); 74 } 75 catch (InstallationException ie) { 76 Object [] options = {"Abbrechen?", "Erneut"}; 77 78 int n = JOptionPane.showOptionDialog(wmPanel, 79 "Installation war nicht erfolgreich:\n" + 80 ie.getMessage(), 81 "Installationsabbruch", 82 JOptionPane.YES_NO_OPTION, 83 JOptionPane.QUESTION_MESSAGE, 84 null, options, options[0]); switch (n) { 88 case JOptionPane.YES_OPTION: 89 wmi.leave(-1); 90 break; 91 case JOptionPane.NO_OPTION: 92 return false; 93 } 94 } 95 return true; 96 } 97 98 99 public void propertyChange(PropertyChangeEvent e) { 100 if (EventConstants.ENTER_SCREEN.equals(e.getPropertyName()) && 101 ((Integer )e.getNewValue()).intValue() == cardIdx) { 102 System.out.println("Entered screen finished"); 103 details.setText(getDetailScreen()); 104 } 105 } 106 107 108 109 110 114 private static final String BGROUP = "bgroup"; 115 private static final String EGROUP = "egroup"; 116 private static final String PROP = "prop"; 117 private static final String TEXT = "text"; 118 private static final String HPROP = "hprop"; 119 private static final String IGNIF = "ignif"; 120 private static final String IGNIFN = "ignifn"; 121 private static final String IGNEND = "ignend"; 122 123 163 String [] details_form = { 164 BGROUP, "Dateisystem", "", 165 PROP, "Ziel-Verzeichnis", DictConstants.SELECTED_PATH, 166 EGROUP, "", "", 167 168 BGROUP, "Datenbank", "", 169 PROP, "Typ", DictConstants.DB_TYPE, 170 PROP, "Zahl d. Lizenzen", DictConstants.DB_LICENCES, 171 PROP, "Username", DictConstants.DB_USER, 172 HPROP, "Password", DictConstants.DB_PASSWORD, 173 PROP, "Host", DictConstants.DB_SERVER, 174 PROP, "Port", DictConstants.DB_PORT, 175 176 IGNIF, "Sybase", DictConstants.DB_TYPE, 177 PROP, "Datenbankname", DictConstants.DB_NAME, 178 IGNEND, "", "", 179 IGNIFN, "false", DictConstants.DB_INSTALL, 180 TEXT, "No Script installation", "", 181 IGNEND, "", "", 182 183 EGROUP, "", "", 184 185 BGROUP, "Tomcat", "", 186 PROP, "HTTP-Port", DictConstants.WEB_PORT, 187 PROP, "Instanz-Name", DictConstants.WEB_INSTANCE, 188 EGROUP, "", "" 189 }; 190 191 private String getDetailScreen() { 192 StringBuffer strbuf = new StringBuffer (); 193 194 strbuf.append("<html>"); 195 strbuf.append("<body bgcolor=\"efefef\">"); 196 strbuf.append("<h3><font color=\"#ff4444\">Details:</font></h3>"); 197 198 199 int ignore = 0; 200 int iflevel = 0; 201 202 203 for (int di = 0; di < details_form.length; di += 3) { 204 if (ignore == 0) { 205 if (BGROUP.equals(details_form[di])) { 206 strbuf.append("<table border=\"0\">"); 207 strbuf.append("<tr><td colspan=\"2\"><tt><font size=\"-1\"><b>"); 208 strbuf.append(details_form[di + 1]); 209 strbuf.append("</b></font></tt></td></tr>"); 210 } 211 else if (EGROUP.equals(details_form[di])) { 212 strbuf.append("</table><br>"); 213 } 214 else if (PROP.equals(details_form[di])) { 215 Object prop = wmi.getDictionary().get(details_form[di + 2]); 216 217 strbuf.append("<tr><td><tt><font size=\"-1\">"); 218 strbuf.append(details_form[di + 1]); 219 strbuf.append(":</font></tt></td><td><tt><font size=\"-1\">"); 220 221 if (prop != null) 222 strbuf.append(prop.toString()); 223 224 strbuf.append("</font></tt></td></tr>"); 225 } 226 else if (HPROP.equals(details_form[di])) { 227 Object prop = wmi.getDictionary().get(details_form[di + 2]); 228 String t = prop.toString(); 229 StringBuffer buf = new StringBuffer (t.length()); 230 for (int c = 0; c < t.length(); c++) 231 buf.append('*'); 232 233 strbuf.append("<tr><td><tt><font size=\"-1\">"); 234 strbuf.append(details_form[di + 1]); 235 strbuf.append(":</font></tt></td><td><tt><font size=\"-1\">"); 236 237 if (prop != null) 238 strbuf.append(buf.toString()); 239 240 strbuf.append("</font></tt></td></tr>"); 241 } 242 else if (IGNIF.equals(details_form[di])) { 243 Object prop = wmi.getDictionary().get(details_form[di + 2]); 244 String t = prop.toString(); 245 iflevel++; 246 if (details_form[di + 1].equals(t)) 247 ignore = iflevel; 248 else 249 ignore = 0; 250 } 251 else if (IGNIFN.equals(details_form[di])) { 252 Object prop = wmi.getDictionary().get(details_form[di + 2]); 253 String t = prop.toString(); 254 iflevel++; 255 if (details_form[di + 1].equals(t)) 256 ignore = 0; 257 else 258 ignore = iflevel; 259 } 260 else if (IGNEND.equals(details_form[di])) { 261 iflevel--; 262 } 263 else if (TEXT.equals(details_form[di])) { 264 strbuf.append("<tr><td colspan=\"2\"><tt><font size=\"-1\"><i>"); 265 strbuf.append(details_form[di + 1]); 266 strbuf.append("</i></font></tt></td></tr>"); 267 } 268 } 269 else { 270 if (IGNIF.equals(details_form[di]) || 271 IGNIFN.equals(details_form[di])) { 272 iflevel++; 273 } 274 if (IGNEND.equals(details_form[di])) { 275 if (ignore == iflevel) 276 ignore = 0; 277 iflevel--; 278 } 279 } 280 281 } 282 283 strbuf.append("</body>"); 284 strbuf.append("</html>"); 285 286 return strbuf.toString(); 287 } 288 } 289 | Popular Tags |