public void lock() { super.lock(); _degrees.lock(); _minutes.lock(); _seconds.lock(); _direction.lock(); }
public ScDoubleField newRatioField(String label) { ScDoubleField e; e = new ScDoubleField(); e.setValueAdaptor(getRatioAdaptor()); e.setLabel(label); e.setValidator(AcBillingSubscriberBillingValidator.instance.getRatioValidator()); return e; }
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); }
// ################################################## // # 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 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 renderDefaultFocusIfNeeded(ScServletData data, JwHtmlBuffer buf) { ScFieldState state = getState(data); if (state.hasDefaultFocus()) renderDefaultFocus(data, buf, _degrees.getKey()); }
public void applyChildrenParameters(ScServletData data) { _degrees.applyAllParameters(data); _minutes.applyAllParameters(data); _seconds.applyAllParameters(data); _direction.applyAllParameters(data); }
public boolean hasSecondsError(ScServletData data) { if (!_seconds.validate(data)) return false; if (_seconds.hasText(data)) return _seconds.getValue(data) == null; if (_minutes.hasText(data)) return isDecimal(_minutes.getValue(data)); return isDecimal(_degrees.getValue(data)); }
public boolean hasDegreesError(ScServletData data) { if (!_degrees.validate(data)) return false; return _degrees.getValue(data) == null; }