protected void execute(final Form f) {
    f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    f.setScrollable(false);
    list = new List(RENDERED_CONTENT);
    list.setFixedSelection(List.FIXED_NONE_CYCLIC);
    list.setSmoothScrolling(true);
    list.getStyle().setBgTransparency(0);
    renderers = new ListCellRenderer[RENDERED_CONTENT.length];
    renderers[0] = new AlternateImageRenderer();
    renderers[1] = new WidgetRenderer();
    renderers[2] = new AlternateColorRenderer();
    renderers[3] = new DefaultListCellRenderer();
    renderers[4] = new FishEyeRenderer();
    list.setListCellRenderer(renderers[0]);
    list.addActionListener(this);

    Label l = new Label("Press \"Select\" to update:");
    l.getStyle().setBgTransparency(100);
    f.addComponent(l);
    f.addComponent(list);
    l = new Label("Try Applying Renderer To Menu");
    l.getStyle().setBgTransparency(100);
    f.addComponent(l);
    f.addCommand(
        new Command("Set To Menu") {

          public void actionPerformed(ActionEvent ev) {
            f.setMenuCellRenderer(list.getRenderer());
          }
        });
  }
 // Daniel
 public static Label imovelInformativo() {
   lbInformativo = new Label();
   ;
   if (!isImovelInformativo) {
     lbInformativo.setText("             IMÓVEL INFORMATIVO");
   } else {
     lbInformativo.setText("");
   }
   lbInformativo.getStyle().setFgColor(0xff0000);
   lbInformativo.setVisible(true);
   lbInformativo.getStyle().setFont(font);
   return lbInformativo;
 }
  public MediaItemsListCellRenderer() {
    super();
    NedMidlet.getInstance().getDownloadManager().setMediaListUpdater(this);
    if (com.sun.lwuit.Display.getInstance().isTouchScreenDevice()) {
      getStyle().setPadding(10, 10, 2, 2);
      getSelectedStyle().setPadding(10, 10, 2, 2);
    }
    if (getPreferredH() < ICON_FIT_SIZE) {
      setPreferredH(ICON_FIT_SIZE);
    }
    displayW = Display.getInstance().getDisplayWidth();

    setLayout(new BoxLayout(BoxLayout.X_AXIS));
    setWidth(displayW);
    setFocusable(true);
    mMediaType = new Label(" "); // must set some text to render properly
    mMediaType.getStyle().setPadding(0, 0, 0, 0);
    mMediaType.getStyle().setMargin(0, 0, 0, 0);
    mMediaType.getSelectedStyle().setPadding(0, 0, 0, 0);
    mMediaType.getSelectedStyle().setMargin(0, 0, 0, 0);
    mMediaType.setAlignment(Label.LEFT);
    mMediaType.getStyle().setBgTransparency(0);
    mMediaType.setPreferredW(ICON_WIDTH);
    mMediaType.setCellRenderer(true);

    mTitle.setPreferredW(displayW - 3 * ICON_WIDTH);
    removeComponent(mTitle);

    mFlag = new Label();
    mFlag.getStyle().setPadding(0, 0, 0, 0);
    mFlag.getStyle().setMargin(0, 0, 0, 0);
    mFlag.getSelectedStyle().setPadding(0, 0, 0, 0);
    mFlag.getSelectedStyle().setMargin(0, 0, 0, 0);
    mFlag.setAlignment(Label.RIGHT);
    mFlag.getStyle().setBgTransparency(0);
    mFlag.setPreferredW(ICON_WIDTH);
    mFlag.setCellRenderer(true);

    addComponent(mMediaType);
    addComponent(mTitle);
    addComponent(mFlag);

    local = NedResources.getRes().getImage("Local");
    remote = NedResources.getRes().getImage("Remote");
  }
Exemple #4
0
  public Form getForm() {

    if (loginForm != null) {
      titleLbl.setText("Login:"******"NoiseTube Account");
    loginPanel = new Container();
    loginPanel.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    titleLbl = new Label(" ");

    usernameLbl = new Label();
    usernameTxt = new TextField();
    usernameLbl.setText("Username:"******"Password:"******"Skip");
    loginCmd = new Command("Login");

    // buttonPanel = new Container();
    // buttonPanel.addComponent(loginBtn);
    // buttonPanel.getStyle().setMargin(2, 2, 2, 2);

    titleLbl.setText("Login:"******"Connexion error");
                titleLbl.setText("Connexion error");
              } catch (RecordStoreException e1) {
                titleLbl.setText("Error saving APIkey");
                log.error(e1, "Error saving APIkey");
              }
            } else if (skipCmd.equals(arg0.getCommand())) {
              MainMidlet.getInstance()
                  .getPreferences()
                  .setSavingMode(
                      Device.supportsSavingToFile() ? Preferences.SAVE_FILE : Preferences.SAVE_NO);
              midlet.showMeasureForm();
            } else midlet.notifyDestroyed();
          }
        });
    return loginForm;
  }
    public Component getListCellRendererComponent(
        List list, Object value, int index, boolean isSelected) {

      PrivacyModel cell = (PrivacyModel) value;

      setLayout(new BorderLayout());

      Label name = new Label();
      name.getStyle().setPadding(Component.LEFT, 5, true);
      name.setText(cell.getTitle());
      name.getStyle().setFont(Fonts.MEDIUM, true);
      name.getStyle().setFgColor(ColorCodes.settingsScreenListItemHeadingGrey, true);
      name.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
      name.getStyle().setBgTransparency(0, true);

      TextArea description = new TextArea();
      description.setText(cell.getSubTitle());
      description.getStyle().setFgColor(ColorCodes.settingsScreenListItemDescGrey);
      description.getSelectedStyle().setFgColor(ColorCodes.settingsScreenListItemDescGrey);
      description.getStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
      description.getSelectedStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
      description.setEditable(false);
      description.setRows(2);
      description.setPreferredW(com.sun.lwuit.Display.getInstance().getDisplayWidth() - 20);
      description.getSelectedStyle().setBgTransparency(255, true);
      description.getStyle().setBgTransparency(255, true);
      description.getStyle().setBorder(Border.createEmpty(), true);
      description.getSelectedStyle().setBorder(Border.createEmpty(), true);
      description.getStyle().setPadding(Component.LEFT, 5, true);
      description.getSelectedStyle().setPadding(Component.LEFT, 5, true);
      description.getStyle().setPadding(Component.TOP, 0, true);
      description.getSelectedStyle().setPadding(Component.TOP, 0, true);
      description.getStyle().setPadding(Component.BOTTOM, 0, true);
      description.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
      description.getSelectedStyle().setFont(Fonts.SMALL, true);
      description.getStyle().setFont(Fonts.SMALL, true);

      Container nameDescContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
      nameDescContainer.getStyle().setPadding(Component.RIGHT, 0, true);
      nameDescContainer.getSelectedStyle().setPadding(Component.RIGHT, 0, true);
      nameDescContainer.getStyle().setBorder(Border.createEmpty(), true);
      nameDescContainer.getSelectedStyle().setBorder(Border.createEmpty(), true);
      nameDescContainer.addComponent(name);
      nameDescContainer.addComponent(description);

      arrowIconLabel = new Label();
      arrowIconLabel.setIcon(arrowIconImage);
      arrowIconLabel.getStyle().setAlignment(Component.CENTER);
      arrowIconLabel.getStyle().setBgTransparency(0, true);
      arrowIconLabel.getSelectedStyle().setBgTransparency(0, true);
      arrowIconLabel.getPressedStyle().setBgTransparency(0, true);
      arrowIconLabel.getPressedStyle().setBorder(null, true);
      arrowIconLabel.getStyle().setBorder(null, true);
      arrowIconLabel.getSelectedStyle().setBorder(null, true);
      arrowIconLabel.getStyle().setAlignment(CENTER);
      arrowIconLabel.getStyle().setPadding(Component.RIGHT, 10, true);

      mainContainer = new Container(new BorderLayout());
      mainContainer.setPreferredH(80);
      mainContainer.getStyle().setPadding(Component.TOP, 2, true);
      mainContainer
          .getStyle()
          .setBorder(
              Border.createCompoundBorder(
                  null,
                  Border.createEtchedRaised(
                      ColorCodes.settingsScreenSeperatorGrey,
                      ColorCodes.settingsScreenSeperatorShadow),
                  null,
                  null),
              true);
      mainContainer.addComponent(BorderLayout.WEST, nameDescContainer);
      mainContainer.addComponent(BorderLayout.EAST, arrowIconLabel);

      return mainContainer;
    }
Exemple #6
0
  protected void executeView(final Container f) {
    reportId = "";
    f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    Image helpIcon = HILMain.getInstance().res.getImage("GeneralReportData_sel.png");

    final Label title = new Label(getName());
    title.getStyle().setFont(HILMain.getInstance().theme.getFont("titleFont"));
    title.setIcon(helpIcon);
    title.setAlignment(Label.LEFT);
    title.setHeight(14);
    title.setWidth(240);
    title.getStyle().setBgColor(0x7799bb);
    title.getStyle().setFgColor(0xFFFFFF);
    title.getStyle().setPadding(5, 5, 15, 0);
    title.getStyle().setBgTransparency(250);

    setTitle(title, f);
    f.setScrollable(true);
    FocusListener textFocus =
        new FocusListener() {
          public void focusGained(Component arg0) {
            arg0.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
            arg0.getStyle().setBorder(Border.createEmpty());
          }

          public void focusLost(Component arg0) {}
        };

    TextArea shortHelpLabel = new TextArea(2, 10);
    shortHelpLabel.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    shortHelpLabel.getStyle().setBorder(Border.createEmpty(), true);
    shortHelpLabel.getStyle().setBgTransparency(0);
    shortHelpLabel.getStyle().setFgColor(0x000000);
    shortHelpLabel.setFocus(false);
    shortHelpLabel.setFocusable(false);
    shortHelpLabel.setText(
        (String) HILMain.getInstance().locale.get("short_help_general_report_data"));
    f.addComponent(shortHelpLabel);

    date = new Date();
    final Button dateLabel = new Button();
    dateLabel.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    dateLabel.getStyle().setBorder(Border.createEmpty());
    dateLabel.getStyle().setBgColor(0xCECECE);
    dateLabel.getStyle().setFgColor(0x81746B);
    dateLabel.setTextPosition(Label.LEFT);
    dateLabel.setText("");
    dateLabel.getSelectedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    dateLabel.getSelectedStyle().setBorder(Border.createEmpty());
    dateLabel.getSelectedStyle().setBgColor(0xCECECE);
    dateLabel.getSelectedStyle().setFgColor(0x81746B);
    dateLabel.getSelectedStyle().setBgTransparency(100);
    dateLabel.getPressedStyle().setBorder(Border.createEmpty());
    dateLabel.getPressedStyle().setBgColor(0xCECECE);
    dateLabel.getPressedStyle().setFgColor(0x81746B);
    dateLabel.getPressedStyle().setBgTransparency(100);
    dateLabel.setText(DateUtil.getMonthYear(date, "/"));
    f.addComponent(createPair((String) HILMain.getInstance().locale.get("time"), dateLabel, 54));

    Container buttonContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));
    buttonContainer.setWidth(Display.getInstance().getDisplayWidth());
    Button submit = new Button();
    submit.setText((String) HILMain.getInstance().locale.get("get_data"));
    submit.getStyle().setBgTransparency(255);
    submit.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    submit.getStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    submit.getStyle().setBgColor(0xFAAC58, true);
    submit.getStyle().setAlignment(Label.CENTER);
    submit.getStyle().setFgColor(0xFFFFFF);
    submit.getSelectedStyle().setBgTransparency(255);
    submit.getSelectedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    submit.getSelectedStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    submit.getSelectedStyle().setBgColor(0xFAAC58);
    submit.getSelectedStyle().setAlignment(Label.CENTER);
    submit.getSelectedStyle().setFgColor(0x000000);
    submit.getPressedStyle().setBgTransparency(255);
    submit.getPressedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    submit.getPressedStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    submit.getPressedStyle().setBgColor(0xFAAC58);
    submit.getPressedStyle().setAlignment(Label.CENTER);
    submit.getPressedStyle().setFgColor(0x000000);

    final Button buttonEdit = new Button();
    buttonEdit.setText((String) HILMain.getInstance().locale.get("edit"));
    buttonEdit.getStyle().setBgTransparency(255);
    buttonEdit.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonEdit.getStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonEdit.getStyle().setBgColor(0xFAAC58, true);
    buttonEdit.getStyle().setAlignment(Label.CENTER);
    buttonEdit.getStyle().setFgColor(0xFFFFFF);
    buttonEdit.getDisabledStyle().setBgTransparency(255);
    buttonEdit.getDisabledStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonEdit.getDisabledStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonEdit.getDisabledStyle().setBgColor(0xBDBDBD);
    buttonEdit.getDisabledStyle().setAlignment(Label.CENTER);
    buttonEdit.getDisabledStyle().setFgColor(0xFFFFFF);
    buttonEdit.getSelectedStyle().setBgTransparency(255);
    buttonEdit.getSelectedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonEdit.getSelectedStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonEdit.getSelectedStyle().setBgColor(0xFAAC58);
    buttonEdit.getSelectedStyle().setAlignment(Label.CENTER);
    buttonEdit.getSelectedStyle().setFgColor(0x000000);
    buttonEdit.getPressedStyle().setBgTransparency(255);
    buttonEdit.getPressedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonEdit.getPressedStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonEdit.getPressedStyle().setBgColor(0xFAAC58);
    buttonEdit.getPressedStyle().setAlignment(Label.CENTER);
    buttonEdit.getPressedStyle().setFgColor(0x000000);
    buttonEdit.setEnabled(false);
    buttonContainer.addComponent(submit);
    buttonContainer.addComponent(buttonEdit);
    f.addComponent(buttonContainer);

    Label normalLabel = new Label((String) HILMain.getInstance().locale.get("normal_reaction"));
    normalLabel.getStyle().setBgTransparency(250);
    normalLabel.setWidth(240);
    normalLabel.getStyle().setBgColor(0xBFD6FF);
    f.addComponent(normalLabel);

    final TextField normalReaction = new TextField(10);
    normalReaction.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    normalReaction.setText("");
    normalReaction.getStyle().setBorder(Border.createEmpty(), true);
    normalReaction.addFocusListener(textFocus);
    normalReaction.getStyle().setBgColor(0xCECECE);
    normalReaction.getStyle().setBgTransparency(150);
    normalReaction.getStyle().setFgColor(0x81746B);
    normalReaction.getSelectedStyle().setBgColor(0xCECECE);
    normalReaction.getSelectedStyle().setBgTransparency(100);
    normalReaction.getSelectedStyle().setFgColor(0x81746B);
    normalReaction.setConstraint(TextField.NUMERIC);
    normalReaction.setInputModeOrder(new String[] {"123"});
    normalReaction.setEditable(false);
    f.addComponent(normalReaction);

    Label seriousLabel = new Label((String) HILMain.getInstance().locale.get("serious_reaction"));
    seriousLabel.getStyle().setBgTransparency(250);
    seriousLabel.setWidth(240);
    seriousLabel.getStyle().setBgColor(0xBFD6FF);
    f.addComponent(seriousLabel);

    final TextField seriousReaction = new TextField(10);
    seriousReaction.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    seriousReaction.setText("");
    seriousReaction.getStyle().setBorder(Border.createEmpty(), true);
    seriousReaction.addFocusListener(textFocus);
    seriousReaction.getStyle().setBgColor(0xCECECE);
    seriousReaction.getStyle().setBgTransparency(150);
    seriousReaction.getStyle().setFgColor(0x81746B);
    seriousReaction.getSelectedStyle().setBgColor(0xCECECE);
    seriousReaction.getSelectedStyle().setBgTransparency(100);
    seriousReaction.getSelectedStyle().setFgColor(0x81746B);
    seriousReaction.setConstraint(TextField.NUMERIC);
    seriousReaction.setInputModeOrder(new String[] {"123"});
    seriousReaction.setEditable(false);
    f.addComponent(seriousReaction);

    Label tetanusLabel = new Label((String) HILMain.getInstance().locale.get("tetanus_protection"));
    tetanusLabel.getStyle().setBgTransparency(250);
    tetanusLabel.setWidth(240);
    tetanusLabel.getStyle().setBgColor(0xBFD6FF);
    f.addComponent(tetanusLabel);

    final TextField tetanus = new TextField(10);
    tetanus.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    tetanus.setText("");
    tetanus.getStyle().setBorder(Border.createEmpty(), true);
    tetanus.addFocusListener(textFocus);
    tetanus.getStyle().setBgColor(0xCECECE);
    tetanus.getStyle().setBgTransparency(150);
    tetanus.getStyle().setFgColor(0x81746B);
    tetanus.getSelectedStyle().setBgColor(0xCECECE);
    tetanus.getSelectedStyle().setBgTransparency(100);
    tetanus.getSelectedStyle().setFgColor(0x81746B);
    tetanus.setConstraint(TextField.NUMERIC);
    tetanus.setInputModeOrder(new String[] {"123"});
    tetanus.setEditable(false);
    f.addComponent(tetanus);

    final Button buttonSave = new Button();
    buttonSave.setText((String) HILMain.getInstance().locale.get("save"));

    buttonSave.getStyle().setBgTransparency(255);
    buttonSave.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonSave.getStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonSave.getStyle().setBgColor(0xFAAC58, true);
    buttonSave.getStyle().setAlignment(Label.CENTER);
    buttonSave.getStyle().setFgColor(0xFFFFFF);
    buttonSave.setWidth(100);
    buttonSave.getDisabledStyle().setBgTransparency(255);
    buttonSave.getDisabledStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonSave.getDisabledStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonSave.getDisabledStyle().setBgColor(0xBDBDBD);
    buttonSave.getDisabledStyle().setAlignment(Label.CENTER);
    buttonSave.getDisabledStyle().setFgColor(0xFFFFFF);
    buttonSave.getSelectedStyle().setBgTransparency(255);
    buttonSave.getSelectedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonSave.getSelectedStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonSave.getSelectedStyle().setBgColor(0xFAAC58);
    buttonSave.getSelectedStyle().setAlignment(Label.CENTER);
    buttonSave.getSelectedStyle().setFgColor(0x000000);
    buttonSave.getPressedStyle().setBgTransparency(255);
    buttonSave.getPressedStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
    buttonSave.getPressedStyle().setBorder(Border.createRoundBorder(0, 0, 0xcadaf1));
    buttonSave.getPressedStyle().setBgColor(0xFAAC58);
    buttonSave.getPressedStyle().setAlignment(Label.CENTER);
    buttonSave.getPressedStyle().setFgColor(0x000000);
    buttonSave.setEnabled(false);
    f.addComponent(buttonSave);

    buttonEdit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            normalReaction.setEditable(true);
            seriousReaction.setEditable(true);
            tetanus.setEditable(true);
            buttonSave.setEnabled(true);
          }
        });

    buttonSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            if (normalReaction.getText().trim().length() == 0
                && seriousReaction.getText().trim().length() == 0
                && tetanus.getText().trim().length() == 0) return;

            ConnectionRequest req =
                new ConnectionRequest() {
                  protected void readResponse(InputStream input) throws IOException {
                    JSONParser p = new JSONParser();

                    Hashtable result = p.parse(new InputStreamReader(input, "UTF-8"));
                    result = (Hashtable) result.get("ResultSet");

                    int total = ((Double) result.get("totalResultsReturned")).intValue();

                    if (total == 0) {
                      Dialog.show(
                          (String) HILMain.getInstance().locale.get("notice"),
                          (String) HILMain.getInstance().locale.get("upload_unsuccessful"),
                          (String) HILMain.getInstance().locale.get("ok"),
                          null);
                    } else {
                      Vector entries = (Vector) result.get("Result");
                      for (int iter = 0; iter < entries.size(); iter++) {
                        result = (Hashtable) entries.elementAt(iter);
                        reportId = (String) result.get("reportId");
                        normalReaction.setText((String) result.get("normal"));
                        seriousReaction.setText((String) result.get("serious"));
                        tetanus.setText((String) result.get("tetanus"));
                        normalReaction.setEditable(false);
                        seriousReaction.setEditable(false);
                        tetanus.setEditable(false);
                        buttonSave.setEnabled(false);
                      }
                      if (Dialog.show(
                          (String) HILMain.getInstance().locale.get("notice"),
                          (String) HILMain.getInstance().locale.get("upload_successful"),
                          (String) HILMain.getInstance().locale.get("ok"),
                          null)) {
                        buttonSave.setEnabled(false);
                        HILMain.getInstance().showMainMenu();
                      }
                    }
                  }
                };
            req.setPost(true);
            req.setUrl(HILMain.getInstance().SERVER_ADDRESS + "saveGeneralReportData");

            req.setContentType("text/plain");

            req.addArgumentNoEncoding(
                "sessionAuth", HILMain.getInstance().currentUser.getSessionAuth());
            req.addArgumentNoEncoding(
                "username", HILMain.getInstance().currentUser.getAccountName());
            req.addArgumentNoEncoding("password", HILMain.getInstance().currentUser.getPassword());
            req.addArgumentNoEncoding("reportId", reportId);
            req.addArgumentNoEncoding("cId", HILMain.getInstance().currentUser.getcId());
            req.addArgumentNoEncoding("timeData", DateUtil.getMonthYear(date, "/"));
            req.addArgumentNoEncoding("normal", normalReaction.getText().trim());
            req.addArgumentNoEncoding("serious", seriousReaction.getText().trim());
            req.addArgumentNoEncoding("tatanus", tetanus.getText().trim());

            NetworkManager.getInstance().addToQueue(req);
          }
        });

    dateLabel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            TextArea noteLabel = new TextArea(2, 10);
            noteLabel.getStyle().setFont(HILMain.getInstance().theme.getFont("defaultFont"));
            noteLabel.getStyle().setBorder(Border.createEmpty(), true);
            noteLabel.getStyle().setBgTransparency(0);
            noteLabel.getStyle().setFgColor(0x000000);
            noteLabel.setFocus(false);
            noteLabel.setFocusable(false);
            noteLabel.setText((String) HILMain.getInstance().locale.get("help_select_date"));

            Form calendarForm = new Form();
            calendarForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
            final Calendar aCalendar = new Calendar();

            Command okCommand =
                new Command((String) HILMain.getInstance().locale.get("ok")) {
                  public void actionPerformed(ActionEvent evt) {
                    showForm(f);
                  }
                };

            aCalendar.addActionListener(
                new ActionListener() {
                  public void actionPerformed(ActionEvent evt) {
                    date = aCalendar.getDate();
                    if (!DateUtil.getMonthYear(date, "/").equalsIgnoreCase(dateLabel.getText())) {
                      dateLabel.setText(DateUtil.getMonthYear(date, "/"));
                      reportId = "";
                      normalReaction.setText("");
                      seriousReaction.setText("");
                      tetanus.setText("");
                      normalReaction.setEditable(true);
                      seriousReaction.setEditable(true);
                      tetanus.setEditable(true);
                      buttonEdit.setEnabled(false);
                      buttonSave.setEnabled(false);
                    }
                  }
                });
            calendarForm.addComponent(noteLabel);
            Container tContainer = new Container();
            tContainer.setLayout(new BorderLayout());
            tContainer.addComponent(BorderLayout.CENTER, aCalendar);
            calendarForm.addComponent(tContainer);
            calendarForm.addCommand(okCommand);
            calendarForm.show();
          }
        });

    submit.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent ae) {
            ConnectionRequest req =
                new ConnectionRequest() {
                  protected void readResponse(InputStream input) throws IOException {
                    JSONParser p = new JSONParser();

                    Hashtable result = p.parse(new InputStreamReader(input, "UTF-8"));
                    result = (Hashtable) result.get("ResultSet");

                    int total = ((Double) result.get("totalResultsReturned")).intValue();

                    if (total == 0) {
                      Dialog.show(
                          (String) HILMain.getInstance().locale.get("notice"),
                          (String) HILMain.getInstance().locale.get("there_is_no_data"),
                          (String) HILMain.getInstance().locale.get("ok"),
                          null);
                      reportId = "";
                      normalReaction.setText("");
                      normalReaction.setEditable(true);
                      seriousReaction.setText("");
                      seriousReaction.setEditable(true);
                      tetanus.setText("");
                      tetanus.setEditable(true);
                      normalReaction.setEditable(true);
                      seriousReaction.setEditable(true);
                      tetanus.setEditable(true);
                      buttonEdit.setEnabled(false);
                      buttonSave.setEnabled(true);
                    } else {
                      Vector entries = (Vector) result.get("Result");
                      for (int iter = 0; iter < entries.size(); iter++) {
                        result = (Hashtable) entries.elementAt(iter);
                        reportId = (String) result.get("reportId");
                        normalReaction.setText((String) result.get("normal"));
                        normalReaction.setEditable(false);
                        seriousReaction.setText((String) result.get("serious"));
                        seriousReaction.setEditable(false);
                        tetanus.setText((String) result.get("tetanus"));
                        tetanus.setEditable(false);
                        normalReaction.setEditable(false);
                        seriousReaction.setEditable(false);
                        tetanus.setEditable(false);
                        buttonEdit.setEnabled(true);
                        buttonSave.setEnabled(false);
                      }
                      if (normalReaction.getText().length() == 0
                          && seriousReaction.getText().length() == 0
                          && tetanus.getText().length() == 0) {
                        Dialog.show(
                            (String) HILMain.getInstance().locale.get("notice"),
                            (String) HILMain.getInstance().locale.get("there_is_no_data"),
                            (String) HILMain.getInstance().locale.get("ok"),
                            null);
                        normalReaction.setEditable(true);
                        seriousReaction.setEditable(true);
                        tetanus.setEditable(true);
                        buttonEdit.setEnabled(false);
                        buttonSave.setEnabled(true);
                      }
                    }
                  }
                };
            req.setPost(true);
            req.setUrl(HILMain.getInstance().SERVER_ADDRESS + "generalReportData");

            req.setContentType("text/plain");
            req.addArgumentNoEncoding(
                "sessionAuth", HILMain.getInstance().currentUser.getSessionAuth());
            req.addArgumentNoEncoding(
                "username", HILMain.getInstance().currentUser.getAccountName());
            req.addArgumentNoEncoding("password", HILMain.getInstance().currentUser.getPassword());
            req.addArgumentNoEncoding("cId", HILMain.getInstance().currentUser.getcId());
            req.addArgumentNoEncoding("timeData", DateUtil.getMonthYear(date, "/"));
            NetworkManager.getInstance().addToQueue(req);
          }
        });
  }
    public Component getListCellRendererComponent(
        List list, Object value, int index, boolean isSelected) {
      if (value != null) {
        addressEntry = (AddressBookEntry) value;

        Log.v(TAG, "AddressBookEntry: " + addressEntry);

        Log.v(TAG, "Index is:" + index);
        onFocusLbl.getStyle().setBgTransparency(20, true);

        Container namephnumContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        namephnumContainer.getStyle().setPadding(Component.LEFT, 3, true);
        namephnumContainer.getStyle().setPadding(Component.TOP, 5, true);
        namephnumContainer.getStyle().setPadding(Component.BOTTOM, 8, true);

        Label contactName = new Label(addressEntry.getName());
        contactName.getStyle().setBgTransparency(0, true);
        contactName.getStyle().setFgColor(ColorCodes.selectContactNameGrey, true);
        contactName.getStyle().setPadding(Component.BOTTOM, 0, true);

        contactName.getSelectedStyle().setFont(Fonts.MONO_MEDIUM, true);
        contactName.getStyle().setFont(Fonts.MONO_MEDIUM, true);
        contactName.getSelectedStyle().setBorder(null, true);
        contactName.setPreferredSize(
            new Dimension(
                (Display.getInstance().getDisplayWidth() - inviteImage.getWidth() - 25), 30));

        Label phoneNum = new Label(addressEntry.getMsisdn());
        phoneNum.getStyle().setBgTransparency(0, true);
        phoneNum.getStyle().setPadding(Component.TOP, 0, true);
        phoneNum.getSelectedStyle().setBorder(null, true);
        phoneNum.getSelectedStyle().setFont(Fonts.MONO_SMALL, true);
        phoneNum.getStyle().setFont(Fonts.MONO_SMALL, true);
        phoneNum.getStyle().setFgColor(ColorCodes.selectContactNumberGrey);

        namephnumContainer.addComponent(contactName);
        namephnumContainer.addComponent(phoneNum);

        inviteButton = new Button(inviteImage);
        inviteButton.getStyle().setBgTransparency(0, true);
        inviteButton.getSelectedStyle().setBgTransparency(0, true);
        inviteButton.getPressedStyle().setBgTransparency(0, true);
        inviteButton.getPressedStyle().setBorder(null, true);
        inviteButton.getStyle().setBorder(null, true);
        inviteButton.getSelectedStyle().setBorder(null, true);
        inviteButton.getStyle().setAlignment(CENTER);

        tickMark = new Label(sentInviteImage);
        tickMark.getStyle().setAlignment(Component.CENTER);
        tickMark.getStyle().setBgTransparency(0, true);
        tickMark.getSelectedStyle().setBgTransparency(0, true);
        tickMark.getPressedStyle().setBgTransparency(0, true);
        tickMark.getPressedStyle().setBorder(null, true);
        tickMark.getStyle().setBorder(null, true);
        tickMark.getSelectedStyle().setBorder(null, true);
        tickMark.getStyle().setAlignment(CENTER);
        tickMark.getStyle().setPadding(Component.RIGHT, 30, true);

        mainContainer = new Container(new BorderLayout());
        mainContainer
            .getStyle()
            .setBorder(
                Border.createCompoundBorder(
                    null,
                    Border.createEtchedRaised(
                        ColorCodes.selectContactSeperator, ColorCodes.selectContactSeperatorShadow),
                    null,
                    null),
                true);

        mainContainer.addComponent(BorderLayout.WEST, namephnumContainer);
        if (inviteButton.getParent() == null) {
          mainContainer.addComponent(BorderLayout.EAST, inviteButton);
        }

        getStyle().setPadding(Component.RIGHT, 0, true);
        getUnselectedStyle().setPadding(Component.RIGHT, 0, true);
        getPressedStyle().setPadding(Component.RIGHT, 0, true);
        getSelectedStyle().setPadding(Component.RIGHT, 0, true);

        if (addressEntry.isInvited()) {
          mainContainer.removeComponent(inviteButton);
          mainContainer.addComponent(BorderLayout.EAST, tickMark);
        }
      }

      return mainContainer;
    }
  public static AbaImoveis getInstancia() {
    if (AbaImoveis.instanciaAbaImoveis == null) {
      instanciaAbaImoveis = new AbaImoveis(new BoxLayout(BoxLayout.Y_AXIS));

      font = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_SMALL);

      lbNomeEndereco = new Label("Endereço:");
      lbNomeEndereco.getStyle().setFont(font);
      lbNomeEndereco.getStyle().setPadding(0, 0, 3, 0);
      lbNomeEndereco.getStyle().setMargin(0, 0, 3, 0);

      lbEndereco = new Label();
      lbEndereco.setFocusable(true);
      lbEndereco.getStyle().setPadding(0, 0, 3, 0);
      lbEndereco.getStyle().setMargin(0, 0, 3, 0);

      nomeMatricula = new Label("Matrícula:");

      nomeMatricula.getStyle().setPadding(1, 0, 1, 0);
      nomeMatricula.getStyle().setMargin(1, 0, 1, 0);
      nomeMatricula.getStyle().setFont(font);

      matricula = new Label();
      matricula.getStyle().setPadding(0, 3, 1, 0);
      matricula.getStyle().setMargin(0, 3, 1, 0);
      matricula.setFocusable(true);

      nomeInscricao = new Label("Inscrição:");
      nomeInscricao.getStyle().setFont(font);
      nomeInscricao.getStyle().setPadding(1, 0, 1, 0);
      nomeInscricao.getStyle().setMargin(1, 0, 1, 0);

      inscricao = new Label();
      inscricao.getStyle().setPadding(0, 3, 1, 0);
      inscricao.getStyle().setMargin(0, 3, 1, 0);
      inscricao.setFocusable(true);

      nomeLocal = new Label();
      nomeLocal.setText("Endereço de Entrega:");
      nomeLocal.getStyle().setPadding(1, 0, 1, 0);
      nomeLocal.getStyle().setMargin(1, 0, 1, 0);
      nomeLocal.getStyle().setFont(font);

      local = new Label();
      local.getStyle().setPadding(0, 3, 1, 0);
      local.getStyle().setMargin(0, 3, 1, 0);
      local.setFocusable(true);

      nomeRota = new Label("Seq. Rota:");
      nomeRota.getStyle().setPadding(1, 0, 1, 0);
      nomeRota.getStyle().setMargin(1, 0, 1, 0);
      nomeRota.getStyle().setFont(font);

      rota = new Label();
      rota.getStyle().setPadding(0, 3, 1, 0);
      rota.getStyle().setMargin(0, 3, 1, 0);
      rota.setFocusable(true);

      nomeLigAgua = new Label("Sit. Lig. Água:");
      nomeLigAgua.getStyle().setPadding(1, 0, 1, 0);
      nomeLigAgua.getStyle().setMargin(1, 0, 1, 0);
      nomeLigAgua.getStyle().setFont(font);

      ligAgua = new Label();
      ligAgua.getStyle().setPadding(0, 3, 1, 0);
      ligAgua.getStyle().setMargin(0, 3, 1, 0);
      ligAgua.setFocusable(true);

      // Daniel
      lbInformativo = new Label();
      lbInformativo.getStyle().setFgColor(0xff0000);
      lbInformativo.setVisible(true);
      lbInformativo.getStyle().setFont(font);

      nomeLigEsgoto = new Label("Sit. Lig. Esgoto:");
      nomeLigEsgoto.getStyle().setPadding(1, 0, 1, 0);
      nomeLigEsgoto.getStyle().setMargin(1, 0, 1, 0);
      nomeLigEsgoto.getStyle().setFont(font);

      ligEsgoto = new Label();
      ligEsgoto.getStyle().setPadding(0, 3, 1, 0);
      ligEsgoto.getStyle().setMargin(0, 3, 1, 0);
      ligEsgoto.setFocusable(true);

      nomeCliente = new Label("Nome Usuário: ");
      nomeCliente.getStyle().setPadding(1, 0, 1, 0);
      nomeCliente.getStyle().setMargin(1, 0, 1, 0);
      nomeCliente.getStyle().setFont(font);

      cliente = new Label();
      cliente.getStyle().setPadding(0, 3, 1, 0);
      cliente.getStyle().setMargin(0, 3, 1, 0);
      cliente.setFocusable(true);

      if (ImovelReg11.getInstancia().getIndcTarifaCatgoria() == ImovelReg11.CALCULO_POR_CATEGORA) {

        nomeCatgoria =
            new Label(
                Util.completaString("Economias", 15)
                    + Util.completaString("Cod. Cat", 25)
                    + Util.completaString("Subcategoria", 20));
        nomeCatgoria.getStyle().setFont(font);

      } else {
        nomeCatgoria =
            new Label(
                (Util.completaString("Eco.", 40)) + (Util.completaString("Subcategoria", 20)));
        nomeCatgoria.getStyle().setFont(font);
      }

      nomeEconomias = new Label("Economias: ");
      nomeEconomias.getStyle().setFont(font);
      economias = new Label();
      economias.setFocusable(true);

      instanciaAbaImoveis.setScrollable(true);
      instanciaAbaImoveis.setScrollableX(false);

      // Daniel - rota completa
      instanciaAbaImoveis.addComponent(lbInformativo);
      instanciaAbaImoveis.addComponent(nomeLigAgua);
      instanciaAbaImoveis.addComponent(ligAgua);
      instanciaAbaImoveis.addComponent(nomeLigEsgoto);
      instanciaAbaImoveis.addComponent(ligEsgoto);
      instanciaAbaImoveis.addComponent(nomeCatgoria);

      dadosCategoria = new Container(new BoxLayout(BoxLayout.Y_AXIS));

      instanciaAbaImoveis.addComponent(dadosCategoria);

      instanciaAbaImoveis.addComponent(lbNomeEndereco);
      instanciaAbaImoveis.addComponent(lbEndereco);
      instanciaAbaImoveis.addComponent(nomeCliente);
      instanciaAbaImoveis.addComponent(cliente);
      instanciaAbaImoveis.addComponent(nomeMatricula);
      instanciaAbaImoveis.addComponent(matricula);
      instanciaAbaImoveis.addComponent(nomeInscricao);
      instanciaAbaImoveis.addComponent(inscricao);
      instanciaAbaImoveis.addComponent(nomeRota);
      instanciaAbaImoveis.addComponent(rota);
    }

    return instanciaAbaImoveis;
  }
  public Container criarAbaImoveis() {

    try {

      // Daniel - rota completa
      if (getImovelSelecionado().isImovelInformativo()
          && getImovelSelecionado().getIndcCondominio() != Constantes.SIM) {
        isImovelInformativo = true;
        lbInformativo.setText("                  IMÓVEL INFORMATIVO");
      } else {
        lbInformativo.setText("");
      }
      // Setamos o endereço
      lbEndereco.setText(getImovelSelecionado().getEndereco());

      matricula.setText(getImovelSelecionado().getMatricula() + "");
      inscricao.setText(getImovelSelecionado().getInscricao());

      nomeLocal.setVisible(
          getImovelSelecionado().getEnderecoEntrega() != null
              && !getImovelSelecionado().getEnderecoEntrega().equals(""));
      local.setVisible(
          getImovelSelecionado().getEnderecoEntrega() != null
              && !getImovelSelecionado().getEnderecoEntrega().equals(""));
      local.setText(getImovelSelecionado().getEnderecoEntrega());

      rota.setText(getImovelSelecionado().getSequencialRota() + "");

      ligAgua.setText(
          getImovelSelecionado()
              .getDescricaoSitLigacaoAgua(getImovelSelecionado().getSituacaoLigAgua()));

      ligEsgoto.setText(
          getImovelSelecionado()
              .getDescricaoSitLigacaoEsgoto(getImovelSelecionado().getSituacaoLigEsgoto()));

      cliente.setText(getImovelSelecionado().getNomeUsuario());

      Label categoriaLabel = null;

      dadosCategoria.removeAll();

      Font font = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);

      ImovelReg11 reg11 = ImovelReg11.getInstancia();

      for (int i = 0; i < getImovelSelecionado().getRegistros2().size(); i++) {

        if (reg11.getIndcTarifaCatgoria() == ImovelReg11.CALCULO_POR_CATEGORA) {

          categoriaLabel =
              new Label(
                  (Util.completaString(
                          ((ImovelReg2)
                                      ControladorImoveis.getInstancia()
                                          .getImovelSelecionado()
                                          .getRegistros2()
                                          .elementAt(i))
                                  .getQtdEconomiasSubcategoria()
                              + "",
                          19))
                      + (Util.completaString(
                          String.valueOf(
                                  ((ImovelReg2)
                                          ControladorImoveis.getInstancia()
                                              .getImovelSelecionado()
                                              .getRegistros2()
                                              .elementAt(i))
                                      .getCodigoCategoria())
                              .trim(),
                          10))
                      + (Util.completaString(
                          ((ImovelReg2)
                                  ControladorImoveis.getInstancia()
                                      .getImovelSelecionado()
                                      .getRegistros2()
                                      .elementAt(i))
                              .getDescricaoCategoria(),
                          22)));

          categoriaLabel.getStyle().setFont(font);

        } else {
          String qtdEconomias =
              String.valueOf(
                  ((ImovelReg2)
                          ControladorImoveis.getInstancia()
                              .getImovelSelecionado()
                              .getRegistros2()
                              .elementAt(i))
                      .getQtdEconomiasSubcategoria());

          categoriaLabel =
              new Label(
                  (Util.completaString(qtdEconomias, 05))
                      + (Util.completaString(
                          ((ImovelReg2)
                                  ControladorImoveis.getInstancia()
                                      .getImovelSelecionado()
                                      .getRegistros2()
                                      .elementAt(i))
                              .getDescricaoSubcategoria(),
                          40)));

          categoriaLabel.getStyle().setFont(font);
        }

        dadosCategoria.setFocusable(true);
        dadosCategoria.addComponent(categoriaLabel);
      }
      // camposImovel.addComponent(5, dadosCategoria);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return instanciaAbaImoveis;
  }