/** * Determines whether this element has the given tag name. * * @param tagName the tag name, including namespace-prefix (if present) * @return <code>true</code> if the element has the given tag name */ public final boolean hasTagName(String tagName) { assert tagName != null : "tagName must not be null"; return tagName.equalsIgnoreCase(getTagName()); }
/** * Determine whether the given {@link Element} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Element elem) { return elem != null && (elem.getTagName().equalsIgnoreCase(TAG_Q) || elem.getTagName().equalsIgnoreCase(TAG_BLOCKQUOTE)); }
/** * Determine whether the given {@link Element} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Element elem) { return elem != null && ( elem.getTagName().equalsIgnoreCase(TAG_THEAD) || elem.getTagName().equalsIgnoreCase(TAG_TFOOT) || elem.getTagName().equalsIgnoreCase(TAG_TBODY) ); }
/** * Determine whether the given {@link Element} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Element elem) { return elem != null && (elem.getTagName().equalsIgnoreCase(TAG_TD) || elem.getTagName().equalsIgnoreCase(TAG_TH)); }
/** * Determine whether the given {@link Element} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Element elem) { return elem != null && ( elem.getTagName().equalsIgnoreCase(TAG_INS) || elem.getTagName().equalsIgnoreCase(TAG_DEL) ); }
/** * Determine whether the given {@link Element} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Element elem) { return elem != null && (elem.getTagName().equalsIgnoreCase(TAG_COL) || elem.getTagName().equalsIgnoreCase(TAG_COLGROUP)); }
protected LabelBase(Element element) { this(element, "span".equalsIgnoreCase(element.getTagName())); }
/** * Check if an element is focusable. If an element is focusable, the cell * widget should not steal focus from it. * * @param elem the element * @return true if the element is focusable, false if not */ public boolean isFocusable(Element elem) { return focusableTypes.contains(elem.getTagName().toLowerCase(Locale.ROOT)) || elem.getTabIndex() >= 0; }
@Override public boolean isFocusable(Element elem) { return focusableTypes.contains(elem.getTagName().toLowerCase(Locale.ROOT)) || getTabIndexIfSpecified(elem) >= 0; }
/** * Determine whether the given {@link Element} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Element elem) { if (elem == null) { return false; } String tag = elem.getTagName().toLowerCase(Locale.ROOT); if (tag.length() != 2) { return false; } if (tag.charAt(0) != 'h') { return false; } int n = Integer.parseInt(tag.substring(1, 2)); if (n < 1 || n > 6) { return false; } return true; }
/** * Check whether or not an element is a checkbox or radio button. * * @param elem the element to check * @return true if a checkbox, false if not */ private static boolean isCheckbox(Element elem) { if (elem == null || !"input".equalsIgnoreCase(elem.getTagName())) { return false; } String inputType = InputElement.as(elem).getType().toLowerCase(Locale.ROOT); return "checkbox".equals(inputType) || "radio".equals(inputType); }
private LabelBase(Element element, boolean isElementInline) { assert (isElementInline ? "span" : "div").equalsIgnoreCase(element.getTagName()); setElement(element); directionalTextHelper = new DirectionalTextHelper(getElement(), isElementInline); }
/** * Get the keyboard selected element from the selected table cell. * * @return the keyboard selected element, or null if there is none */ private Element getKeyboardSelectedElement(TableCellElement td) { if (td == null) { return null; } /* * The TD itself is a cell parent, which means its internal structure * (including the tabIndex that we set) could be modified by its Cell. We * return the TD to be safe. */ if (tableBuilder.isColumn(td)) { return td; } /* * The default table builder adds a focusable div to the table cell because * TDs aren't focusable in all browsers. If the user defines a custom table * builder with a different structure, we must assume the keyboard selected * element is the TD itself. */ Element firstChild = td.getFirstChildElement(); if (firstChild != null && td.getChildCount() == 1 && "div".equalsIgnoreCase(firstChild.getTagName())) { return firstChild; } return td; }
/** * Start a child element. * * @param element the element to start * @param builder the builder used to builder the new element */ private void start(Element element, ElementBuilderBase<?> builder) { onStart(element.getTagName(), builder); // Set the root element. if (rootElement == null) { // This is the new root element. rootElement = element; } else { // Appending to the current element. getCurrentElement().appendChild(element); } // Add the element to the stack. currentElement = element; }
public SelectAction translateSelectionEvent(CellPreviewEvent<T> event) { // Handle the event. NativeEvent nativeEvent = event.getNativeEvent(); if (BrowserEvents.CLICK.equals(nativeEvent.getType())) { // Ignore if the event didn't occur in the correct column. if (column > -1 && column != event.getColumn()) { return SelectAction.IGNORE; } // Determine if we clicked on a checkbox. Element target = nativeEvent.getEventTarget().cast(); if ("input".equals(target.getTagName().toLowerCase(Locale.ROOT))) { final InputElement input = target.cast(); if ("checkbox".equals(input.getType().toLowerCase(Locale.ROOT))) { // Synchronize the checkbox with the current selection state. input.setChecked(event.getDisplay().getSelectionModel().isSelected( event.getValue())); return SelectAction.TOGGLE; } } return SelectAction.IGNORE; } // For keyboard events, do the default action. return SelectAction.DEFAULT; } }
if (Element.is(eventTarget)) { Element target = Element.as(eventTarget); if ("input".equals(target.getTagName().toLowerCase(Locale.ROOT))) { commit(context, parent, viewData, valueUpdater);
if (BrowserEvents.FOCUSIN.equals(type)) { String tagName = target.getTagName().toLowerCase(Locale.ROOT); if (inputTypes.contains(tagName)) { focusedInput = target;
if (TableCellElement.TAG_TD.equalsIgnoreCase(cur.getTagName()) && tableBuilder.isColumn(cur.getFirstChildElement())) { cur = cur.getFirstChildElement(); String tagName = cur.getTagName(); if (TableCellElement.TAG_TD.equalsIgnoreCase(tagName) || TableCellElement.TAG_TH.equalsIgnoreCase(tagName)) {
public void setAttribute(Element e, String key, Object value) { if ("button".equals(e.getTagName())) { AttrNodeSetter.getInstance().setAttribute(e, key, value); return; } super.setAttribute(e, key, value); } }
public Button create(Element e) { Button button = new Button(); button.getElement().setInnerText(e.getInnerText()); if ("button".equalsIgnoreCase(e.getTagName())) { copyAttributes((ButtonElement) e.cast(), (ButtonElement) button.getElement().cast()); } WidgetsUtils.replaceOrAppend(e, button); return button; }