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();
          }
        });
  }
예제 #2
0
  public LabelField FocusableFormatLabel(
      Manager parent, net.rim.device.api.ui.Font font, final int color, String content) {
    content = content.trim();

    LabelField l_Label =
        new LabelField(content, Field.FOCUSABLE) {
          public void paint(Graphics g) {
            g.setColor(color);
            super.paint(g);
          }
        };
    l_Label.setMargin(1, 1, 1, 1);
    l_Label.setPadding(0, 0, 0, 0);
    l_Label.setFont(font);
    parent.add(l_Label);
    return l_Label;
  }
예제 #3
0
 /**
  * Create a LabelField that spans the entire width of the container with gray text and a single
  * pixel gray border at the bottom.
  *
  * @param title
  * @return
  */
 public static LabelField createGroupLabel(String title) {
   LabelField titleField =
       new LabelField(title, LabelField.USE_ALL_WIDTH) {
         protected void paint(Graphics graphics) {
           graphics.setColor(COLOR_GROUP_LABEL_FOREGROUND);
           super.paint(graphics);
         }
       };
   Font font = titleField.getFont();
   titleField.setFont(font.derive(Font.BOLD, font.getHeight() - 3));
   titleField.setPadding(new XYEdges(0, 0, 4, 0));
   titleField.setBorder(
       BorderFactory.createSimpleBorder(
           new XYEdges(0, 0, 1, 0),
           new XYEdges(0, 0, COLOR_GROUP_LABEL_BORDER, 0),
           Border.STYLE_SOLID));
   titleField.setMargin(new XYEdges(0, 0, 4, 0));
   return titleField;
 }
예제 #4
0
  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);
  }
예제 #5
0
  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()));
    }
  }