private static int dateRange_getYear(final Object object) { final String s = Context.toString(object); if (Character.isDigit(s.charAt(0))) { final int i = Integer.parseInt(s); if (i > 1000) { return i; } } return -1; }
private static int getSmallInt(final Object object) { final String s = Context.toString(object); if (Character.isDigit(s.charAt(0))) { final int i = Integer.parseInt(s); if (i < 70) { return i; } } return -1; }
/** * Converts the arguments to strings and concatenate them. * @param args the JavaScript arguments * @return the string concatenation */ private static String concatArgsAsString(final Object[] args) { final StringBuilder builder = new StringBuilder(); for (final Object arg : args) { builder.append(Context.toString(arg)); } return builder.toString(); }
/** * Replaces all child elements of this element with the supplied text value. * @param value the new value for the contents of this element */ @Override public void setTextContent(final Object value) { setInnerTextImpl(value == null ? null : Context.toString(value)); }
/** * Sets the text content of the attribute. * @param value the text content of the attribute */ @Override public void setText(final Object value) { setValue(value == null ? null : Context.toString(value)); }
/** * Sets the text contained in the node. * @param newText the text contained in the node */ @Override public void setText(final Object newText) { setData(newText == null ? null : Context.toString(newText)); }
/** * Sets the text contained in the node. * @param newText the text contained in the node */ @Override public void setText(final Object newText) { setData(newText == null ? null : Context.toString(newText)); }
@Override protected boolean isReadOnlySettable(final String name, final Object value) { throw ScriptRuntime.typeError3("msg.set.prop.no.setter", name, getClassName(), Context.toString(value)); }
private static Node toNodeOrTextNode(final Node thisObj, final Object obj) { if (obj instanceof Node) { return (Node) obj; } return (Node) ((HTMLDocument) thisObj.getOwnerDocument()).createTextNode(Context.toString(obj)); }
/** * Removes the named property. * @param name the name of the property to remove * @return the value deleted */ @JsxFunction public String removeProperty(final Object name) { return removeStyleAttribute(Context.toString(name)); }
/** * Selects the option with the specified value. * @param newValue the value of the option to select */ @Override public void setValue(final Object newValue) { final String val = Context.toString(newValue); getHtmlSelect().setSelectedAttribute(val, true, false); }
/** * Sets the "size" attribute. * @param size the "size" attribute */ public void jsxSet_size(final int size) { getDomNodeOrDie().setAttribute("size", Context.toString(size)); } }
/** * Sets the {@code size} attribute. * @param size the {@code size} attribute */ @JsxSetter public void setSize(final int size) { getDomNodeOrDie().setAttribute("size", Context.toString(Integer.valueOf(size))); }
/** * Replace all child elements of this element by the supplied text. * @param text the new text of this node */ @JsxSetter public void setText(final Object text) { final DomNode domNode = getDomNodeOrDie(); domNode.setTextContent(text == null ? null : Context.toString(text)); }
/** * Sets the value of the JavaScript attribute {@code value}. * * @param newValue the new value */ @JsxSetter public void setValue(final Object newValue) { getDomNodeOrDie().setAttribute("value", Context.toString(newValue)); }
/** * {@inheritDoc} */ @Override public String getPropertyValue(final String name) { // need to invoke the getter to take care of the default value final Object property = getProperty(this, camelize(name)); if (property == NOT_FOUND) { return super.getPropertyValue(name); } return Context.toString(property); }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ @JsxSetter public void setTextContent(final Object value) { getDomNodeOrDie().setTextContent(value == null ? null : Context.toString(value)); }
/** * Sets the {@code size} attribute. * @param size the {@code size} attribute */ @JsxSetter public void setSize(final int size) { getDomNodeOrDie().setAttribute("size", Context.toString(size)); } }
/** * Sets the value of the {@code value} attribute. * @param value the new value */ @Override public void setValue(final Object value) { if (null == value && getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_VALUE_NULL)) { ((HtmlTextArea) getDomNodeOrDie()).setText(""); return; } ((HtmlTextArea) getDomNodeOrDie()).setText(Context.toString(value)); }