/**
  * Creates an edit field with no label and a rounded border.
  *
  * @param text The default text to show in the edit field.
  * @param style The style bitmask to apply to the field.
  * @return A new field.
  */
 public static EditField createEditField(String text, long style) {
   EditField field = new EditField("", text, EditField.DEFAULT_MAXCHARS, style);
   field.setBorder(
       BorderFactory.createRoundedBorder(
           new XYEdges(5, 5, 5, 5), COLOR_EDITFIELD_BORDER, Border.STYLE_SOLID));
   field.setMargin(new XYEdges(2, 0, 3, 0));
   return field;
 }
  /**
   * restoreUIFieldsFromCitation - populate the UI fields from those currently stored in the
   * citation record
   */
  private void restoreUIFieldsFromCitation() {
    boolean accidentStatus = c.Violation.getElement(CViolation.ACCIDENT).equals("true");
    boolean radarStatus = c.Violation.getElement(CViolation.RADAR).equals("true");
    boolean jailStatus = c.Violation.getElement(CViolation.JAIL_BOOKING).equals("true");
    boolean pacedStatus = c.Violation.getElement(CViolation.PACED).equals("true");
    boolean alcoholStatus = c.Violation.getElement(CViolation.ALCOHOL).equals("true");

    field_accident.setChecked(accidentStatus);
    field_radar.setChecked(radarStatus);
    field_jail_booking.setChecked(jailStatus);
    field_paced.setChecked(pacedStatus);
    field_alcohol.setChecked(alcoholStatus);

    field_vbfi.setText(c.Violation.getElement(CViolation.VBFI));
    field_speed_limit.setSelectedIndex(c.Violation.getElement(CViolation.SPEED_LIMIT));
    field_alleged_speed.setText(c.Violation.getElement(CViolation.ALLEGED_SPEED));
  }
  /** storeUIFieldsToCitation - transfer the UI field values to the citation record */
  private void storeUIFieldsToCitation() {
    String accidentStatus = field_accident.getChecked() ? "true" : "false";
    String radarStatus = field_radar.getChecked() ? "true" : "false";
    String jailStatus = field_jail_booking.getChecked() ? "true" : "false";
    String pacedStatus = field_paced.getChecked() ? "true" : "false";
    String schoolStatus = field_school_zone.getChecked() ? "true" : "false";
    String alcoholStatus = field_alcohol.getChecked() ? "true" : "false";

    c.Violation.setElement(CViolation.ACCIDENT, accidentStatus);
    c.Violation.setElement(CViolation.RADAR, radarStatus);
    c.Violation.setElement(CViolation.JAIL_BOOKING, jailStatus);
    c.Violation.setElement(CViolation.PACED, pacedStatus);
    c.Violation.setElement(CViolation.SCHOOL_ZONE, schoolStatus);
    c.Violation.setElement(CViolation.ALCOHOL, alcoholStatus);

    c.Violation.setElement(CViolation.VBFI, field_vbfi.getText());
    c.Violation.setElement(CViolation.SPEED_LIMIT, field_speed_limit.toString());
    c.Violation.setElement(CViolation.ALLEGED_SPEED, field_alleged_speed.getText());
  }
  private void add() {
    // validate input..
    if (nameTxt.getText().equals("")
        || nameTxt.getText() == null && urlTxt.getText().equals("")
        || urlTxt.getText() == null) {
      // invalid input..
      Dialog.alert("Enter Feed Name and URL");

    } else {
      // get the new feed name and url
      String feedName = nameTxt.getText();
      String feedUrl = urlTxt.getText();

      if (feedUrl.indexOf("http://") == -1) {
        Dialog.alert("Feed URL must begin with http://");
      } else {
        // create new Feed object/store it at same time
        Feed newFeed = new Feed(feedName, feedUrl);
        databaseManager.getFeeds().addElement(newFeed);

        // add the new Feed to the end of the feeds list
        list.insert(list.getSize());
        FeedsListCallback callback = (FeedsListCallback) list.getCallback();
        callback.insert(newFeed);

        // close dialog..
        close();
      }
    }
  }
  public ChatBoxTextBoxField(int width, int height, long style) {
    super(Manager.NO_VERTICAL_SCROLL | style);
    managerWidth = width;
    managerHeight = height;

    VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL);

    editField =
        new EditField() {
          public void paint(Graphics g) {
            getManager().invalidate();
            super.paint(g);
          }
        };
    editField.setNonSpellCheckable(true);

    vfm.setPadding(10, 20, 10, 20);
    vfm.add(editField);
    add(vfm);
  }
Example #6
0
 /*
  * (non-Javadoc)
  *
  * @see de.enough.glaze.ui.component.GzField#gz_layout(int, int)
  */
 public void gz_layout(int width, int height) {
   super.layout(width, height);
 }
Example #7
0
 /*
  * (non-Javadoc)
  *
  * @see de.enough.glaze.ui.delegate.GzField#gz_invalidateAll(int, int, int,
  * int)
  */
 public void gz_invalidateAll(int x, int y, int width, int height) {
   super.invalidateAll(x, y, width, height);
 }
Example #8
0
 /*
  * (non-Javadoc)
  *
  * @see net.rim.device.api.ui.Field#onUnfocus()
  */
 protected void onUnfocus() {
   super.onUnfocus();
   invalidate();
 }
Example #9
0
 /*
  * (non-Javadoc)
  *
  * @see net.rim.device.api.ui.Field#onFocus(int)
  */
 protected void onFocus(int arg0) {
   super.onFocus(arg0);
   invalidate();
 }
Example #10
0
 /*
  * (non-Javadoc)
  *
  * @see de.enough.glaze.ui.component.GzField#gz_setExtent(int, int)
  */
 public void gz_setExtent(int width, int height) {
   super.setExtent(width, height);
 }
Example #11
0
 /*
  * (non-Javadoc)
  *
  * @see
  * de.enough.glaze.ui.component.GzField#gz_paint(net.rim.device.api.ui.Graphics
  * )
  */
 public void gz_paint(Graphics graphics) {
   super.paint(graphics);
 }
 public void paint(Graphics graphics) {
   graphics.setColor(color);
   super.paint(graphics);
 }
 protected void layout(int maxWidth, int maxHeight) {
   super.layout(width, getHeight());
   setExtent(width, getHeight());
 }
 public void setText(String text) {
   editField.setText(text);
 }
 public String getText() {
   return editField.getText();
 }