List of usage examples for com.google.gwt.dom.client Style setOpacity
public void setOpacity(double value)
From source file:com.allen_sauer.gwt.dnd.client.MouseDragHandler.java
License:Apache License
private void initCapturingWidget() { capturingWidget = new FocusPanel(); capturingWidget.addMouseMoveHandler(this); capturingWidget.addMouseUpHandler(this); capturingWidget.addTouchMoveHandler(this); capturingWidget.addTouchEndHandler(this); capturingWidget.addTouchCancelHandler(this); Style style = capturingWidget.getElement().getStyle(); // workaround for IE8 opacity http://code.google.com/p/google-web-toolkit/issues/detail?id=5538 style.setProperty("filter", "alpha(opacity=0)"); style.setOpacity(0); style.setZIndex(1000);/*from ww w . j av a 2 s . c om*/ style.setMargin(0, Style.Unit.PX); style.setBorderStyle(BorderStyle.NONE); style.setBackgroundColor("blue"); }
From source file:com.vaadin.client.debug.internal.Highlight.java
License:Apache License
/** * Highlight the given {@link Element} using the given color. * <p>/*from ww w. j av a2 s .c o m*/ * Pass the returned highlight {@link Element} to {@link #hide(Element)} to * remove this particular highlight. * </p> * * @param element * Element to highlight * @param color * Color of highlight * @return Highlight element */ static Element show(Element element, String color) { if (element != null) { if (highlights == null) { highlights = new HashSet<Element>(); } Element highlight = DOM.createDiv(); Style style = highlight.getStyle(); style.setTop(element.getAbsoluteTop(), Unit.PX); style.setLeft(element.getAbsoluteLeft(), Unit.PX); int width = element.getOffsetWidth(); if (width < MIN_WIDTH) { width = MIN_WIDTH; } style.setWidth(width, Unit.PX); int height = element.getOffsetHeight(); if (height < MIN_HEIGHT) { height = MIN_HEIGHT; } style.setHeight(height, Unit.PX); RootPanel.getBodyElement().appendChild(highlight); style.setPosition(Position.ABSOLUTE); style.setZIndex(VWindow.Z_INDEX + 1000); style.setBackgroundColor(color); style.setOpacity(DEFAULT_OPACITY); if (BrowserInfo.get().isIE()) { style.setProperty("filter", "alpha(opacity=" + (DEFAULT_OPACITY * 100) + ")"); } highlights.add(highlight); return highlight; } return null; }
From source file:com.vaadin.client.metadata.ConnectorBundleLoader.java
License:Apache License
private void notice(String productName) { if (notice == null) { notice = new HTML(); notice.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { notice.removeFromParent(); }//from w ww. j av a 2 s . co m }); notice.addTouchStartHandler(new TouchStartHandler() { public void onTouchStart(TouchStartEvent event) { notice.removeFromParent(); } }); } String msg = notice.getText().trim(); msg += msg.isEmpty() ? "Using Evaluation License of: " : ", "; notice.setText(msg + productName); RootPanel.get().add(notice); notice.getElement().setClassName(""); Style s = notice.getElement().getStyle(); s.setPosition(Position.FIXED); s.setTextAlign(TextAlign.CENTER); s.setRight(0, Unit.PX); s.setLeft(0, Unit.PX); s.setBottom(0, Unit.PX); s.setProperty("padding", "0.5em 1em"); s.setProperty("font-family", "sans-serif"); s.setFontSize(12, Unit.PX); s.setLineHeight(1.1, Unit.EM); s.setColor("white"); s.setBackgroundColor("black"); s.setOpacity(0.7); s.setZIndex(2147483646); s.setProperty("top", "auto"); s.setProperty("width", "auto"); s.setDisplay(Display.BLOCK); s.setWhiteSpace(WhiteSpace.NORMAL); s.setVisibility(Visibility.VISIBLE); s.setMargin(0, Unit.PX); }
From source file:info.magnolia.ui.vaadin.gwt.client.magnoliashell.viewport.ShellAppsTransitionDelegate.java
License:Open Source License
private void initAnimations() { this.fadeInAnimation = new FadeAnimation(ALPHA_MAX, false) { @Override// w w w .j a v a2 s .c om protected void onStart() { super.onStart(); Style style = getCurrentElement().getStyle(); String currentOpacity = style.getOpacity(); if (currentOpacity == null || currentOpacity.isEmpty()) { style.setOpacity(0d); } style.clearDisplay(); } }; this.fadeInAnimation.addCallback(new JQueryCallback() { @Override public void execute(JQueryWrapper query) { viewport.onShellAppLoaded(Util.<Widget>findWidget(query.get(0), null)); } }); this.slideUpAnimation = new SlideAnimation(false); this.slideDownAnimation = new SlideAnimation(false); this.slideDownAnimation.addCallback(new JQueryCallback() { @Override public void execute(JQueryWrapper query) { if (!slideDownAnimation.isCancelled()) { viewport.onShellAppLoaded(viewport.getVisibleChild()); } } }); this.slideUpAnimation.addCallback(new JQueryCallback() { @Override public void execute(JQueryWrapper query) { if (!slideUpAnimation.isCancelled()) { viewport.onShellAppsHidden(); } } }); this.fadeOutAnimation = new FadeAnimation(ALPHA_MIN, false); }
From source file:org.cruxframework.crux.widgets.client.grid.FrozenCellsScrollHandler.java
License:Apache License
/** * Freezes the grid columns that are assigned with <code>frozen=true</code> * @param newHorizontalScrollPosition//from w w w .j a v a2 s . co m */ private void maybeFreezeColumns(int newHorizontalScrollPosition) { boolean isHorizontalScroll = newHorizontalScrollPosition != lastHorizontalScrollPosition; if (isHorizontalScroll && tablelessStruct.getGrid().hasFrozenColumns()) { Lines lines = tablelessStruct.getLines(); int numLines = lines.getWidgetCount(); int lastFrozenCol = discoverLastFrozenColIndex(lines.getLine(0)); for (int i = 0; i < numLines; i++) { if (tablelessStruct.canFreezeColumns(i)) { Line line = lines.getLine(i); for (int j = 0; j <= lastFrozenCol; j++) { Element cellElem = line.getCell(j).getElement(); Style style = cellElem.getStyle(); style.setZIndex(i == 0 ? 4 : 2); style.setOpacity(1); HorizontalMotionAnimation columnAnimation = new HorizontalMotionAnimation(cellElem); columnAnimation.move(getIntegerPixelMeasure(cellElem.getStyle().getLeft()), newHorizontalScrollPosition, 200); } } } } }
From source file:org.cruxframework.crux.widgets.client.grid.FrozenCellsScrollHandler.java
License:Apache License
/** * Freezes the header line if the grid is assigned with <code>freezeHeaders=true</code> *//*from w w w. jav a 2 s . co m*/ private void maybeFreezeHeaders(int newVerticalScrollPosition) { boolean isVerticalScroll = newVerticalScrollPosition != lastVerticalScrollPosition; if (isVerticalScroll && tablelessStruct.getGrid().hasFrozenHeaders()) { Element headerLineElement = tablelessStruct.getLines().getLine(0).getElement(); Style style = headerLineElement.getStyle(); style.setZIndex(3); style.setOpacity(1); VerticalMotionAnimation headerAnimation = new VerticalMotionAnimation(headerLineElement); headerAnimation.move(headerLineElement.getOffsetTop(), newVerticalScrollPosition, -1); } }
From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java
License:Apache License
/** * Constructor//from www . j ava 2 s. c om */ public HorizontalSwapPanel() { contentPanel = new FlowPanel(); initWidget(contentPanel); setStyleName("crux-HorizontalSwapPanel"); Style style = contentPanel.getElement().getStyle(); style.setPosition(Position.RELATIVE); style.setOverflow(Overflow.HIDDEN); style.setWidth(100, Unit.PCT); style.setVisibility(Visibility.VISIBLE); style.setOpacity(1); configureCurrentPanel(); configureNextPanel(); Transition.hideBackface(currentPanel); Transition.hideBackface(nextPanel); contentPanel.add(currentPanel); contentPanel.add(nextPanel); }
From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java
License:Apache License
private void configureCurrentPanel() { Transition.resetTransition(currentPanel); Style style = currentPanel.getElement().getStyle(); style.setPosition(Position.RELATIVE); style.setTop(0, Unit.PX);/*from w w w.ja v a2s. c o m*/ style.setLeft(0, Unit.PX); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setOverflowX(Overflow.HIDDEN); style.setOverflowY(Overflow.VISIBLE); style.setVisibility(Visibility.VISIBLE); style.setOpacity(1); }
From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java
License:Apache License
private void configureNextPanel() { Style style = nextPanel.getElement().getStyle(); style.setTop(0, Unit.PX);/*www .j av a2s. co m*/ style.setLeft(0, Unit.PX); style.setPosition(Position.ABSOLUTE); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setOverflowX(Overflow.HIDDEN); style.setOverflowY(Overflow.VISIBLE); style.setVisibility(Visibility.HIDDEN); style.setOpacity(0); }
From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java
License:Apache License
private void prepareNextPanelToSlideIn(Widget w, Direction direction) { try {/*from www . j av a2 s .c o m*/ nextPanel.clear(); } catch (Exception e) { nextPanel = new SimplePanel(); } nextPanel.add(w); int left; if (direction.equals(Direction.FORWARD)) { left = contentPanel.getOffsetWidth(); } else { left = -contentPanel.getOffsetWidth(); } Transition.translateX(nextPanel, left, null); Style style = nextPanel.getElement().getStyle(); style.setVisibility(Visibility.VISIBLE); style.setOpacity(1); }