List of usage examples for com.google.gwt.dom.client Element addClassName
@Override
public boolean addClassName(String className)
From source file:cc.kune.polymer.client.PolymerUtils.java
License:GNU Affero Public License
public static void addLayout(final Element element, final Layout... layouts) { for (final Layout layout : layouts) { element.addClassName(layout.getAttribute()); // element.setAttribute(layout.getAttribute(), ""); }/*w w w. jav a 2s. com*/ }
From source file:cc.kune.pspace.client.PSpacePanel.java
License:GNU Affero Public License
/** * Instantiates a new p space panel.//from w w w . j av a 2 s.c o m * * @param guiProvider * the gui provider * @param res * the res * @param wsArmor * the ws armor * @param inDevelopment * the in development * @param i18n * the i18n */ @Inject public PSpacePanel(final GuiProvider guiProvider, final CoreResources res, final GSpaceArmor wsArmor, final PSpaceInDevelopment inDevelopment, final I18nTranslationService i18n) { widget = uiBinder.createAndBindUi(this); actionPanel = new ActionFlowPanel(guiProvider, i18n); actionPanelContainer.add(actionPanel); final Element layer = mainPanel.getWidgetContainerElement(messagePanel); layer.addClassName("k-publicspace-msg"); layer.addClassName("k-opacity80"); layer.addClassName("k-box-5shadow"); layer.addClassName("k-5corners"); icon.setResource(res.browser32()); // wsArmor.getPublicSpace().add(widget); frame.add(inDevelopment); }
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 a v a 2 s. c om*/ 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. * // w w w .java 2 s.c o m * @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 av a 2s . c om 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 w w w .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()); }/*w w w . j a v a 2 s . c o m*/ }
From source file:client.ui.components.MaterialItem.java
License:Open Source License
/** * Toggle the specified class.//from ww w .jav a2s .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 a va 2s . c o 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.geranium.client.ui.TabbedPanel.java
License:Open Source License
/** * Add a new tab with the provided name and content.<p> * //www . j a v a2 s . c o m * 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(); }