private Element findUiSelect() { // In case of manual JQMContext.render() call, created could be still false, // but ui-select is already created, so set all needed properties before render() call. if (!created) return null; Element uiSel = JQMCommon.findChild(getElement(), "ui-select"); return uiSel; }
private Element findUiSelect() { // In case of manual JQMContext.render() call, created could be still false, // but ui-select is already created, so set all needed properties before render() call. if (!created) return null; Element uiSel = JQMCommon.findChild(getElement(), "ui-select"); return uiSel; }
private void findUiInputText() { if (uiInputText == null && isInstance()) { uiInputText = JQMCommon.findChild(getElement(), "ui-input-text"); } }
@Override public void setTheme(String themeName) { JQMCommon.applyTheme(select, themeName); Element uiSel = findUiSelect(); if (uiSel != null) { Element btn = JQMCommon.findChild(uiSel, "ui-btn"); if (btn != null) JQMButton.setTheme(btn, themeName); } }
@Override public void setTheme(String themeName) { JQMCommon.applyTheme(select, themeName); Element uiSel = findUiSelect(); if (uiSel != null) { Element btn = JQMCommon.findChild(uiSel, "ui-btn"); if (btn != null) JQMButton.setTheme(btn, themeName); } }
private void findUiSelect() { if (uiSelect == null && isInstance(select.getElement())) { uiSelect = JQMCommon.findChild(getElement(), "ui-select"); } }
@Override public void setTheme(String themeName) { JQMCommon.applyTheme(select, themeName); findUiSelect(); if (uiSelect != null) { Element btn = JQMCommon.findChild(uiSelect, "ui-btn"); if (btn != null) JQMButton.setTheme(btn, themeName); } }
/** * @return - first child Element with specified className */ public static Element findChild(Element elt, String className) { if (elt == null) return null; if (JQMCommon.hasStyle(elt, className)) return elt; NodeList<Node> children = elt.getChildNodes(); if (children != null && children.getLength() > 0) { for (int i = 0; i < children.getLength(); i++) { Node child = children.getItem(i); if (child instanceof Element) { Element e = (Element) child; e = findChild(e, className); if (e != null) return e; } } } return null; }
/** * @return - first child Element with specified className */ public static Element findChild(Element elt, String className) { if (elt == null) return null; if (JQMCommon.hasStyle(elt, className)) return elt; NodeList<Node> children = elt.getChildNodes(); if (children != null && children.getLength() > 0) { for (int i = 0; i < children.getLength(); i++) { Node child = children.getItem(i); if (child instanceof Element) { Element e = (Element) child; e = findChild(e, className); if (e != null) return e; } } } return null; }
/** * @return - first child Element with specified className */ public static Element findChild(Element elt, String className) { if (elt == null) return null; if (JQMCommon.hasStyle(elt, className)) return elt; NodeList<Node> children = elt.getChildNodes(); if (children != null && children.getLength() > 0) { for (int i = 0; i < children.getLength(); i++) { Node child = children.getItem(i); if (child instanceof Element) { Element e = (Element) child; e = findChild(e, className); if (e != null) return e; } } } return null; }
private void refreshTrackTheme() { Element elt = select.getElement(); if (!select.isAttached() || !isReady(elt)) return; Element par = elt.getParentElement(); if (par == null) return; Element track = JQMCommon.findChild(par, "ui-flipswitch-on"); if (track != null && JQMCommon.hasStyle(track, "ui-btn")) { if (trackTheme != null && !trackTheme.isEmpty()) { track.removeClassName("ui-btn-inherit"); JQMButton.setTheme(track, trackTheme); } else { JQMButton.setTheme(track, "inherit"); track.removeAttribute("data-theme"); } } }
@Override public void onClick(ClickEvent event) { EventTarget target = event.getNativeEvent().getEventTarget(); if (target != null) { Element elt = target.cast(); findUiSelect(); if (uiSelect != null) { Element btn = JQMCommon.findChild(uiSelect, "ui-btn"); if (btn != null) { while (elt != null) { // filter out non-button related elements (label for instance) if (elt == btn) { handler.onClick(event); return; } elt = elt.getParentElement(); } } } } } }, ClickEvent.getType());
@Override public void onClick(ClickEvent event) { EventTarget target = event.getNativeEvent().getEventTarget(); if (target != null) { Element elt = target.cast(); Element uiSel = findUiSelect(); if (uiSel != null) { Element btn = JQMCommon.findChild(uiSel, "ui-btn"); if (btn != null) { while (elt != null) { // filter out non-button related elements (label for instance) if (elt == btn) { handler.onClick(event); return; } elt = elt.getParentElement(); } } } } } }, ClickEvent.getType());
@Override public void onClick(ClickEvent event) { EventTarget target = event.getNativeEvent().getEventTarget(); if (target != null) { Element elt = target.cast(); Element uiSel = findUiSelect(); if (uiSel != null) { Element btn = JQMCommon.findChild(uiSel, "ui-btn"); if (btn != null) { while (elt != null) { // filter out non-button related elements (label for instance) if (elt == btn) { handler.onClick(event); return; } elt = elt.getParentElement(); } } } } } }, ClickEvent.getType());
private void refreshTrackTheme() { Element elt = select.getElement(); if (!select.isAttached() || !isReady(elt)) return; Element par = elt.getParentElement(); if (par == null) return; Element track = JQMCommon.findChild(par, "ui-flipswitch-on"); if (track != null && JQMCommon.hasStyle(track, "ui-btn")) { if (trackTheme != null && !trackTheme.isEmpty()) { track.removeClassName("ui-btn-inherit"); JQMButton.setTheme(track, trackTheme); } else { JQMButton.setTheme(track, "inherit"); track.removeAttribute("data-theme"); } } }
private void prepareTransparentPrevPage(Element prevPage) { if (transparent && prevPage != null) { if (transparentPrevPage == prevPage) return; // already prepared transparentPrevPage = prevPage; prevPage.addClassName(UI_DIALOG_BACKGROUND); String s = prevPage.getAttribute(DATA_DOM_CACHE); if ("true".equals(s)) { transparentPrevPageClearCache = false; } else { transparentPrevPageClearCache = true; prevPage.setAttribute(DATA_DOM_CACHE, "true"); } if (!transparentDoPrevPageLifecycle) { JQMPage prev = findPage(transparentPrevPage); if (prev != null) JQMPage.unbindLifecycleEvents(prev.getElement()); } if (content != null) content.addStyleName(JQMCommon.STYLE_UI_BODY_INHERIT); Element dlgContain = JQMCommon.findChild(getElement(), UI_DIALOG_CONTAIN); if (dlgContain != null) dlgContain.addClassName(JQMCommon.STYLE_UI_BODY_INHERIT); } else { transparentPrevPage = null; transparentPrevPageClearCache = false; if (content != null) content.removeStyleName(JQMCommon.STYLE_UI_BODY_INHERIT); Element dlgContain = JQMCommon.findChild(getElement(), UI_DIALOG_CONTAIN); if (dlgContain != null) dlgContain.removeClassName(JQMCommon.STYLE_UI_BODY_INHERIT); } }
private void refreshTrackTheme() { Element elt = select.getElement(); if (!select.isAttached() || !isReady(elt)) return; Element par = elt.getParentElement(); if (par == null) return; Element track = JQMCommon.findChild(par, "ui-flipswitch-on"); if (track != null && JQMCommon.hasStyle(track, "ui-btn")) { if (trackTheme != null && !trackTheme.isEmpty()) { track.removeClassName("ui-btn-inherit"); JQMButton.setTheme(track, trackTheme); } else { JQMButton.setTheme(track, "inherit"); track.removeAttribute("data-theme"); } } }
/** * There is no "correct" way to restore page after it was called as dialog, * so this method is ugly hack, but it's useful and working. */ public void restoreRolePage() { JQMCommon.setDataRole(this, "page"); JQMCommon.setDataDialog(this, false); removeStyleName(STYLE_UI_DIALOG); Element elt = getElement(); Element dlgContain = JQMCommon.findChild(elt, UI_DIALOG_CONTAIN); if (dlgContain != null) { JQMCommon.moveChildren(dlgContain, elt); elt.removeChild(dlgContain); } JQMHeader h = getHeader(); if (h != null) { Element btn = JQMCommon.findChild(h.getElement(), "ui-btn-icon-notext"); if (btn != null && "#".equals(JQMCommon.getAttribute(btn, "href")) && (DataIcon.DELETE == JQMCommon.getIcon(btn) || DataIcon.DELETE == JQMCommon.getStyleIcon(btn))) { h.getElement().removeChild(btn); } } }
/** * There is no "correct" way to restore page after it was called as dialog, * so this method is ugly hack, but it's useful and working. */ public void restoreRolePage() { JQMCommon.setDataRole(this, "page"); JQMCommon.setDataDialog(this, false); removeStyleName(STYLE_UI_DIALOG); Element elt = getElement(); Element dlgContain = JQMCommon.findChild(elt, UI_DIALOG_CONTAIN); if (dlgContain != null) { JQMCommon.moveChildren(dlgContain, elt); elt.removeChild(dlgContain); } JQMHeader h = getHeader(); if (h != null) { Element btn = JQMCommon.findChild(h.getElement(), "ui-btn-icon-notext"); if (btn != null && "#".equals(JQMCommon.getAttribute(btn, "href")) && (DataIcon.DELETE == JQMCommon.getIcon(btn) || DataIcon.DELETE == JQMCommon.getStyleIcon(btn))) { h.getElement().removeChild(btn); } } }
/** * There is no "correct" way to restore page after it was called as dialog, * so this method is ugly hack, but it's useful and working. */ public void restoreRolePage() { JQMCommon.setDataRole(this, "page"); JQMCommon.setDataDialog(this, false); removeStyleName(STYLE_UI_DIALOG); Element elt = getElement(); Element dlgContain = JQMCommon.findChild(elt, UI_DIALOG_CONTAIN); if (dlgContain != null) { JQMCommon.moveChildren(dlgContain, elt); elt.removeChild(dlgContain); } JQMHeader h = getHeader(); if (h != null) { Element btn = JQMCommon.findChild(h.getElement(), "ui-btn-icon-notext"); if (btn != null && "#".equals(JQMCommon.getAttribute(btn, "href")) && (DataIcon.DELETE == JQMCommon.getIcon(btn) || DataIcon.DELETE == JQMCommon.getStyleIcon(btn))) { h.getElement().removeChild(btn); } } }