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.List;
- import java.awt.Panel;
- import java.awt.TextField;
- import java.util.StringTokenizer;
- import java.util.Vector;
-
- public class JDPDefineMethod extends JDPClassLayout {
- JDPUser user;
- JDPJagg jaggSQL;
- JDPPopupMessage popuppanel;
- JDPMaskEdit JDPMaskEditMain;
- String moduleParameter;
- Panel Main;
- JDPChiselFramePanel ChiselPanel1;
- Panel Panel1;
- JDPTabSelectPanel TabPanel1;
- JDPScrollPanel ScrollPanel1;
- Label Label1;
- Panel Panel7;
- TextField methodName;
- TextField methodDesc;
- Checkbox publicCheck;
- Panel Panel3;
- Checkbox privateCheck;
- Checkbox protectedCheck;
- Panel Panel2;
- Checkbox staticCheck;
- Checkbox abstractCheck;
- Checkbox nativeCheck;
- Panel Panel6;
- Checkbox finalCheck;
- Checkbox synchCheck;
- Panel Panel5;
- JDPComboBox returnType;
- Vector valuereturnType;
- Label Label5;
- TextField returnDesc;
- JDPComboBox throwsExceptions;
- Vector valuethrowsExceptions;
- Label Label2;
- Label Label3;
- Panel Panel4;
- JDPTextGrid paramGrid;
-
- 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, "Method Definition");
- this.Panel1 = new Panel();
- String[] var4 = new String[2];
- Panel[] var5 = new Panel[]{new Panel(), null};
- var5[0].setLayout(new BorderLayout());
- var4[0] = "Definition";
- var5[1] = new Panel();
- var5[1].setLayout(new BorderLayout());
- var4[1] = "Parameters";
- this.TabPanel1 = new JDPTabSelectPanel(var1, var4, var5, "North");
- this.ScrollPanel1 = new JDPScrollPanel();
- this.Label1 = new Label("Name/Desc::", 0);
- this.Panel7 = new Panel();
- this.methodName = new TextField("", 15);
- this.methodDesc = new TextField("", 50);
- this.publicCheck = new Checkbox("public");
- this.Panel3 = new Panel();
- this.privateCheck = new Checkbox("private");
- this.protectedCheck = new Checkbox("protected");
- this.Panel2 = new Panel();
- this.staticCheck = new Checkbox("static");
- this.abstractCheck = new Checkbox("abstract");
- this.nativeCheck = new Checkbox("native");
- this.Panel6 = new Panel();
- this.finalCheck = new Checkbox("final");
- this.synchCheck = new Checkbox("synchronized");
- this.Panel5 = new Panel();
- this.returnTypeMain();
- this.Label5 = new Label("Description:", 0);
- this.returnDesc = new TextField("", 47);
- this.throwsExceptionsMain();
- this.Label2 = new Label("Return Type:", 0);
- this.Label3 = new Label("Throws:", 0);
- this.Panel4 = new Panel();
- this.paramGrid = new JDPTextGrid(var1);
- 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.TabPanel1);
- var5[0].add("Center", this.ScrollPanel1);
- this.ScrollPanel1.add("Left", this.Label1);
- this.ScrollPanel1.add("Right", this.Panel7);
- this.Panel7.setLayout(new JDPLineLayout());
- this.Panel7.add("Left", this.methodName);
- this.Panel7.add("Left", this.methodDesc);
- this.ScrollPanel1.add("Left", this.publicCheck);
- this.ScrollPanel1.add("Right", this.Panel3);
- this.Panel3.setLayout(new JDPLineLayout());
- this.Panel3.add("Left", this.privateCheck);
- this.Panel3.add("Left", this.protectedCheck);
- this.Panel3.add("Left", this.Panel2);
- this.Panel2.setLayout(new JDPLineLayout());
- this.Panel2.add("Left", this.staticCheck);
- this.Panel2.add("Left", this.abstractCheck);
- this.Panel2.add("Left", this.nativeCheck);
- this.Panel3.add("Left", this.Panel6);
- this.Panel6.setLayout(new JDPLineLayout());
- this.Panel6.add("Left", this.finalCheck);
- this.Panel6.add("Left", this.synchCheck);
- this.ScrollPanel1.add("Right", this.Panel5);
- this.Panel5.setLayout(new JDPLineLayout());
- this.Panel5.add("Left", this.returnType);
- this.Panel5.add("Left", this.Label5);
- this.Panel5.add("Left", this.returnDesc);
- this.ScrollPanel1.add("Right", this.throwsExceptions);
- this.ScrollPanel1.add("Left", this.Label2);
- this.ScrollPanel1.add("Left", this.Label3);
- var5[1].add("Center", this.Panel4);
- this.Panel4.setLayout(new BorderLayout());
- this.Panel4.add("North", this.paramGrid);
- this.TabPanel1.setTabcolor(0, var1.u._cvtcolor("Black"), var1.u._cvtcolor("LightGray"));
- this.TabPanel1.setTabcolor(1, var1.u._cvtcolor("Black"), var1.u._cvtcolor("LightGray"));
- this.paramGrid.setTableDimensions(3, 50);
- this.paramGrid.setRowHeaderOn(false);
- this.paramGrid.setColumnHeader(0, "Parameter Type");
- this.paramGrid.setColumnHeader(1, "Name");
- this.paramGrid.setColumnHeader(2, "Description");
- this.paramGrid.setColumnWidth(0, 100);
- this.paramGrid.setColumnWidth(1, 100);
- this.paramGrid.setColumnWidth(2, 1000);
- this.paramGrid.setMinimumHeight(91);
- this.paramGrid.setColumnHeaderStyle(0, 0);
- this.paramGrid.setColumnHeaderStyle(1, 0);
- this.paramGrid.setColumnHeaderStyle(2, 0);
- this.paramGrid.setPullDownCol(0, true);
- this.paramGrid.setScrollSouthDisabled(true);
- 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.methodName)) {
- this.user.u.cursor(this.methodDesc);
- }
-
- if (var1.target.equals(this.methodDesc)) {
- this.user.u.cursor(this.publicCheck);
- }
-
- if (var1.target.equals(this.publicCheck)) {
- this.user.u.cursor(this.privateCheck);
- }
-
- if (var1.target.equals(this.privateCheck)) {
- this.user.u.cursor(this.protectedCheck);
- }
-
- if (var1.target.equals(this.protectedCheck)) {
- this.user.u.cursor(this.staticCheck);
- }
-
- if (var1.target.equals(this.staticCheck)) {
- this.user.u.cursor(this.abstractCheck);
- }
-
- if (var1.target.equals(this.abstractCheck)) {
- this.user.u.cursor(this.nativeCheck);
- }
-
- if (var1.target.equals(this.nativeCheck)) {
- this.user.u.cursor(this.finalCheck);
- }
-
- if (var1.target.equals(this.finalCheck)) {
- this.user.u.cursor(this.synchCheck);
- }
-
- if (var1.target.equals(this.synchCheck)) {
- this.user.u.cursor(this.returnType);
- }
-
- if (var1.target.equals(this.returnType)) {
- this.user.u.cursor(this.returnDesc);
- }
-
- if (var1.target.equals(this.returnDesc)) {
- this.user.u.cursor(this.paramGrid);
- }
- }
-
- if (var1.key == 9 && var1.modifiers == 1) {
- if (var1.target.equals(this.methodName)) {
- this.user.u.cursor(this.throwsExceptions);
- return true;
- }
-
- if (var1.target.equals(this.methodDesc)) {
- this.user.u.cursor(this.methodName);
- return true;
- }
-
- if (var1.target.equals(this.publicCheck)) {
- this.user.u.cursor(this.methodDesc);
- return true;
- }
-
- if (var1.target.equals(this.privateCheck)) {
- this.user.u.cursor(this.publicCheck);
- return true;
- }
-
- if (var1.target.equals(this.protectedCheck)) {
- this.user.u.cursor(this.privateCheck);
- return true;
- }
-
- if (var1.target.equals(this.staticCheck)) {
- this.user.u.cursor(this.protectedCheck);
- return true;
- }
-
- if (var1.target.equals(this.abstractCheck)) {
- this.user.u.cursor(this.staticCheck);
- return true;
- }
-
- if (var1.target.equals(this.nativeCheck)) {
- this.user.u.cursor(this.abstractCheck);
- return true;
- }
-
- if (var1.target.equals(this.finalCheck)) {
- this.user.u.cursor(this.nativeCheck);
- return true;
- }
-
- if (var1.target.equals(this.synchCheck)) {
- this.user.u.cursor(this.finalCheck);
- return true;
- }
-
- if (var1.target.equals(this.returnType)) {
- this.user.u.cursor(this.synchCheck);
- return true;
- }
-
- if (var1.target.equals(this.returnDesc)) {
- this.user.u.cursor(this.returnType);
- return true;
- }
- }
-
- return false;
- case 503:
- case 504:
- case 505:
- this.popuppanel.postEvent(var1);
- return false;
- case 1001:
- if (var1.target.equals(this.publicCheck)) {
- if (this.publicCheck.getState()) {
- this.privateCheck.setState(false);
- }
-
- if (this.publicCheck.getState()) {
- this.protectedCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.privateCheck)) {
- if (this.privateCheck.getState()) {
- this.publicCheck.setState(false);
- }
-
- if (this.privateCheck.getState()) {
- this.protectedCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.protectedCheck)) {
- if (this.protectedCheck.getState()) {
- this.publicCheck.setState(false);
- }
-
- if (this.protectedCheck.getState()) {
- this.privateCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.staticCheck)) {
- if (this.staticCheck.getState()) {
- this.abstractCheck.setState(false);
- }
-
- if (this.staticCheck.getState()) {
- this.nativeCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.abstractCheck)) {
- if (this.abstractCheck.getState()) {
- this.staticCheck.setState(false);
- }
-
- if (this.abstractCheck.getState()) {
- this.nativeCheck.setState(false);
- }
-
- if (this.abstractCheck.getState()) {
- this.synchCheck.setState(false);
- }
-
- if (this.abstractCheck.getState()) {
- this.finalCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.nativeCheck)) {
- if (this.nativeCheck.getState()) {
- this.staticCheck.setState(false);
- }
-
- if (this.nativeCheck.getState()) {
- this.abstractCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.finalCheck)) {
- if (this.finalCheck.getState()) {
- this.abstractCheck.setState(false);
- }
-
- if (this.synchCheck.getState()) {
- this.staticCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.synchCheck)) {
- if (this.synchCheck.getState()) {
- this.abstractCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.returnType)) {
- this.sendLostFocus();
- return true;
- } else {
- if (var1.target.equals(this.throwsExceptions)) {
- this.sendLostFocus();
- return true;
- }
-
- return false;
- }
- case 1005:
- if (var1.target.equals(this.methodName)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.methodDesc)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.returnType)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.returnDesc)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.throwsExceptions)) {
- this.sendLostFocus();
- return true;
- } else {
- if (var1.target.equals(this.paramGrid)) {
- this.sendLostFocus();
- return true;
- }
-
- return false;
- }
- default:
- return false;
- }
- }
-
- public void InitComponents() {
- this.jaggSQL.setKeepConnectionOpen(false);
- this.loadParameterTypes();
- }
-
- public void setPublic(boolean var1) {
- this.publicCheck.setState(var1);
- }
-
- public boolean getPublic() {
- return this.publicCheck.getState();
- }
-
- public String getReturnType() {
- StringTokenizer var1 = new StringTokenizer(this.returnType.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- }
-
- this.returnType.setText(var2);
- return this.returnType.getText();
- }
-
- public void setReturnType(String var1) {
- this.returnType.setText(var1);
- }
-
- public void setParameterTypes(Vector var1) {
- int var2 = 0;
- if (var1 != null) {
- for(var2 = 0; var2 < var1.size(); ++var2) {
- this.paramGrid.setText((String)var1.elementAt(var2), 0, var2);
- }
- }
-
- while(var2 < this.paramGrid.getTableRows()) {
- this.paramGrid.setText("", 0, var2);
- ++var2;
- }
-
- }
-
- public void setParameterNames(Vector var1) {
- int var2 = 0;
- if (var1 != null) {
- for(var2 = 0; var2 < var1.size(); ++var2) {
- this.paramGrid.setText((String)var1.elementAt(var2), 1, var2);
- }
- }
-
- while(var2 < this.paramGrid.getTableRows()) {
- this.paramGrid.setText("", 1, var2);
- ++var2;
- }
-
- }
-
- public void setParameterDescriptions(Vector var1) {
- int var2 = 0;
- if (var1 != null) {
- for(var2 = 0; var2 < var1.size(); ++var2) {
- this.paramGrid.setText((String)var1.elementAt(var2), 2, var2);
- }
- }
-
- while(var2 < this.paramGrid.getTableRows()) {
- this.paramGrid.setText("", 2, var2);
- ++var2;
- }
-
- }
-
- public Vector getParameterTypes() {
- Vector var1 = new Vector();
-
- for(int var2 = 0; var2 < this.paramGrid.getTableRows() && !this.paramGrid.getText(0, var2).equals(""); ++var2) {
- var1.addElement(this.paramGrid.getText(0, var2));
- }
-
- return var1;
- }
-
- public Vector getParameterNames() {
- Vector var1 = new Vector();
-
- for(int var2 = 0; var2 < this.paramGrid.getTableRows() && !this.paramGrid.getText(1, var2).equals(""); ++var2) {
- var1.addElement(this.paramGrid.getText(1, var2));
- }
-
- return var1;
- }
-
- public Vector getParameterDescriptions() {
- Vector var1 = new Vector();
-
- for(int var2 = 0; var2 < this.paramGrid.getTableRows() && !this.paramGrid.getText(2, var2).equals(""); ++var2) {
- var1.addElement(this.paramGrid.getText(2, var2));
- }
-
- return var1;
- }
-
- public void loadParameterTypes() {
- List var1 = new List();
- var1.addItem("int");
- var1.addItem("boolean");
- var1.addItem("String");
- var1.addItem("long");
- var1.addItem("float");
- var1.addItem("JDPJob");
- this.paramGrid.newTable();
- this.paramGrid.setPullDownColType(0, 3);
- this.paramGrid.setPullDownList(0, 0, var1);
- }
-
- public void setPrivate(boolean var1) {
- this.privateCheck.setState(var1);
- }
-
- public boolean getPrivate() {
- return this.privateCheck.getState();
- }
-
- public void setProtected(boolean var1) {
- this.protectedCheck.setState(var1);
- }
-
- public boolean getProtected() {
- return this.protectedCheck.getState();
- }
-
- public void setStatic(boolean var1) {
- this.staticCheck.setState(var1);
- }
-
- public boolean getStatic() {
- return this.staticCheck.getState();
- }
-
- public void setAbstract(boolean var1) {
- this.abstractCheck.setState(var1);
- }
-
- public boolean getAbstract() {
- return this.abstractCheck.getState();
- }
-
- public void setNative(boolean var1) {
- this.nativeCheck.setState(var1);
- }
-
- public boolean getNative() {
- return this.nativeCheck.getState();
- }
-
- public void setSynchronized(boolean var1) {
- this.synchCheck.setState(var1);
- }
-
- public boolean getSynchronized() {
- return this.synchCheck.getState();
- }
-
- public void setMethodDesc(String var1) {
- this.methodDesc.setText(var1);
- }
-
- public String getMethodDesc() {
- return this.methodDesc.getText();
- }
-
- public void setMethodName(String var1) {
- this.methodName.setText(var1);
- }
-
- public String getMethodName() {
- StringTokenizer var1 = new StringTokenizer(this.methodName.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- }
-
- this.methodName.setText(var2);
- return this.methodName.getText();
- }
-
- public void setSourceItem(JDPSourceItem var1) {
- if (var1.type == 2) {
- this.setMethodName(var1.name);
- this.setMethodDesc(var1.description);
- this.setPublic(var1.ispublic);
- this.setPrivate(var1.isprivate);
- this.setProtected(var1.isprotected);
- this.setStatic(var1.isstatic);
- this.setAbstract(var1.isabstract);
- this.setNative(var1.isnative);
- this.setSynchronized(var1.issynchronized);
- this.setParameterTypes(var1.parmTypes);
- this.setParameterNames(var1.parmNames);
- this.setParameterDescriptions(var1.parmDescs);
- this.setReturnType(var1.returnType);
- this.setReturnDesc(var1.returnDesc);
- if (var1.throwsExceptions != null) {
- String var2 = "";
-
- for(int var3 = 0; var3 < var1.throwsExceptions.size(); ++var3) {
- if (var3 > 0) {
- var2 = var2 + ",";
- }
-
- var2 = var2 + (String)var1.throwsExceptions.elementAt(var3);
- }
-
- this.setThrowsExceptions(var2);
- } else {
- this.setThrowsExceptions("");
- }
- }
- }
-
- public JDPSourceItem getSourceItem() {
- JDPSourceItem var1 = new JDPSourceItem();
- return this.updateSourceItem(var1);
- }
-
- public void setReturnDesc(String var1) {
- this.returnDesc.setText(var1);
- }
-
- public String getReturnDesc() {
- return this.returnDesc.getText();
- }
-
- public void sendLostFocus() {
- Event var1 = new Event(this, 1005, (Object)null);
- ((Component)this).getParent().postEvent(var1);
- }
-
- public JDPSourceItem updateSourceItem(JDPSourceItem var1) {
- var1.type = 2;
- if (!this.user.u.ischaracter(this.methodName, this.user.mainmsg)) {
- return null;
- } else if (!this.user.u.ischaracter(this.returnType, this.user.mainmsg)) {
- return null;
- } else {
- var1.ispublic = this.getPublic();
- var1.isprivate = this.getPrivate();
- var1.isprotected = this.getProtected();
- var1.isstatic = this.getStatic();
- var1.isabstract = this.getAbstract();
- var1.isnative = this.getNative();
- var1.issynchronized = this.getSynchronized();
- var1.name = this.getMethodName();
- var1.description = this.getMethodDesc();
- var1.parmTypes = this.getParameterTypes();
- var1.parmNames = this.getParameterNames();
- var1.parmDescs = this.getParameterDescriptions();
- var1.returnType = this.getReturnType();
- var1.returnDesc = this.getReturnDesc();
- StringTokenizer var2 = new StringTokenizer(this.getThrowsExceptions(), ",");
- var1.throwsExceptions = new Vector();
-
- while(var2.hasMoreTokens()) {
- var1.throwsExceptions.addElement(var2.nextToken());
- }
-
- return var1;
- }
- }
-
- public void setThrowsExceptions(String var1) {
- this.throwsExceptions.setText(var1);
- }
-
- public String getThrowsExceptions() {
- StringTokenizer var1 = new StringTokenizer(this.throwsExceptions.getText(), " ,~!@#$%^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- if (!var2.equals("")) {
- var2 = var2 + ",";
- }
- }
-
- this.throwsExceptions.setText(var2);
- return this.throwsExceptions.getText();
- }
-
- public void returnTypeMain() {
- if (this.returnType == null) {
- this.returnType = new JDPComboBox(this.user);
- }
-
- String[] var1 = new String[]{"void ", "int", "boolean", "String", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
- this.returnType.loadChoice(var1);
- }
-
- public void throwsExceptionsMain() {
- if (this.throwsExceptions == null) {
- this.throwsExceptions = new JDPComboBox(this.user);
- }
-
- String[] var1 = new String[]{" ", "Exception", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
- this.throwsExceptions.loadChoice(var1);
- }
- }
-