@Override
 public void onBrowserEvent(
     Context context,
     Element parent,
     String value,
     NativeEvent event,
     ValueUpdater<String> valueUpdater) {
   super.onBrowserEvent(context, parent, value, event, valueUpdater);
   String type = event.getType();
   if ("change".equals(type)) {
     HasOptions key = (HasOptions) context.getKey();
     SelectElement select = parent.getFirstChild().cast();
     String newValue = null;
     if (key.hasOptions()) {
       List<String> options = key.getOptions();
       int optionsPreambleSize =
           key.getOptionsPreamble() == null ? 0 : key.getOptionsPreamble().size();
       int selectedOptionIndex = select.getSelectedIndex() - optionsPreambleSize;
       if (selectedOptionIndex >= 0) newValue = options.get(selectedOptionIndex);
     } else newValue = key.getNoOptionsString();
     setViewData(key, newValue);
     finishEditing(parent, newValue, key, valueUpdater);
     if (valueUpdater != null) {
       valueUpdater.update(newValue);
     }
   }
 }
 /**
  * Update the view data based on the current value.
  *
  * @param parent the parent element
  * @param viewData the {@link ViewData} object to update
  * @param isEditing true if in edit mode
  * @return the new value
  */
 private String updateViewData(Element parent, ViewData viewData, boolean isEditing) {
   TextAreaElement input = (TextAreaElement) parent.getFirstChild();
   String value = input.getValue();
   viewData.setText(value);
   viewData.setEditing(isEditing);
   return value;
 }
 /** {@inheritDoc} */
 @Override
 public void onRemovingChild(Node child, Element paragraph) {
   Node first = paragraph.getFirstChild();
   BRElement spacer = getSpacer(paragraph);
   if (first == null) {
     appendSpacer(paragraph);
   } else if (first != spacer) {
     spacer.removeFromParent();
   }
 }
 @Override
 public void onBrowserEvent(
     final Context context,
     final Element parent,
     final String value,
     final NativeEvent event,
     final ValueUpdater<String> valueUpdater) {
   super.onBrowserEvent(context, parent, value, event, valueUpdater);
   final String type = event.getType();
   if ("change".equals(type)) {
     final Object key = context.getKey();
     final SelectElement select = parent.getFirstChild().cast();
     final String newValue = options.get(select.getSelectedIndex());
     setViewData(key, newValue);
     finishEditing(parent, newValue, key, valueUpdater);
     if (valueUpdater != null) {
       valueUpdater.update(newValue);
     }
   }
 }
  private void updatePOILayer(Element markerElement) {
    String markerImageSrc = Element.as(markerElement.getFirstChild()).getAttribute("src");
    String currentStyles = markerElement.getAttribute("style");

    if (markerImageSrc.equals("images/selected-DOWN.png")
        || markerImageSrc.equals("images/deselected-DOWN.png")) {
      markerElement.setAttribute("style", currentStyles.replace("z-index: 90", "z-index: 90"));
    } else if (markerImageSrc.equals("images/selected-DISCONNECTED.png")
        || markerImageSrc.equals("images/deselected-DISCONNECTED.png")) {
      markerElement.setAttribute("style", currentStyles.replace("z-index: 90", "z-index: 80"));
    } else if (markerImageSrc.equals("images/selected-MARGINAL.png")
        || markerImageSrc.equals("images/deselected-MARGINAL.png")) {
      markerElement.setAttribute("style", currentStyles.replace("z-index: 90", "z-index: 70"));
    } else if (markerImageSrc.equals("images/selected-UP.png")
        || markerImageSrc.equals("images/deselected-UP.png")) {
      markerElement.setAttribute("style", currentStyles.replace("z-index: 90", "z-index: 60"));
    } else if (markerImageSrc.equals("images/selected-STOPPED.png")
        || markerImageSrc.equals("images/deselected-STOPPED.png")) {
      markerElement.setAttribute("style", currentStyles.replace("z-index: 90", "z-index: 50"));
    } else if (markerImageSrc.equals("images/selected-UNKNOWN.png")
        || markerImageSrc.equals("images/deselected-UNKNOWN.png")) {
      markerElement.setAttribute("style", currentStyles.replace("z-index: 90", "z-index: 40"));
    }
  }
 /** Get the input element in edit mode. */
 private TextAreaElement getInputElement(Element parent) {
   return parent.getFirstChild().<TextAreaElement>cast();
 }