/** * Returns the element's style name. * * @return the style name */ public String getStyleName() { return dom.getClassName(); }
/** * Checks if the specified CSS style name exists on this element's DOM node. * * @param style the style name * @return true if the style name exists, else false */ public boolean hasStyleName(String style) { String cls = dom.getClassName(); return (" " + cls + " ").indexOf(" " + style + " ") != -1 ? true : false; }
private String getColorFromElement(Element elem) { String className = elem.getClassName(); if (className.indexOf("color-") != -1) { return className.substring(className.indexOf("color-") + 6, className.indexOf("color-") + 12); } return null; }
/** * Resolve if widget is a Vaadin Caption * * @param w * Widget to check * @return True if the widget is a caption widget, false otherwise */ public static boolean isCaption(Widget w) { return w instanceof VCaption || w instanceof VFormLayout.Caption || w instanceof TabCaption || w.getElement().getClassName().contains("v-panel-caption"); }
/** * Resolve if widget is a Vaadin Caption * * @param w * Widget to check * @return True if the widget is a caption widget, false otherwise */ public static boolean isCaption(Widget w) { return w instanceof VCaption || w instanceof VFormLayout.Caption || w instanceof TabCaption || w.getElement().getClassName().contains("v-panel-caption"); }
@Override protected void handleMouseClick(GridEvent<M> e) { if (e.getTarget().getClassName().equals("x-grid3-row-checker")) { return; } super.handleMouseClick(e); }
protected AbstractComposite(AbstractComposite source) { this.handlerManager = new HandlerManager(source.handlerManager, this); this.handlerManager.resetSinkEvents(); this.styleToClone = source.getElement().getClassName(); }
protected void onMouseDown(GridEvent<?> e) { if (e.getTarget().getClassName().equals("x-grid3-row-expander")) { e.stopEvent(); El row = e.getTarget(".x-grid3-row", 15); toggleRow(row); } }
protected AbstractComposite(AbstractComposite source) { this.handlerManager = new HandlerManager(source.handlerManager, this); this.handlerManager.resetSinkEvents(); this.styleToClone = source.getElement().getClassName(); }
public static void cloneStyle(Widget target, Widget source) { target.getElement().setClassName(source.getElement().getClassName()); }
public static void cloneStyle(Widget target, Widget source) { target.getElement().setClassName(source.getElement().getClassName()); }
protected void applyCollapsibleProgress(boolean isShow) { MaterialCollapsibleItem item = (MaterialCollapsibleItem) uiObject; MaterialCollapsibleBody body = (MaterialCollapsibleBody) item.getWidget(1); if (uiObject.getElement().getClassName().contains(CssName.ACTIVE)) { if (isShow) { body.setDisplay(Display.NONE); item.add(progress); } else { body.setDisplay(Display.BLOCK); progress.removeFromParent(); } } } }
protected void applyCollapsibleProgress(boolean isShow) { MaterialCollapsibleItem item = (MaterialCollapsibleItem) uiObject; MaterialCollapsibleBody body = (MaterialCollapsibleBody) item.getWidget(1); if (uiObject.getElement().getClassName().contains(CssName.ACTIVE)) { if (isShow) { body.setDisplay(Display.NONE); item.add(progress); } else { body.setDisplay(Display.BLOCK); progress.removeFromParent(); } } } }
public void update() { text.setInnerText(data.getLabel()); if (data.getIconFontId() != null) { icon.setClassName("v-icon"); if (data.getIconFontId() != null && !data.getIconFontId().isEmpty()) { icon.addClassName(data.getIconFontId()); } } else if (iconImage != null) { iconImage.setUri(data.getResourceUrl()); } if (isEnabled() && root.getClassName().contains(ApplicationConnection.DISABLED_CLASSNAME)) { root.removeClassName(ApplicationConnection.DISABLED_CLASSNAME); } else if (!isEnabled() && !root.getClassName().contains(ApplicationConnection.DISABLED_CLASSNAME)) { root.addClassName(ApplicationConnection.DISABLED_CLASSNAME); } }
public void setUiPart(final UIPart uiPart) { if (uiPart != null) { this.uiPart = uiPart; this.widget = uiPart.getWidget().asWidget(); this.widget.getElement().getStyle().setFloat(Style.Float.LEFT); this.widget.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN); this.style = this.widget.getElement().getClassName(); container.clear(); container.add(widget); } else { this.uiPart = null; this.widget = null; this.style = null; container.clear(); } } }
@Override protected void handleMouseDown(GridEvent<M> e) { if (e.getEvent().getButton() == Event.BUTTON_LEFT && e.getTarget().getClassName().equals("x-grid3-row-checker")) { M m = listStore.getAt(e.getRowIndex()); if (m != null) { if (isSelected(m)) { deselect(m); } else { select(m, true); } } } else { super.handleMouseDown(e); } }
public void testTypes() { // given MaterialTab tab = getWidget(); // when / then tab.setType(TabType.DEFAULT); assertEquals(TabType.DEFAULT, tab.getType()); assertTrue(tab.getElement().getClassName().contains(TabType.DEFAULT.getCssName())); tab.setType(TabType.ICON); assertEquals(TabType.ICON, tab.getType()); assertTrue(tab.getElement().hasClassName(TabType.ICON.getCssName())); }
public void testTypes() { // given MaterialTab tab = getWidget(); // when / then tab.setType(TabType.DEFAULT); assertEquals(TabType.DEFAULT, tab.getType()); assertTrue(tab.getElement().getClassName().contains(TabType.DEFAULT.getCssName())); tab.setType(TabType.ICON); assertEquals(TabType.ICON, tab.getType()); assertTrue(tab.getElement().hasClassName(TabType.ICON.getCssName())); }
public void testProgressBar() { // given MaterialNavBar navBar = getWidget(); // when / then navBar.showProgress(ProgressType.INDETERMINATE); assertTrue(navBar.getNavWrapper().getWidget(2) instanceof MaterialProgress); assertEquals(navBar.getNavWrapper().getWidget(2).getElement().getClassName(), CssName.PROGRESS); MaterialProgress progress = (MaterialProgress) navBar.getNavWrapper().getWidget(2); assertEquals(ProgressType.INDETERMINATE, progress.getType()); navBar.hideProgress(); assertFalse(progress.isAttached()); }
public void testProgressBar() { // given MaterialNavBar navBar = getWidget(); // when / then navBar.showProgress(ProgressType.INDETERMINATE); assertTrue(navBar.getNavWrapper().getWidget(2) instanceof MaterialProgress); assertEquals(navBar.getNavWrapper().getWidget(2).getElement().getClassName(), CssName.PROGRESS); MaterialProgress progress = (MaterialProgress) navBar.getNavWrapper().getWidget(2); assertEquals(ProgressType.INDETERMINATE, progress.getType()); navBar.hideProgress(); assertFalse(progress.isAttached()); }