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.StringTokenizer;
- import java.util.Vector;
-
- public class JDPDefineVar 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 varName;
- Label Label2;
- JDPComboBox varType;
- Vector valuevarType;
- Label Label3;
- TextField varDesc;
- Label Label4;
- Panel Panel3;
- Checkbox publicCheck;
- Checkbox privateCheck;
- Checkbox staticCheck;
- Checkbox finalCheck;
- Checkbox transientCheck;
-
- 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, "Global Variable Definition");
- this.Panel1 = new Panel();
- this.ScrollPanel1 = new JDPScrollPanel();
- this.Label1 = new Label("Name:", 0);
- this.Panel2 = new Panel();
- this.varName = new TextField("", 20);
- this.Label2 = new Label("Type:", 0);
- this.varTypeMain();
- this.Label3 = new Label("Description:", 0);
- this.varDesc = new TextField("", 44);
- this.Label4 = new Label("", 0);
- this.Panel3 = new Panel();
- this.publicCheck = new Checkbox("public");
- this.privateCheck = new Checkbox("private");
- this.staticCheck = new Checkbox("static");
- this.finalCheck = new Checkbox("final");
- this.transientCheck = new Checkbox("transient");
- 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.varName);
- this.Panel2.add("Left", this.Label2);
- this.Panel2.add("Left", this.varType);
- this.ScrollPanel1.add("Left", this.Label3);
- this.ScrollPanel1.add("Right", this.varDesc);
- 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.privateCheck);
- this.Panel3.add("Left", this.staticCheck);
- this.Panel3.add("Left", this.finalCheck);
- this.Panel3.add("Left", this.transientCheck);
- 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.varName)) {
- this.user.u.cursor(this.varType);
- }
-
- if (var1.target.equals(this.varType)) {
- this.user.u.cursor(this.varDesc);
- }
-
- if (var1.target.equals(this.varDesc)) {
- this.user.u.cursor(this.publicCheck);
- }
-
- if (var1.target.equals(this.publicCheck)) {
- this.user.u.cursor(this.staticCheck);
- }
-
- if (var1.target.equals(this.staticCheck)) {
- this.user.u.cursor(this.finalCheck);
- }
-
- if (var1.target.equals(this.finalCheck)) {
- this.user.u.cursor(this.varName);
- }
- }
-
- if (var1.key == 9 && var1.modifiers == 1) {
- if (var1.target.equals(this.varName)) {
- this.user.u.cursor(this.finalCheck);
- return true;
- }
-
- if (var1.target.equals(this.varType)) {
- this.user.u.cursor(this.varName);
- return true;
- }
-
- if (var1.target.equals(this.varDesc)) {
- this.user.u.cursor(this.varType);
- return true;
- }
-
- if (var1.target.equals(this.publicCheck)) {
- this.user.u.cursor(this.varDesc);
- return true;
- }
-
- if (var1.target.equals(this.staticCheck)) {
- this.user.u.cursor(this.publicCheck);
- return true;
- }
-
- if (var1.target.equals(this.finalCheck)) {
- this.user.u.cursor(this.staticCheck);
- return true;
- }
- }
-
- return false;
- case 503:
- case 504:
- case 505:
- this.popuppanel.postEvent(var1);
- return false;
- case 1001:
- if (var1.target.equals(this.varType)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.publicCheck)) {
- if (this.publicCheck.getState()) {
- this.privateCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.privateCheck)) {
- if (this.privateCheck.getState()) {
- this.publicCheck.setState(false);
- }
-
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.staticCheck)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.finalCheck)) {
- this.sendLostFocus();
- return true;
- } else {
- if (var1.target.equals(this.transientCheck)) {
- this.sendLostFocus();
- return true;
- }
-
- return false;
- }
- case 1005:
- if (var1.target.equals(this.varName)) {
- this.sendLostFocus();
- return true;
- } else if (var1.target.equals(this.varType)) {
- this.sendLostFocus();
- return true;
- } else {
- if (var1.target.equals(this.varDesc)) {
- this.sendLostFocus();
- return true;
- }
-
- return false;
- }
- default:
- return false;
- }
- }
-
- public void InitComponents() {
- this.jaggSQL.setKeepConnectionOpen(false);
- }
-
- public void setVarName(String var1) {
- this.varName.setText(var1);
- }
-
- public String getVarName() {
- StringTokenizer var1 = new StringTokenizer(this.varName.getText(), " ,~!@#$^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- }
-
- this.varName.setText(var2);
- return this.varName.getText();
- }
-
- public String getVarType() {
- StringTokenizer var1 = new StringTokenizer(this.varType.getText(), " ,~!@#$^&*()+=|\\`'\":;{}[]?/<>");
-
- String var2;
- for(var2 = ""; var1.hasMoreTokens(); var2 = var2 + var1.nextToken()) {
- }
-
- this.varType.setText(var2);
- return this.varType.getText();
- }
-
- public void setVarType(String var1) {
- this.varType.setText(var1);
- }
-
- public void setVarPublic(boolean var1) {
- this.publicCheck.setState(var1);
- }
-
- public boolean getVarPublic() {
- return this.publicCheck.getState();
- }
-
- public void setVarStatic(boolean var1) {
- this.staticCheck.setState(var1);
- }
-
- public boolean getVarStatic() {
- return this.staticCheck.getState();
- }
-
- public void setVarFinal(boolean var1) {
- this.finalCheck.setState(var1);
- }
-
- public boolean getVarFinal() {
- return this.finalCheck.getState();
- }
-
- public void setVarDesc(String var1) {
- this.varDesc.setText(var1);
- }
-
- public String getVarDesc() {
- return this.varDesc.getText();
- }
-
- public void setSourceItem(JDPSourceItem var1) {
- if (var1.type == 3) {
- this.setVarName(var1.name);
- this.setVarType(var1.varType);
- this.setVarDesc(var1.description);
- this.setVarPublic(var1.ispublic);
- this.setVarPrivate(var1.isprivate);
- this.setVarStatic(var1.isstatic);
- this.setVarFinal(var1.isfinal);
- this.setVarTransient(var1.istransient);
- }
- }
-
- public void setVarPrivate(boolean var1) {
- this.privateCheck.setState(var1);
- }
-
- public boolean getVarPrivate() {
- return this.privateCheck.getState();
- }
-
- public void setVarTransient(boolean var1) {
- this.transientCheck.setState(var1);
- }
-
- public boolean getVarTransient() {
- return this.transientCheck.getState();
- }
-
- 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 = 3;
- var1.name = this.getVarName();
- var1.varType = this.getVarType();
- var1.description = this.getVarDesc();
- var1.ispublic = this.getVarPublic();
- var1.isprivate = this.getVarPrivate();
- var1.isstatic = this.getVarStatic();
- var1.isfinal = this.getVarFinal();
- var1.istransient = this.getVarTransient();
- return var1;
- }
-
- public void varTypeMain() {
- if (this.varType == null) {
- this.varType = new JDPComboBox(this.user);
- }
-
- String[] var1 = new String[]{"int ", "boolean", "String", "long", "float", "int[]", "boolean[]", "String[]", "", "", "", "", "", "", "", "", "", "", "", ""};
- this.varType.loadChoice(var1);
- }
- }
-