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

  1. import java.awt.BorderLayout;
  2. import java.awt.Checkbox;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Event;
  6. import java.awt.Label;
  7. import java.awt.Panel;
  8. import java.awt.TextField;
  9. import java.util.Date;
  10. import java.util.StringTokenizer;
  11. import java.util.Vector;
  12.  
  13. public class JDPDefineClass extends JDPClassLayout {
  14.    JDPUser user;
  15.    JDPJagg jaggSQL;
  16.    JDPPopupMessage popuppanel;
  17.    JDPMaskEdit JDPMaskEditMain;
  18.    String moduleParameter;
  19.    Panel Main;
  20.    JDPChiselFramePanel ChiselPanel1;
  21.    Panel Panel1;
  22.    JDPScrollPanel ScrollPanel1;
  23.    Label Label1;
  24.    Panel Panel2;
  25.    TextField className;
  26.    TextField classDesc;
  27.    Label Label4;
  28.    Panel Panel3;
  29.    Checkbox publicCheck;
  30.    Checkbox finalCheck;
  31.    Checkbox abstractCheck;
  32.    Label Label2;
  33.    Label Label6;
  34.    Label Label7;
  35.    Panel Panel5;
  36.    JDPComboBox extendType;
  37.    Vector valueextendType;
  38.    Label Label5;
  39.    JDPComboBox implType;
  40.    Vector valueimplType;
  41.    Panel Panel4;
  42.    TextField authorName;
  43.    Label Label9;
  44.    TextField version;
  45.    Panel Panel6;
  46.    TextField createdDate;
  47.    Label Label8;
  48.    TextField lastModDate;
  49.  
  50.    public void InitClass(JDPUser var1, Panel var2, String var3) {
  51.       this.user = var1;
  52.       this.moduleParameter = var3;
  53.       super.targetPanel = var2;
  54.       this.jaggSQL = new JDPJagg(var1.jaggPath);
  55.       ((Container)this).setLayout(new BorderLayout());
  56.       this.popuppanel = new JDPPopupMessage(var1, this);
  57.       ((Container)this).add(this.popuppanel);
  58.       this.JDPMaskEditMain = new JDPMaskEdit();
  59.       this.Main = new Panel();
  60.       this.ChiselPanel1 = new JDPChiselFramePanel(var1, "Class Definition");
  61.       this.Panel1 = new Panel();
  62.       this.ScrollPanel1 = new JDPScrollPanel();
  63.       this.Label1 = new Label("Name/Desc:", 0);
  64.       this.Panel2 = new Panel();
  65.       this.className = new TextField("", 15);
  66.       this.classDesc = new TextField("", 50);
  67.       this.Label4 = new Label("", 0);
  68.       this.Panel3 = new Panel();
  69.       this.publicCheck = new Checkbox("public");
  70.       this.finalCheck = new Checkbox("final");
  71.       this.abstractCheck = new Checkbox("abstract");
  72.       this.Label2 = new Label("Extends:", 0);
  73.       this.Label6 = new Label("Author:", 0);
  74.       this.Label7 = new Label("Created:", 0);
  75.       this.Panel5 = new Panel();
  76.       this.extendTypeMain();
  77.       this.Label5 = new Label("Implements:", 0);
  78.       this.implTypeMain();
  79.       this.Panel4 = new Panel();
  80.       this.authorName = new TextField("", 13);
  81.       this.Label9 = new Label("Version:", 0);
  82.       this.version = new TextField("", 4);
  83.       this.Panel6 = new Panel();
  84.       this.createdDate = new TextField("", 23);
  85.       this.Label8 = new Label("Last Modified:", 0);
  86.       this.lastModDate = new TextField("", 23);
  87.       this.Main.setLayout(new BorderLayout());
  88.       ((Container)this).add("Center", this.Main);
  89.       this.Main.add("Center", this.ChiselPanel1);
  90.       this.ChiselPanel1.add("Center", this.Panel1);
  91.       this.Panel1.setLayout(new BorderLayout());
  92.       this.Panel1.add("Center", this.ScrollPanel1);
  93.       this.ScrollPanel1.add("Left", this.Label1);
  94.       this.ScrollPanel1.add("Right", this.Panel2);
  95.       this.Panel2.setLayout(new JDPLineLayout());
  96.       this.Panel2.add("Left", this.className);
  97.       this.Panel2.add("Left", this.classDesc);
  98.       this.ScrollPanel1.add("Left", this.Label4);
  99.       this.ScrollPanel1.add("Right", this.Panel3);
  100.       this.Panel3.setLayout(new JDPLineLayout());
  101.       this.Panel3.add("Left", this.publicCheck);
  102.       this.Panel3.add("Left", this.finalCheck);
  103.       this.Panel3.add("Left", this.abstractCheck);
  104.       this.ScrollPanel1.add("Left", this.Label2);
  105.       this.ScrollPanel1.add("Left", this.Label6);
  106.       this.ScrollPanel1.add("Left", this.Label7);
  107.       this.ScrollPanel1.add("Right", this.Panel5);
  108.       this.Panel5.setLayout(new JDPLineLayout());
  109.       this.Panel5.add("Left", this.extendType);
  110.       this.Panel5.add("Left", this.Label5);
  111.       this.Panel5.add("Left", this.implType);
  112.       this.ScrollPanel1.add("Right", this.Panel4);
  113.       this.Panel4.setLayout(new JDPLineLayout());
  114.       this.Panel4.add("Left", this.authorName);
  115.       this.Panel4.add("Left", this.Label9);
  116.       this.Panel4.add("Left", this.version);
  117.       this.ScrollPanel1.add("Right", this.Panel6);
  118.       this.Panel6.setLayout(new JDPLineLayout());
  119.       this.Panel6.add("Left", this.createdDate);
  120.       this.Panel6.add("Left", this.Label8);
  121.       this.Panel6.add("Left", this.lastModDate);
  122.       this.InitComponents();
  123.       var1.gParm.addElement(this);
  124.    }
  125.  
  126.    public boolean handleEvent(Event var1) {
  127.       switch (var1.id) {
  128.          case 401:
  129.             if (var1.key == 9 && var1.modifiers != 1) {
  130.                if (var1.target.equals(this.className)) {
  131.                   this.user.u.cursor(this.classDesc);
  132.                }
  133.  
  134.                if (var1.target.equals(this.classDesc)) {
  135.                   this.user.u.cursor(this.publicCheck);
  136.                }
  137.  
  138.                if (var1.target.equals(this.publicCheck)) {
  139.                   this.user.u.cursor(this.finalCheck);
  140.                }
  141.  
  142.                if (var1.target.equals(this.finalCheck)) {
  143.                   this.user.u.cursor(this.abstractCheck);
  144.                }
  145.  
  146.                if (var1.target.equals(this.abstractCheck)) {
  147.                   this.user.u.cursor(this.extendType);
  148.                }
  149.  
  150.                if (var1.target.equals(this.extendType)) {
  151.                   this.user.u.cursor(this.implType);
  152.                }
  153.  
  154.                if (var1.target.equals(this.implType)) {
  155.                   this.user.u.cursor(this.className);
  156.                }
  157.             }
  158.  
  159.             if (var1.key == 9 && var1.modifiers == 1) {
  160.                if (var1.target.equals(this.className)) {
  161.                   this.user.u.cursor(this.implType);
  162.                   return true;
  163.                }
  164.  
  165.                if (var1.target.equals(this.classDesc)) {
  166.                   this.user.u.cursor(this.className);
  167.                   return true;
  168.                }
  169.  
  170.                if (var1.target.equals(this.publicCheck)) {
  171.                   this.user.u.cursor(this.classDesc);
  172.                   return true;
  173.                }
  174.  
  175.                if (var1.target.equals(this.finalCheck)) {
  176.                   this.user.u.cursor(this.publicCheck);
  177.                   return true;
  178.                }
  179.  
  180.                if (var1.target.equals(this.abstractCheck)) {
  181.                   this.user.u.cursor(this.finalCheck);
  182.                   return true;
  183.                }
  184.  
  185.                if (var1.target.equals(this.extendType)) {
  186.                   this.user.u.cursor(this.abstractCheck);
  187.                   return true;
  188.                }
  189.  
  190.                if (var1.target.equals(this.implType)) {
  191.                   this.user.u.cursor(this.extendType);
  192.                   return true;
  193.                }
  194.             }
  195.  
  196.             return false;
  197.          case 503:
  198.          case 504:
  199.          case 505:
  200.             this.popuppanel.postEvent(var1);
  201.             return false;
  202.          case 1001:
  203.             if (var1.target.equals(this.publicCheck)) {
  204.                this.sendLostFocus();
  205.                return true;
  206.             } else if (var1.target.equals(this.finalCheck)) {
  207.                if (this.finalCheck.getState()) {
  208.                   this.abstractCheck.setState(false);
  209.                }
  210.  
  211.                this.sendLostFocus();
  212.                return true;
  213.             } else if (var1.target.equals(this.abstractCheck)) {
  214.                if (this.abstractCheck.getState()) {
  215.                   this.finalCheck.setState(false);
  216.                }
  217.  
  218.                this.sendLostFocus();
  219.                return true;
  220.             } else if (var1.target.equals(this.extendType)) {
  221.                this.sendLostFocus();
  222.                return true;
  223.             } else {
  224.                if (var1.target.equals(this.implType)) {
  225.                   this.sendLostFocus();
  226.                   return true;
  227.                }
  228.  
  229.                return false;
  230.             }
  231.          case 1005:
  232.             if (var1.target.equals(this.className)) {
  233.                this.sendLostFocus();
  234.                return true;
  235.             } else if (var1.target.equals(this.classDesc)) {
  236.                this.sendLostFocus();
  237.                return true;
  238.             } else if (var1.target.equals(this.extendType)) {
  239.                this.sendLostFocus();
  240.                return true;
  241.             } else if (var1.target.equals(this.implType)) {
  242.                this.sendLostFocus();
  243.                return true;
  244.             } else if (var1.target.equals(this.authorName)) {
  245.                this.sendLostFocus();
  246.                return true;
  247.             } else if (var1.target.equals(this.version)) {
  248.                this.sendLostFocus();
  249.                return true;
  250.             } else if (var1.target.equals(this.createdDate)) {
  251.                this.sendLostFocus();
  252.                return true;
  253.             } else {
  254.                if (var1.target.equals(this.lastModDate)) {
  255.                   this.sendLostFocus();
  256.                   return true;
  257.                }
  258.  
  259.                return false;
  260.             }
  261.          default:
  262.             return false;
  263.       }
  264.    }
  265.  
  266.    public void InitComponents() {
  267.       this.jaggSQL.setKeepConnectionOpen(false);
  268.    }
  269.  
  270.    public void setClassName(String var1) {
  271.       this.className.setText(var1);
  272.    }
  273.  
  274.    public String getClassName() {
  275.       StringTokenizer var1 = new StringTokenizer(this.className.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
  276.  
  277.       String var2;
  278.       for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
  279.       }
  280.  
  281.       this.className.setText(var2);
  282.       return this.className.getText();
  283.    }
  284.  
  285.    public String getExtendType() {
  286.       StringTokenizer var1 = new StringTokenizer(this.extendType.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
  287.  
  288.       String var2;
  289.       for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
  290.       }
  291.  
  292.       this.extendType.setText(var2);
  293.       return this.extendType.getText();
  294.    }
  295.  
  296.    public void setExtendType(String var1) {
  297.       this.extendType.setText(var1);
  298.    }
  299.  
  300.    public void setPublic(boolean var1) {
  301.       this.publicCheck.setState(var1);
  302.    }
  303.  
  304.    public boolean getPublic() {
  305.       return this.publicCheck.getState();
  306.    }
  307.  
  308.    public void setFinal(boolean var1) {
  309.       this.finalCheck.setState(var1);
  310.    }
  311.  
  312.    public boolean getFinal() {
  313.       return this.finalCheck.getState();
  314.    }
  315.  
  316.    public void setAbstract(boolean var1) {
  317.       this.abstractCheck.setState(var1);
  318.    }
  319.  
  320.    public boolean getAbstract() {
  321.       return this.abstractCheck.getState();
  322.    }
  323.  
  324.    public String getImplementType() {
  325.       StringTokenizer var1 = new StringTokenizer(this.implType.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
  326.  
  327.       String var2;
  328.       for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
  329.          if (!var2.equals("")) {
  330.             var2 = var2 + ",";
  331.          }
  332.       }
  333.  
  334.       this.implType.setText(var2);
  335.       return this.implType.getText();
  336.    }
  337.  
  338.    public void setImplementType(String var1) {
  339.       this.implType.setText(var1);
  340.    }
  341.  
  342.    public void setAuthor(String var1) {
  343.       this.authorName.setText(var1);
  344.    }
  345.  
  346.    public void setCreated(Date var1) {
  347.       if (var1 != null) {
  348.          this.createdDate.setText(var1.toString());
  349.       } else {
  350.          this.createdDate.setText("");
  351.       }
  352.    }
  353.  
  354.    public void setLastModified(Date var1) {
  355.       if (var1 != null) {
  356.          this.lastModDate.setText(var1.toString());
  357.       } else {
  358.          this.lastModDate.setText("");
  359.       }
  360.    }
  361.  
  362.    public void setClassDesc(String var1) {
  363.       this.classDesc.setText(var1);
  364.    }
  365.  
  366.    public String getClassDesc() {
  367.       return this.classDesc.getText();
  368.    }
  369.  
  370.    public void setSourceItem(JDPSourceItem var1) {
  371.       if (var1.type == 0) {
  372.          this.setClassName(var1.name);
  373.          this.setExtendType(var1.extendsClass);
  374.          this.setPublic(var1.ispublic);
  375.          this.setFinal(var1.isfinal);
  376.          this.setAbstract(var1.isabstract);
  377.          if (var1.implementsClasses != null) {
  378.             String var2 = "";
  379.  
  380.             for(int var3 = 0; var3 < var1.implementsClasses.size(); ++var3) {
  381.                if (var3 > 0) {
  382.                   var2 = var2 + ",";
  383.                }
  384.  
  385.                var2 = var2 + (String)var1.implementsClasses.elementAt(var3);
  386.             }
  387.  
  388.             this.setImplementType(var2);
  389.          } else {
  390.             this.setImplementType("");
  391.          }
  392.  
  393.          this.setAuthor(var1.author);
  394.          this.setCreated(var1.created);
  395.          this.setLastModified(var1.lastModified);
  396.          this.setVersion(var1.version);
  397.          this.setClassDesc(var1.description);
  398.       }
  399.    }
  400.  
  401.    public void setVersion(String var1) {
  402.       this.version.setText(var1);
  403.    }
  404.  
  405.    public String getVersion() {
  406.       return this.version.getText();
  407.    }
  408.  
  409.    public JDPSourceItem getSourceItem() {
  410.       JDPSourceItem var1 = new JDPSourceItem();
  411.       return this.updateSourceItem(var1);
  412.    }
  413.  
  414.    public void sendLostFocus() {
  415.       Event var1 = new Event(this, 1005, (Object)null);
  416.       ((Component)this).getParent().postEvent(var1);
  417.    }
  418.  
  419.    public JDPSourceItem updateSourceItem(JDPSourceItem var1) {
  420.       var1.type = 0;
  421.       if (!this.user.u.ischaracter(this.className, this.user.mainmsg)) {
  422.          return null;
  423.       } else {
  424.          var1.name = this.getClassName();
  425.          var1.extendsClass = this.getExtendType();
  426.          var1.ispublic = this.getPublic();
  427.          var1.isfinal = this.getFinal();
  428.          var1.isabstract = this.getAbstract();
  429.          StringTokenizer var2 = new StringTokenizer(this.getImplementType(), ",");
  430.          var1.implementsClasses = new Vector();
  431.  
  432.          while(var2.hasMoreTokens()) {
  433.             var1.implementsClasses.addElement(var2.nextToken());
  434.          }
  435.  
  436.          var1.version = this.getVersion();
  437.          var1.description = this.getClassDesc();
  438.          var1.author = this.getAuthor();
  439.          if (!this.getCreatedDate().equals("")) {
  440.             try {
  441.                var1.created = new Date(this.getCreatedDate());
  442.             } catch (Exception var4) {
  443.             }
  444.          }
  445.  
  446.          if (!this.getLastModified().equals("")) {
  447.             try {
  448.                var1.lastModified = new Date(this.getLastModified());
  449.             } catch (Exception var3) {
  450.             }
  451.          }
  452.  
  453.          return var1;
  454.       }
  455.    }
  456.  
  457.    public void stampLastModifiedDate() {
  458.       this.lastModDate.setText((new Date()).toString());
  459.    }
  460.  
  461.    public String getAuthor() {
  462.       return this.authorName.getText();
  463.    }
  464.  
  465.    public String getCreatedDate() {
  466.       return this.createdDate.getText();
  467.    }
  468.  
  469.    public String getLastModified() {
  470.       return this.lastModDate.getText();
  471.    }
  472.  
  473.    public void extendTypeMain() {
  474.       if (this.extendType == null) {
  475.          this.extendType = new JDPComboBox(this.user);
  476.       }
  477.  
  478.       String[] var1 = new String[]{"JDPServerModule", "EntityBean", "SessionBean", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
  479.       this.extendType.loadChoice(var1);
  480.    }
  481.  
  482.    public void implTypeMain() {
  483.       if (this.implType == null) {
  484.          this.implType = new JDPComboBox(this.user);
  485.       }
  486.  
  487.       String[] var1 = new String[]{"                                        ", "Runnable", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
  488.       this.implType.loadChoice(var1);
  489.    }
  490. }
  491.