home *** CD-ROM | disk | FTP | other *** search
- package com.sfs.iavazip;
-
- import com.sfs.awt.Picture;
- import com.sfs.awt.TexturePanel;
- import com.sfs.util.Reg;
- import java.awt.AWTEvent;
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.Image;
- import java.awt.Label;
- import java.awt.Panel;
- import java.awt.Rectangle;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.WindowEvent;
-
- public class About extends Dialog implements ActionListener {
- iavaZip mainApp;
- boolean retCode = true;
- PurchasePanel purchase;
- LicensePanel license;
- FailedPanel failed;
- GrantedPanel granted;
- Panel about;
- Panel lastPanel;
-
- protected void processWindowEvent(WindowEvent var1) {
- switch (((AWTEvent)var1).getID()) {
- case 201:
- this.retCode = false;
- ((Window)this).dispose();
- return;
- default:
- }
- }
-
- public void actionPerformed(ActionEvent var1) {
- String var2 = var1.getActionCommand();
- ((Container)this).remove(this.lastPanel);
- if (var2.equals("OK")) {
- this.retCode = false;
- ((Window)this).dispose();
- }
-
- if (var2.equals("Purchase a license")) {
- ((Dialog)this).setTitle("Purchase a license");
- ((Container)this).add("Center", this.lastPanel = this.purchase);
- }
-
- if (var2.equals("Cancel")) {
- if (this.lastPanel == this.purchase) {
- ((Dialog)this).setTitle("About");
- ((Container)this).add("Center", this.lastPanel = this.about);
- } else if (this.lastPanel == this.license) {
- ((Container)this).add("Center", this.lastPanel = this.purchase);
- }
- }
-
- if (var2.equals("License iavaZIP")) {
- ((Dialog)this).setTitle("Purchase a license");
- ((Container)this).add("Center", this.lastPanel = this.license);
- }
-
- if (var2.equals("License iavaZIP now")) {
- if (Reg.isSerialRegcode(this.license.registrationCode.getText())) {
- this.mainApp.properties.put("user.Name", this.license.userName.getText());
- this.mainApp.properties.put("user.Code", this.license.registrationCode.getText());
- ((Dialog)this).setTitle("License granted");
- this.granted.setUserData(this.license.userName.getText(), this.license.registrationCode.getText());
- ((Container)this).add("Center", this.granted);
- } else {
- ((Container)this).add("Center", this.lastPanel = this.failed);
- }
- }
-
- if (var2.equals("OK")) {
- this.retCode = true;
- ((Window)this).dispose();
- }
-
- if (var2.equals("Back")) {
- ((Dialog)this).setTitle("Purchase a license");
- ((Container)this).add("Center", this.lastPanel = this.license);
- }
-
- ((Window)this).pack();
- }
-
- About(iavaZip var1) {
- super(var1, "About iavaZip", true);
- this.mainApp = var1;
- ((Container)this).setLayout(new BorderLayout());
- this.about = new Panel();
- this.about.setLayout(new BorderLayout());
- TexturePanel var2 = new TexturePanel(this, var1.backgroundTexture);
- Image var3 = ((Window)this).getToolkit().getImage(this.getClass().getResource("logo.gif"));
- ((Window)this).getToolkit().prepareImage(var3, -1, -1, this);
- ((Container)var2).add(new Picture(this, var3, true));
- this.about.add("Center", var2);
- TexturePanel var4 = new TexturePanel(this, var1.backgroundTexture);
- ((Container)var4).setLayout(new FlowLayout());
- Button var5 = new Button("OK");
- ((Container)var4).add(var5);
- var5.addActionListener(this);
- Panel var6 = new Panel();
- ((Container)var6).setLayout(new GridLayout(2, 1));
- Label var7 = new Label("This version is not licensed.", 1);
- if (var1.properties.getProperty("user.Name") != null) {
- var7.setText("Licensed for: " + var1.properties.getProperty("user.Name"));
- } else {
- var5 = new Button("Purchase a license");
- ((Container)var4).add(var5);
- var5.addActionListener(this);
- }
-
- ((Component)var7).setBackground(Color.gray);
- ((Container)var6).add(var7);
- ((Container)var6).add(var4);
- this.about.add("South", var6);
- ((Container)this).add("Center", this.lastPanel = this.about);
- ((Window)this).pack();
- this.purchase = new PurchasePanel(var1, this);
- this.license = new LicensePanel(var1, this);
- this.granted = new GrantedPanel(var1, this);
- this.failed = new FailedPanel(var1, this);
- ((Component)this).enableEvents(64L);
- }
-
- public boolean doModal() {
- ((Window)this).pack();
- Rectangle var1 = ((Component)this).getParent().getBounds();
- Rectangle var2 = ((Component)this).getBounds();
- var2.x = var1.x + (var1.width - var2.width) / 2;
- var2.y = var1.y + (var1.height - var2.height) / 2;
- ((Component)this).setBounds(var2);
- ((Dialog)this).show();
- return this.retCode;
- }
- }
-