Java Code Examples for com.google.gwt.dom.client.Element#hasClassName()
The following examples show how to use
com.google.gwt.dom.client.Element#hasClassName() .
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: CubaTreeTableWidget.java From cuba with Apache License 2.0 | 6 votes |
protected boolean isCubaTableClickableCellText(Event event) { Element eventTarget = event.getEventTarget().cast(); Element elementTdOrTr = getElementTdOrTr(eventTarget); if (elementTdOrTr != null && TableCellElement.TAG_TD.equalsIgnoreCase(elementTdOrTr.getTagName()) && !elementTdOrTr.hasClassName(CUBA_TABLE_CLICKABLE_TEXT_STYLE)) { // found <td> if (SpanElement.TAG.equalsIgnoreCase(eventTarget.getTagName()) && eventTarget.hasClassName(CUBA_TABLE_CLICKABLE_CELL_STYLE)) { // found <span class="c-table-clickable-cell"> return true; } } return false; }
Example 2
Source File: CubaGridLayoutSlot.java From cuba with Apache License 2.0 | 5 votes |
protected int getButtonHeight(CubaButtonWidget widget) { Element element = widget.getElement(); if (!element.hasClassName("link")) { return getWidgetHeight(widget); } Element captionElement = findLinkButtonCaptionElement(element); if (captionElement == null) { return getWidgetHeight(widget); } // The LinkButton component has an ability to wrap caption onto multiple rows. // Thus, at the first recalculation of the heights for the slots, the "getWidgetHeight()" call // returns an invalid multiline component height. // In order to calculate the really required caption height, regardless of the 'white-space' mode, // we need to explicitly set it to 'nowrap'. After calculation, it's reverted back. Style style = captionElement.getStyle(); String prevWhiteSpace = style.getWhiteSpace(); style.setWhiteSpace(Style.WhiteSpace.NOWRAP); int buttonHeight = element.getOffsetHeight(); if (prevWhiteSpace != null && !prevWhiteSpace.isEmpty()) { style.setWhiteSpace(Style.WhiteSpace.valueOf(prevWhiteSpace)); } else { style.clearWhiteSpace(); } return buttonHeight; }
Example 3
Source File: CubaTreeTableWidget.java From cuba with Apache License 2.0 | 5 votes |
protected boolean isCubaTableClickableCell(Event event) { Element eventTarget = event.getEventTarget().cast(); Element elementTdOrTr = getElementTdOrTr(eventTarget); return elementTdOrTr != null && TableCellElement.TAG_TD.equalsIgnoreCase(elementTdOrTr.getTagName()) && elementTdOrTr.hasClassName(CUBA_TABLE_CLICKABLE_CELL_CONTENT) && !eventTarget.hasClassName(TREE_TABLE_SPACER); }
Example 4
Source File: WidgetDoodad.java From swellrt with Apache License 2.0 | 5 votes |
/** * Do a recursive search bottom-up in the DOM searching the first node matching * the class * * @param element * @param clazz * @return */ public static Element getWidgetElementUp(Element element) { if (element == null) return null; if (element.hasClassName(CSS_CLASS)) { return element; } return getWidgetElementUp(element.getParentElement()); }
Example 5
Source File: StyleUtils.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
public static <S extends CssStyle> void removeStyle(Element e, S style) { if (e == null) { return; } if (style instanceof Enum) { StyleUtils.cleanEnumStyle(e, style.getClass()); } String styleName = StyleUtils.getStyle(style); String currentClassName = e.getClassName(); if (styleName != null && currentClassName != null && e.hasClassName(styleName)) { e.removeClassName(styleName); } }
Example 6
Source File: StyleUtils.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
public static void cleanEnumStyle(Element e, Class<?> enumClass) { if (enumClass == null) { return; } for (Object enumValue : enumClass.getEnumConstants()) { if (enumValue instanceof CssStyle) { String currentClassName = e.getClassName(); String styleName = ((CssStyle) enumValue).get(); if (styleName != null && currentClassName != null && e.hasClassName(styleName)) { e.removeClassName(styleName); } } } }
Example 7
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 5 votes |
private void fillWeekResolutionBlock(DivElement resBlock, boolean fillWeekBlock, Date date, int index, Weekday weekDay, boolean firstWeek, boolean lastBlock, int left, boolean even) { if (fillWeekBlock) { resBlock.setInnerText(formatWeekCaption(date)); if (even) { resBlock.addClassName(STYLE_EVEN); } else { resBlock.removeClassName(STYLE_EVEN); } if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) { resBlock.getStyle().setPosition(Position.RELATIVE); resBlock.getStyle().setLeft(left, Unit.PX); } resBlock.removeClassName(STYLE_FIRST); resBlock.removeClassName(STYLE_LAST); } if (firstWeek && (weekDay == Weekday.Last || lastBlock)) { Element firstEl = resolutionDiv.getFirstChildElement(); if (!firstEl.hasClassName(STYLE_FIRST)) { firstEl.addClassName(STYLE_FIRST); } } else if (lastBlock) { Element lastEl = Element.as(resolutionDiv.getLastChild()); if (!lastEl.hasClassName(STYLE_LAST)) { lastEl.addClassName(STYLE_LAST); } } }
Example 8
Source File: CubaSideMenuWidget.java From cuba with Apache License 2.0 | 4 votes |
protected boolean isRootItem() { Element parentElement = getElement().getParentElement(); return parentElement != null && parentElement.hasClassName(CLASS_NAME); }
Example 9
Source File: GanttWidget.java From gantt with Apache License 2.0 | 4 votes |
protected boolean isBar(Element element) { if (isSvg(element)) { return false; } return element.hasClassName(AbstractStepWidget.STYLE_BAR); }
Example 10
Source File: GanttWidget.java From gantt with Apache License 2.0 | 4 votes |
protected boolean isSubBar(Element element) { if (isSvg(element)) { return false; } return element.hasClassName(SubStepWidget.STYLE_SUB_BAR); }
Example 11
Source File: GanttWidget.java From gantt with Apache License 2.0 | 4 votes |
protected boolean hasSubBars(Element element) { if (isSvg(element)) { return false; } return element.hasClassName(StepWidget.STYLE_HAS_SUB_STEPS); }