1 23 24 package org.infoglue.cmsinstaller; 25 import javax.swing.*; 26 import java.awt.*; 27 28 31 32 public class InstallerSkeleton extends JFrame 33 { 34 private InfoGlueInstaller infoglueInstaller = null; 35 36 public IntroductionDialog introductionDialog = null; 37 public DatabaseDialog databaseDialog = null; 38 public ServerDialog serverDialog = null; 39 public FinishDialog finishDialog = null; 40 public InstallingDialog installingDialog = null; 41 public DoneDialog doneDialog = null; 42 43 protected JButton backButton = null; 44 protected JButton nextButton = null; 45 protected String previousPanel = ""; 46 private int mainXStart = 205; 47 private int mainXWidth = 422; 48 private int mainYStart = 5; 49 private int mainYHeight = 520; 50 51 public InstallerSkeleton(InfoGlueInstaller infoglueInstaller) 52 { 53 this.infoglueInstaller = infoglueInstaller; 54 55 this.setDefaultCloseOperation(EXIT_ON_CLOSE); 56 57 this.setSize(640, 590); 58 this.getContentPane().setLayout(null); 59 this.getContentPane().setBackground(Color.WHITE); 60 this.setResizable(false); 61 62 ImagePanel imagePanel = new ImagePanel(); 63 imagePanel.setBounds(0, 0, 400, 590); 64 imagePanel.setBackground(Color.BLACK); 65 66 JPanel linePanel = new JPanel(); 67 linePanel.setBounds(0, 522, 640, 2); 68 linePanel.setBackground(Color.BLACK); 69 70 JPanel buttonPanel = new JPanel(); 71 buttonPanel.setLayout(null); 72 buttonPanel.setBounds(0, 524, 640, 40); 73 buttonPanel.setBackground(new Color(212, 208, 200)); 74 75 backButton = new JButton("<< Back"); 76 backButton.setBounds(400, 7, 100, 24); 77 backButton.setBackground(new Color(212, 208, 200)); 78 backButton.addActionListener(new InstallerMouseAdapter(infoglueInstaller)); 80 buttonPanel.add(backButton); 81 82 nextButton = new JButton("Next >>"); 83 nextButton.setBounds(500, 7, 100, 24); 84 nextButton.setBackground(new Color(212, 208, 200)); 85 nextButton.addActionListener(new InstallerMouseAdapter(infoglueInstaller)); 87 buttonPanel.add(nextButton); 88 89 this.getContentPane().add(imagePanel); 90 this.getContentPane().add(linePanel); 91 this.getContentPane().add(buttonPanel); 92 } 93 94 95 public void showIntroductionDialog() 96 { 97 if(introductionDialog == null) 98 introductionDialog = new IntroductionDialog(this.infoglueInstaller); 99 introductionDialog.setBounds(mainXStart, mainYStart, mainXWidth, mainYHeight); 100 101 infoglueInstaller.setBackButtonCommand(""); 102 infoglueInstaller.setNextButtonCommand("ShowDatabaseDialog"); 103 104 if(this.getPreviousPanel().equalsIgnoreCase("databaseDialog")) 106 this.getContentPane().remove(databaseDialog); 107 this.setPreviousPanel(""); 108 this.backButton.hide(); 109 110 this.getContentPane().add(introductionDialog); 111 this.getContentPane().repaint(); 112 } 113 114 public void showDatabaseServerDialog() 115 { 116 if(databaseDialog == null) 117 databaseDialog = new DatabaseDialog(this.infoglueInstaller); 118 databaseDialog.setBounds(mainXStart, mainYStart, mainXWidth, mainYHeight); 119 120 infoglueInstaller.setBackButtonCommand("ShowIntroductionDialog"); 121 infoglueInstaller.setNextButtonCommand("ShowServerDialog"); 122 123 if(this.getPreviousPanel().equalsIgnoreCase("serverDialog")) 124 this.getContentPane().remove(serverDialog); 125 else 126 this.getContentPane().remove(introductionDialog); 127 this.setPreviousPanel("databaseDialog"); 128 this.backButton.show(); 129 130 this.getContentPane().add(databaseDialog); 131 this.getContentPane().repaint(); 132 } 133 134 public void showServerDialog() 135 { 136 if(serverDialog == null) 137 serverDialog = new ServerDialog(this.infoglueInstaller); 138 serverDialog.setBounds(mainXStart, mainYStart, mainXWidth, mainYHeight); 139 140 infoglueInstaller.setBackButtonCommand("ShowDatabaseDialog"); 141 infoglueInstaller.setNextButtonCommand("ShowFinishDialog"); 142 143 if(this.getPreviousPanel().equalsIgnoreCase("finishDialog")) 144 this.getContentPane().remove(finishDialog); 145 else 146 this.getContentPane().remove(databaseDialog); 147 this.setPreviousPanel("serverDialog"); 148 this.nextButton.setLabel("Next"); 149 150 this.getContentPane().add(serverDialog); 151 this.getContentPane().repaint(); 152 } 153 154 public void showFinishDialog() 155 { 156 finishDialog = new FinishDialog(this.infoglueInstaller); 157 finishDialog.setBounds(mainXStart, mainYStart, mainXWidth, mainYHeight); 158 159 infoglueInstaller.setBackButtonCommand("ShowServerDialog"); 160 infoglueInstaller.setNextButtonCommand("ShowDOneDialog"); 161 162 this.setPreviousPanel("finishDialog"); 163 this.nextButton.setLabel("Finish"); 164 165 this.getContentPane().remove(serverDialog); 166 this.getContentPane().add(finishDialog); 167 this.getContentPane().repaint(); 168 } 169 170 public void showInstallingDialog() 171 { 172 installingDialog = new InstallingDialog(this.infoglueInstaller); 173 installingDialog.setBounds(mainXStart, mainYStart, mainXWidth, mainYHeight); 174 this.getContentPane().remove(finishDialog); 175 this.getContentPane().add(installingDialog); 176 this.getContentPane().repaint(); 177 } 178 179 public void showDoneDialog() 180 { 181 doneDialog = new DoneDialog(this.infoglueInstaller); 182 doneDialog.setBounds(mainXStart, mainYStart, mainXWidth, mainYHeight); 183 this.getContentPane().remove(installingDialog); 184 this.getContentPane().add(doneDialog); 185 this.getContentPane().repaint(); 186 } 187 188 public String getPreviousPanel() 189 { 190 return previousPanel; 191 } 192 public void setPreviousPanel(String previousPanel) 193 { 194 this.previousPanel = previousPanel; 195 } 196 } | Popular Tags |