home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPSupportApp.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-09  |  10.1 KB  |  319 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Container;
  3. import java.awt.Dialog;
  4. import java.awt.Event;
  5. import java.awt.Font;
  6. import java.awt.Label;
  7. import java.awt.Panel;
  8. import java.awt.TextArea;
  9. import java.awt.TextField;
  10. import java.util.Vector;
  11.  
  12. public class JDPSupportApp extends JDPClassLayout {
  13.    JDPUser user;
  14.    JDPJagg jaggSQL;
  15.    JDPPopupMessage popuppanel;
  16.    JDPMaskEdit JDPMaskEditMain;
  17.    String moduleParameter;
  18.    Panel Main;
  19.    JDPEmailSender EMail1;
  20.    JDPChiselFramePanel ChiselPanel1;
  21.    JDPTabSelectPanel TabPanel1;
  22.    Panel Panel1;
  23.    JDPScrollPanel ScrollPanel2;
  24.    Label Label9;
  25.    TextField fromAddress;
  26.    Label Label3;
  27.    TextField subject;
  28.    Label Label2;
  29.    TextField firstName;
  30.    Label Label5;
  31.    TextField lastName;
  32.    Label Label4;
  33.    TextField mailServer;
  34.    Label Label6;
  35.    Panel Panel3;
  36.    TextField attachment;
  37.    JDPButton JDPButton1;
  38.    Panel Panel2;
  39.    Label Label1;
  40.    TextArea messageText;
  41.    JDPButtons JDPButtons1;
  42.    JDPBrowser HTMLPanel1;
  43.  
  44.    public void InitClass(JDPUser var1, Panel var2, String var3) {
  45.       this.user = var1;
  46.       this.moduleParameter = var3;
  47.       super.targetPanel = var2;
  48.       this.jaggSQL = new JDPJagg(var1.jaggPath);
  49.       ((Container)this).setLayout(new BorderLayout());
  50.       this.popuppanel = new JDPPopupMessage(var1, this);
  51.       ((Container)this).add(this.popuppanel);
  52.       this.JDPMaskEditMain = new JDPMaskEdit();
  53.       this.Main = new Panel();
  54.       this.EMail1 = new JDPEmailSender(var1);
  55.       this.ChiselPanel1 = new JDPChiselFramePanel(var1, "BulletProof Customer Support");
  56.       String[] var4 = new String[2];
  57.       Panel[] var5 = new Panel[]{new Panel(), null};
  58.       var5[0].setLayout(new BorderLayout());
  59.       var4[0] = "Send a message to Customer Support";
  60.       var5[1] = new Panel();
  61.       var5[1].setLayout(new BorderLayout());
  62.       var4[1] = "Win JDesignerPro valued at $1200";
  63.       this.TabPanel1 = new JDPTabSelectPanel(var1, var4, var5, "North");
  64.       this.Panel1 = new Panel();
  65.       this.ScrollPanel2 = new JDPScrollPanel();
  66.       this.Label9 = new Label("Enter your email address:", 0);
  67.       this.fromAddress = new TextField(String.valueOf(var1.cust.getEmailaddr()), 30);
  68.       this.Label3 = new Label("Subject of your question:", 0);
  69.       this.subject = new TextField("", 30);
  70.       this.Label2 = new Label("Your First name:", 0);
  71.       this.firstName = new TextField(String.valueOf(var1.cust.getFirstname()), 30);
  72.       this.Label5 = new Label("Your Last name:", 0);
  73.       this.lastName = new TextField(String.valueOf(var1.cust.getLastname()), 30);
  74.       this.Label4 = new Label("Enter your mailserver (only if send fails):", 0);
  75.       this.mailServer = new TextField("mail", 30);
  76.       this.Label6 = new Label("Attach file:", 0);
  77.       this.Panel3 = new Panel();
  78.       this.attachment = new TextField("", 30);
  79.       this.JDPButton1 = new JDPButton(JDPButton.getIconValue("New"), "Attach", JDPButton.getAlignmentValue("Center"));
  80.       this.Panel2 = new Panel();
  81.       this.Label1 = new Label("Enter the details of your question. The Java console and your system specifics are automatically added to this message:", 0);
  82.       this.messageText = new TextArea("", 6, 31);
  83.       String[] var6 = new String[]{"Send"};
  84.       int[] var7 = new int[]{JDPButton.getIconValue("Email")};
  85.       this.JDPButtons1 = new JDPButtons(var1, var6, var7, JDPButtons.getAlignmentValue("Horizontal"));
  86.       this.HTMLPanel1 = new JDPBrowser();
  87.       this.HTMLPanel1.InitClass(var1, var2, "Docs/jdpwin.htm");
  88.       this.Main.setLayout(new BorderLayout());
  89.       ((Container)this).add("Center", this.Main);
  90.       this.Main.add("Center", this.ChiselPanel1);
  91.       this.ChiselPanel1.add("Center", this.TabPanel1);
  92.       var5[0].add("Center", this.Panel1);
  93.       this.Panel1.setLayout(new BorderLayout());
  94.       this.Panel1.add("North", this.ScrollPanel2);
  95.       this.ScrollPanel2.add("Left", this.Label9);
  96.       this.ScrollPanel2.add("Right", this.fromAddress);
  97.       this.ScrollPanel2.add("Left", this.Label3);
  98.       this.ScrollPanel2.add("Right", this.subject);
  99.       this.ScrollPanel2.add("Left", this.Label2);
  100.       this.ScrollPanel2.add("Right", this.firstName);
  101.       this.ScrollPanel2.add("Left", this.Label5);
  102.       this.ScrollPanel2.add("Right", this.lastName);
  103.       this.ScrollPanel2.add("Left", this.Label4);
  104.       this.ScrollPanel2.add("Right", this.mailServer);
  105.       this.ScrollPanel2.add("Left", this.Label6);
  106.       this.ScrollPanel2.add("Right", this.Panel3);
  107.       this.Panel3.setLayout(new JDPLineLayout());
  108.       this.Panel3.add("Left", this.attachment);
  109.       this.Panel3.add("Left", this.JDPButton1);
  110.       this.Panel1.add("Center", this.Panel2);
  111.       this.Panel2.setLayout(new BorderLayout());
  112.       this.Panel2.add("North", this.Label1);
  113.       this.Panel2.add("Center", this.messageText);
  114.       this.Panel1.add("South", this.JDPButtons1);
  115.       var5[1].add("Center", this.HTMLPanel1);
  116.       this.ChiselPanel1.setFont(new Font("Helvetica", 0, 11));
  117.       this.ChiselPanel1.setForeground(var1.u._cvtcolor("Black"));
  118.       this.ChiselPanel1.setBackground(var1.u._cvtcolor("LightGray"));
  119.       this.TabPanel1.setTabcolor(0, var1.u._cvtcolor("Black"), var1.u._cvtcolor("LightGray"));
  120.       this.TabPanel1.setTabcolor(1, var1.u._cvtcolor("Black"), var1.u._cvtcolor("LightGray"));
  121.       this.Label9.setFont(new Font("Helvetica", 1, 11));
  122.       this.Label9.setForeground(var1.u._cvtcolor("Black"));
  123.       this.Label9.setBackground(var1.u._cvtcolor("LightGray"));
  124.       this.fromAddress.setFont(new Font("Helvetica", 0, 11));
  125.       this.fromAddress.setForeground(var1.u._cvtcolor("Black"));
  126.       this.fromAddress.setBackground(var1.u._cvtcolor("White"));
  127.       this.Label3.setFont(new Font("Helvetica", 1, 11));
  128.       this.Label3.setForeground(var1.u._cvtcolor("Black"));
  129.       this.Label3.setBackground(var1.u._cvtcolor("LightGray"));
  130.       this.subject.setFont(new Font("Helvetica", 0, 11));
  131.       this.subject.setForeground(var1.u._cvtcolor("Black"));
  132.       this.subject.setBackground(var1.u._cvtcolor("White"));
  133.       this.Label2.setFont(new Font("Helvetica", 1, 11));
  134.       this.Label2.setForeground(var1.u._cvtcolor("Black"));
  135.       this.Label2.setBackground(var1.u._cvtcolor("LightGray"));
  136.       this.firstName.setFont(new Font("Helvetica", 0, 11));
  137.       this.firstName.setForeground(var1.u._cvtcolor("Black"));
  138.       this.firstName.setBackground(var1.u._cvtcolor("White"));
  139.       this.Label5.setFont(new Font("Helvetica", 1, 11));
  140.       this.Label5.setForeground(var1.u._cvtcolor("Black"));
  141.       this.Label5.setBackground(var1.u._cvtcolor("LightGray"));
  142.       this.lastName.setFont(new Font("Helvetica", 0, 11));
  143.       this.lastName.setForeground(var1.u._cvtcolor("Black"));
  144.       this.lastName.setBackground(var1.u._cvtcolor("White"));
  145.       this.Label4.setFont(new Font("Helvetica", 1, 11));
  146.       this.Label4.setForeground(var1.u._cvtcolor("Black"));
  147.       this.Label4.setBackground(var1.u._cvtcolor("LightGray"));
  148.       this.mailServer.setFont(new Font("Helvetica", 0, 11));
  149.       this.mailServer.setForeground(var1.u._cvtcolor("Black"));
  150.       this.mailServer.setBackground(var1.u._cvtcolor("White"));
  151.       this.Label6.setFont(new Font("Helvetica", 1, 11));
  152.       this.Label6.setForeground(var1.u._cvtcolor("Black"));
  153.       this.Label6.setBackground(var1.u._cvtcolor("LightGray"));
  154.       this.Panel3.setFont(new Font("Helvetica", 0, 11));
  155.       this.Panel3.setForeground(var1.u._cvtcolor("Black"));
  156.       this.Panel3.setBackground(var1.u._cvtcolor("LightGray"));
  157.       this.attachment.setBackground(var1.u._cvtcolor("White"));
  158.       this.Panel2.setFont(new Font("Helvetica", 0, 11));
  159.       this.Panel2.setForeground(var1.u._cvtcolor("Black"));
  160.       this.Panel2.setBackground(var1.u._cvtcolor("LightGray"));
  161.       this.JDPButtons1.setFont(new Font("Helvetica", 0, 11));
  162.       this.JDPButtons1.setForeground(var1.u._cvtcolor("Black"));
  163.       this.JDPButtons1.setBackground(var1.u._cvtcolor("LightGray"));
  164.       this.HTMLPanel1.setFont(new Font("TimesRoman", 0, 14));
  165.       var1.gParm.addElement(this);
  166.       this.InitComponents();
  167.    }
  168.  
  169.    public boolean handleEvent(Event var1) {
  170.       switch (var1.id) {
  171.          case 401:
  172.             if (var1.key == 9 && var1.modifiers != 1) {
  173.                if (var1.target.equals(this.fromAddress)) {
  174.                   this.user.u.cursor(this.subject);
  175.                }
  176.  
  177.                if (var1.target.equals(this.subject)) {
  178.                   this.user.u.cursor(this.firstName);
  179.                }
  180.  
  181.                if (var1.target.equals(this.firstName)) {
  182.                   this.user.u.cursor(this.lastName);
  183.                }
  184.  
  185.                if (var1.target.equals(this.lastName)) {
  186.                   this.user.u.cursor(this.mailServer);
  187.                }
  188.  
  189.                if (var1.target.equals(this.mailServer)) {
  190.                   this.user.u.cursor(this.messageText);
  191.                }
  192.  
  193.                if (var1.target.equals(this.messageText)) {
  194.                   this.user.u.cursor(this.fromAddress);
  195.                }
  196.             }
  197.  
  198.             if (var1.key == 9 && var1.modifiers == 1) {
  199.                if (var1.target.equals(this.fromAddress)) {
  200.                   this.user.u.cursor(this.messageText);
  201.                   return true;
  202.                }
  203.  
  204.                if (var1.target.equals(this.subject)) {
  205.                   this.user.u.cursor(this.fromAddress);
  206.                   return true;
  207.                }
  208.  
  209.                if (var1.target.equals(this.firstName)) {
  210.                   this.user.u.cursor(this.subject);
  211.                   return true;
  212.                }
  213.  
  214.                if (var1.target.equals(this.lastName)) {
  215.                   this.user.u.cursor(this.firstName);
  216.                   return true;
  217.                }
  218.  
  219.                if (var1.target.equals(this.mailServer)) {
  220.                   this.user.u.cursor(this.lastName);
  221.                   return true;
  222.                }
  223.  
  224.                if (var1.target.equals(this.messageText)) {
  225.                   this.user.u.cursor(this.mailServer);
  226.                   return true;
  227.                }
  228.             }
  229.  
  230.             return false;
  231.          case 503:
  232.          case 504:
  233.          case 505:
  234.             this.popuppanel.postEvent(var1);
  235.             return false;
  236.          case 1001:
  237.             if (var1.target.equals(this.JDPButton1)) {
  238.                JDPFileDialog var16 = new JDPFileDialog(this.user, this.user.jdpMainWindow, "Select the file to attach");
  239.                JDPFilePicker var3 = var16.getFilePicker();
  240.                var3.setMode(0);
  241.                var3.setMultipleSelections(false);
  242.                var3.loadFiles(this.user.JDesignerPro.JDPDirectory + JDesignerPro.serverSeparator + "Applications", false);
  243.                ((Dialog)var16).show();
  244.                this.attachment.setText(var3.getSelectedFullPath());
  245.                return true;
  246.             } else {
  247.                if (var1.target.equals(this.JDPButtons1.button[0])) {
  248.                   this.EMail1.setMailServer(this.mailServer.getText());
  249.                   this.EMail1.setToAddress("support@bulletproof.com");
  250.                   this.EMail1.setMessageSubject(this.subject.getText());
  251.                   this.EMail1.setReturnAddress(this.fromAddress.getText());
  252.                   if (!this.user.u.ischaracter(this.fromAddress, this.user.mainmsg)) {
  253.                      return true;
  254.                   }
  255.  
  256.                   if (!this.user.u.ischaracter(this.subject, this.user.mainmsg)) {
  257.                      return true;
  258.                   }
  259.  
  260.                   if (!this.user.u.ischaracter(this.firstName, this.user.mainmsg)) {
  261.                      return true;
  262.                   }
  263.  
  264.                   if (!this.user.u.ischaracter(this.lastName, this.user.mainmsg)) {
  265.                      return true;
  266.                   }
  267.  
  268.                   String var2 = "Firstname:" + this.firstName.getText() + "\n";
  269.                   var2 = var2 + "Lastname:" + this.lastName.getText() + "\n";
  270.                   var2 = var2 + "Email:" + this.fromAddress.getText() + "\n";
  271.                   var2 = var2 + "JDPVersion:" + JDesignerPro.actualversion + "\n";
  272.                   var2 = var2 + "Vendor:" + System.getProperty("java.vendor") + "\n";
  273.                   var2 = var2 + "Version:" + System.getProperty("java.version") + "\n";
  274.                   var2 = var2 + "OS Name:" + System.getProperty("os.name") + "\n";
  275.                   var2 = var2 + "OS Version:" + System.getProperty("os.version") + "\n";
  276.                   var2 = var2 + "Domain:" + this.user.getJDPDomain() + "\n";
  277.                   var2 = var2 + "\n";
  278.                   var2 = var2 + this.messageText.getText();
  279.                   var2 = var2 + "\n\n";
  280.                   var2 = var2 + "Console:\n" + this.user.JDesignerPro.consoleDialog.consoleOutput.getText() + "\n";
  281.                   this.EMail1.setMessage(var2);
  282.                   this.EMail1.setAttachment(this.attachment.getText());
  283.                   this.EMail1.sendSingleMessage();
  284.                   this.updateJDPUserTable();
  285.                   return true;
  286.                }
  287.  
  288.                return false;
  289.             }
  290.          default:
  291.             return false;
  292.       }
  293.    }
  294.  
  295.    public void InitComponents() {
  296.       if (this.firstName.getText().equals("Admin")) {
  297.          this.firstName.setText("");
  298.       }
  299.  
  300.       if (this.lastName.getText().equals("Account")) {
  301.          this.lastName.setText("");
  302.       }
  303.  
  304.       if (!JDesignerPro.executable) {
  305.          this.Label1.setText("Enter the details of your question:");
  306.       }
  307.  
  308.    }
  309.  
  310.    public void updateJDPUserTable() {
  311.       if ((this.user.cust.getFirstname().equals("") || this.user.cust.getFirstname().equals("Admin") || this.user.cust.getLastname().equals("") || this.user.cust.getLastname().equals("Account") || this.user.cust.getEmailaddr().equals("")) && !this.user.cust.username.toLowerCase().equals("guest")) {
  312.          String var1 = "UPDATE JDPUser SET firstname = '" + this.firstName.getText() + "'," + "lastname = '" + this.lastName.getText() + "', " + "emailaddr = '" + this.fromAddress.getText() + "' " + "WHERE userid = " + this.user.cust.suserid;
  313.          Vector var2 = new Vector();
  314.          this.user.jaggSQL.execSQL(var1, var2);
  315.       }
  316.  
  317.    }
  318. }
  319.