List of usage examples for com.google.gwt.user.client.ui Widget addStyleDependentName
public void addStyleDependentName(String styleSuffix)
From source file:gwtBlocks.client.views.WidgetFactory.java
License:Apache License
private static MouseListener getIconMouseListener(final String suffix) { if (_iconMouseListener == null) _iconMouseListener = new MouseListenerAdapter() { public void onMouseDown(Widget sender, int x, int y) { sender.addStyleDependentName("down"); if (suffix != null) sender.addStyleDependentName("down-" + suffix); }/*from w w w.ja va2 s . co m*/ public void onMouseUp(Widget sender, int x, int y) { sender.removeStyleDependentName("down"); sender.removeStyleDependentName("down-" + suffix); } public void onMouseEnter(Widget sender) { sender.addStyleDependentName("hover"); if (suffix != null) sender.addStyleDependentName("hover-" + suffix); } public void onMouseLeave(Widget sender) { sender.removeStyleDependentName("hover"); sender.removeStyleDependentName("down"); sender.removeStyleDependentName("hover-" + suffix); sender.removeStyleDependentName("down-" + suffix); } }; return _iconMouseListener; }
From source file:org.cruxframework.crux.widgets.client.promobanner.BannerImpl.java
License:Apache License
protected void switchActiveBullet(int i) { for (int b = 0; b < bullets.getWidgetCount(); b++) { Widget bullet = bullets.getWidget(b); if (b == i) { bullet.addStyleDependentName("active"); } else {/*from w w w. j a va2s . c o m*/ bullet.removeStyleDependentName("active"); } } }
From source file:org.freemedsoftware.gwt.client.widget.AccordionPanel.java
License:Open Source License
protected void selectPanel(Widget widget, Label label) { widget.addStyleDependentName("selected"); currentlyExpanded = widget.getParent(); currentlyExpandedLabel = label;/*from www. j a va 2s . c om*/ currentlyExpandedLabel.addStyleDependentName("selected"); Element elem = widget.getParent().getElement(); DOM.setStyleAttribute(elem, "overflow", "auto"); DOM.setStyleAttribute(elem, animField, "auto"); elem.getStyle().setDisplay(Display.BLOCK); }
From source file:org.freemedsoftware.gwt.client.widget.AccordionPanel.java
License:Open Source License
private void expand(final Label label, final Widget c) { // c.getParent().getElement().setAttribute("style", ""); if (currentlyExpanded != null) { DOM.setStyleAttribute(currentlyExpanded.getElement(), "overflow", "hidden"); }/*from w ww .j a v a2 s . c o m*/ final Timer t = new Timer() { int frame = 0; public void run() { if (currentlyExpanded != null) { Widget w = currentlyExpanded; Element elem = w.getElement(); int oSh = DOM.getElementPropertyInt(elem, animBounds); DOM.setStyleAttribute(elem, animField, "" + ((NUM_FRAMES - frame) * oSh / NUM_FRAMES) + "px"); } if (currentlyExpanded != c) { Widget w = c; Element elem = w.getElement(); int oSh = DOM.getElementPropertyInt(elem, animBounds); DOM.setStyleAttribute(elem, animField, "" + (frame * oSh / NUM_FRAMES) + "px"); } frame++; if (frame <= NUM_FRAMES) { schedule(10); } else { if (currentlyExpanded != null) { currentlyExpanded.removeStyleDependentName("selected"); currentlyExpandedLabel.removeStyleDependentName("selected"); currentlyExpanded.getElement().getStyle().setDisplay(Display.NONE); } c.addStyleDependentName("selected"); if (currentlyExpanded != c) { currentlyExpanded = c; currentlyExpandedLabel = label; currentlyExpandedLabel.addStyleDependentName("selected"); Element elem = c.getElement(); DOM.setStyleAttribute(elem, "overflow", "auto"); DOM.setStyleAttribute(elem, animField, "auto"); elem.getStyle().setDisplay(Display.BLOCK); } else { currentlyExpanded = null; } } } }; t.schedule(10); }