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

  1. import java.awt.BorderLayout;
  2. import java.awt.Container;
  3. import java.awt.Event;
  4. import java.awt.Label;
  5. import java.awt.Panel;
  6. import java.awt.TextField;
  7.  
  8. public class SalesReportClient extends JDPClassLayout {
  9.    JDPUser user;
  10.    JDPJagg jaggSQL;
  11.    JDPPopupMessage popuppanel;
  12.    JDPMaskEdit JDPMaskEditMain;
  13.    String moduleParameter;
  14.    Panel Main;
  15.    JDPScrollPanel ScrollPanel1;
  16.    Label Label2;
  17.    TextField mailServer;
  18.    Label Label3;
  19.    TextField toAddress;
  20.    Label Label4;
  21.    TextField returnAddress;
  22.    Label Label1;
  23.    JDPButtons JDPButtons1;
  24.    JDPRMIConnection RMIConnection1;
  25.  
  26.    public void InitClass(JDPUser var1, Panel var2, String var3) {
  27.       this.user = var1;
  28.       this.moduleParameter = var3;
  29.       super.targetPanel = var2;
  30.       this.jaggSQL = new JDPJagg(var1.jaggPath);
  31.       ((Container)this).setLayout(new BorderLayout());
  32.       this.popuppanel = new JDPPopupMessage(var1, this);
  33.       ((Container)this).add(this.popuppanel);
  34.       this.JDPMaskEditMain = new JDPMaskEdit();
  35.       this.Main = new Panel();
  36.       this.ScrollPanel1 = new JDPScrollPanel();
  37.       this.Label2 = new Label("Mail Server Name:", 0);
  38.       this.mailServer = new TextField("mail", 20);
  39.       this.Label3 = new Label("Recipient Email Address:", 0);
  40.       this.toAddress = new TextField("", 20);
  41.       this.Label4 = new Label("Sender's Email Address:", 0);
  42.       this.returnAddress = new TextField("", 20);
  43.       this.Label1 = new Label("This example demonstrates the use of a Server Session Bean that sends a email sales report to an end user", 0);
  44.       String[] var4 = new String[]{"Send"};
  45.       int[] var5 = new int[]{JDPButton.getIconValue("Email")};
  46.       this.JDPButtons1 = new JDPButtons(var1, var4, var5, JDPButtons.getAlignmentValue("Horizontal"));
  47.       this.RMIConnection1 = new JDPRMIConnection(var1);
  48.       this.Main.setLayout(new BorderLayout());
  49.       ((Container)this).add("Center", this.Main);
  50.       this.Main.add("Center", this.ScrollPanel1);
  51.       this.ScrollPanel1.add("Left", this.Label2);
  52.       this.ScrollPanel1.add("Right", this.mailServer);
  53.       this.ScrollPanel1.add("Left", this.Label3);
  54.       this.ScrollPanel1.add("Right", this.toAddress);
  55.       this.ScrollPanel1.add("Left", this.Label4);
  56.       this.ScrollPanel1.add("Right", this.returnAddress);
  57.       this.Main.add("North", this.Label1);
  58.       this.Main.add("South", this.JDPButtons1);
  59.       var1.gParm.addElement(this);
  60.       this.InitComponents();
  61.    }
  62.  
  63.    public boolean handleEvent(Event var1) {
  64.       switch (var1.id) {
  65.          case 503:
  66.          case 504:
  67.          case 505:
  68.             this.popuppanel.postEvent(var1);
  69.             return false;
  70.          case 1001:
  71.             if (var1.target.equals(this.JDPButtons1.button[0])) {
  72.                this.submitReportJob();
  73.                return true;
  74.             }
  75.  
  76.             return false;
  77.          default:
  78.             return false;
  79.       }
  80.    }
  81.  
  82.    public void InitComponents() {
  83.       this.jaggSQL.setKeepConnectionOpen(false);
  84.    }
  85.  
  86.    public void submitReportJob() {
  87.       String var1 = "JDPSubsystemMgr,JDPJob,";
  88.       var1 = var1 + this.mailServer.getText() + ",";
  89.       var1 = var1 + this.toAddress.getText() + ",";
  90.       var1 = var1 + this.returnAddress.getText();
  91.       String var2 = this.RMIConnection1.submitJob("QIMMED", "Sales Report", "C", "SalesReportSessionBean", "(JDPSubsystemMgr,JDPJob,String,String,String)", var1, 5, 5, false, -1, "", "", "B");
  92.       if (var2 == null) {
  93.          this.user.mainmsg.setStatusMsg("Job submission failed.", 10);
  94.       } else if (var2.startsWith("Jobnumber:")) {
  95.          this.user.mainmsg.setStatusMsg("Sales Report job submitted to QIMMED.", 10);
  96.       } else {
  97.          this.user.mainmsg.setStatusMsg(var2, 20);
  98.       }
  99.    }
  100. }
  101.