Java Code Examples for com.google.gwt.dom.client.Element#removeAttribute()

The following examples show how to use com.google.gwt.dom.client.Element#removeAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaSourceCodeEditorWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);

    super.setReadOnly(!enabled || readOnly);

    if (editor != null) {
        Element textAreaElement = getTextAreaElement();

        if (enabled) {
            textAreaElement.removeAttribute("disabled");
        } else {
            textAreaElement.setAttribute("disabled", "disabled");
        }

        updateTabIndex();
    }
}
 
Example 2
Source File: AnnotationSpreadRenderer.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private void applyAttribute(ContentElement element, String name, String newValue) {
  // NOTE(user): If an link attribute is added, then handle specially,
  // otherwise treat as style attribute.
  Element implNodelet = element.getImplNodelet();
  if (name.equals(AnnotationPaint.LINK_ATTR)) {
    if (newValue != null) {
      String scrubbedValue = Scrub.scrub(newValue);
      implNodelet.setAttribute("href", scrubbedValue);
      if (scrubbedValue.startsWith("#")) {
        implNodelet.removeAttribute("target");
      } else {
        implNodelet.setAttribute("target", "_blank");
      }
    } else {
      implNodelet.removeAttribute("href");
    }
  } else if (name.equals(AnnotationPaint.MOUSE_LISTENER_ATTR)) {
    updateEventHandler(element, newValue);
  } else {
    try {
      implNodelet.getStyle().setProperty(name, newValue);
    } catch (RuntimeException e) {
      // NOTE(user): some property value are invalid, try catch them and ignores them.
      EditorStaticDeps.logger.error().log("Failed to set CSS property " + name +
        " -> " + newValue);
    }
  }
}
 
Example 3
Source File: CellTreeNodeView.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Select or deselect this node with the keyboard.
 *
 * @param selected   true if selected, false if not
 * @param stealFocus true to steal focus
 */
void setKeyboardSelected(boolean selected, boolean stealFocus) {
  if (tree.isKeyboardSelectionDisabled()) {
    return;
  }

  // Apply the selected style.
  if (!selected || tree.isFocused || stealFocus) {
    setKeyboardSelectedStyle(selected);
  }

  // Make the node focusable or not.
  Element cellParent = getCellParent();
  if (!selected) {
    // Chrome: Elements remain focusable after removing the tabIndex, so set
    // it to -1 first.
    cellParent.setTabIndex(-1);
    cellParent.removeAttribute("tabIndex");
    cellParent.removeAttribute("accessKey");
  }
  else {
    FocusImpl focusImpl = FocusImpl.getFocusImplForWidget();
    focusImpl.setTabIndex(cellParent, tree.getTabIndex());
    char accessKey = tree.getAccessKey();
    if (accessKey != 0) {
      focusImpl.setAccessKey(cellParent, accessKey);
    }
    if (stealFocus && !tree.cellIsEditing) {
      cellParent.focus();
    }
  }

  // Update the selection model.
  if (KeyboardSelectionPolicy.BOUND_TO_SELECTION == tree.getKeyboardSelectionPolicy()) {
    setSelected(selected);
  }
}
 
Example 4
Source File: DebugClassHelper.java    From swellrt with Apache License 2.0 2 votes vote down vote up
/**
 * Removes all debug classes from an Element.
 * @param elem The element to remove debug classes from.
 */
public static void clearDebugClasses(Element elem) {
  elem.removeAttribute(DEBUG_CLASS_ATTRIBUTE);
}
 
Example 5
Source File: DebugClassHelper.java    From incubator-retired-wave with Apache License 2.0 2 votes vote down vote up
/**
 * Removes all debug classes from an Element.
 * @param elem The element to remove debug classes from.
 */
public static void clearDebugClasses(Element elem) {
  elem.removeAttribute(DEBUG_CLASS_ATTRIBUTE);
}