/** * Add a new tab with the provided name and content. * * <p>Wrapper function for {@link com.google.gwt.user.client.ui.TabLayoutPanel#add(Widget, * String)} * * @param tabContent the widget to add as a tab * @param tabName the name of the tab to display in the tabbar */ public void add(E tabContent, String tabName) { tabContent.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()); m_tabPanel.add(tabContent, tabName); Element tabRootEl = m_tabPanel.getElement(); // set an additional css class for the parent element of the .gwt-TabLayoutPanelTabs element List<Element> tabDivs = CmsDomUtil.getElementsByClass( I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelTab(), CmsDomUtil.Tag.div, tabRootEl); Iterator<Element> it = tabDivs.iterator(); boolean first = true; while (it.hasNext()) { Element e = it.next(); e.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerLeft()); e.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerRight()); if (first) { e.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerLeft()); first = false; } if (!it.hasNext()) { e.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerRight()); } } }
private void show(Element el, boolean show) { if (show) { el.removeClassName("hide"); } else { el.addClassName("hide"); } }
private void setSmallPhotosHtml(String html, boolean center) { if (center) { elSmallPhotosW.addClassName("sf-w__center"); } else { elSmallPhotosW.removeClassName("sf-w__center"); } elSmallPhotosW.setInnerHTML(html); }
/** * Enables the tab with the given index. * * <p> * * @param tabContent the content of the tab that should be enabled */ public void enableTab(E tabContent) { Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent)); Element tab = getTabElement(index.intValue()); if ((tab != null) && m_disabledTabIndexes.containsKey(index)) { tab.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled()); tab.setTitle(m_disabledTabIndexes.get(index)); m_disabledTabIndexes.remove(index); } }
@Override public void setLoading(boolean isLoading) { if (isLoading) { aLoadMore.addStyleName("hide"); divPreloader.removeClassName("hide"); } else { divPreloader.addClassName("hide"); aLoadMore.removeStyleName("hide"); } }
public void deselectAll() { if (currentActiveElementId != null) { Element e = elementsInPrimaryTab.get(currentActiveElementId); if (e == null) { e = elementsInSecondaryTab.get(currentActiveElementId); } if (e != null) { e.removeClassName("active"); } currentActiveElementId = null; } }
public void selectTab(int index, boolean fFireEvent) { Element toSelect = getTab(index); if (selected == toSelect) return; if (selected != null) selected.removeClassName(getStylePrimaryName() + "-Item-selected"); if (toSelect != null) toSelect.addClassName(getStylePrimaryName() + "-Item-selected"); selected = toSelect; if (fFireEvent) callback.onSelection(index); }
public void setChecked(boolean checked) { if (this.checked != checked) { this.checked = checked; if (this.checked && this.checkable) { markerElement.addClassName(appearance.css().iconCheckClass()); getElement().setAttribute("aria-checked", "true"); } else { markerElement.removeClassName(appearance.css().iconCheckClass()); getElement().setAttribute("aria-checked", "false"); } } }
public void setCheckable(boolean checkable) { if (this.checkable != checkable) { this.checkable = checkable; if (this.checkable) { if (this.iconClass != null) { markerElement.removeClassName(this.iconClass); } markerElement.getStyle().setDisplay(Style.Display.BLOCK); if (this.checked) { markerElement.addClassName("icon-check"); } } else { markerElement.getStyle().setDisplay(Style.Display.NONE); markerElement.removeClassName("icon-check"); } } }
/** * Enable/Disable dialog's resize support * * @param enabled */ public void enableResizeSupport(boolean enabled) { this.resizeSupportEnabled = enabled; Element dialogBottomRight = getElementByTagAndClassName("td", "dialogBottomRight"); // $NON-NLS-1$ //$NON-NLS-2$ assert dialogBottomRight != null; if (enabled) { dialogBottomRight.addClassName(STYLE_RESIZE_POSTFIX); } else { dialogBottomRight.removeClassName(STYLE_RESIZE_POSTFIX); } }
public void setIcon(String iconClass) { setCheckable(false); if (this.iconClass != null) { markerElement.removeClassName(this.iconClass); } if (iconClass != null) { this.iconClass = iconClass; markerElement.getStyle().setDisplay(Style.Display.BLOCK); markerElement.addClassName(iconClass); } else { markerElement.getStyle().setDisplay(Style.Display.NONE); } }
private void highlightRow(int row) { if (row != mLastRowSelected) { for (int i = 0; i < COLUMN_COUNT; i++) { Element selectedCell = DOM.getElementById("x" + i + "y" + row); if (selectedCell != null) { selectedCell.addClassName("selectedItem"); } // un-highlight old row Element oldCell = DOM.getElementById("x" + i + "y" + mLastRowSelected); if (oldCell != null) { oldCell.removeClassName("selectedItem"); } } mLastRowSelected = row; } }
/** * Handling MouseOut event. * * @param row - element to be processed. */ protected void setStyleNormal(Element row) { if (row != null) { row.removeClassName(POPUP_RESOURCES.popup().popupMenuItemOver()); } }
/** * Forces IE8 to reinterpret CSS rules. {@link * com.vaadin.client.Util#forceIE8Redraw(com.google.gwt.dom.client.Element)} doesn't work in this * case. * * @param element the element to redraw */ private void forceRedrawIfIE8(Element element) { if (BrowserInfo.get().isIE8()) { element.addClassName("foo"); element.removeClassName("foo"); } }