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

  1. import java.awt.BorderLayout;
  2. import java.awt.CheckboxGroup;
  3. import java.awt.Container;
  4. import java.awt.Event;
  5. import java.awt.Label;
  6. import java.awt.Panel;
  7. import java.awt.TextField;
  8.  
  9. public class SimplePrinting extends JDPClassLayout {
  10.    JDPUser user;
  11.    JDPJagg jaggSQL;
  12.    JDPPopupMessage popuppanel;
  13.    JDPMaskEdit JDPMaskEditMain;
  14.    String moduleParameter;
  15.    Panel Main;
  16.    JDPButtons JDPButtons1;
  17.    JDPScrollPanel ScrollPanel1;
  18.    Label Label1;
  19.    TextField TextField1;
  20.    Label Label2;
  21.    TextField TextField2;
  22.    JDPEmailSender EMail1;
  23.    JDPFormatDoc Formatter1;
  24.  
  25.    public void InitClass(JDPUser var1, Panel var2, String var3) {
  26.       this.user = var1;
  27.       this.moduleParameter = var3;
  28.       this.jaggSQL = new JDPJagg(var1.jaggPath);
  29.       ((Container)this).setLayout(new BorderLayout());
  30.       this.popuppanel = new JDPPopupMessage(var1, this);
  31.       ((Container)this).add(this.popuppanel);
  32.       this.JDPMaskEditMain = new JDPMaskEdit();
  33.       new CheckboxGroup();
  34.       this.Main = new Panel();
  35.       String[] var4 = new String[]{"Create Html", "Create Excel", "Send Email"};
  36.       int[] var5 = new int[]{JDPButton.getIconValue("New"), JDPButton.getIconValue("New"), JDPButton.getIconValue("Email")};
  37.       this.JDPButtons1 = new JDPButtons(var1, var4, var5, JDPButtons.getAlignmentValue("Horizontal"));
  38.       this.ScrollPanel1 = new JDPScrollPanel();
  39.       this.Label1 = new Label("Name:", 0);
  40.       this.TextField1 = new TextField("", 20);
  41.       this.Label2 = new Label("Email:", 0);
  42.       this.TextField2 = new TextField("", 20);
  43.       this.EMail1 = new JDPEmailSender(var1);
  44.       this.Formatter1 = new JDPFormatDoc(var1);
  45.       this.Main.setLayout(new BorderLayout());
  46.       ((Container)this).add("Center", this.Main);
  47.       this.Main.add("South", this.JDPButtons1);
  48.       this.Main.add("Center", this.ScrollPanel1);
  49.       this.ScrollPanel1.add("Left", this.Label1);
  50.       this.ScrollPanel1.add("Right", this.TextField1);
  51.       this.ScrollPanel1.add("Left", this.Label2);
  52.       this.ScrollPanel1.add("Right", this.TextField2);
  53.       this.InitComponents();
  54.       var1.gParm.addElement(this);
  55.    }
  56.  
  57.    public boolean handleEvent(Event var1) {
  58.       switch (var1.id) {
  59.          case 503:
  60.          case 504:
  61.          case 505:
  62.             this.popuppanel.postEvent(var1);
  63.             return false;
  64.          case 1001:
  65.             if (var1.target.equals(this.JDPButtons1.button[0])) {
  66.                this.Formatter1.initDocument(0);
  67.                this.Formatter1.setTitle("My first html report");
  68.                this.Formatter1.setBody("");
  69.                this.Formatter1.addHeader("My First Report", "h2");
  70.                this.Formatter1.addComponent(this.ScrollPanel1);
  71.                this.Formatter1.finishOutput();
  72.                this.Formatter1.loadDocument();
  73.                return true;
  74.             } else if (var1.target.equals(this.JDPButtons1.button[1])) {
  75.                this.Formatter1.initDocument(3);
  76.                this.Formatter1.addComponent(this.ScrollPanel1);
  77.                this.Formatter1.finishOutput();
  78.                this.Formatter1.loadDocument();
  79.                return true;
  80.             } else {
  81.                if (var1.target.equals(this.JDPButtons1.button[2])) {
  82.                   this.Formatter1.initDocument(2);
  83.                   this.Formatter1.addComponent(this.ScrollPanel1);
  84.                   this.Formatter1.finishOutput();
  85.                   this.user.u.writeToFile(this.user.JDesignerPro.JDPDirectory + "temp" + JDesignerPro.serverSeparator + this.user.cust.getUsername() + ".txt", this.Formatter1.getFinishedDocument(), "w+");
  86.                   this.EMail1.setMailServer("mail");
  87.                   this.EMail1.setToAddress(this.TextField2.getText());
  88.                   this.EMail1.setReturnAddress(this.TextField2.getText());
  89.                   this.EMail1.setMessageSubject("Attached file example from JDesignerPro");
  90.                   this.EMail1.setMessage("Hi " + this.TextField1.getText() + ",\n" + "This message was sent from JDesignerPro to demonstrate how to send an attachment created from the contents of a JDP screen.\n\n");
  91.                   this.EMail1.setAttachment(this.user.JDesignerPro.JDPDirectory + "temp" + JDesignerPro.serverSeparator + this.user.cust.getUsername() + ".txt");
  92.                   this.EMail1.sendSingleMessage();
  93.                   return true;
  94.                }
  95.  
  96.                return false;
  97.             }
  98.          default:
  99.             return false;
  100.       }
  101.    }
  102.  
  103.    public void InitComponents() {
  104.    }
  105. }
  106.