home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPSearchResults.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-09  |  14.5 KB  |  901 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.Label;
  8. import java.awt.Panel;
  9. import java.awt.Rectangle;
  10. import java.util.StringTokenizer;
  11. import java.util.Vector;
  12.  
  13. public class JDPSearchResults extends Panel {
  14.    JDPUser user;
  15.    JDPJagg jaggSQL;
  16.    JDPPopupMessage popuppanel;
  17.    Container targetPanel;
  18.    boolean useTreeClass;
  19.    boolean listEvents;
  20.    JDPComboBox sortChoice;
  21.    JDPList resultList;
  22.    JDPTreePicker tree;
  23.    JDPTreeBranch treeRoot;
  24.    JDPTreeBranch lastBranch;
  25.    String prevEntry;
  26.    Label listCountText;
  27.    Label listCount;
  28.    String pselectFields;
  29.    int[] pdisplayFields;
  30.    String[] psdisplayFields;
  31.    String pfromWhereClause;
  32.    String savepfromWhereClause;
  33.    String[] psortChoice;
  34.    String[] pdisplayChoice;
  35.    int icon = -1;
  36.    String[] recordName;
  37.    String[] recordKey0;
  38.    String[] recordKey1;
  39.    String[] recordKey2;
  40.    String[] recordKey3;
  41.    String[] recordKey4;
  42.    String[] recordKey5;
  43.    String[] recordKey6;
  44.    String[] recordKey7;
  45.    String[] recordKey8;
  46.    String[] recordKey9;
  47.    String[][] psdisplayActual;
  48.    String lastKey;
  49.    Font currentFont;
  50.    Color fgColor;
  51.    Color bgColor;
  52.  
  53.    public JDPSearchResults(JDPUser var1, Container var2, boolean var3, JDPJagg var4, boolean var5, String var6, String[] var7, String var8, String[] var9, String[] var10, String[] var11, String var12, boolean var13, String var14) {
  54.       this.fgColor = Color.black;
  55.       this.useTreeClass = var3;
  56.       this.targetPanel = var2;
  57.       this.createPanel(var1, var4, var5, var6, (int[])null, var7, var8, var9, var10, var11, var12, var13, var14);
  58.    }
  59.  
  60.    public JDPSearchResults(JDPUser var1, Panel var2, boolean var3, JDPJagg var4, boolean var5, String var6, String[] var7, String var8, String[] var9, String[] var10, String[] var11, String var12, boolean var13, String var14) {
  61.       this.fgColor = Color.black;
  62.       this.useTreeClass = var3;
  63.       this.targetPanel = (Container)var2;
  64.       this.createPanel(var1, var4, var5, var6, (int[])null, var7, var8, var9, var10, var11, var12, var13, var14);
  65.    }
  66.  
  67.    public JDPSearchResults(JDPUser var1, boolean var2, JDPJagg var3, boolean var4, String var5, String[] var6, String var7, String[] var8, String[] var9, String[] var10, String var11, boolean var12, String var13) {
  68.       this.fgColor = Color.black;
  69.       this.useTreeClass = var2;
  70.       this.createPanel(var1, var3, var4, var5, (int[])null, var6, var7, var8, var9, var10, var11, var12, var13);
  71.    }
  72.  
  73.    public JDPSearchResults(JDPUser var1, boolean var2, JDPJagg var3, boolean var4, String var5, int[] var6, String var7, String[] var8, String[] var9, String[] var10, String var11, boolean var12, String var13) {
  74.       this.fgColor = Color.black;
  75.       this.useTreeClass = var2;
  76.       this.createPanel(var1, var3, var4, var5, var6, (String[])null, var7, var8, var9, var10, var11, var12, var13);
  77.    }
  78.  
  79.    public JDPSearchResults(JDPUser var1, JDPJagg var2, boolean var3, String var4, String var5, String[] var6, String[] var7, String[] var8, String var9, boolean var10, String var11) {
  80.       this.fgColor = Color.black;
  81.       this.createPanel(var1, var2, var3, var4, (int[])null, (String[])null, var5, var6, var7, var8, var9, var10, var11);
  82.    }
  83.  
  84.    public JDPSearchResults(JDPUser var1) {
  85.       this.fgColor = Color.black;
  86.    }
  87.  
  88.    public void clearList() {
  89.       if (!this.useTreeClass) {
  90.          this.resultList.clear();
  91.       } else {
  92.          if (this.treeRoot != null && this.treeRoot.name != null) {
  93.             this.treeRoot = this.tree.setRoot(this.treeRoot.name, true);
  94.          } else {
  95.             this.treeRoot = this.tree.setRoot("", true);
  96.          }
  97.  
  98.          this.lastBranch = null;
  99.          this.prevEntry = null;
  100.       }
  101.    }
  102.  
  103.    public void clearList(String var1) {
  104.       if (!this.useTreeClass) {
  105.          this.resultList.clear();
  106.       } else {
  107.          this.treeRoot = this.tree.setRoot(var1, true);
  108.          this.lastBranch = null;
  109.          this.prevEntry = null;
  110.       }
  111.    }
  112.  
  113.    public void setListEvents(boolean var1) {
  114.       this.listEvents = var1;
  115.    }
  116.  
  117.    public void loadList() {
  118.       int var2 = 0;
  119.       Vector var3 = new Vector();
  120.       String var4 = this.jaggSQL.getSEP();
  121.       int var5 = 0;
  122.       int var7 = 0;
  123.       if (this.sortChoice != null && this.sortChoice.getSelectedIndex() >= 0) {
  124.          var7 = this.sortChoice.getSelectedIndex();
  125.       }
  126.  
  127.       if (this.psortChoice.length != 0) {
  128.          String var8 = "";
  129.          if (var7 < this.psortChoice.length && var7 >= 0) {
  130.             var8 = var8 + " ORDER BY " + this.psortChoice[var7];
  131.          }
  132.  
  133.          String var9 = "SELECT ";
  134.          if (this.useTreeClass && this.pselectFields.toUpperCase().indexOf("DISTINCT") < 0) {
  135.             var9 = var9 + "DISTINCT ";
  136.          }
  137.  
  138.          if (this.useTreeClass) {
  139.             String var10 = "";
  140.             if (this.psdisplayFields != null) {
  141.                for(int var11 = 0; var11 < this.psdisplayFields.length; ++var11) {
  142.                   if (var11 > 0) {
  143.                      var10 = var10 + ",";
  144.                   }
  145.  
  146.                   var10 = var10 + this.psdisplayFields[var11];
  147.                }
  148.             } else {
  149.                var10 = this.pselectFields;
  150.             }
  151.  
  152.             if (this.pselectFields.startsWith("DISTINCT ")) {
  153.                var10 = this.pselectFields.substring(9);
  154.             }
  155.  
  156.             if (var7 < this.psortChoice.length && var7 >= 0 && this.psortChoice[var7] != null) {
  157.                int var21 = var10.indexOf(this.psortChoice[var7]);
  158.                if (var21 >= 0) {
  159.                   String var12 = "";
  160.                   if (var21 > 0) {
  161.                      var12 = var10.substring(0, var21 - 1);
  162.                   }
  163.  
  164.                   int var13 = var10.substring(var21).indexOf(",");
  165.                   if (var13 > 0) {
  166.                      String var14 = var10.substring(var21).substring(var13);
  167.                      if (var12.length() > 0) {
  168.                         var10 = var12 + var14;
  169.                      } else {
  170.                         var10 = var14.substring(1);
  171.                      }
  172.                   } else {
  173.                      var10 = var12;
  174.                   }
  175.                }
  176.             }
  177.  
  178.             if (var10.length() > 0) {
  179.                var8 = var8 + "," + var10;
  180.             }
  181.          }
  182.  
  183.          var9 = var9 + this.pselectFields;
  184.          String var20 = this.pfromWhereClause;
  185.          if (this.psdisplayFields != null) {
  186.             String[] var22 = new String[this.psdisplayFields.length];
  187.  
  188.             for(int var25 = 0; var25 < this.psdisplayFields.length; ++var25) {
  189.                var22[var25] = this.psdisplayFields[var25];
  190.                if (var22[var25].endsWith(" DESC")) {
  191.                   var22[var25] = var22[var25].substring(0, var22[var25].indexOf(" DESC"));
  192.                }
  193.             }
  194.  
  195.             for(int var26 = 0; var26 < var22.length; ++var26) {
  196.                if (this.user.u.sqlRequiresChange(this.jaggSQL, 0)) {
  197.                   if (this.pselectFields.indexOf(var22[var26]) >= 0) {
  198.                      String var28 = this.user.u.getDataSourceType(this.jaggSQL);
  199.                      if (var28.indexOf(JDPJagg.ANYWHERE) < 0 && var28.indexOf(JDPJagg.SOLIDSERVER) < 0) {
  200.                         if (var28.indexOf(JDPJagg.VFOXPRO) < 0 && var28.indexOf(JDPJagg.ORACLE) < 0 && var28.indexOf(JDPJagg.POLITE) < 0 && var28.indexOf(JDPJagg.INFORMIX) < 0 && var28.indexOf(JDPJagg.CLOUDSCAPE) < 0) {
  201.                            var9 = var9 + "," + var22[var26];
  202.                         } else {
  203.                            var9 = var9 + "," + var22[var26] + " as b" + this.user.u.strip(var22[var26]);
  204.                         }
  205.                      } else {
  206.                         var9 = var9 + "," + var22[var26] + " b" + this.user.u.strip(var22[var26]);
  207.                      }
  208.                   } else {
  209.                      var9 = var9 + "," + var22[var26];
  210.                   }
  211.                } else {
  212.                   var9 = var9 + "," + var22[var26];
  213.                }
  214.             }
  215.          }
  216.  
  217.          if (this.user.u.sqlRequiresChange(this.jaggSQL, 0)) {
  218.             if (this.pselectFields.indexOf(this.pdisplayChoice[var7]) >= 0) {
  219.                String var23 = this.user.u.getDataSourceType(this.jaggSQL);
  220.                if (var23.indexOf(JDPJagg.ANYWHERE) < 0 && var23.indexOf(JDPJagg.SOLIDSERVER) < 0) {
  221.                   if (var23.indexOf(JDPJagg.VFOXPRO) < 0 && var23.indexOf(JDPJagg.ORACLE) < 0 && var23.indexOf(JDPJagg.POLITE) < 0 && var23.indexOf(JDPJagg.CLOUDSCAPE) < 0) {
  222.                      if (var23.indexOf(JDPJagg.INFORMIX) >= 0) {
  223.                         var9 = var9 + "," + this.pdisplayChoice[var7] + " a" + this.user.u.strip(this.pdisplayChoice[var7]) + " " + this.pfromWhereClause + this.user.u.replace(var8, this.user.u.strip(this.pdisplayChoice[var7]), "a" + this.user.u.strip(this.pdisplayChoice[var7]));
  224.                      }
  225.                   } else {
  226.                      var9 = var9 + "," + this.pdisplayChoice[var7] + " as a" + this.user.u.strip(this.pdisplayChoice[var7]) + " " + this.pfromWhereClause + var8;
  227.                   }
  228.                } else {
  229.                   var9 = var9 + "," + this.pdisplayChoice[var7] + " a" + this.user.u.strip(this.pdisplayChoice[var7]) + " " + this.pfromWhereClause + var8;
  230.                }
  231.             } else {
  232.                var9 = var9 + "," + this.pdisplayChoice[var7] + " " + var20 + var8;
  233.             }
  234.          } else {
  235.             var9 = var9 + "," + this.pdisplayChoice[var7] + " " + var20 + var8;
  236.          }
  237.  
  238.          if (this.user.DEBUG) {
  239.             System.out.println("JDPSearchResults/loadList SQL: " + var9);
  240.          }
  241.  
  242.          this.user.mainmsg.setStatusMsg("Accessing database...", 0);
  243.          var2 = this.jaggSQL.execSQL(var9, var3);
  244.          if (this.user.DEBUG) {
  245.             System.out.println("JDPSearchResults/loadList CNT: " + Integer.toString(var2));
  246.          }
  247.  
  248.          if (var2 == -1) {
  249.             this.user.u.setSqlMessage(this.jaggSQL, var9);
  250.          } else {
  251.             if (this.user.DEBUG) {
  252.                System.out.println("JDPSearchResults/loadList COL: " + Integer.toString(this.jaggSQL.getColumnCount()));
  253.             }
  254.  
  255.             var5 = this.jaggSQL.getRowCount();
  256.             this.recordKey0 = new String[var5];
  257.             this.recordKey1 = new String[var5];
  258.             this.recordKey2 = new String[var5];
  259.             this.recordKey3 = new String[var5];
  260.             this.recordKey4 = new String[var5];
  261.             this.recordKey5 = new String[var5];
  262.             this.recordKey6 = new String[var5];
  263.             this.recordKey7 = new String[var5];
  264.             this.recordKey8 = new String[var5];
  265.             this.recordKey9 = new String[var5];
  266.             this.recordName = new String[var5];
  267.             int var24 = 0;
  268.             if (this.psdisplayFields != null) {
  269.                this.psdisplayActual = new String[var5][this.psdisplayFields.length];
  270.                var24 = this.psdisplayFields.length;
  271.             }
  272.  
  273.             this.listCount.setText(Integer.toString(var5));
  274.             int var27 = this.jaggSQL.getColumnCount();
  275.             int var29 = 0;
  276.             this.lastKey = null;
  277.  
  278.             for(int var30 = 0; var30 < var5; ++var30) {
  279.                String var6 = (String)var3.elementAt(var30);
  280.                if (var6 != null && var6.trim().compareTo("") != 0) {
  281.                   StringTokenizer var1 = new StringTokenizer(var6);
  282.                   this.recordKey0[var29] = var1.nextToken(var4).trim();
  283.                   if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(0))) {
  284.                      this.recordKey0[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey0[var29]));
  285.                   }
  286.  
  287.                   if (var27 > 2 + var24) {
  288.                      this.recordKey1[var29] = var1.nextToken(var4).trim();
  289.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(1))) {
  290.                         this.recordKey1[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey1[var29]));
  291.                      }
  292.                   }
  293.  
  294.                   if (var27 > 3 + var24) {
  295.                      this.recordKey2[var29] = var1.nextToken(var4).trim();
  296.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(2))) {
  297.                         this.recordKey2[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey2[var29]));
  298.                      }
  299.                   }
  300.  
  301.                   if (var27 > 4 + var24) {
  302.                      this.recordKey3[var29] = var1.nextToken(var4).trim();
  303.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(3))) {
  304.                         this.recordKey3[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey3[var29]));
  305.                      }
  306.                   }
  307.  
  308.                   if (var27 > 5 + var24) {
  309.                      this.recordKey4[var29] = var1.nextToken(var4).trim();
  310.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(4))) {
  311.                         this.recordKey4[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey4[var29]));
  312.                      }
  313.                   }
  314.  
  315.                   if (var27 > 6 + var24) {
  316.                      this.recordKey5[var29] = var1.nextToken(var4).trim();
  317.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(5))) {
  318.                         this.recordKey5[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey5[var29]));
  319.                      }
  320.                   }
  321.  
  322.                   if (var27 > 7 + var24) {
  323.                      this.recordKey6[var29] = var1.nextToken(var4).trim();
  324.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(6))) {
  325.                         this.recordKey6[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey6[var29]));
  326.                      }
  327.                   }
  328.  
  329.                   if (var27 > 8 + var24) {
  330.                      this.recordKey7[var29] = var1.nextToken(var4).trim();
  331.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(7))) {
  332.                         this.recordKey7[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey7[var29]));
  333.                      }
  334.                   }
  335.  
  336.                   if (var27 > 9 + var24) {
  337.                      this.recordKey8[var29] = var1.nextToken(var4).trim();
  338.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(8))) {
  339.                         this.recordKey8[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey8[var29]));
  340.                      }
  341.                   }
  342.  
  343.                   if (var27 > 10 + var24) {
  344.                      this.recordKey9[var29] = var1.nextToken(var4).trim();
  345.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(9))) {
  346.                         this.recordKey9[var29] = JDPDate.formatSystem(Long.valueOf(this.recordKey9[var29]));
  347.                      }
  348.                   }
  349.  
  350.                   if (this.psdisplayFields != null) {
  351.                      int var15 = var27 - var1.countTokens();
  352.  
  353.                      for(int var16 = 0; var16 < this.psdisplayFields.length; ++var16) {
  354.                         this.psdisplayActual[var29][var16] = var1.nextToken(var4).trim();
  355.                         if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(var15 + var16))) {
  356.                            this.psdisplayActual[var29][var16] = JDPDate.format(Long.valueOf(this.psdisplayActual[var29][var16]));
  357.                         }
  358.                      }
  359.                   }
  360.  
  361.                   if (var1 != null) {
  362.                      this.recordName[var29] = var1.nextToken(var4).trim();
  363.                      if (JDPUtils.isOdbcDate(this.jaggSQL.getColumnType(var27 - 1))) {
  364.                         this.recordName[var29] = JDPDate.format(Long.valueOf(this.recordName[var29]));
  365.                      }
  366.                   }
  367.  
  368.                   if (this.addEntry(var29)) {
  369.                      ++var29;
  370.                   }
  371.                }
  372.             }
  373.  
  374.             if (this.useTreeClass) {
  375.                this.listCount.setText(Integer.toString(var29));
  376.                this.tree.repaint();
  377.             }
  378.  
  379.             this.user.mainmsg.clearStatusMsg();
  380.          }
  381.       }
  382.    }
  383.  
  384.    public JDPList getListHandle() {
  385.       return this.resultList;
  386.    }
  387.  
  388.    public void setIcons(int[] var1) {
  389.       if (this.useTreeClass && this.tree != null) {
  390.          this.tree.setIcons(var1);
  391.       }
  392.  
  393.    }
  394.  
  395.    public void setDisplayChoice(String[] var1) {
  396.       this.pdisplayChoice = var1;
  397.    }
  398.  
  399.    public String[] getSelectedBranch() {
  400.       return this.useTreeClass ? this.tree.getSelectedBranch() : null;
  401.    }
  402.  
  403.    public void setMinWidth(int var1) {
  404.       if (this.useTreeClass) {
  405.          if (this.tree != null) {
  406.             this.tree.setMinWidth(var1);
  407.             return;
  408.          }
  409.       } else if (this.resultList != null) {
  410.          this.resultList.setMinWidth(var1);
  411.       }
  412.  
  413.    }
  414.  
  415.    public int getMinWidth() {
  416.       return this.useTreeClass ? this.tree.getMinWidth() : this.resultList.getMinWidth();
  417.    }
  418.  
  419.    void createPanel(JDPUser var1, JDPJagg var2, boolean var3, String var4, int[] var5, String[] var6, String var7, String[] var8, String[] var9, String[] var10, String var11, boolean var12, String var13) {
  420.       this.user = var1;
  421.       this.jaggSQL = var2;
  422.       this.pselectFields = var4;
  423.       this.pdisplayFields = var5;
  424.       this.psdisplayFields = var6;
  425.       this.pfromWhereClause = var7;
  426.       this.psortChoice = var9;
  427.       this.savepfromWhereClause = var7;
  428.       this.pdisplayChoice = new String[var10.length];
  429.  
  430.       for(int var14 = 0; var14 < var10.length; ++var14) {
  431.          this.pdisplayChoice[var14] = var10[var14];
  432.          if (var10[var14] != null && var10[var14].indexOf(" DESC") > 0) {
  433.             this.pdisplayChoice[var14] = var10[var14].substring(0, var10[var14].length() - 5);
  434.          }
  435.       }
  436.  
  437.       ((Container)this).setLayout(new BorderLayout());
  438.       Panel var17 = new Panel();
  439.       ((Container)var17).setLayout(new BorderLayout());
  440.       this.popuppanel = new JDPPopupMessage(var1, this.targetPanel);
  441.       if (this.targetPanel != null) {
  442.          this.targetPanel.add(this.popuppanel);
  443.       }
  444.  
  445.       if (var8 != null && var8.length > 1) {
  446.          this.sortChoice = new JDPComboBox(var1, "", 7);
  447.          this.sortChoice.setEditable(false);
  448.  
  449.          for(int var15 = 0; var15 < var8.length; ++var15) {
  450.             if (var8[var15] != null) {
  451.                this.sortChoice.addItem(var8[var15]);
  452.             }
  453.          }
  454.  
  455.          this.sortChoice.select(var11);
  456.          ((Container)var17).add("North", this.sortChoice);
  457.          this.popuppanel.addComponent(this.sortChoice, "Order by", "Order list entries by this item");
  458.       }
  459.  
  460.       Panel var18 = new Panel();
  461.       ((Container)var18).setLayout(new BorderLayout(4, 1));
  462.       this.listCountText = new Label(var13, 0);
  463.       ((Container)var18).add("West", this.listCountText);
  464.       this.listCount = new Label("0      ", 0);
  465.       Panel var16 = new Panel();
  466.       ((Container)var16).setLayout(new BorderLayout(4, 1));
  467.       ((Container)var16).add("West", this.listCount);
  468.       ((Container)var16).add("Center", new Label(" ", 0));
  469.       ((Container)var18).add("Center", var16);
  470.       if (var12) {
  471.          ((Container)var17).add("South", var18);
  472.       }
  473.  
  474.       if (var12 || var8 != null && var8.length > 1) {
  475.          ((Container)this).add("North", var17);
  476.       }
  477.  
  478.       if (this.useTreeClass) {
  479.          this.tree = new JDPTreePicker(var1);
  480.          ((Container)this).add("Center", this.tree);
  481.          this.popuppanel.addComponent(this.tree, "Result List Tree", "Matching entries are displayed in this tree structure");
  482.       } else {
  483.          this.resultList = new JDPList(var1);
  484.          this.resultList.allowMultipleSelections(var3);
  485.          ((Container)this).add("Center", this.resultList);
  486.          this.popuppanel.addComponent(this.resultList, "Result List", "Matching entries are displayed in this list");
  487.       }
  488.    }
  489.  
  490.    public JDPTreePicker getTreeHandle() {
  491.       return this.tree;
  492.    }
  493.  
  494.    public void setTableKey(String var1) {
  495.       this.pselectFields = var1;
  496.    }
  497.  
  498.    public void setBackground(Color var1) {
  499.       this.bgColor = var1;
  500.       if (this.sortChoice != null) {
  501.          this.sortChoice.setBackground(var1);
  502.       }
  503.  
  504.       if (this.listCountText != null) {
  505.          this.listCountText.setBackground(var1);
  506.       }
  507.  
  508.       if (this.listCount != null) {
  509.          this.listCount.setBackground(var1);
  510.       }
  511.  
  512.       if (!this.useTreeClass && this.resultList != null) {
  513.          this.resultList.setBackground(var1);
  514.       }
  515.    }
  516.  
  517.    public Color getBackground() {
  518.       if (this.bgColor != null) {
  519.          return this.bgColor;
  520.       } else {
  521.          Container var1 = ((Component)this).getParent();
  522.          return var1 != null ? ((Component)var1).getBackground() : null;
  523.       }
  524.    }
  525.  
  526.    public void setFromWhereClause(String var1) {
  527.       if (this.savepfromWhereClause.toUpperCase().indexOf("FROM ") < 0) {
  528.          this.pfromWhereClause = var1 + " AND " + this.savepfromWhereClause;
  529.       } else {
  530.          this.pfromWhereClause = var1;
  531.       }
  532.    }
  533.  
  534.    public void setIcon(int var1) {
  535.       if (!this.useTreeClass) {
  536.          this.icon = var1;
  537.       }
  538.  
  539.    }
  540.  
  541.    public void setFont(Font var1) {
  542.       this.currentFont = var1;
  543.       if (this.sortChoice != null) {
  544.          this.sortChoice.setFont(var1);
  545.       }
  546.  
  547.       if (this.listCountText != null) {
  548.          this.listCountText.setFont(var1);
  549.       }
  550.  
  551.       if (this.listCount != null) {
  552.          this.listCount.setFont(var1);
  553.       }
  554.  
  555.       if (!this.useTreeClass) {
  556.          if (this.resultList != null) {
  557.             this.resultList.setFont(var1);
  558.             return;
  559.          }
  560.       } else if (this.tree != null) {
  561.          this.tree.setFont(var1);
  562.       }
  563.  
  564.    }
  565.  
  566.    public Font getFont() {
  567.       if (this.currentFont != null) {
  568.          return this.currentFont;
  569.       } else {
  570.          Container var1 = ((Component)this).getParent();
  571.          return var1 != null ? ((Component)var1).getFont() : null;
  572.       }
  573.    }
  574.  
  575.    public int getSelectedIndex() {
  576.       return this.useTreeClass ? this.tree.getSelectedIndex() : this.resultList.getSelectedIndex();
  577.    }
  578.  
  579.    public int getTotalEntries() {
  580.       try {
  581.          return Integer.parseInt(this.listCount.getText());
  582.       } catch (Exception var1) {
  583.          return 0;
  584.       }
  585.    }
  586.  
  587.    public void resetSelections() {
  588.       if (this.tree != null) {
  589.          this.tree.resetSelections();
  590.       } else {
  591.          if (this.resultList != null) {
  592.             this.resultList.resetSelections();
  593.          }
  594.  
  595.       }
  596.    }
  597.  
  598.    public void setMinHeight(int var1) {
  599.       if (this.useTreeClass) {
  600.          if (this.tree != null) {
  601.             this.tree.setMinHeight(var1);
  602.             return;
  603.          }
  604.       } else if (this.resultList != null) {
  605.          this.resultList.setMinHeight(var1);
  606.       }
  607.  
  608.    }
  609.  
  610.    public int getMinHeight() {
  611.       return this.useTreeClass ? this.tree.getMinHeight() : this.resultList.getMinHeight();
  612.    }
  613.  
  614.    public void setSortChoice(String[] var1) {
  615.       this.psortChoice = var1;
  616.    }
  617.  
  618.    public boolean setSelectedKey(String[] var1) {
  619.       boolean var2 = true;
  620.  
  621.       for(int var3 = 0; var3 < this.recordKey0.length; ++var3) {
  622.          var2 = true;
  623.  
  624.          for(int var4 = 0; var4 < var1.length; ++var4) {
  625.             if (var4 == 0 && !var1[var4].equals(this.recordKey0[var3])) {
  626.                var2 = false;
  627.             }
  628.  
  629.             if (var4 == 1 && !var1[var4].equals(this.recordKey1[var3])) {
  630.                var2 = false;
  631.             }
  632.  
  633.             if (var4 == 2 && !var1[var4].equals(this.recordKey2[var3])) {
  634.                var2 = false;
  635.             }
  636.  
  637.             if (var4 == 3 && !var1[var4].equals(this.recordKey3[var3])) {
  638.                var2 = false;
  639.             }
  640.  
  641.             if (var4 == 4 && !var1[var4].equals(this.recordKey4[var3])) {
  642.                var2 = false;
  643.             }
  644.  
  645.             if (var4 == 5 && !var1[var4].equals(this.recordKey5[var3])) {
  646.                var2 = false;
  647.             }
  648.  
  649.             if (var4 == 6 && !var1[var4].equals(this.recordKey6[var3])) {
  650.                var2 = false;
  651.             }
  652.  
  653.             if (var4 == 7 && !var1[var4].equals(this.recordKey7[var3])) {
  654.                var2 = false;
  655.             }
  656.  
  657.             if (var4 == 8 && !var1[var4].equals(this.recordKey8[var3])) {
  658.                var2 = false;
  659.             }
  660.  
  661.             if (var4 == 9 && !var1[var4].equals(this.recordKey9[var3])) {
  662.                var2 = false;
  663.             }
  664.          }
  665.  
  666.          if (var2) {
  667.             this.tree.select(var3);
  668.             return true;
  669.          }
  670.       }
  671.  
  672.       this.tree.resetSelections();
  673.       return false;
  674.    }
  675.  
  676.    public void setForeground(Color var1) {
  677.       this.fgColor = var1;
  678.       if (this.sortChoice != null) {
  679.          this.sortChoice.setForeground(var1);
  680.       }
  681.  
  682.       if (this.listCountText != null) {
  683.          this.listCountText.setForeground(var1);
  684.       }
  685.  
  686.       if (this.listCount != null) {
  687.          this.listCount.setForeground(var1);
  688.       }
  689.  
  690.       if (!this.useTreeClass) {
  691.          if (this.resultList != null) {
  692.             this.resultList.setForeground(var1);
  693.             return;
  694.          }
  695.       } else if (this.tree != null) {
  696.          this.tree.setForeground(var1);
  697.       }
  698.  
  699.    }
  700.  
  701.    public Color getForeground() {
  702.       if (this.fgColor != null) {
  703.          return this.fgColor;
  704.       } else {
  705.          Container var1 = ((Component)this).getParent();
  706.          return var1 != null ? ((Component)var1).getForeground() : null;
  707.       }
  708.    }
  709.  
  710.    public void setAllowMultSel(boolean var1) {
  711.       if (!this.useTreeClass) {
  712.          this.resultList.setMultipleSelections(var1);
  713.       }
  714.  
  715.    }
  716.  
  717.    public boolean getAllowMultSel() {
  718.       return !this.useTreeClass ? this.resultList.getMultipleSelections() : false;
  719.    }
  720.  
  721.    boolean addEntry(int var1) {
  722.       int var2 = 0;
  723.       int var3 = 0;
  724.       byte var4 = 0;
  725.       String[] var5 = new String[30];
  726.       if (this.useTreeClass) {
  727.          if (this.recordName[var1] != null) {
  728.             var5[var2++] = this.recordName[var1];
  729.             var4 = 1;
  730.          }
  731.  
  732.          String var6 = "";
  733.          var6 = var6 + this.recordKey0[var1];
  734.          var6 = var6 + this.recordKey1[var1];
  735.          var6 = var6 + this.recordKey2[var1];
  736.          var6 = var6 + this.recordKey3[var1];
  737.          var6 = var6 + this.recordKey4[var1];
  738.          var6 = var6 + this.recordKey5[var1];
  739.          var6 = var6 + this.recordKey6[var1];
  740.          var6 = var6 + this.recordKey7[var1];
  741.          var6 = var6 + this.recordKey8[var1];
  742.          var6 = var6 + this.recordKey9[var1];
  743.          if (this.pdisplayFields != null) {
  744.             var5[var2++] = this.recordKey0[var1];
  745.             var5[var2++] = this.recordKey1[var1];
  746.             var5[var2++] = this.recordKey2[var1];
  747.             var5[var2++] = this.recordKey3[var1];
  748.             var5[var2++] = this.recordKey4[var1];
  749.             var5[var2++] = this.recordKey5[var1];
  750.             var5[var2++] = this.recordKey6[var1];
  751.             var5[var2++] = this.recordKey7[var1];
  752.             var5[var2++] = this.recordKey8[var1];
  753.             var5[var2++] = this.recordKey9[var1];
  754.  
  755.             for(var3 = 0; var3 < this.pdisplayFields.length; ++var3) {
  756.                var5[var3 + var4] = var5[this.pdisplayFields[var3] + var4];
  757.             }
  758.          } else {
  759.             for(var3 = 0; var3 < this.psdisplayFields.length; ++var3) {
  760.                var5[var3 + var4] = this.psdisplayActual[var1][var3];
  761.             }
  762.          }
  763.  
  764.          for(int var7 = var3 + var4; var7 < var5.length; ++var7) {
  765.             var5[var7] = null;
  766.          }
  767.  
  768.          if (this.lastKey != null && var6.equals(this.lastKey)) {
  769.             if (this.tree.addEntry(var5)) {
  770.                return false;
  771.             }
  772.          } else {
  773.             this.lastKey = var6;
  774.             if (var5[var3 + var4 - 1].equals("")) {
  775.                var5[var3 + var4 - 1] = " ";
  776.             }
  777.  
  778.             this.tree.addEntry(var5, false, true);
  779.          }
  780.       } else if (this.icon >= 0) {
  781.          if (this.recordName[var1] != null) {
  782.             this.resultList.addItem(this.recordName[var1], this.icon);
  783.          } else {
  784.             this.resultList.addItem(this.recordKey0[var1], this.icon);
  785.          }
  786.       } else if (this.recordName[var1] != null) {
  787.          this.resultList.addItem(this.recordName[var1]);
  788.       } else {
  789.          this.resultList.addItem(this.recordKey0[var1]);
  790.       }
  791.  
  792.       return true;
  793.    }
  794.  
  795.    public String[] getSelectedKey() {
  796.       int var1 = -1;
  797.       if (this.useTreeClass) {
  798.          var1 = this.tree.getSelectedIndex();
  799.       } else {
  800.          var1 = this.resultList.getSelectedIndex();
  801.       }
  802.  
  803.       if (var1 >= 0 && this.recordKey0.length > var1) {
  804.          String[] var2 = new String[]{this.recordKey0[var1], this.recordKey1[var1], this.recordKey2[var1], this.recordKey3[var1], this.recordKey4[var1], this.recordKey5[var1], this.recordKey6[var1], this.recordKey7[var1], this.recordKey8[var1], this.recordKey9[var1]};
  805.          int var3 = 0;
  806.          var3 = 0;
  807.  
  808.          while(var2[var3] != null) {
  809.             ++var3;
  810.             if (var3 >= 9) {
  811.                break;
  812.             }
  813.          }
  814.  
  815.          String[] var4 = new String[var3];
  816.          System.arraycopy(var2, 0, var4, 0, var3);
  817.          return var4;
  818.       } else {
  819.          return null;
  820.       }
  821.    }
  822.  
  823.    public boolean handleEvent(Event var1) {
  824.       switch (var1.id) {
  825.          case 501:
  826.          case 502:
  827.          case 503:
  828.          case 504:
  829.          case 505:
  830.          case 506:
  831.             if (this.targetPanel == null) {
  832.                for(this.targetPanel = super.getParent(); this.targetPanel != null && !(this.targetPanel instanceof JDPPanelLoader); this.targetPanel = this.targetPanel.getParent()) {
  833.                }
  834.  
  835.                if (this.targetPanel != null && this.popuppanel != null) {
  836.                   this.popuppanel.setTarget(this.targetPanel);
  837.                   this.targetPanel.add(this.popuppanel);
  838.                }
  839.             }
  840.  
  841.             Object var6 = this;
  842.             if (this != null && this.targetPanel != null) {
  843.                Rectangle var3 = ((Component)this).bounds();
  844.  
  845.                while(var6 != null && !var6.equals(this.targetPanel)) {
  846.                   var1.x += var3.x;
  847.                   var1.y += var3.y;
  848.                   var6 = ((Component)var6).getParent();
  849.                   if (var6 != null) {
  850.                      var3 = ((Component)var6).bounds();
  851.                   }
  852.                }
  853.             }
  854.  
  855.             if (this.popuppanel != null) {
  856.                this.popuppanel.postEvent(var1);
  857.             }
  858.  
  859.             return false;
  860.          case 701:
  861.             if (var1.target instanceof JDPList && !this.listEvents) {
  862.                Event var4 = new Event(var1.target, var1.when, 1001, var1.x, var1.y, var1.key, var1.modifiers, var1.arg);
  863.                ((Component)this).getParent().postEvent(var4);
  864.                var4 = new Event(this, var1.when, 1001, var1.x, var1.y, var1.key, var1.modifiers, var1.arg);
  865.                ((Component)this).getParent().postEvent(var4);
  866.                return false;
  867.             } else {
  868.                if (var1.target.equals(this.tree)) {
  869.                   var1.target = this;
  870.                   ((Component)this).getParent().postEvent(var1);
  871.                   return true;
  872.                }
  873.  
  874.                return false;
  875.             }
  876.          case 1001:
  877.             if (var1.target instanceof JDPList) {
  878.                if (this.listEvents) {
  879.                   return false;
  880.                }
  881.  
  882.                return true;
  883.             } else if (var1.target instanceof JDPComboBox) {
  884.                this.clearList();
  885.                this.loadList();
  886.                return true;
  887.             } else {
  888.                if (var1.target instanceof JDPTreePicker) {
  889.                   Event var2 = new Event(this, var1.when, var1.id, var1.x, var1.y, var1.key, var1.modifiers);
  890.                   super.postEvent(var2);
  891.                   return false;
  892.                }
  893.  
  894.                return false;
  895.             }
  896.          default:
  897.             return false;
  898.       }
  899.    }
  900. }
  901.