Beispiel #1
0
  public void welcomeTitleDisplay() {

    String curDateForDisplayLbl =
        new SimpleDateFormat("dd-MMM-yyyy").formatLocal(System.currentTimeMillis());

    DisplayTimeLbl =
        new LabelFieldImpl(
            curDateForDisplayLbl, DrawStyle.RIGHT | Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT);

    DisplayTimeLbl.setBgColor(0x000072BC);
    DisplayTimeLbl.setFontColor(Color.WHITE);

    WelcomeNameLbl = new LabelFieldImpl("Welcome: " + userName);
    WelcomeNameLbl.setBgColor(0x000072BC);
    WelcomeNameLbl.setFontColor(Color.WHITE);

    if (Display.getWidth() > 320) {
      DisplayTimeLbl.setFont(Constants.font);
      WelcomeNameLbl.setFont(Constants.font);
    } else {
      DisplayTimeLbl.setFont(Constants.fontVerySmall);
      WelcomeNameLbl.setFont(Constants.fontVerySmall);
    }

    horizontalWelcomeLabel = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
    horizontalWelcomeLabel.add(WelcomeNameLbl);
    horizontalWelcomeLabel.add(DisplayTimeLbl);
    horizontalWelcomeLabel.setBorder(roundedBorder);
  }
  /** 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);
  }
  /**
   * Arranges a label and a field horizontally using a HorizontalFieldManager. Label first,then the
   * field.
   *
   * @param label The text of the label.
   * @param field The field to place.
   * @return A HorizontalFieldManager containing both label and the field.
   */
  public static HorizontalFieldManager arrangeHorizontally(String label, Field field) {
    HorizontalFieldManager manager = new HorizontalFieldManager();

    manager.add(
        new LabelField(
            label,
            LabelField.USE_ALL_HEIGHT | LabelField.FIELD_VCENTER | LabelField.NON_FOCUSABLE));
    manager.add(field);

    return manager;
  }
  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();
          }
        });
  }
 public void paint(Graphics g) {
   int xPts[] = {0, 0, getPreferredWidth(), getPreferredWidth()};
   int yPts[] = {0, getPreferredHeight(), getPreferredHeight(), 0};
   g.setColor(3947580);
   g.drawFilledPath(xPts, yPts, null, null);
   // g.drawTexturedPath(xPts,yPts,null,null,0,0,Fixed32.ONE,0,0,Fixed32.ONE,img);
   super.paint(g);
 }
Beispiel #6
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 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 void runMain() {

    Bitmap img = imgstock.getHeader();
    BitmapFieldWithStatus bf =
        new BitmapFieldWithStatus(img, BitmapField.FIELD_HCENTER | BitmapField.USE_ALL_WIDTH, "");
    add(bf);
    Engine.getInstance().registerStatus(bf);
    try {
      MainListVerticalFieldManager mainManager = new MainListVerticalFieldManager();
      XYEdges edge =
          new XYEdges(5, 25 * Display.getWidth() / 480, 2, 25 * Display.getWidth() / 480);
      HorizontalFieldManager mainHorizontalManager =
          new HorizontalFieldManager(
              HorizontalFieldManager.FIELD_HCENTER
                  | HorizontalFieldManager.USE_ALL_WIDTH
                  | HorizontalFieldManager.FIELD_VCENTER);
      RadioButtonGroup rgrp = new RadioButtonGroup();

      // EditField

      // EditField
      searchTextField =
          new EditFieldwithFocus(
              "Search: ",
              topic,
              35,
              BasicEditField.FIELD_HCENTER | BasicEditField.FIELD_VCENTER,
              MyColor.FONT_SEARCH,
              MyColor.SEARCH_COLOR) {
            public void layout(int width, int height) {
              super.layout(getPreferredWidth(), getPreferredHeight());
              setExtent(getPreferredWidth(), getPreferredHeight());
            }

            public int getPreferredHeight() {
              return 25;
            }

            public int getPreferredWidth() {
              return 340 * Display.getWidth() / 480;
            }
          };
      // edit.setBorder(BorderFactory.createSimpleBorder(edge,Border.STYLE_TRANSPARENT));
      // add(edit);
      MyButtonField button = new MyButtonField("Share a file", ButtonField.ELLIPSIS);
      // stopButton.setBorder(BorderFactory.createSimpleBorder(edge,Border.STYLE_TRANSPARENT));
      button.setChangeListener(new ButtonListener(rgrp, 12));
      button.setMargin(edge);
      mainManager.add(button);
      //			searchTextField.setMargin(edge);
      mainHorizontalManager.add(searchTextField);
      mainHorizontalManager.add(searchBT);
      mainHorizontalManager.setMargin(edge);
      mainManager.add(mainHorizontalManager);
      // BitmapField bff = new BitmapField(img,
      // BitmapField.NON_FOCUSABLE);
      // mainManager.add(bff);
      LabelField topicLabel =
          new LabelFieldWithFullBG(
              "Document Sharing",
              MyColor.FONT_TOPIC,
              MyColor.FONT_TOPIC_COLOR,
              MyColor.TOPIC_BG,
              Const.LABEL_WIDTH);
      edge = new XYEdges(2, 25 * Display.getWidth() / 480, 2, 25 * Display.getWidth() / 480);
      topicLabel.setMargin(edge);

      mainManager.add(topicLabel);
      _list = new TrainingListField();
      mainManager.add(_list);
      pagingManager.setMargin(edge);
      mainManager.add(pagingManager);
      add(mainManager);
    } catch (Exception e) {
      System.out.println("" + e.toString());
    }
    // bf = new BitmapField(img, Field.FIELD_BOTTOM | Field.USE_ALL_HEIGHT);
    // bf.setBorder(BorderFactory.createSimpleBorder(edge,Border.STYLE_TRANSPARENT));
    // add(bf);

    addMenuItem(_mainMenuItem);
  }
  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
  }
  public CambiarPuntosMap() {

    if (Display.getWidth() == 320) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(
                  Bitmap.getBitmapResource("background_320.png")));
      tFuente = 17;
      tFuente2 = 20;
      veinticinco = 10;
      veinte = 10;
      trecientoscuarentaysiete = 170;
      setenta = 35;
      hr = Bitmap.getBitmapResource("hr_line_3.png");
      leftHr = 10;
      btnMapa = Bitmap.getBitmapResource("btnMapa_320.png");
      btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png");
      btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png");
      btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png");
    }
    if (Display.getWidth() == 360) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(
                  Bitmap.getBitmapResource("background_360.png")));
      tFuente = 20;
      tFuente2 = 23;
      veinticinco = 10;
      veinte = 10;
      trecientoscuarentaysiete = 403;
      setenta = 35;
      hr = Bitmap.getBitmapResource("hr_line_3.png");
      leftHr = 30;
      btnMapa = Bitmap.getBitmapResource("btnMapa_320.png");
      btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png");
      btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png");
      btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png");
    }
    if (Display.getWidth() == 480) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(
                  Bitmap.getBitmapResource("background_480.png")));
      tFuente = 20;
      tFuente2 = 23;
      veinticinco = 10;
      veinte = 10;
      trecientoscuarentaysiete = 291;
      setenta = 35;
      hr = Bitmap.getBitmapResource("hr_line.png");
      leftHr = 0;
      btnMapa = Bitmap.getBitmapResource("btnMapa_320.png");
      btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png");
      btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png");
      btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png");
    }
    if (Display.getWidth() == 640) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png")));

      tFuente = 35;
      tFuente2 = 40;
    }

    try {

      FontFamily ffFont1 = FontFamily.forName("Arial");
      fLite = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente);
      fTitle = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente2);

      // hr = Bitmap.getBitmapResource("hr_line.png");

      // getMainManager().setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png")));

      VerticalFieldManager logoHfm = new VerticalFieldManager(VerticalFieldManager.FIELD_HCENTER);
      logoHfm.setBackground(
          BackgroundFactory.createLinearGradientBackground(0xe68241, 0xe68241, 0xd16f2f, 0xd16f2f));
      logoHfm.setMargin(0, 0, 0, 0);

      ColorRichText emailCrt =
          new ColorRichText(
              Strings.CHANGECONFIG,
              0xffffff,
              RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER);
      emailCrt.setFont(fTitle);
      emailCrt.setMargin(veinticinco, 0, veinticinco, 0);

      logoHfm.add(emailCrt);

      VerticalField footerLogoHfm =
          new VerticalField(Display.getWidth(), veinte, VerticalFieldManager.FIELD_HCENTER);
      footerLogoHfm.setBackground(
          BackgroundFactory.createLinearGradientBackground(0x9cbe4f, 0x7a9b3c, 0x7a9b3c, 0x9cbe4f));

      ColorRichText introCrt =
          new ColorRichText(
              "Elige tus puntos favoritos",
              0xffffff,
              RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER);
      introCrt.setFont(fTitle);
      introCrt.setMargin(25, 0, 25, 0);
      footerLogoHfm.add(introCrt);

      logoHfm.add(footerLogoHfm);

      add(logoHfm);

      VerticalField allContentFiltro =
          new VerticalField(
              Display.getWidth(),
              trecientoscuarentaysiete,
              HorizontalField.FIELD_HCENTER
                  | VerticalField.VERTICAL_SCROLL
                  | VerticalField.VERTICAL_SCROLLBAR);

      Object[] municipioO = new Object[] {"one", "two", "three"};
      ObjectChoiceField municipioOcf = new FullWidthChoiceField();
      municipioOcf.setChoices(municipioO);
      municipioOcf.setMargin(0, 70, 0, 70);

      VerticalFieldManager municipioVfm =
          new VerticalFieldManager(
              VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER);

      LabelField municipioLf = new LabelField("Municipio", LabelField.FIELD_HCENTER);
      municipioLf.setFont(fLite);
      municipioLf.setMargin(15, 0, 5, 0);

      municipioVfm.add(municipioLf); // |/ DrawStyle.HCENTER));
      municipioVfm.add(municipioOcf);

      hrBf = new BitmapField(hr);
      hrBf.setMargin(20, 0, 0, leftHr);
      municipioVfm.add(hrBf);

      allContentFiltro.add(municipioVfm);

      /**/
      Object[] establecimientoO = new Object[] {"one", "two", "three"};
      ObjectChoiceField establecimientoOcf = new FullWidthChoiceField();
      establecimientoOcf.setChoices(establecimientoO);
      establecimientoOcf.setMargin(0, 70, 0, 70);

      VerticalFieldManager establecimientoVfm =
          new VerticalFieldManager(
              VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER);

      LabelField establecimientoLf = new LabelField("Establecimiento", LabelField.FIELD_HCENTER);
      establecimientoLf.setFont(fLite);
      establecimientoLf.setMargin(15, 0, 5, 0);

      establecimientoVfm.add(establecimientoLf); // |/ DrawStyle.HCENTER));
      establecimientoVfm.add(establecimientoOcf);

      hrBf = new BitmapField(hr);
      hrBf.setMargin(20, 0, 0, leftHr);
      establecimientoVfm.add(hrBf);

      allContentFiltro.add(establecimientoVfm);

      HorizontalFieldManager botonesHfc =
          new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER);
      // botonesHfc.setMargin(0, 50, 0, 0);

      BitmapButtonField btnMapaUser = new BitmapButtonField(btnMapa, btnMapa1, Field.FIELD_HCENTER);
      btnMapaUser.setChangeListener(
          new FieldChangeListener() {
            public void fieldChanged(Field field, int context) {
              UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap());
            }
          });
      btnMapaUser.setMargin(20, 10, 0, 0);

      BitmapButtonField btnAgregarMapaUser =
          new BitmapButtonField(btnAgregarMapa, btnAgregarMapa1, Field.FIELD_HCENTER);
      btnAgregarMapaUser.setChangeListener(
          new FieldChangeListener() {
            public void fieldChanged(Field field, int context) {
              UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap());
            }
          });
      btnAgregarMapaUser.setMargin(20, 10, 0, 0);

      botonesHfc.add(btnMapaUser);
      botonesHfc.add(btnAgregarMapaUser);

      allContentFiltro.add(botonesHfc);

      add(allContentFiltro);

    } catch (Exception e) {
      // TODO: handle exception
      System.out.println(e.getMessage());
      add(new RichTextField(e.getMessage()));
    }
  }
Beispiel #11
0
  public MenuOpciones() {
    VerticalFieldManager vField = new VerticalFieldManager();
    UsuarioDB usuarios = new UsuarioDB();
    usuario = usuarios.getUsuario();
    usuarios = null;
    //		meGlobales.setPerfil(perfil);

    HorizontalFieldManager hField =
        new HorizontalFieldManager() {
          protected void sublayout(int width, int height) {
            super.sublayout(super.getScreen().getWidth(), height);
            super.setExtent(super.getScreen().getWidth(), getField(1).getHeight());
            Field field;

            field = getField(0);
            layoutChild(field, width / 2, height);
            // setPositionChild(field, (width / 4) - ( field.getPreferredWidth() / 2), 0);
            setPositionChild(field, 5, 0);

            field = getField(1);
            layoutChild(field, width, height);
            setPositionChild(field, (width / 2) + (width / 4) - (field.getPreferredWidth() / 2), 0);
          }
        };

    vField.add(new LabelField("", LabelField.FIELD_LEFT));
    vField.add(
        new mkpyLabelField(
            usuario.getNombre(),
            LabelField.ELLIPSIS | LabelField.FIELD_LEFT,
            Color.BLACK,
            Color.WHITE,
            true));
    vField.add(new LabelField(usuario.getZonaRegionPais(), LabelField.FIELD_LEFT));
    vField.add(new LabelField(usuario.getCampanaFormato(), LabelField.FIELD_LEFT));

    hField.add(vField);
    hField.add(
        new BitmapField(
            Bitmap.getBitmapResource("img/logo.png"),
            BitmapField.FIELD_LEFT | BitmapField.FIELD_VCENTER));

    opciones = MetodosGlobales.menuOpcionesxPerfil();
    menu = new ListField(opciones.length, ListField.FIELD_HCENTER);
    menu.setCallback(this);

    add(
        new BitmapField(
            Bitmap.getBitmapResource("img/titulos/menuprincipal.png"), BitmapField.FIELD_HCENTER));
    add(hField);
    add(menu);
    addMenuItem(mnSincronizar);
    addMenuItem(mnAcerca);
    addMenuItem(mnCerrarSesion);

    Sistema.addEstadistica(Cadenas.MENUPRINCIPAL);

    if (usuario != null) {
      // MBL : Timer de sincronización
      long tiempo = usuario.getTiempoDatosConsultora() * 60 * 60000; // mbl: En horas
      // long tiempo = 3*60*1000;
      timer = new Timer();
      timer.schedule(new Sicronizacion(), tiempo, tiempo);
    }
  }
Beispiel #12
0
  public FirstScreen(final Hashtable hashtable, String[] moduleVisible) {

    userName = (String) hashtable.get("stringval1");

    welcomeTitleDisplay();

    add(horizontalWelcomeLabel);

    pUpdatedBy = (String) hashtable.get("stringval37");

    HorizontalFieldManager hfm = new HorizontalFieldManager(FIELD_HCENTER);

    VerticalFieldManager vfm1 = new VerticalFieldManager(FIELD_HCENTER);
    VerticalFieldManager vfm2 = new VerticalFieldManager(FIELD_HCENTER);

    vfm1.setMargin(30, 50, 10, 30);
    vfm2.setMargin(30, 30, 10, 50);

    btnCar =
        new BitmapButtonField(carUnclick, carClick, FIELD_HCENTER) {
          protected boolean navigationClick(int status, int time) {
            Controller.showScreen(new StartupScreen(hashtable, 0));
            return true;
          }
        };
    // btnCar.setMargin(30, 0, 0, 30);

    LabelField l2 = new LabelField("iMotor", FIELD_HCENTER);
    // l2.setMargin(10, 0, 0, 0);
    l2.setFont(Constants.fontBold6);

    btnAeroplane =
        new BitmapButtonField(travelUnclick, travelClick, FIELD_HCENTER) {
          protected boolean navigationClick(int status, int time) {
            Controller.showScreen(new StartupScreen(hashtable, 1));
            return true;
          }
        };
    // btnAeroplane.setMargin(30, 0, 0, 30);

    LabelField l3 = new LabelField("iTravel", FIELD_HCENTER);
    // l3.setMargin(10, 0, 0, 0);
    l3.setFont(Constants.fontBold6);

    vfm1.add(btnCar);
    vfm1.add(l2);
    vfm2.add(btnAeroplane);
    vfm2.add(l3);

    for (int i = 0; i < moduleVisible.length; i++) {
      if (moduleVisible[i].equals("11")) {
        Constants.iMotorModuleVisible = true;
      } else if (moduleVisible[i].equals("12")) {
        Constants.iTravelModuleVisible = true;
      }
    }

    if (Constants.iMotorModuleVisible == true) {
      hfm.add(vfm1);
    }
    if (Constants.iTravelModuleVisible) {
      hfm.add(vfm2);
    }
    add(hfm);
  }
  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();
  }
 protected void sublayout(int width, int height) {
   super.sublayout(width, height);
   if (useall) setExtent();
 }