// ##################################################
  // # render
  // ##################################################//
  public void renderControl(ScServletData data, JwHtmlBuffer buf) {
    JwGeographicCoordinate c = null;
    if (getModel() != null) {
      if (getModel() instanceof JwGeographicCoordinate) c = (JwGeographicCoordinate) getModel();
      else c = (JwGeographicCoordinate) getValueAdaptor().getValue(getModel());
    }

    if (c != null) {
      _degrees.setValue((double) c.getDegrees().intValue());
      _minutes.setValue((double) c.getMinutes().intValue());
      _seconds.setValue(c.getSeconds().doubleValue());
      _direction.setSelectedValue(c.getDirection());
    }

    _degrees.render(data, buf);
    buf.print(JwConstantsIF.SYMBOL_DEGREE);
    buf.printNonBreakingSpace();

    _minutes.render(data, buf);
    buf.printLiteral("'");
    buf.printNonBreakingSpace();

    _seconds.render(data, buf);
    buf.print("\"");
    buf.printNonBreakingSpace();

    _direction.render(data, buf);
  }
 public void lock() {
   super.lock();
   _degrees.lock();
   _minutes.lock();
   _seconds.lock();
   _direction.lock();
 }
  protected void initialize() {
    super.initialize();

    _degrees = new ScDoubleField();
    _degrees.setWidth(3);

    _minutes = new ScDoubleField();
    _minutes.setWidth(3);

    _seconds = new ScDoubleField();
    _seconds.setWidth(5);

    _direction = new ScDropdownField();
    _direction.addOption("N", "North");
    _direction.addOption("S", "South");
    _direction.addOption("E", "East");
    _direction.addOption("W", "West");
  }
  public JwGeographicCoordinate getValue(ScServletData data) {
    int degrees;
    int minutes;
    double seconds;

    Double d = _degrees.getValue(data);
    if (d == null) return null;
    if (isDecimal(d)) {
      if (_minutes.hasValue(data) && !JwUtility.isEqual(_minutes.getValue(data).doubleValue(), 0.0))
        return null;
      if (_seconds.hasValue(data) && !JwUtility.isEqual(_seconds.getValue(data).doubleValue(), 0.0))
        return null;

      degrees = (int) d.doubleValue();

      d = d - degrees;
      d = d * 60;
      minutes = (int) d.doubleValue();

      d = d - minutes;
      seconds = d * 60;
    } else {
      degrees = (int) d.doubleValue();
      d = _minutes.getValue(data);
      if (d == null) return null;
      if (isDecimal(d)) {
        if (_seconds.hasValue(data)
            && !JwUtility.isEqual(_seconds.getValue(data).doubleValue(), 0.0)) return null;

        minutes = (int) d.doubleValue();

        d = d - minutes;
        seconds = d * 60;
      } else {
        minutes = (int) d.doubleValue();
        d = _seconds.getValue(data);
        if (d == null) return null;
        seconds = d;
      }
    }

    String direction = _direction.getSelectedString();
    if (JwUtility.isEmpty(direction)) return null;
    return new JwGeographicCoordinate(degrees, minutes, seconds, direction, null, null);
  }
 public void setValue(ScServletData data, JwGeographicCoordinate value) {
   _degrees.setValue((double) value.getDegrees().intValue());
   _minutes.setValue((double) value.getMinutes().intValue());
   _seconds.setValue(value.getSeconds().doubleValue());
   _direction.setValue(value.getDirection());
 }
 public void applyChildrenParameters(ScServletData data) {
   _degrees.applyAllParameters(data);
   _minutes.applyAllParameters(data);
   _seconds.applyAllParameters(data);
   _direction.applyAllParameters(data);
 }
 public boolean hasDirectionError(ScServletData data) {
   return !_direction.validate(data);
 }