home *** CD-ROM | disk | FTP | other *** search
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Choice;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Panel;
- import java.awt.TextField;
- import java.util.StringTokenizer;
- import java.util.Vector;
-
- public class JDPUserSystemMaint extends JDPClassLayout {
- JDPWhereClause jdpWhereClause;
- JDPSearchResults searchResults;
- String[] psortChoice;
- String[] pdisplayChoice;
- int itemIndex;
- boolean insertRequested;
- boolean deleteRequested;
- JDPPopupMessage popuppanel;
- JDPJagg jaggSQL;
- TextField userid;
- TextField username;
- TextField firstname;
- TextField lastname;
- TextField status;
- TextField jdpsystem0;
- TextField jdpsystem1;
- TextField jdpsystem2;
- TextField jdpsystem3;
- TextField jdpsystem4;
- TextField jdpsystem5;
- TextField jdpsystem6;
- TextField jdpsystem7;
- TextField jdpsystem8;
- TextField jdpsystem9;
- String pfromWhereClause;
-
- void newSearch() {
- String var1 = this.pfromWhereClause + " AND " + this.jdpWhereClause.whereClause;
- this.searchResults.setFromWhereClause(var1);
- this.searchResults.clearList();
- this.searchResults.loadList();
- }
-
- void clearFields() {
- this.userid.setText("");
- this.username.setText("");
- this.firstname.setText("");
- this.lastname.setText("");
- this.status.setText("");
- this.jdpsystem0.setText("");
- this.jdpsystem1.setText("");
- this.jdpsystem2.setText("");
- this.jdpsystem3.setText("");
- this.jdpsystem4.setText("");
- this.jdpsystem5.setText("");
- this.jdpsystem6.setText("");
- this.jdpsystem7.setText("");
- this.jdpsystem8.setText("");
- this.jdpsystem9.setText("");
- }
-
- void loadData() {
- int var2 = 0;
- Vector var3 = new Vector();
- String var4 = this.jaggSQL.getSEP();
- this.itemIndex = this.searchResults.resultList.getSelectedIndex();
- String var6 = "SELECT userid," + "username," + "firstname," + "lastname," + "status," + "jdpsystem0," + "jdpsystem1," + "jdpsystem2," + "jdpsystem3," + "jdpsystem4," + "jdpsystem5," + "jdpsystem6," + "jdpsystem7," + "jdpsystem8," + "jdpsystem9 FROM JDPUser WHERE userid=" + this.searchResults.recordKey0[this.itemIndex];
- if (super.user.DEBUG) {
- System.out.println("loadData SQL: " + var6);
- }
-
- super.user.mainmsg.setStatusMsg("Accessing database...", 0);
- var2 = this.jaggSQL.execSQL(var6, var3);
- if (super.user.DEBUG) {
- System.out.println("loadData CNT: " + Integer.toString(var2));
- }
-
- if (var2 == -1) {
- super.user.u.setSqlMessage(this.jaggSQL, var6);
- } else {
- if (var2 == 1) {
- String var5 = (String)var3.elementAt(0);
- if (var5 != null && var5.trim().compareTo("") != 0) {
- StringTokenizer var1 = new StringTokenizer(var5);
- this.userid.setText(var1.nextToken(var4).trim());
- this.username.setText(var1.nextToken(var4).trim());
- this.firstname.setText(var1.nextToken(var4).trim());
- this.lastname.setText(var1.nextToken(var4).trim());
- this.status.setText(var1.nextToken(var4).trim());
- this.jdpsystem0.setText(var1.nextToken(var4).trim());
- this.jdpsystem1.setText(var1.nextToken(var4).trim());
- this.jdpsystem2.setText(var1.nextToken(var4).trim());
- this.jdpsystem3.setText(var1.nextToken(var4).trim());
- this.jdpsystem4.setText(var1.nextToken(var4).trim());
- this.jdpsystem5.setText(var1.nextToken(var4).trim());
- this.jdpsystem6.setText(var1.nextToken(var4).trim());
- this.jdpsystem7.setText(var1.nextToken(var4).trim());
- this.jdpsystem8.setText(var1.nextToken(var4).trim());
- this.jdpsystem9.setText(var1.nextToken(var4).trim());
- }
-
- super.user.mainmsg.clearStatusMsg();
- } else {
- super.user.mainmsg.setStatusMsg("Requested entry does not exist.", 10);
- this.clearFields();
- }
-
- String var7 = this.status.getText();
- if (var7.compareTo("A") == 0) {
- this.status.setText("Active");
- }
-
- if (var7.compareTo("P") == 0) {
- this.status.setText("Pending");
- }
-
- if (var7.compareTo("S") == 0) {
- this.status.setText("Suspended");
- }
-
- if (var7.compareTo("C") == 0) {
- this.status.setText("Cancelled");
- }
-
- if (var7.compareTo("X") == 0) {
- this.status.setText("Deleted");
- }
-
- if (var7.compareTo("F") == 0) {
- this.status.setText("Free");
- }
-
- if (var7.compareTo("G") == 0) {
- this.status.setText("Guest");
- }
-
- }
- }
-
- boolean saveData() {
- int var1 = 0;
- Vector var2 = new Vector();
- this.jaggSQL.getSEP();
- String var3 = "";
- this.itemIndex = this.searchResults.resultList.getSelectedIndex();
- if (this.itemIndex < 0) {
- super.user.mainmsg.setStatusMsg("You must first make a selection", 5);
- return false;
- } else {
- var3 = "UPDATE JDPUser SET " + "jdpsystem0 = '" + this.jdpsystem0.getText() + "', " + "jdpsystem1 = '" + this.jdpsystem1.getText() + "', " + "jdpsystem2 = '" + this.jdpsystem2.getText() + "', " + "jdpsystem3 = '" + this.jdpsystem3.getText() + "', " + "jdpsystem4 = '" + this.jdpsystem4.getText() + "', " + "jdpsystem5 = '" + this.jdpsystem5.getText() + "', " + "jdpsystem6 = '" + this.jdpsystem6.getText() + "', " + "jdpsystem7 = '" + this.jdpsystem7.getText() + "', " + "jdpsystem8 = '" + this.jdpsystem8.getText() + "', " + "jdpsystem9 = '" + this.jdpsystem9.getText() + "'" + " WHERE userid=" + this.searchResults.recordKey0[this.itemIndex];
- if (super.user.DEBUG) {
- System.out.println("saveData SQL: " + var3);
- }
-
- super.user.mainmsg.setStatusMsg("Accessing database...", 0);
- var1 = this.jaggSQL.execSQL(var3, var2);
- if (super.user.DEBUG) {
- System.out.println("saveData CNT: " + Integer.toString(var1));
- }
-
- if (var1 == -1) {
- super.user.u.setSqlMessage(this.jaggSQL, var3);
- return false;
- } else {
- if (var1 == 1) {
- super.user.mainmsg.setStatusMsg("Record successfully updated.", 3);
- this.insertRequested = false;
- this.deleteRequested = false;
- } else {
- super.user.u.setSqlMessage(this.jaggSQL, var3);
- }
-
- return true;
- }
- }
- }
-
- boolean checkFields() {
- return true;
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 401:
- if (var1.key == 9) {
- if (var1.target.equals(this.jdpsystem0)) {
- super.user.u.cursor(this.jdpsystem1);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem1)) {
- super.user.u.cursor(this.jdpsystem2);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem2)) {
- super.user.u.cursor(this.jdpsystem3);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem3)) {
- super.user.u.cursor(this.jdpsystem4);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem4)) {
- super.user.u.cursor(this.jdpsystem5);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem5)) {
- super.user.u.cursor(this.jdpsystem6);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem6)) {
- super.user.u.cursor(this.jdpsystem7);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem7)) {
- super.user.u.cursor(this.jdpsystem8);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem8)) {
- super.user.u.cursor(this.jdpsystem9);
- return true;
- }
-
- if (var1.target.equals(this.jdpsystem9)) {
- super.user.u.cursor(this.jdpsystem0);
- return true;
- }
-
- super.user.u.cursor(this.jdpsystem0);
- return true;
- }
-
- return false;
- case 503:
- case 504:
- case 505:
- this.popuppanel.postEvent(var1);
- return false;
- case 1001:
- if (var1.target.equals(this.searchResults.resultList)) {
- this.loadData();
- return true;
- } else if (var1.target instanceof Button) {
- String var2 = (String)var1.arg;
- if (var2.trim().compareTo("Apply") == 0) {
- if (this.checkFields()) {
- this.saveData();
- }
-
- return true;
- } else if (var2.trim().compareTo("Reset") == 0) {
- this.loadData();
- return true;
- } else {
- if (var2.trim().compareTo("Search") == 0) {
- this.newSearch();
- return true;
- }
-
- return true;
- }
- } else {
- if (var1.target instanceof Choice) {
- return true;
- }
-
- if (var1.target instanceof TextField) {
- this.checkFields();
- }
-
- return false;
- }
- default:
- return false;
- }
- }
-
- public void InitClass(JDPUser var1, Panel var2, String var3) {
- super.user = var1;
- this.jaggSQL = new JDPJagg(var1.jaggPath);
- this.jaggSQL.loadSettings(var1);
- ((Container)this).setLayout(new BorderLayout());
- ((Component)this).setFont(var1.plainFont);
- this.popuppanel = new JDPPopupMessage(var1, var2);
- ((Container)var2).add(this.popuppanel);
- Panel var4 = new Panel();
- ((Container)var4).setLayout(new BorderLayout());
- Panel var5 = new Panel();
- ((Container)var5).setLayout(new BorderLayout());
- Panel var6 = new Panel();
- ((Container)var6).setLayout(new BorderLayout());
- JDPScrollPanel var7 = new JDPScrollPanel();
- String var8 = "userid";
- this.pfromWhereClause = "FROM JDPUser WHERE (1=1)";
- this.psortChoice = new String[4];
- this.psortChoice[0] = "userid";
- this.psortChoice[1] = "username";
- this.psortChoice[2] = "firstname";
- this.psortChoice[3] = "lastname";
- String[] var9 = new String[]{"User ID", "Username", "First Name", "Last Name"};
- this.pdisplayChoice = this.psortChoice;
- String var10 = var9[1];
- boolean var11 = true;
- String var12 = "Total Users:";
- this.userid = new TextField("", 4);
- this.username = new TextField("", 20);
- this.firstname = new TextField("", 15);
- this.lastname = new TextField("", 20);
- this.status = new TextField("", 10);
- this.jdpsystem0 = new TextField("", 5);
- this.jdpsystem1 = new TextField("", 5);
- this.jdpsystem2 = new TextField("", 5);
- this.jdpsystem3 = new TextField("", 5);
- this.jdpsystem4 = new TextField("", 5);
- this.jdpsystem5 = new TextField("", 5);
- this.jdpsystem6 = new TextField("", 5);
- this.jdpsystem7 = new TextField("", 5);
- this.jdpsystem8 = new TextField("", 5);
- this.jdpsystem9 = new TextField("", 5);
- this.userid.setEditable(false);
- this.username.setEditable(false);
- this.firstname.setEditable(false);
- this.lastname.setEditable(false);
- this.status.setEditable(false);
- ((Container)var7).add("Left", new JDPWrapLabel(var1, "User ID:"));
- ((Container)var7).add("Left", new JDPWrapLabel(var1, "Username:"));
- ((Container)var7).add("Left", new JDPWrapLabel(var1, "First Name:"));
- ((Container)var7).add("Left", new JDPWrapLabel(var1, "Last Name:"));
- ((Container)var7).add("Left", new JDPWrapLabel(var1, "Status:"));
- ((Container)var7).add("Left", new JDPWrapLabel(var1, "Systems:"));
- ((Container)var7).add("Right", this.userid);
- ((Container)var7).add("Right", this.username);
- ((Container)var7).add("Right", this.firstname);
- ((Container)var7).add("Right", this.lastname);
- ((Container)var7).add("Right", this.status);
- Panel var13 = new Panel();
- ((Container)var13).setLayout(new JDPLineLayout(1));
- Panel var14 = new Panel();
- ((Container)var14).setLayout(new JDPLineLayout(1));
- ((Container)var13).add("Left", this.jdpsystem0);
- ((Container)var13).add("Left", this.jdpsystem1);
- ((Container)var13).add("Left", this.jdpsystem2);
- ((Container)var13).add("Left", this.jdpsystem3);
- ((Container)var13).add("Left", this.jdpsystem4);
- ((Container)var14).add("Left", this.jdpsystem5);
- ((Container)var14).add("Left", this.jdpsystem6);
- ((Container)var14).add("Left", this.jdpsystem7);
- ((Container)var14).add("Left", this.jdpsystem8);
- ((Container)var14).add("Left", this.jdpsystem9);
- ((Container)var7).add("Right", var13);
- ((Container)var7).add("Right", var14);
- ((Container)var6).add("Center", var7);
- String[] var15 = new String[]{"Apply", "Reset"};
- int[] var16 = new int[]{0, 6, 8, 9, 10};
- JDPButtons var17 = new JDPButtons(var1, var15, var16, JDPButtons.HORIZONTAL);
- ((Container)var6).add("South", var17);
- this.popuppanel.addComponent(var17.button[0], "Apply Changes", "Save changes to the database");
- this.popuppanel.addComponent(var17.button[1], "Undo Changes", "Undo changes by reloading the record");
- ((Container)var4).add("Center", var6);
- String[] var18 = new String[]{"Userid", "Username", "Firstname", "Lastname"};
- String[] var19 = new String[]{"userid", "username", "firstname", "lastname"};
- String[][] var20 = new String[4][8];
- var20[0][0] = "Greater than";
- var20[0][1] = "Less than";
- var20[0][2] = "Equal to";
- var20[1][0] = "Begins with";
- var20[1][1] = "Contains";
- var20[2][0] = "Begins with";
- var20[2][1] = "Contains";
- var20[3][0] = "Begins with";
- var20[3][1] = "Contains";
- String[][] var21 = new String[4][8];
- var21[0][0] = ">";
- var21[0][1] = "<";
- var21[0][2] = "=";
- var21[1][0] = " like ";
- var21[1][1] = " like ";
- var21[2][0] = " like ";
- var21[2][1] = " like ";
- var21[3][0] = " like ";
- var21[3][1] = " like ";
- boolean[] var22 = new boolean[]{false, true, true, true};
- int[] var23 = new int[]{6, 22, 17, 22};
- this.jdpWhereClause = new JDPWhereClause(var1, var2, "JDPUserSystemMaint", true, var18[1], var18, var19, var20, var21, (String[][])null, (String[][])null, var23, var22);
- this.searchResults = new JDPSearchResults(var1, (Container)var2, false, this.jaggSQL, false, var8, (String[])null, this.pfromWhereClause, var9, this.psortChoice, this.pdisplayChoice, var10, var11, var12);
- this.searchResults.setIcon(5);
- Panel var24 = new Panel();
- ((Container)var24).setLayout(new BorderLayout());
- ((Container)var24).add("North", this.jdpWhereClause);
- ((Container)var24).add("Center", this.searchResults);
- ((Container)var4).add("West", var24);
- ((Container)this).add("Center", new JDPChiselFramePanel(var1, "Maintain User Access to Systems", var4, "North"));
- this.searchResults.loadList();
- ((Component)var2).paintAll(((Component)var2).getGraphics());
- }
- }
-