예제 #1
2
  void bPronadji_actionPerformed(ActionEvent e) {
    if (txtOznakaBanke.getText().equals("")) {
      JOptionPane.showMessageDialog(null, "Oznaka banke mora biti uneta");
      txtOznakaBanke.grabFocus();
    } else {
      Vector filijale = DBF.getFilijale(txtOznakaBanke.getText());
      if (!filijale.isEmpty()) {

        ((TModelPrijave) tabBanke.getModel()).rejoinData(filijale);

        String adresa = DBF.getadresaB(txtOznakaBanke.getText());
        jLadresaBanke.setText(adresa);

        jLnazivBanke.setText(DBF.getnazivB(txtOznakaBanke.getText()));

      } else {
        JOptionPane.showMessageDialog(null, "Nije pronadjena ni jedna filijala");
      }
    }
  }
예제 #2
0
  /**
   * Method called by the SAX parser at the </
   *
   * @param uri URI of incoming file
   * @param localName String of element's local name
   * @param rawName String of element's raw name
   * @throws SAXException many possible
   */
  public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName)
      throws SAXException {

    String data = contents.toString();

    try {

      if (rawName.compareTo("dbf") == 0) {;
      } else if (rawName.compareTo("field") == 0) {
        if (recordProcessing == false) ;
        else fld.put(data);

      } else if (rawName.compareTo("record") == 0) {
        dbf.write();
      }
    } catch (xBaseJException xbe) {
      throw new SAXException("org.xBaseJ error: " + xbe.getMessage());
    } catch (IOException ioe) {
      throw new SAXException("java.IOExcpetion: " + ioe.getMessage());
    }
  }
예제 #3
0
  /**
   * method called for each xml element found. <br>
   * process logic
   *
   * <ul>
   *   <li>based on the name of the element found
   *   <li>for each pull appropriate attributes and construct object
   *   <li>if owned by another class, and all are except for Standard, add it to its parents object
   * </ul>
   *
   * @param uri URI of incoming file
   * @param localName String of element's local name
   * @param rawName String of element's raw name
   * @param attributes Vector of the elements attributes
   * @throws SAXException many possible exceptions
   */
  public void startElement(
      java.lang.String uri,
      java.lang.String localName,
      java.lang.String rawName,
      Attributes attributes)
      throws SAXException {

    iElement++;

    contents.reset();

    try {

      if (rawName.compareTo("dbf") == 0) {
        String dbfName = attributes.getValue("name");
        String dbfEncoding = attributes.getValue("encoding");
        if (dbfEncoding.length() == 0) dbf = new DBF(dbfName, true);
        else dbf = new DBF(dbfName, true, dbfEncoding);
      } else if (rawName.compareTo("field") == 0) {
        fldName = attributes.getValue("name");
        int fl, dp;
        if (recordProcessing == false) {
          fldType = attributes.getValue("type").charAt(0);
          switch (fldType) {
            case 'C':
              fl = Integer.parseInt(attributes.getValue("length"));
              dbf.addField(new CharField(fldName, fl));
              break;
            case 'D':
              dbf.addField(new DateField(fldName));
              break;
            case 'F':
              fl = Integer.parseInt(attributes.getValue("length"));
              dp = Integer.parseInt(attributes.getValue("decimalPos"));
              dbf.addField(new FloatField(fldName, fl, dp));
              break;
            case 'N':
              fl = Integer.parseInt(attributes.getValue("length"));
              dp = Integer.parseInt(attributes.getValue("decimalPos"));
              dbf.addField(new NumField(fldName, fl, dp));
              break;
            case 'L':
              dbf.addField(new LogicalField(fldName));
              break;
            case 'M':
              dbf.addField(new MemoField(fldName));
              break;
            case 'P':
              dbf.addField(new PictureField(fldName));
              break;
            case '$':
              dbf.addField(new CurrencyField(fldName));
              break;
          }
        } else {
          fld = dbf.getField(fldName);
        }
      } else if (rawName.compareTo("record") == 0) {
        recordProcessing = true;
      } else
        System.err.println(
            "Logic error: Unknown element name \""
                + rawName
                + "\" found at element position "
                + iElement
                + " line: "
                + iLine);
    } catch (xBaseJException xbe) {
      throw new SAXException("org.xBaseJ error: " + xbe.getMessage());
    } catch (IOException ioe) {
      throw new SAXException("java.IOExcpetion: " + ioe.getMessage());
    }
  }