home *** CD-ROM | disk | FTP | other *** search
- import java.awt.BorderLayout;
- import java.awt.Checkbox;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Label;
- import java.awt.Panel;
- import java.awt.TextField;
- import java.util.Date;
- import java.util.StringTokenizer;
- import java.util.Vector;
-
- public class JDPDefineClass extends JDPClassLayout {
- JDPUser user;
- JDPJagg jaggSQL;
- JDPPopupMessage popuppanel;
- JDPMaskEdit JDPMaskEditMain;
- String moduleParameter;
- Panel Main;
- JDPChiselFramePanel ChiselPanel1;
- Panel Panel1;
- JDPScrollPanel ScrollPanel1;
- Label Label1;
- Panel Panel2;
- TextField className;
- TextField classDesc;
- Label Label4;
- Panel Panel3;
- Checkbox publicCheck;
- Checkbox finalCheck;
- Checkbox abstractCheck;
- Label Label2;
- Label Label6;
- Label Label7;
- Panel Panel5;
- JDPComboBox extendType;
- Vector valueextendType;
- Label Label5;
- JDPComboBox implType;
- Vector valueimplType;
- Panel Panel4;
- TextField authorName;
- Label Label9;
- TextField version;
- Panel Panel6;
- TextField createdDate;
- Label Label8;
- TextField lastModDate;
-
- public void InitClass(JDPUser var1, Panel var2, String var3) {
- this.user = var1;
- this.moduleParameter = var3;
- super.targetPanel = var2;
- this.jaggSQL = new JDPJagg(var1.jaggPath);
- ((Container)this).setLayout(new BorderLayout());
- this.popuppanel = new JDPPopupMessage(var1, this);
- ((Container)this).add(this.popuppanel);
- this.JDPMaskEditMain = new JDPMaskEdit();
- this.Main = new Panel();
- this.ChiselPanel1 = new JDPChiselFramePanel(var1, "Class Definition");
- this.Panel1 = new Panel();
- this.ScrollPanel1 = new JDPScrollPanel();
- this.Label1 = new Label("Name/Desc:", 0);
- this.Panel2 = new Panel();
- this.className = new TextField("", 15);
- this.classDesc = new TextField("", 50);
- this.Label4 = new Label("", 0);
- this.Panel3 = new Panel();
- this.publicCheck = new Checkbox("public");
- this.finalCheck = new Checkbox("final");
- this.abstractCheck = new Checkbox("abstract");
- this.Label2 = new Label("Extends:", 0);
- this.Label6 = new Label("Author:", 0);
- this.Label7 = new Label("Created:", 0);
- this.Panel5 = new Panel();
- this.extendTypeMain();
- this.Label5 = new Label("Implements:", 0);
- this.implTypeMain();
- this.Panel4 = new Panel();
- this.authorName = new TextField("", 13);
- this.Label9 = new Label("Version:", 0);
- this.version = new TextField("", 4);
- this.Panel6 = new Panel();
- this.createdDate = new TextField("", 23);
- this.Label8 = new Label("Last Modified:", 0);
- this.lastModDate = new TextField("", 23);
- this.Main.setLayout(new BorderLayout());
- ((Container)this).add("Center", this.Main);
- this.Main.add("Center", this.ChiselPanel1);
- this.ChiselPanel1.add("Center", this.Panel1);
- this.Panel1.setLayout(new BorderLayout());
- this.Panel1.add("Center", this.ScrollPanel1);
- this.ScrollPanel1.add("Left", this.Label1);
- this.ScrollPanel1.add("Right", this.Panel2);
- this.Panel2.setLayout(new JDPLineLayout());
- this.Panel2.add("Left", this.className);
- this.Panel2.add("Left", this.classDesc);
- this.ScrollPanel1.add("Left", this.Label4);
- this.ScrollPanel1.add("Right", this.Panel3);
- this.Panel3.setLayout(new JDPLineLayout());
- this.Panel3.add("Left", this.publicCheck);
- this.Panel3.add("Left", this.finalCheck);
- this.Panel3.add("Left", this.abstractCheck);
- this.ScrollPanel1.add("Left", this.Label2);
- this.ScrollPanel1.add("Left", this.Label6);
- this.ScrollPanel1.add("Left", this.Label7);
- this.ScrollPanel1.add("Right", this.Panel5);
- this.Panel5.setLayout(new JDPLineLayout());
- this.Panel5.add("Left", this.extendType);
- this.Panel5.add("Left", this.Label5);
- this.Panel5.add("Left", this.implType);
- this.ScrollPanel1.add("Right", this.Panel4);
- this.Panel4.setLayout(new JDPLineLayout());
- this.Panel4.add("Left", this.authorName);
- this.Panel4.add("Left", this.Label9);
- this.Panel4.add("Left", this.version);
- this.ScrollPanel1.add("Right", this.Panel6);
- this.Panel6.setLayout(new JDPLineLayout());
- this.Panel6.add("Left", this.createdDate);
- this.Panel6.add("Left", this.Label8);
- this.Panel6.add("Left", this.lastModDate);
- this.InitComponents();
- var1.gParm.addElement(this);
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 401:
- if (var1.key == 9 && var1.modifiers != 1) {
- if (var1.target.equals(this.className)) {
- this.user.u.cursor(this.classDesc);
- }
-
- if (var1.target.equals(this.classDesc)) {
- this.user.u.cursor(this.publicCheck);
- }
-
- if (var1.target.equals(this.publicCheck)) {
- this.user.u.cursor(this.finalCheck);
- }
-
- if (var1.target.equals(this.finalCheck)) {
- this.user.u.cursor(this.abstractCheck);
- }
-
- if (var1.target.equals(this.abstractCheck)) {
- this.user.u.cursor(this.extendType);
- }
-
- if (var1.target.equals(this.extendType)) {
- this.user.u.cursor(this.implType);
- }
-
- if (var1.target.equals(this.implType)) {
- this.user.u.cursor(this.className);
- }
- }
-
- if (var1.key == 9 && var1.modifiers == 1) {
- if (var1.target.equals(this.className)) {
- this.user.u.cursor(this.implType);
- return true;
- }
-
- if (var1.target.equals(this.classDesc)) {
- this.user.u.cursor(this.className);
- return true;
- }
-
- if (var1.target.equals(this.publicCheck)) {
- this.user.u.cursor(this.classDesc);
- return true;
- }
-
- if (var1.target.equals(this.finalCheck)) {
- this.user.u.cursor(this.publicCheck);
- return true;
- }
-
- if (var1.target.equals(this.abstractCheck)) {
- this.user.u.cursor(this.finalCheck);
- return true;
- }
-
- if (var1.target.equals(this.extendType)) {
- this.user.u.cursor(this.abstractCheck);
- return true;
- }
-
- if (var1.target.equals(this.implType)) {
- this.user.u.cursor(this.extendType);
- return true;
- }
- }
-
- return false;
- case 503:
- case 504:
- case 505:
- this.popuppanel.postEvent(var1);
- return false;
- case 1001:
- if (var1.target.equals(this.publicCheck)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.finalCheck)) {
- if (this.finalCheck.getState()) {
- this.abstractCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.abstractCheck)) {
- if (this.abstractCheck.getState()) {
- this.finalCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.extendType)) {
- this.sendLostFocus();
- return true;
- } else {
- if (var1.target.equals(this.implType)) {
- this.sendLostFocus();
- return true;
- }
-
- return false;
- }
- case 1005:
- if (var1.target.equals(this.className)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.classDesc)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.extendType)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.implType)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.authorName)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.version)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.createdDate)) {
- this.sendLostFocus();
- return true;
- } else {
- if (var1.target.equals(this.lastModDate)) {
- this.sendLostFocus();
- return true;
- }
-
- return false;
- }
- default:
- return false;
- }
- }
-
- public void InitComponents() {
- this.jaggSQL.setKeepConnectionOpen(false);
- }
-
- public void setClassName(String var1) {
- this.className.setText(var1);
- }
-
- public String getClassName() {
- StringTokenizer var1 = new StringTokenizer(this.className.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- }
-
- this.className.setText(var2);
- return this.className.getText();
- }
-
- public String getExtendType() {
- StringTokenizer var1 = new StringTokenizer(this.extendType.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- }
-
- this.extendType.setText(var2);
- return this.extendType.getText();
- }
-
- public void setExtendType(String var1) {
- this.extendType.setText(var1);
- }
-
- public void setPublic(boolean var1) {
- this.publicCheck.setState(var1);
- }
-
- public boolean getPublic() {
- return this.publicCheck.getState();
- }
-
- public void setFinal(boolean var1) {
- this.finalCheck.setState(var1);
- }
-
- public boolean getFinal() {
- return this.finalCheck.getState();
- }
-
- public void setAbstract(boolean var1) {
- this.abstractCheck.setState(var1);
- }
-
- public boolean getAbstract() {
- return this.abstractCheck.getState();
- }
-
- public String getImplementType() {
- StringTokenizer var1 = new StringTokenizer(this.implType.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- if (!var2.equals("")) {
- var2 = var2 + ",";
- }
- }
-
- this.implType.setText(var2);
- return this.implType.getText();
- }
-
- public void setImplementType(String var1) {
- this.implType.setText(var1);
- }
-
- public void setAuthor(String var1) {
- this.authorName.setText(var1);
- }
-
- public void setCreated(Date var1) {
- if (var1 != null) {
- this.createdDate.setText(var1.toString());
- } else {
- this.createdDate.setText("");
- }
- }
-
- public void setLastModified(Date var1) {
- if (var1 != null) {
- this.lastModDate.setText(var1.toString());
- } else {
- this.lastModDate.setText("");
- }
- }
-
- public void setClassDesc(String var1) {
- this.classDesc.setText(var1);
- }
-
- public String getClassDesc() {
- return this.classDesc.getText();
- }
-
- public void setSourceItem(JDPSourceItem var1) {
- if (var1.type == 0) {
- this.setClassName(var1.name);
- this.setExtendType(var1.extendsClass);
- this.setPublic(var1.ispublic);
- this.setFinal(var1.isfinal);
- this.setAbstract(var1.isabstract);
- if (var1.implementsClasses != null) {
- String var2 = "";
-
- for(int var3 = 0; var3 < var1.implementsClasses.size(); ++var3) {
- if (var3 > 0) {
- var2 = var2 + ",";
- }
-
- var2 = var2 + (String)var1.implementsClasses.elementAt(var3);
- }
-
- this.setImplementType(var2);
- } else {
- this.setImplementType("");
- }
-
- this.setAuthor(var1.author);
- this.setCreated(var1.created);
- this.setLastModified(var1.lastModified);
- this.setVersion(var1.version);
- this.setClassDesc(var1.description);
- }
- }
-
- public void setVersion(String var1) {
- this.version.setText(var1);
- }
-
- public String getVersion() {
- return this.version.getText();
- }
-
- public JDPSourceItem getSourceItem() {
- JDPSourceItem var1 = new JDPSourceItem();
- return this.updateSourceItem(var1);
- }
-
- public void sendLostFocus() {
- Event var1 = new Event(this, 1005, (Object)null);
- ((Component)this).getParent().postEvent(var1);
- }
-
- public JDPSourceItem updateSourceItem(JDPSourceItem var1) {
- var1.type = 0;
- if (!this.user.u.ischaracter(this.className, this.user.mainmsg)) {
- return null;
- } else {
- var1.name = this.getClassName();
- var1.extendsClass = this.getExtendType();
- var1.ispublic = this.getPublic();
- var1.isfinal = this.getFinal();
- var1.isabstract = this.getAbstract();
- StringTokenizer var2 = new StringTokenizer(this.getImplementType(), ",");
- var1.implementsClasses = new Vector();
-
- while(var2.hasMoreTokens()) {
- var1.implementsClasses.addElement(var2.nextToken());
- }
-
- var1.version = this.getVersion();
- var1.description = this.getClassDesc();
- var1.author = this.getAuthor();
- if (!this.getCreatedDate().equals("")) {
- try {
- var1.created = new Date(this.getCreatedDate());
- } catch (Exception var4) {
- }
- }
-
- if (!this.getLastModified().equals("")) {
- try {
- var1.lastModified = new Date(this.getLastModified());
- } catch (Exception var3) {
- }
- }
-
- return var1;
- }
- }
-
- public void stampLastModifiedDate() {
- this.lastModDate.setText((new Date()).toString());
- }
-
- public String getAuthor() {
- return this.authorName.getText();
- }
-
- public String getCreatedDate() {
- return this.createdDate.getText();
- }
-
- public String getLastModified() {
- return this.lastModDate.getText();
- }
-
- public void extendTypeMain() {
- if (this.extendType == null) {
- this.extendType = new JDPComboBox(this.user);
- }
-
- String[] var1 = new String[]{"JDPServerModule", "EntityBean", "SessionBean", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
- this.extendType.loadChoice(var1);
- }
-
- public void implTypeMain() {
- if (this.implType == null) {
- this.implType = new JDPComboBox(this.user);
- }
-
- String[] var1 = new String[]{" ", "Runnable", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
- this.implType.loadChoice(var1);
- }
- }
-