コード例 #1
0
  protected void beforeGUI1(Form f) {
    try {
      HttpCon con12 = new HttpCon(null, PropertyClass.ServerUrl + "Allfrends");
      con12.SetContype(false, true, true);
      Thread t = new Thread(con12);
      synchronized (t) {
        t.start();
        t.wait();
      }
      final String bf[] = Splitter.Split(con12.getValue().toString(), "-");
      System.out.println(bf);
      final List l = (List) findByName("studentlist", f);

      for (int i = 0; i < bf.length - 1; i++) {

        l.addItem(Splitter.Split(bf[i], "/")[0]);
      }

      l.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
              frndid = Splitter.Split(bf[l.getSelectedIndex()], "/")[1];
              showForm("Userprofile", null);
            }
          });

    } catch (Exception e) {
      System.out.println(e);
    }

    super.beforeGUI1(f);
  }
コード例 #2
0
  protected void beforeMyProfile(Form f) {
    Myprofile = f;
    Label l1 = (Label) findByName("propic", f);
    name = (TextField) findByName("name", Myprofile);
    index = (TextField) findByName("index", Myprofile);
    tel = (TextField) findByName("tel", Myprofile);
    addr = (TextField) findByName("addr", Myprofile);
    email = (TextField) findByName("email", Myprofile);
    group = (TextField) findByName("group", Myprofile);
    try {

      String userde[] = Splitter.Split(new String(record.getRecord(4)), "-");

      name.setText(userde[0]);
      index.setText(userde[1]);
      tel.setText(userde[2]);
      addr.setText(userde[3]);
      email.setText(userde[4]);
      group.setText(userde[5]);

      if (new String(record.getRecord(2)).equals("no")) {
        l1.setIcon(Image.createImage("/no_user.png").scaledHeight(72));

      } else {
        l1.setIcon(Image.createImage(new String(record.getRecord(2))).scaledHeight(72));
      }

      System.gc();
    } catch (Exception e) {
    }
    super.beforeMyProfile(f);
  }
コード例 #3
0
  protected boolean onHtmlpasrecoverRetrieve() {

    try {
      String Email = Splitter.Split(new String(record.getRecord(4)), "-")[4];
      if (!Email.equals("n")) {
        HttpCon con =
            new HttpCon(
                new String(record.getRecord(1)) + "-" + Email,
                PropertyClass.ServerUrl + "PasswordRecvoer");
        con.SetContype(true, true, true);
        Thread t = new Thread(con);
        showContainer("AlertBox", null, null);
        synchronized (t) {
          t.start();
          t.wait();
        }

        ((TextField) findByName("status1", HTTPemailsender)).setText(con.getValue().toString());
      } else {
        ((TextField) findByName("status1", HTTPemailsender))
            .setText("Your password need not to retrive, it's default password");
      }
      Email = null;
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    boolean val = super.onHtmlpasrecoverRetrieve();
    return val;
  }
コード例 #4
0
  protected void beforeDepartments(Form f) {
    department = f;
    Label l = (Label) findByName("Label2", f);
    try {
      HttpCon con12 =
          new HttpCon(
              String.valueOf(departmentPerson) + "-p",
              PropertyClass.ServerUrl + "DepartmentOffiecer");
      con12.SetContype(true, true, true);
      Thread t = new Thread(con12);
      synchronized (t) {
        t.start();
        t.wait();
      }

      String a[] = Splitter.Split(con12.getValue().toString(), "-");
      ((Label) findByName("Label3", f)).setText(a[4]);
      ((TextArea) findByName("aboutDepartmentt", f)).setText(a[0]);
      ((Label) findByName("name", f)).setText("Head Dept: " + a[1]);
      ((Label) findByName("Label7", f)).setText(a[2]);
      ((Label) findByName("Label8", f)).setText("Tel : " + a[3]);

      switch (departmentPerson) {
        case 1:
          l.setIcon(Image.createImage("/ceo.png").scaledHeight(78));

          break;
        case 2:
          l.setIcon(Image.createImage("/div1.png").scaledHeight(78));
          break;
        case 3:
          l.setIcon(Image.createImage("/div2.png").scaledHeight(78));
          break;
        case 4:
          l.setIcon(Image.createImage("/div3.png").scaledHeight(78));
          break;
        default:
          l.setIcon(Image.createImage("no_user.png").scaledHeight(78));
          break;
      }
      departmentPerson = 0;
      super.beforeDepartments(f);
      System.gc();
    } catch (Exception e) {
    }
  }
コード例 #5
0
  protected boolean onLoginGUILogme() {
    try {
      showForm("FirstForm", null);
      String values[] = Splitter.Split(new String(record.getRecord(1)), "-");
      showForm("FirstForm", null);
      if (values[0].equals(username.getText()) && values[1].equals(password.getText())) {
        showForm("FirstForm", null);
      } else {

        showForm("Htmlpasrecover", null);
      }

      values = null;
    } catch (Exception e) {
      System.out.println(e);
    }

    boolean val = super.onLoginGUILogme();
    return val;
  }
コード例 #6
0
  protected void beforeUserprofile(Form f) {
    try {
      ((Label) findByName("Label2", f)).setIcon(Image.createImage("/no_user.png").scaledHeight(72));
      HttpCon con12 = new HttpCon(frndid + "-p", PropertyClass.ServerUrl + "Frends");
      con12.SetContype(true, true, true);
      Thread t = new Thread(con12);
      synchronized (t) {
        t.start();
        t.wait();
      }
      String frnd[] = Splitter.Split(con12.getValue().toString(), "-");
      ((Label) findByName("Label4", f)).setText(frnd[0]);
      ((Label) findByName("Label6", f)).setText(frnd[1]);
      ((Label) findByName("tel", f)).setText("Tel   " + frnd[2]);
      ((Label) findByName("Label81", f)).setText("Address   " + frnd[3]);
      ((Label) findByName("Label7", f)).setText("email   " + frnd[4]);

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    super.beforeUserprofile(f);
  }
コード例 #7
0
  protected boolean onMyProfileSaveAll() {
    String pass = null;
    byte arr[] = null;

    if (checkpass.equals("+")) {
      try {
        pass = new String(record.getRecord(1));
        pass = Splitter.Split(pass, "-")[1];
      } catch (Exception e) {
      }

    } else {
      pass = checkpass;
    }

    if (!imgpath.equals("+")) {
      try {
        record.setRecord(2, imgpath.getBytes(), 0, imgpath.getBytes().length);
      } catch (RecordStoreException ex) {
        ex.printStackTrace();
      }
    }

    try {

      String userpass[] = Splitter.Split(new String(record.getRecord(1)), "-");

      byte userpsss[] = (userpass[0] + "-" + pass).getBytes();
      record.setRecord(1, userpsss, 0, userpsss.length);

      String record4 =
          name.getText()
              + "-"
              + index.getText()
              + "-"
              + tel.getText()
              + "-"
              + addr.getText()
              + "-"
              + email.getText()
              + "-"
              + group.getText();
      byte reco4[] = record4.getBytes();

      record.setRecord(4, reco4, 0, reco4.length);

      String id = (Splitter.Split(new String(record.getRecord(3)), "-")[1]);

      if (id.equals("0")) {

        HttpCon con2 = new HttpCon(record4 + "-" + pass, PropertyClass.ServerUrl + "addaUser");
        con2.SetContype(true, true, true);
        Thread t = new Thread(con2);
        synchronized (t) {
          t.start();
          t.wait();
        }

        String[] newid = Splitter.Split((new String(record.getRecord(3))), "-");
        userpsss = null;
        userpsss = (newid[0] + "-" + con2.getValue().toString() + "-" + newid[2]).getBytes();
        record.setRecord(3, userpsss, 0, userpsss.length);

      } else {
        HttpCon con12 =
            new HttpCon(record4 + ("-" + pass + "-" + id), PropertyClass.ServerUrl + "UpdateUser");

        con12.SetContype(true, true, true);
        Thread t = new Thread(con12);

        synchronized (t) {
          t.start();
          t.wait();
        }
      }
    } catch (Exception e) {
      System.out.println(e);
    }
    pass = null;
    arr = null;
    boolean val = super.onMyProfileSaveAll();
    return val;
  }