/** Creates a new ProgressIndicatorScreen object */
  public ProgressIndicatorScreen() {
    setTitle("Progress Indicator Screen");

    // Initialize progress indicator
    final ProgressIndicatorView view = new ProgressIndicatorView(0);
    _model = new ProgressIndicatorModel(0, 100, 0);
    final ProgressIndicatorController controller = new ProgressIndicatorController();
    _model.setController(controller);
    _model.addListener(new DemoProgressIndicatorListener());
    view.setModel(_model);
    view.setController(controller);
    controller.setModel(_model);
    controller.setView(view);
    view.setLabel("Progress");
    view.createProgressBar(Field.FIELD_HCENTER);

    // Initialize buttons
    _processButton =
        new ButtonField("Process data", ButtonField.NEVER_DIRTY | ButtonField.CONSUME_CLICK);
    _processButton.setChangeListener(this);
    _cancelButton = new ButtonField("Cancel", ButtonField.NEVER_DIRTY | ButtonField.CONSUME_CLICK);
    _cancelButton.setChangeListener(this);
    _resumeButton = new ButtonField("Resume", ButtonField.NEVER_DIRTY | ButtonField.CONSUME_CLICK);
    _resumeButton.setChangeListener(this);

    // Add buttons to manager
    final HorizontalFieldManager hfm = new HorizontalFieldManager(Field.FIELD_HCENTER);
    hfm.add(_processButton);
    hfm.add(_cancelButton);
    hfm.add(_resumeButton);

    add(hfm);
    add(new SeparatorField());
    add(view);
  }
  public AddFeedDialog(ObjectListField list) {
    super(
        new VerticalFieldManager(VERTICAL_SCROLLBAR | VERTICAL_SCROLL),
        DEFAULT_MENU | Field.FOCUSABLE);
    this.list = list;

    // title label to sit at top of screen
    LabelField titleLbl = new LabelField("Add a Feed", Field.FIELD_HCENTER);
    titleLbl.setFont(titleLbl.getFont().derive(Font.BOLD));
    titleLbl.setMargin(new XYEdges(0, 0, 10, 0)); // top,right,bottom,left

    // set up fields..
    LabelField nameLbl = new LabelField("Name");
    nameTxt = new TextField(500);

    LabelField urlLbl = new LabelField("Address");
    urlTxt = new TextField(500, EditField.FILTER_URL);

    addBtn = new ButtonField("Add", ButtonField.CONSUME_CLICK | Field.FIELD_HCENTER);
    cancelBtn = new ButtonField("Cancel", ButtonField.CONSUME_CLICK | Field.FIELD_HCENTER);

    // add everything to the screen..
    HorizontalFieldManager buttonsManager = new HorizontalFieldManager(Field.FIELD_HCENTER);
    buttonsManager.setMargin(new XYEdges(10, 0, 5, 0)); // top,right,bottom,left
    buttonsManager.add(addBtn);
    buttonsManager.add(cancelBtn);
    this.add(titleLbl);
    this.add(nameLbl);
    this.add(nameTxt);
    this.add(urlLbl);
    this.add(urlTxt);
    this.add(buttonsManager);

    // add action listeners to buttons..
    addBtn.setChangeListener(
        new FieldChangeListener() {
          public void fieldChanged(Field field, int context) {
            add();
          }
        });
    cancelBtn.setChangeListener(
        new FieldChangeListener() {
          public void fieldChanged(Field field, int context) {
            cancel();
          }
        });
  }
Пример #3
0
  /** Create a new GPSDemoAdvanced object */
  public GPSDemoAdvanced() {
    final MainScreen screen = new MainScreen();

    // Initialize UI components
    screen.setTitle("GPS Advanced Demo");
    final LabelField apiChoiceMessage =
        new LabelField("Please select an API to test:", Field.USE_ALL_WIDTH | Field.FIELD_HCENTER);
    _coreTestButton =
        new ButtonField("Core GPS API Test", ButtonField.NEVER_DIRTY | ButtonField.CONSUME_CLICK);
    _extendedTestButton =
        new ButtonField(
            "Extended GPS API Test", ButtonField.NEVER_DIRTY | ButtonField.CONSUME_CLICK);
    _coreTestButton.setChangeListener(this);
    _extendedTestButton.setChangeListener(this);

    screen.add(apiChoiceMessage);
    screen.add(_coreTestButton);
    screen.add(_extendedTestButton);
    pushScreen(screen);
  }
Пример #4
0
  public RoomScreen() {
    // DBStor.set_roomFav(null);
    for (int a = 0; a < favRomm.size(); a++) {
      reloadFav((RoomChat) favRomm.elementAt(a));
    }
    setJudul("BlackBerry Near yoU");
    mf1.add(new SpaceField(8));
    mf1.add(showmaps);
    mf1.add(settinng);
    mf1.add(new SpaceField(8));
    settinng.setChangeListener(this);
    showmaps.setChangeListener(this);

    mf2.add(new LabelFieldBold("Active Room", 0x424242, FIELD_HCENTER));
    mf2.add(AktifRoom);
    mf2.add(new SpaceField(8));

    mf3.add(new LabelFieldBold("Favourite Room", 0x424242, FIELD_HCENTER));
    mf3.add(Favourite);
    mf3.add(new SpaceField(8));

    mf4.add(new LabelFieldBold("Nearest Chat Room", 0x424242, FIELD_HCENTER));
    mf4.add(ChatRoom);
    mf4.add(hfm);
    hfm.add(refresh);
    hfm.add(addroom);
    refresh.setChangeListener(this);
    addroom.setChangeListener(this);
    mf4.add(new SpaceField(8));

    add(mf1);
    add(new SpaceField(4));
    add(mf2);
    add(new SpaceField(4));
    add(mf3);
    add(new SpaceField(4));
    add(mf4);
    add(new SpaceField(4));
  }
  public PushAuthScreen() {
    super(new VerticalFieldManager(), Field.FOCUSABLE);
    me = this;
    String time = new Long(new Date().getTime()).toString();
    timestamp = time.substring(0, time.length() - 3);

    add(new LabelField("You will ressieve push notifications"));

    logButton = new ButtonField("OK", ButtonField.CONSUME_CLICK);
    logButton.setChangeListener(me);
    add(logButton);

    logButton.setFocus();
  }
Пример #6
0
  public dialogPopUpScreen(String msg, final Vector v) {

    super(new VerticalFieldManager(), Field.FOCUSABLE);

    // dialogPopUpScreen.v = v;

    msgText = new LabelField(msg, Field.USE_ALL_WIDTH | Field.FIELD_HCENTER | Field.NON_FOCUSABLE);

    HorizontalFieldManager oneHorizontalFieldManager = new HorizontalFieldManager();
    label1 = new LabelField("Claim No. : ", Field.NON_FOCUSABLE);
    edit1 = new EditField("", "", 24, FOCUSABLE);
    // edit1.setText("OC-11-1901-8403-00000001");
    oneHorizontalFieldManager.add(label1);
    oneHorizontalFieldManager.add(edit1);

    HorizontalFieldManager btnHorizontalFieldManager =
        new HorizontalFieldManager(Field.FIELD_HCENTER);

    btnUpload = new ButtonField("Upload", Field.FIELD_HCENTER);
    btnUpload.setChangeListener(
        new FieldChangeListener() {

          public void fieldChanged(Field field, int context) {
            if (field == btnUpload) {
              PolicyId = edit1.getText().toString();
              if (PolicyId.trim().equalsIgnoreCase("")) {
                UiApplication.getUiApplication()
                    .invokeLater(
                        new Runnable() {
                          public void run() {
                            Screen screen = UiApplication.getUiApplication().getActiveScreen();
                            if (screen instanceof PopupSpinnerScreen) {
                              UiApplication.getUiApplication().popScreen(screen);
                            }
                            Dialog.alert("Please enter valid PolicyId!");
                            edit1.setText("");
                          }
                        });
              } else {
                Controller.showScreen(new PopupSpinnerScreen("Authenticating Policy Id..."));

                Thread thread =
                    new Thread() {
                      public void run() {
                        boolean flag = true;
                        flag = CallService.INSTANCE.callvalidateClmPolicyWS(PolicyId, v);
                        if (flag == false) {
                          flag = CallService.INSTANCE.callvalidateClmPolicyWS(PolicyId, v);
                        }
                      };
                    };
                thread.start();
              }
            }
          }
        });

    btnCancel = new ButtonField("Cancel", Field.FIELD_HCENTER);
    btnCancel.setChangeListener(
        new FieldChangeListener() {

          public void fieldChanged(Field field, int context) {
            if (field == btnCancel) {
              synchronized (UiApplication.getEventLock()) {
                Screen screen = UiApplication.getUiApplication().getActiveScreen();
                UiApplication.getUiApplication().popScreen(screen);
              }
            }
          }
        });
    btnHorizontalFieldManager.add(btnUpload);
    btnHorizontalFieldManager.add(btnCancel);

    add(msgText);
    add(oneHorizontalFieldManager);
    add(btnHorizontalFieldManager);
  }
  public PickScreen(int voteType) {
    super();
    this.voteType = voteType;

    VerticalFieldManager vertFieldManager =
        new VerticalFieldManager(
            VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.VERTICAL_SCROLLBAR) {
          // Override the paint method to draw the background image.
          public void paint(Graphics graphics) {
            graphics.setColor(Color.BLACK);
            graphics.fillRect(0, 0, this.getWidth(), this.getHeight());
            super.paint(graphics);
          }
        };
    ;

    try { // set up the smaller list font
      ff1 = FontFamily.forName("Verdana");
      font2 = ff1.getFont(Font.BOLD, 20);
    } catch (final ClassNotFoundException cnfe) {
    }

    Vector contList = GameData.getCurrentGame().getActiveContestants();

    Contestant[] contArray = new Contestant[contList.size()];
    contList.copyInto(contArray);
    ocfActiveContestant = new ObjectChoiceField(" Cast your " + voteType + " vote: ", contArray);
    User user = GameData.getCurrentGame().getCurrentUser();
    if (voteType == T_WEEKLY && user.getWeeklyPick() != null) {
      ocfActiveContestant.setSelectedIndex(user.getWeeklyPick());
    } else if (voteType == T_ULTIMATE && user.getUltimatePick() != null) {
      ocfActiveContestant.setSelectedIndex(user.getUltimatePick());
    }

    list = new RichList(vertFieldManager, true, 3, 0);

    // get all contestants for list
    contList = GameData.getCurrentGame().getAllContestants();
    for (int i = 0; i < contList.size(); i++) {
      Contestant cont = (Contestant) contList.elementAt(i);
      /* list contains labels so that the text colour can change */
      lblContName =
          new LabelField(cont.getFirstName() + " " + cont.getLastName(), LabelField.ELLIPSIS) {
            public void paint(Graphics g) {
              g.setColor(Color.WHITE);
              super.paint(g);
            }
          };
      lblContName.setFont(font2);

      labelContTribe =
          new LabelField(cont.getTribe(), LabelField.ELLIPSIS) {
            public void paint(Graphics g) {
              g.setColor(Color.WHITE);
              super.paint(g);
            }
          };
      lblContName.setFont(font2);

      String tempString = "";

      if (cont.isCastOff()) tempString = "Castoff";
      else tempString = "Active";

      labelTempStatus =
          new LabelField(tempString, LabelField.ELLIPSIS) {
            public void paint(Graphics g) {
              g.setColor(Color.WHITE);
              super.paint(g);
            }
          };
      lblContName.setFont(font2);
      Bitmap imgContestant = getImage(cont.getPicture());
      list.add(new Object[] {imgContestant, lblContName, labelContTribe, labelTempStatus});
    }

    HorizontalFieldManager horFieldManager =
        new HorizontalFieldManager(
            HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.FIELD_HCENTER) {
          // Override the paint method to draw the background image.
          public void paint(Graphics graphics) {
            graphics.setColor(Color.GREEN);
            graphics.fillRect(0, 0, this.getWidth(), this.getHeight());
            super.paint(graphics);
          }
        };
    ;

    String voted = "Vote";
    user = GameData.getCurrentGame().getCurrentUser();
    System.out.println(user.getWeeklyPick() + " " + this.voteType);
    if ((this.voteType == T_WEEKLY && user.getWeeklyPick() != null)
        || (this.voteType == T_ULTIMATE && user.getUltimatePick() != null)) voted = "Revote";
    btnVoted = new ButtonField(voted);
    btnVoted.setChangeListener(this);

    horFieldManager.add(btnVoted);
    horFieldManager.add(ocfActiveContestant);
    horFieldManager.setFont(font2);

    this.setTitle(horFieldManager);
    this.add(vertFieldManager);
    this.setStatus(Common.getToolbar("Log Out"));
    vertFieldManager.setFocus(); // THIS NEEDS TO BE HERE. APP CRASHES WITHOUT IT
  }
  CitationScreen6(Citation _c) {
    c = _c;

    String cNumberString = Integer.toString(c.Number);
    /*
            CustomLabelField lf = new CustomLabelField("OREGON UNIFORM CITATION: #" + cNumberString, LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
            lf.setBackgroundColor(0x00194E84);
            lf.setTextColor(0x00ffffff);
            FontFamily fontFamily0[] = FontFamily.getFontFamilies();
            Font font = fontFamily0[1].getFont(FontFamily.CBTF_FONT, 14);
            lf.setFont(font);

            add(lf);
    */
    LabelField lf0 =
        new LabelField(
            "OREGON UNIFORM CITATION: #" + cNumberString,
            LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH | DrawStyle.HCENTER) {
          protected void paintBackground(net.rim.device.api.ui.Graphics g) {
            g.clear();
            g.getColor();
            g.setColor(Color.GREEN);
            g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
            g.setColor(Color.WHITE);
          }
        };
    FontFamily fontFamily0[] = FontFamily.getFontFamilies();
    Font font0 = fontFamily0[1].getFont(FontFamily.CBTF_FONT, 14);
    lf0.setFont(font0);
    setTitle(lf0);
    add(new SeparatorField());
    /*
          CustomLabelField lf1 = new CustomLabelField("************* INCIDENT ATTRIBUTES **************", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
          lf1.setBackgroundColor(Color.LIGHTGREY);
          lf1.setTextColor(Color.BLUE);

          FontFamily fontFamily[] = FontFamily.getFontFamilies();
          Font font1 = fontFamily[1].getFont(FontFamily.CBTF_FONT, 14);
          lf1.setFont(font1);
          add(lf1);
    */
    LabelField lf3 =
        new LabelField(
            "********* INCIDENT ATTRIBUTES **********",
            LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH | DrawStyle.HCENTER) {
          protected void paintBackground(net.rim.device.api.ui.Graphics g) {
            g.clear();
            g.getColor();
            g.setColor(Color.GREEN);
            g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
            g.setColor(Color.WHITE);
          }
        };
    FontFamily fontFamily3[] = FontFamily.getFontFamilies();
    Font font3 = fontFamily3[1].getFont(FontFamily.CBTF_FONT, 14);
    lf3.setFont(font0);
    add(lf3);
    add(new SeparatorField());

    // --------------

    // CheckboxField
    field_accident = new CheckboxField("Accident", false);
    add(field_accident);

    // CheckboxField
    field_radar = new CheckboxField("Radar", false);
    add(field_radar);

    // CheckboxField
    field_jail_booking = new CheckboxField("Jail Booking", false);
    add(field_jail_booking);

    // CheckboxField
    field_paced = new CheckboxField("Paced", false);
    add(field_paced);

    // CheckboxField
    field_school_zone = new CheckboxField("School Zone", false);
    add(field_school_zone);

    // CheckboxField
    field_alcohol = new CheckboxField("Alcohol", false);
    add(field_alcohol);

    add(new SeparatorField());

    // EditField
    field_vbfi = new EditField("VBFI: ", "");
    add(field_vbfi);

    // ObjectChoiceField
    String choicestrs1[] = {
      "5MPH", "10MPH", "15MPH", "20MPH", "25MPH", "30MPH", "35MPH", "40MPH", "45MPH", "50MPH",
      "55MPH", "60MPH", "65MPH", "70MPH", "75MPH", "80MPH"
    };
    field_speed_limit = new ObjectChoiceField("Speed Limit: ", choicestrs1, 0);
    add(field_speed_limit);

    // EditField
    field_alleged_speed = new EditField("Alleged Speed: ", "");
    add(field_alleged_speed);

    add(new SeparatorField());

    // ButtonField row - set all buttons at the bottom row of the form
    HorizontalFieldManager navButtonManager = new HorizontalFieldManager();

    // ButtonField
    ButtonField btn_prev;
    btn_prev = new ButtonField("Prev", ButtonField.CONSUME_CLICK);
    btn_prev.setChangeListener(new ButtonListener6(this, c));
    navButtonManager.add(btn_prev);

    ButtonField btn_next;
    btn_next = new ButtonField("Next", ButtonField.CONSUME_CLICK);
    btn_next.setChangeListener(new ButtonListener6(this, c));
    navButtonManager.add(btn_next);

    add(navButtonManager);

    add(new SeparatorField());

    addMenuItem(saveItem6);
    addMenuItem(getItem6);

    restoreUIFieldsFromCitation();
  }
Пример #9
0
  public Questions(String currentUser, int week) {
    // current user
    this.currentUser = currentUser;
    // set week
    this.week = week;
    // set title
    setTitle("Questions");

    // background
    defaultBg =
        BackgroundFactory.createLinearGradientBackground(
            Color.WHITE, Color.LIGHTSKYBLUE, Color.WHITE, Color.GRAY);

    // main manager
    mainManager = (VerticalFieldManager) getMainManager();
    mainManager.setBackground(defaultBg);

    // create  buttons
    goBack = new ButtonField("Go back", ButtonField.FIELD_HCENTER);

    // create reader object
    reader = new ReadFile();

    // read the question file and return its contents
    test = reader.readTextFile("Questions2.txt");

    // process the information
    process_Qfile(test);
    // create and set the question objects
    CreateAndSetQuestionObj();

    // create Question list
    questions_list = CreateQList();

    // drop-down list
    questionsList = new ObjectChoiceField("This week's Questions: ", questions_list);

    // set margins
    questionsList.setMargin(20, 0, 0, 0);
    goBack.setMargin(30, 0, 0, 0);

    // add buttons to the listener
    questionsList.setChangeListener(this);
    goBack.setChangeListener(this);

    // create image and overwrite the paint method of verticalFieldManager
    // backgroundImage = Bitmap.getBitmapResource("beach4 copy1.jpg");
    backgroundImage = Bitmap.getBitmapResource("beach5 copy copy.jpg");
    mainManager =
        new VerticalFieldManager(
            VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT) {
          public void paint(Graphics graphics) {

            graphics.drawBitmap(0, 0, 480, 510, backgroundImage, 0, 0);
            super.paint(graphics);
          }
        };
    this.add(mainManager);

    // add components
    mainManager.add(questionsList);
    mainManager.add(goBack);

    // decide which panel should display
    displayAnswer();
  }
Пример #10
0
  public Reingresos() {
    // setTitle("Reingreso");
    add(
        new BitmapField(
            Bitmap.getBitmapResource("img/titulos/reingreso.png"), BitmapField.HCENTER));
    usuario = usuarios.getUsuario();

    // JGF: en caso de requerirse deshabilitar GPS
    if (!usuario.getHabilitaD().equals("1")) {
      GPSScreen.StopMessure();
      GPSScreen.CancelTimer();
      GPSScreen.PrintMessage("GPS deshabilitado!");
    }

    lblTipoDoc =
        new mkpyLabelLabelField(
            "Tipo doc:",
            usuario.getIdTipoDoc(),
            ObjectChoiceField.FIELD_RIGHT,
            Color.BLACK,
            Color.WHITE);

    add(txtCodConsultora);
    txtCodConsultora.setChangeListener(this);
    txtCodConsultora.setFocusListener(this);
    add(lblTipoDoc);
    if (usuario.getIdPais().equals("7")) { // PR
      txtNroDoc =
          new mkpyLabelEditField(
              "Nro doc:",
              "",
              9,
              EditField.FIELD_LEFT | EditField.NO_NEWLINE | EditField.FILTER_NUMERIC,
              Color.BLACK,
              Color.WHITE);
    }
    if (usuario.getIdPais().equals("8")) { // DOM
      txtNroDoc =
          new mkpyLabelEditField(
              "Nro doc:",
              "",
              11,
              EditField.FIELD_LEFT | EditField.NO_NEWLINE | EditField.FILTER_NUMERIC,
              Color.BLACK,
              Color.WHITE);
    }
    add(txtNroDoc);
    txtNroDoc.setChangeListener(this);
    txtNroDoc.setFocusListener(this);
    add(txtAppaterno);
    txtAppaterno.setChangeListener(this);
    txtAppaterno.setFocusListener(this);
    add(txtApmaterno);
    txtApmaterno.setChangeListener(this);
    txtApmaterno.setFocusListener(this);
    add(txtNombres);
    txtNombres.setChangeListener(this);
    txtNombres.setFocusListener(this);
    add(txtTelefonoCasa);
    txtTelefonoCasa.setChangeListener(this);
    txtTelefonoCasa.setFocusListener(this);
    add(txtTelefonoCelular);
    txtTelefonoCelular.setChangeListener(this);
    txtTelefonoCelular.setFocusListener(this);

    if (usuario.getHabilitaC().equals("1")) {
      add(lblRecord);
      add(txtFechaRec);
      txtFechaRec.setChangeListener(this);
      txtFechaRec.setFocusListener(this);

      add(txtObsRec);
      txtObsRec.setChangeListener(this);
      txtObsRec.setFocusListener(this);
    }

    add(btnGrabar);
    btnGrabar.setChangeListener(this);
    setStatus(lblEstado);
  }