List of usage examples for com.google.gwt.dom.client Element removeClassName
@Override
public boolean removeClassName(String className)
From source file:cc.kune.polymer.client.PolymerUtils.java
License:GNU Affero Public License
public static void removeLayout(final Element element, final Layout... layouts) { for (final Layout layout : layouts) { element.removeClassName(layout.getAttribute()); // element.removeAttribute(layout.getAttribute()); }// w w w . java2 s. co m }
From source file:ch.takoyaki.email.html.client.ui.generic.ScrolledTabLayoutPanel.java
License:Open Source License
private void indentTabbar(boolean indent) { Element container = tabBar.getElement().getParentElement(); container.addClassName("scroll_tabs"); if (indent) { container.addClassName("scroll"); } else {/*from w w w . j ava 2 s .com*/ container.removeClassName("scroll"); } }
From source file:ch.unifr.pai.twice.dragndrop.client.MPDragNDrop.java
License:Apache License
/** * This method looks up all the drop targets which are intersecting with the given element. If the drop targets differ in their priorities ({@link Priority} * ), only widgets of the highest priority are returned. * //from w ww . j av a 2 s .c om * @param e * - a HTML element (typically the HTML element of the dragged widget) * @return the drop target widgets which are intersecting with the given element and do have the highest priority */ protected Set<Widget> getAffectedDropTargets(Element e) { int w1X = e.getAbsoluteLeft(); int w1Y = e.getAbsoluteTop(); int w1Width = e.getOffsetWidth(); int w1Height = e.getOffsetHeight(); Map<Integer, HashSet<Widget>> targets = new HashMap<Integer, HashSet<Widget>>(); for (Widget w2 : dropTargetRegistry.keySet()) { int w2X = w2.getAbsoluteLeft(); int w2Y = w2.getAbsoluteTop(); boolean xCollision = w1X < w2X ? w2X - w1X < w1Width : w1X - w2X < w2.getOffsetWidth(); boolean yCollision = w1Y < w2Y ? w2Y - w1Y < w1Height : w1Y - w2Y < w2.getOffsetHeight(); String idStyle = w2.getElement().getId() != null && !w2.getElement().getId().equals("") ? "hover-" + w2.getElement().getId() : null; if (xCollision && yCollision) { if (idStyle != null) { e.addClassName(idStyle); } DropTargetHandler h = dropTargetRegistry.get(w2); if (h != null) { int prio = h.getPriority().getValue(); HashSet<Widget> widgetsForPrio = targets.get(prio); if (widgetsForPrio == null) { widgetsForPrio = new HashSet<Widget>(); targets.put(prio, widgetsForPrio); } widgetsForPrio.add(w2); } } else if (idStyle != null) { e.removeClassName(idStyle); } } if (targets.isEmpty()) return null; int maxprio = 0; for (Integer i : targets.keySet()) { if (i > maxprio) { maxprio = i; } } return targets.get(maxprio); }
From source file:client.dashboard.Dashboard.java
License:Open Source License
/** * Enable or disable scrollbars depending on the current tab. * * @param seriesTabCoordinator {@code TabCoordinator} managing series tabs. * @param tabIndex Index of the current tab. *///from w w w. j a va 2s . c o m private void autoEnableScroll(TabCoordinator<SeriesManager> seriesTabCoordinator, int tabIndex) { Element overlayElement = overlay.getElement(); if (tabIndex == 0) { overlayElement.addClassName(CLASS_NAME_OVERLAY_SCROLL); } else { overlayElement.removeClassName(CLASS_NAME_OVERLAY_SCROLL); } SeriesView view = (SeriesView) seriesTabCoordinator.getView(0); if (view != null) { if (tabIndex == 0) { view.setScrollEnabled(true); } else { view.setScrollEnabled(false); } } }
From source file:client.ui.components.MaterialButton.java
License:Open Source License
/** * Toggle the specified class./*from www.j a v a2 s . com*/ * * @param cls {@link Class} to toggle. * @param toggle Whether to add or remove the class. */ private void toggleClass(Class cls, boolean toggle) { Element anchorElement = anchor.getElement(); if (toggle) { anchorElement.addClassName(cls.getName()); } else { anchorElement.removeClassName(cls.getName()); } }
From source file:client.ui.components.MaterialItem.java
License:Open Source License
@Override public void onClick(ClickEvent event) { if (animationEnabled) { Element inkElement = ink.getElement(); inkElement.removeClassName(Class.ANIMATE.getName()); Style style = inkElement.getStyle(); int size = panel.getOffsetWidth(); style.setWidth(size, Style.Unit.PX); style.setHeight(size, Style.Unit.PX); style.setMarginLeft(-size / 2, Style.Unit.PX); style.setMarginTop(-size / 2, Style.Unit.PX); style.setLeft(event.getX(), Style.Unit.PX); style.setTop(event.getY(), Style.Unit.PX); inkElement.addClassName(Class.ANIMATE.getName()); }//from ww w . ja va 2 s . com }
From source file:client.ui.components.MaterialItem.java
License:Open Source License
/** * Toggle the specified class.// ww w . j a v a 2s .c o m * * @param cls {@link Class} to toggle. * @param toggle Whether to add or remove the class. */ private void toggleClass(Class cls, boolean toggle) { Element panelElement = panel.getElement(); if (toggle) { panelElement.addClassName(cls.getName()); } else { panelElement.removeClassName(cls.getName()); } }
From source file:client.ui.views.series.SeriesView.java
License:Open Source License
/** * Set whether scrollbars are enabled./* w w w.j av a2 s . co m*/ * * @param enabled Whether scrollbars are enabled. */ public void setScrollEnabled(final boolean enabled) { final Element element = (Element) getElement().getFirstChild(); boolean scrollEnabled = element.hasClassName(CLASS_NAME_SCROLL); if ((scrollEnabled && !enabled) || (!scrollEnabled && enabled)) { if (enabled) { (new Timer() { @Override public void run() { element.addClassName(CLASS_NAME_SCROLL); } }).schedule(SCROLL_DELAY); } else { element.removeClassName(CLASS_NAME_SCROLL); } } }
From source file:com.alkacon.acacia.client.ui.AttributeValueView.java
License:Open Source License
/** * Removes the drag helper styles from the given element.<p> * //from w ww . j a v a 2 s . co m * @param helper the helper element */ private void removeDragHelperStyles(Element helper) { Style style = helper.getStyle(); style.clearTop(); style.clearLeft(); style.clearPosition(); style.clearWidth(); helper.removeClassName(formCss().dragHelper()); }
From source file:com.alkacon.geranium.client.ui.TabbedPanel.java
License:Open Source License
/** * Add a new tab with the provided name and content.<p> * //from w w w . j a v a 2 s. c om * 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_LayoutBundle.INSTANCE.generalCss().cornerAll()); m_tabPanel.add(tabContent, DomUtil.stripHtml(tabName)); Element tabRootEl = m_tabPanel.getElement(); // set an additional css class for the parent element of the .gwt-TabLayoutPanelTabs element List<Element> tabDivs = DomUtil.getElementsByClass( I_LayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelTab(), DomUtil.Tag.div, tabRootEl); Iterator<Element> it = tabDivs.iterator(); boolean first = true; while (it.hasNext()) { Element e = it.next(); e.removeClassName(I_LayoutBundle.INSTANCE.tabbedPanelCss().cornerLeft()); e.removeClassName(I_LayoutBundle.INSTANCE.tabbedPanelCss().cornerRight()); if (first) { e.addClassName(I_LayoutBundle.INSTANCE.tabbedPanelCss().cornerLeft()); first = false; } if (!it.hasNext()) { e.addClassName(I_LayoutBundle.INSTANCE.tabbedPanelCss().cornerRight()); } } m_tabPanel.checkTabOverflow(); }