home *** CD-ROM | disk | FTP | other *** search
- import java.awt.BorderLayout;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Label;
- import java.awt.Panel;
- import java.awt.TextArea;
- import java.util.Vector;
-
- public class JDPSQLStoredProc extends JDPClassLayout {
- JDPUser user;
- JDPJagg jaggSQL;
- JDPPopupMessage popuppanel;
- JDPMaskEdit JDPMaskEditMain;
- String moduleParameter;
- Panel Main;
- Panel Panel1;
- TextArea completeSQL;
- Label Label4;
- Panel Panel6;
- Panel Panel2;
- Panel Panel8;
- Label Label5;
- JDPList storedProcedures;
- Panel Panel9;
- Panel Panel10;
- Label Label6;
- JDPList paramColumns;
- Panel Panel11;
- Label Label7;
- JDPComboBox paramSettings;
- Vector valueparamSettings;
- Panel Panel7;
- Panel Panel4;
- JDPList returnedColumns;
- Label Label2;
- Panel Panel5;
- Label Label3;
- JDPComboBox placeInto;
- Vector valueplaceInto;
- boolean SQLOnly = false;
- String value;
-
- 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.Panel1 = new Panel();
- this.completeSQL = new TextArea("", 3, 20);
- this.Label4 = new Label("SQL", 0);
- this.Panel6 = new Panel();
- this.Panel2 = new Panel();
- this.Panel8 = new Panel();
- this.Label5 = new Label("Stored Procedures", 0);
- this.storedProceduresMain();
- this.Panel9 = new Panel();
- this.Panel10 = new Panel();
- this.Label6 = new Label("Parameters", 0);
- this.paramColumnsMain();
- this.Panel11 = new Panel();
- this.Label7 = new Label("Equals", 0);
- this.paramSettingsMain();
- this.Panel7 = new Panel();
- this.Panel4 = new Panel();
- this.returnedColumnsMain();
- this.Label2 = new Label("Return Values", 0);
- this.Panel5 = new Panel();
- this.Label3 = new Label("Place Into", 0);
- this.placeIntoMain();
- this.Main.setLayout(new BorderLayout());
- ((Container)this).add("Center", this.Main);
- this.Main.add("Center", this.Panel1);
- this.Panel1.setLayout(new BorderLayout());
- this.Panel1.add("Center", this.completeSQL);
- this.Panel1.add("North", this.Label4);
- this.Main.add("North", this.Panel6);
- this.Panel6.setLayout(new JDPRowLayout());
- this.Panel6.add("Left", this.Panel2);
- this.Panel2.setLayout(new JDPLineLayout());
- this.Panel2.add("Left", this.Panel8);
- this.Panel8.setLayout(new BorderLayout());
- this.Panel8.add("North", this.Label5);
- this.Panel8.add("Center", this.storedProcedures);
- this.Panel6.add("Left", this.Panel9);
- this.Panel9.setLayout(new JDPLineLayout());
- this.Panel9.add("Left", this.Panel10);
- this.Panel10.setLayout(new BorderLayout());
- this.Panel10.add("North", this.Label6);
- this.Panel10.add("Center", this.paramColumns);
- this.Panel9.add("Left", this.Panel11);
- this.Panel11.setLayout(new JDPRowLayout());
- this.Panel11.add("Left", this.Label7);
- this.Panel11.add("Left", this.paramSettings);
- this.Panel6.add("Left", this.Panel7);
- this.Panel7.setLayout(new JDPLineLayout());
- this.Panel7.add("Left", this.Panel4);
- this.Panel4.setLayout(new BorderLayout());
- this.Panel4.add("Center", this.returnedColumns);
- this.Panel4.add("North", this.Label2);
- this.Panel7.add("Left", this.Panel5);
- this.Panel5.setLayout(new JDPRowLayout());
- this.Panel5.add("Left", this.Label3);
- this.Panel5.add("Left", this.placeInto);
- this.storedProcedures.setBackground(var1.u._cvtcolor("White"));
- this.storedProcedures.setMinHeight(60);
- this.storedProcedures.setMultipleSelections(false);
- this.storedProcedures.setSelectionsCheckboxes(false);
- this.storedProcedures.setMinWidth(285);
- this.paramColumns.setBackground(var1.u._cvtcolor("White"));
- this.paramColumns.setMinHeight(60);
- this.paramColumns.setMultipleSelections(false);
- this.paramColumns.setSelectionsCheckboxes(false);
- this.paramSettings.setMinimumWidth(140);
- this.paramSettings.setMaximumWidth(250);
- this.returnedColumns.setBackground(var1.u._cvtcolor("White"));
- this.returnedColumns.setMinHeight(60);
- this.returnedColumns.setMultipleSelections(false);
- this.returnedColumns.setSelectionsCheckboxes(false);
- this.placeInto.setMinimumWidth(140);
- this.placeInto.setMaximumWidth(250);
- this.InitComponents();
- var1.gParm.addElement(this);
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 402:
- if (var1.target.equals(this.paramSettings)) {
- String var15 = this.paramColumns.getSelectedKey();
- String var20 = var15.substring(var15.indexOf(":"));
- this.paramColumns.replaceItemKey(this.paramColumns.getSelectedIndex(), this.paramSettings.getText() + var20);
- this.constructSQL();
- return true;
- } else {
- if (var1.target.equals(this.placeInto)) {
- String var14 = this.returnedColumns.getSelectedKey();
- String var19 = var14.substring(var14.indexOf(":"));
- this.returnedColumns.replaceItemKey(this.returnedColumns.getSelectedIndex(), this.placeInto.getText() + var19);
- this.constructSQL();
- return true;
- }
-
- return false;
- }
- case 503:
- case 504:
- case 505:
- this.popuppanel.postEvent(var1);
- return false;
- case 701:
- if (var1.target.equals(this.storedProcedures)) {
- Event var13 = new Event(this, 1001, "StoredProcedures");
- ((Container)this).deliverEvent(var13);
- this.constructSQL();
- return true;
- } else if (var1.target.equals(this.paramColumns)) {
- if (this.paramColumns.getSelectedIndex() >= 0) {
- String var10 = this.paramColumns.getSelectedKey();
- var10 = var10.substring(0, var10.indexOf(":"));
- this.paramSettings.setText(var10);
- } else {
- this.paramSettings.setText("");
- }
-
- this.constructSQL();
- Event var12 = new Event(this, 701, "paramColumns");
- ((Container)this).deliverEvent(var12);
- return true;
- } else {
- if (var1.target.equals(this.returnedColumns)) {
- if (this.returnedColumns.getSelectedIndex() >= 0) {
- String var7 = this.returnedColumns.getSelectedKey();
- var7 = var7.substring(0, var7.indexOf(":"));
- this.placeInto.setText(var7);
- } else {
- this.placeInto.setText("");
- }
-
- this.constructSQL();
- Event var9 = new Event(this, 701, "returnedColumns");
- ((Container)this).deliverEvent(var9);
- return true;
- }
-
- return false;
- }
- case 702:
- if (var1.target.equals(this.paramColumns)) {
- this.constructSQL();
- return true;
- } else {
- if (var1.target.equals(this.returnedColumns)) {
- this.constructSQL();
- return true;
- }
-
- return false;
- }
- case 1001:
- if (var1.target.equals(this.paramColumns)) {
- this.constructSQL();
- return true;
- } else if (var1.target.equals(this.paramSettings)) {
- String var6 = this.paramColumns.getSelectedKey();
- String var18 = var6.substring(var6.indexOf(":"));
- this.paramColumns.replaceItemKey(this.paramColumns.getSelectedIndex(), this.paramSettings.getText() + var18);
- this.constructSQL();
- return true;
- } else if (var1.target.equals(this.returnedColumns)) {
- this.constructSQL();
- return true;
- } else {
- if (var1.target.equals(this.placeInto)) {
- String var5 = this.returnedColumns.getSelectedKey();
- String var17 = var5.substring(var5.indexOf(":"));
- this.returnedColumns.replaceItemKey(this.returnedColumns.getSelectedIndex(), this.placeInto.getText() + var17);
- this.constructSQL();
- return true;
- }
-
- return false;
- }
- case 1005:
- if (var1.target.equals(this.paramSettings)) {
- String var4 = this.paramColumns.getSelectedKey();
- String var16 = var4.substring(var4.indexOf(":"));
- this.paramColumns.replaceItemKey(this.paramColumns.getSelectedIndex(), this.paramSettings.getText() + var16);
- this.constructSQL();
- return true;
- } else {
- if (var1.target.equals(this.placeInto)) {
- String var2 = this.returnedColumns.getSelectedKey();
- String var3 = var2.substring(var2.indexOf(":"));
- this.returnedColumns.replaceItemKey(this.returnedColumns.getSelectedIndex(), this.placeInto.getText() + var3);
- this.constructSQL();
- return true;
- }
-
- return false;
- }
- default:
- return false;
- }
- }
-
- public void InitComponents() {
- this.jaggSQL.setKeepConnectionOpen(false);
- }
-
- public void MainMethod() {
- }
-
- public String constructSQL() {
- String var1 = this.constructCompleteSQL(this.SQLOnly);
- this.completeSQL.setText(var1);
- return var1;
- }
-
- public JDPComboBox getPlaceIntoHandle() {
- return this.placeInto;
- }
-
- public JDPList getParamColumnsHandle() {
- return this.paramColumns;
- }
-
- public JDPComboBox getParamSettingsHandle() {
- return this.paramSettings;
- }
-
- public JDPList getStoredProceduresHandle() {
- return this.storedProcedures;
- }
-
- public JDPList getReturnedColumnsHandle() {
- return this.returnedColumns;
- }
-
- public void setSQLOnly(boolean var1) {
- this.SQLOnly = var1;
- if (var1) {
- this.Panel5.hide();
- } else {
- this.Panel5.show();
- }
- }
-
- public String constructCompleteSQL(boolean var1) {
- StringBuffer var2 = new StringBuffer();
- if (this.storedProcedures.getSelectedItem() == null) {
- return "";
- } else {
- String var3 = "\"";
- String var4 = "+";
- if (var1) {
- var3 = "";
- var4 = "";
- }
-
- var2.append(var3 + this.storedProcedures.getSelectedItem() + " ");
- if (this.paramColumns.countItems() > 0) {
- for(int var5 = 0; var5 < this.paramColumns.countItems(); ++var5) {
- if (var5 > 0) {
- var2.append(", " + var3 + " " + var4 + "\n\t" + var3);
- }
-
- this.value = this.paramColumns.getItemKey(var5);
- this.value = this.value.substring(0, this.value.indexOf(":"));
- var2.append(this.value);
- }
- }
-
- var2.append(var3);
- return var2.toString();
- }
- }
-
- public String getSQL() {
- return this.SQLOnly ? this.completeSQL.getText() : this.constructCompleteSQL(true);
- }
-
- public void clear() {
- this.storedProcedures.clear();
- this.paramColumns.clear();
- this.paramSettings.clear();
- this.paramSettings.setText("");
- this.returnedColumns.clear();
- this.placeInto.clear();
- this.placeInto.setText("");
- this.completeSQL.setText("");
- }
-
- public void storedProceduresMain() {
- if (this.storedProcedures == null) {
- this.storedProcedures = new JDPList(this.user);
- }
-
- }
-
- public void paramColumnsMain() {
- if (this.paramColumns == null) {
- this.paramColumns = new JDPList(this.user);
- }
-
- }
-
- public void paramSettingsMain() {
- if (this.paramSettings == null) {
- this.paramSettings = new JDPComboBox(this.user);
- }
-
- }
-
- public void returnedColumnsMain() {
- if (this.returnedColumns == null) {
- this.returnedColumns = new JDPList(this.user);
- }
-
- }
-
- public void placeIntoMain() {
- if (this.placeInto == null) {
- this.placeInto = new JDPComboBox(this.user);
- }
-
- }
- }
-