com.google.gwt.dom.client.Style.Visibility Java Examples
The following examples show how to use
com.google.gwt.dom.client.Style.Visibility.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Scrollbar.java From djvu-html5 with GNU General Public License v2.0 | 6 votes |
public void setThumb(double center, double width) { Style style = getElement().getStyle(); if (width >= 1) { style.setVisibility(Visibility.HIDDEN); return; } else { style.setVisibility(Visibility.VISIBLE); } if (isHorizontal) { style.setLeft(100 * (center - width / 2), Unit.PCT); style.setRight(100 * (1 - center - width / 2), Unit.PCT); } else { style.setTop(100.0 * (center - width / 2), Unit.PCT); style.setBottom(100 * (1 - center - width / 2), Unit.PCT); } }
Example #2
Source File: CenterPopupPositioner.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void setPopupPositionAndMakeVisible(Element relative, final Element p) { ScheduleCommand.addCommand(new Scheduler.Task() { @Override public void execute() { p.getStyle().setLeft((RootPanel.get().getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX); int height = PositionUtil.boundHeightToScreen(p.getOffsetHeight()); int top = (RootPanel.get().getOffsetHeight() - height) / 2; // Prevent negative top position. p.getStyle().setTop(Math.max(top, MIN_OFFSET_HEIGHT_DEFAULT), Unit.PX); p.getStyle().setHeight(height, Unit.PX); p.getStyle().setVisibility(Visibility.VISIBLE); } }); }
Example #3
Source File: CenterPopupPositioner.java From swellrt with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void setPopupPositionAndMakeVisible(Element relative, final Element p) { ScheduleCommand.addCommand(new Scheduler.Task() { @Override public void execute() { p.getStyle().setLeft((RootPanel.get().getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX); int height = PositionUtil.boundHeightToScreen(p.getOffsetHeight()); int top = (RootPanel.get().getOffsetHeight() - height) / 2; // Prevent negative top position. p.getStyle().setTop(Math.max(top, MIN_OFFSET_HEIGHT_DEFAULT), Unit.PX); p.getStyle().setHeight(height, Unit.PX); p.getStyle().setVisibility(Visibility.VISIBLE); } }); }
Example #4
Source File: ContextFieldSet.java From bitcoin-transaction-explorer with MIT License | 6 votes |
private void displayContextPopup(final Widget target, final Widget popupContent) { if (!popupPanel.isShowing()) { popupContent.getElement().getStyle().setVisibility(Visibility.HIDDEN); } popupPanel.setWidget(popupContent); popupPanel.show(); attachRegistration = target.addAttachHandler(attachHandler); // Defer the attach event because we don't have the element's width/height at this point Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { popupPanel.attachToWidget(target); popupContent.getElement().getStyle().clearVisibility(); } }); }
Example #5
Source File: SvgArrowWidget.java From gantt with Apache License 2.0 | 6 votes |
protected void handleMove(NativeEvent event) { Point movePoint = new Point(getTouchOrMouseClientX(event), getTouchOrMouseClientY(event)); updateMovingData(movePoint); setWidth(movingData.getWidth()); setHeight(movingData.getHeight()); setTop((int) movingData.getTop()); setLeft((int) movingData.getLeft()); startingPoint.getStyle().setVisibility(Visibility.HIDDEN); endingPoint.getStyle().setVisibility(Visibility.HIDDEN); internalDrawCurve(movingData); event.stopPropagation(); }
Example #6
Source File: SearchPanelWidget.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void setShowMoreVisible(boolean visible) { // In order to keep the padding effect, the button always need to be present // in order to affect layout. Just make it invisible and non-clickable. if (visible) { showMore.getStyle().clearVisibility(); } else { showMore.getStyle().setVisibility(Visibility.HIDDEN); } }
Example #7
Source File: DesktopUniversalPopup.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void show() { // nothing to do if we are already visible. if (showing) { return; } // we are invisbile, need to set up the popup getElement().getStyle().setVisibility(Visibility.HIDDEN); getElement().getStyle().setOpacity(0.0); if (isMaskEnabled) { setMaskVisible(true); } RootPanel.get().add(this); if (shouldAutoHide) { registerAutoHider(); } if (positioner != null) { position(); } else { getElement().getStyle().setVisibility(Visibility.VISIBLE); } for (PopupEventListener listener : listeners) { listener.onShow(this); } // trigger the fade-in animation getElement().removeClassName(Resources.INSTANCE.css().fadeOut()); getElement().addClassName(Resources.INSTANCE.css().fadeIn()); getOffsetWidth(); // force update getElement().getStyle().setOpacity(1.0); // change state to appearing showing = true; }
Example #8
Source File: InteractiveSuggestionsManager.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void setPopupPositionAndMakeVisible(Element reference, final Element popup) { Style popupStyle = popup.getStyle(); // TODO(danilatos): Do something more intelligent than arbitrary constants (which might be // susceptible to font size changes, etc) popupStyle.setLeft(popupAnchor.getAbsoluteLeft() - popup.getOffsetWidth() + 26, Unit.PX); popupStyle.setTop(popupAnchor.getAbsoluteBottom() + 5, Unit.PX); popupStyle.setVisibility(Visibility.VISIBLE); }
Example #9
Source File: ImageThumbnailWidget.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Get the thumbnail to load its image from the given url. * @param url */ public void loadImage(final String url) { // Remove the old double loader to stop the last double buffered load. if (onLoadHandlerRegistration != null) { onLoadHandlerRegistration.removeHandler(); onErrorHandlerRegistration.removeHandler(); // We used to set doubleLoadedImage's url to "" here. // It turns out to be a really bad thing to do. Setting an url to null // cause Wfe's bootstrap servelet to get called, which overload the server. RootPanel.get().remove(doubleLoadedImage); } // set up the handler to hide spinning wheel when loading has finished // We need to have the doubleLoadedImage created even if we are loading the image directly // in imageToLoad. This is done because we don't get a event otherwise. DoubleLoadHandler doubleLoadHandler = new DoubleLoadHandler(url); onLoadHandlerRegistration = doubleLoadedImage.addLoadHandler(doubleLoadHandler); onErrorHandlerRegistration = doubleLoadedImage.addErrorHandler(doubleLoadHandler); error.setVisible(false); doubleLoadedImage.setVisible(false); doubleLoadedImage.setUrl(url); RootPanel.get().add(doubleLoadedImage); imageToLoad.getElement().getStyle().setVisibility(Visibility.HIDDEN); // If image is empty, show the url directly. if (imageToLoad.getUrl().length() == 0) { imageToLoad.setUrl(url); } }
Example #10
Source File: SearchPanelWidget.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void setShowMoreVisible(boolean visible) { // In order to keep the padding effect, the button always need to be present // in order to affect layout. Just make it invisible and non-clickable. if (visible) { showMore.getStyle().clearVisibility(); } else { showMore.getStyle().setVisibility(Visibility.HIDDEN); } }
Example #11
Source File: SvgArrowWidget.java From gantt with Apache License 2.0 | 5 votes |
protected void resetArrow() { setWidth(originalData.getWidth()); setHeight(originalData.getHeight()); setTop((int) originalData.getTop()); setLeft((int) originalData.getLeft()); draw(originalData); startingPoint.getStyle().setVisibility(Visibility.VISIBLE); endingPoint.getStyle().setVisibility(Visibility.VISIBLE); }
Example #12
Source File: SvgArrowWidget.java From gantt with Apache License 2.0 | 5 votes |
protected void startMoving(NativeEvent event, Element element) { if (element.equals(startingPoint)) { selectPredecessorMode = true; startingPoint.getStyle().setVisibility(Visibility.HIDDEN); } else if (element.equals(endingPoint)) { selectFollowerMode = true; endingPoint.getStyle().setVisibility(Visibility.HIDDEN); } capturePointScrollTop = getElement().getParentElement() .getParentElement().getScrollTop(); capturePointScrollLeft = getElement().getParentElement() .getParentElement().getScrollLeft(); getParent().getElement().appendChild(movePointElement); getElement().getParentElement().addClassName(SELECTION_STYLE_NAME); GWT.log("Capturing clicked point."); captureElement = getElement(); Event.setCapture(getElement()); event.stopPropagation(); // enable MODE for new predecessor/following step // selection. addMoveHandler(); capturePoint = new Point(getTouchOrMouseClientX(event), getTouchOrMouseClientY(event)); originalWidth = width; originalHeight = height; }
Example #13
Source File: SvgArrowWidget.java From gantt with Apache License 2.0 | 5 votes |
protected Element createSnapshotElement(Point point) { int deltaX = (int) (point.getX() - capturePoint.getX()); int deltaY = (int) (point.getY() - capturePoint.getY()); int scrollDeltaY = getElement().getParentElement().getParentElement() .getScrollTop() - capturePointScrollTop; int scrollDeltaX = getElement().getParentElement().getParentElement() .getScrollLeft() - capturePointScrollLeft; int originalTopPoint = selectPredecessorMode ? originalData .calcStartPointY() : originalData.calcEndPointY(); int originalLeftPoint = selectPredecessorMode ? originalData .calcStartPointX() : originalData.calcEndPointX(); movePointElement.getStyle().setVisibility(Visibility.HIDDEN); movePointElement.getStyle().setPosition(Position.ABSOLUTE); movePointElement.getStyle().setTop( Math.max(0, originalData.getTop() + originalTopPoint + deltaY + scrollDeltaY), Unit.PX); movePointElement.getStyle().setLeft( Math.max(0, originalData.getLeft() + originalLeftPoint + deltaX + scrollDeltaX), Unit.PX); movePointElement.getStyle().setWidth(2, Unit.PX); movePointElement.getStyle().setHeight(2, Unit.PX); return movePointElement; }
Example #14
Source File: SvgArrowWidget.java From gantt with Apache License 2.0 | 5 votes |
@Override public void draw(ArrowPositionData d) { originalData = d; startingPoint.getStyle().setVisibility(Visibility.VISIBLE); endingPoint.getStyle().setVisibility(Visibility.VISIBLE); internalDraw(d); }
Example #15
Source File: AbstractStepWidget.java From gantt with Apache License 2.0 | 5 votes |
public AbstractStepWidget() { DivElement bar = DivElement.as(DOM.createDiv()); bar.setClassName(STYLE_BAR); setElement(bar); caption = DivElement.as(DOM.createDiv()); caption.setClassName(STYLE_BAR_LABEL); bar.appendChild(caption); // hide by default bar.getStyle().setVisibility(Visibility.HIDDEN); }
Example #16
Source File: DesktopUniversalPopup.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void show() { // nothing to do if we are already visible. if (showing) { return; } // we are invisbile, need to set up the popup getElement().getStyle().setVisibility(Visibility.HIDDEN); getElement().getStyle().setOpacity(0.0); if (isMaskEnabled) { setMaskVisible(true); } RootPanel.get().add(this); if (shouldAutoHide) { registerAutoHider(); } if (positioner != null) { position(); } else { getElement().getStyle().setVisibility(Visibility.VISIBLE); } for (PopupEventListener listener : listeners) { listener.onShow(this); } // trigger the fade-in animation getElement().removeClassName(Resources.INSTANCE.css().fadeOut()); getElement().addClassName(Resources.INSTANCE.css().fadeIn()); getOffsetWidth(); // force update getElement().getStyle().setOpacity(1.0); // change state to appearing showing = true; }
Example #17
Source File: InteractiveSuggestionsManager.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void setPopupPositionAndMakeVisible(Element reference, final Element popup) { Style popupStyle = popup.getStyle(); // TODO(danilatos): Do something more intelligent than arbitrary constants (which might be // susceptible to font size changes, etc) popupStyle.setLeft(popupAnchor.getAbsoluteLeft() - popup.getOffsetWidth() + 26, Unit.PX); popupStyle.setTop(popupAnchor.getAbsoluteBottom() + 5, Unit.PX); popupStyle.setVisibility(Visibility.VISIBLE); }
Example #18
Source File: ImageThumbnailWidget.java From swellrt with Apache License 2.0 | 5 votes |
/** * Get the thumbnail to load its image from the given url. * @param url */ public void loadImage(final String url) { // Remove the old double loader to stop the last double buffered load. if (onLoadHandlerRegistration != null) { onLoadHandlerRegistration.removeHandler(); onErrorHandlerRegistration.removeHandler(); // We used to set doubleLoadedImage's url to "" here. // It turns out to be a really bad thing to do. Setting an url to null // cause Wfe's bootstrap servelet to get called, which overload the server. RootPanel.get().remove(doubleLoadedImage); } // set up the handler to hide spinning wheel when loading has finished // We need to have the doubleLoadedImage created even if we are loading the image directly // in imageToLoad. This is done because we don't get a event otherwise. DoubleLoadHandler doubleLoadHandler = new DoubleLoadHandler(url); onLoadHandlerRegistration = doubleLoadedImage.addLoadHandler(doubleLoadHandler); onErrorHandlerRegistration = doubleLoadedImage.addErrorHandler(doubleLoadHandler); error.setVisible(false); doubleLoadedImage.setVisible(false); doubleLoadedImage.setUrl(url); RootPanel.get().add(doubleLoadedImage); imageToLoad.getElement().getStyle().setVisibility(Visibility.HIDDEN); // If image is empty, show the url directly. if (imageToLoad.getUrl().length() == 0) { imageToLoad.setUrl(url); } }
Example #19
Source File: ListRelativePopupPositioner.java From swellrt with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public void setPopupPositionAndMakeVisible(final Element relative, final Element p) { ScheduleCommand.addCommand(new Scheduler.Task() { public void execute() { Style s = p.getStyle(); int horizontalCenter = RootPanel.get().getOffsetWidth() / 2; int verticalCenter = RootPanel.get().getOffsetHeight() / 2; int left = relative.getAbsoluteLeft(); int right = relative.getAbsoluteRight(); int top = relative.getAbsoluteTop(); int bottom = relative.getAbsoluteBottom(); if (inHorizontalList) { // Place popup above or below relative if (right > horizontalCenter) { // Place popup left of relative's right s.setRight(RootPanel.get().getOffsetWidth() - right + PIXEL_OFFSET, Unit.PX); if (top < verticalCenter) { // Place popup below bottom of relative s.setTop(bottom, Unit.PX); } else { // Place popup above top of relative s.setBottom(RootPanel.get().getOffsetHeight() - top, Unit.PX); } } else { // Place popup right of relative's left s.setLeft(left + PIXEL_OFFSET, Unit.PX); if (top < verticalCenter) { // Place popup below bottom of relative s.setTop(bottom, Unit.PX); } else { // Place popup above top of relative s.setBottom(RootPanel.get().getOffsetHeight() - top, Unit.PX); } } } else { // Place popup on left or right side of relative if (right > horizontalCenter) { // Place popup left of relative's left s.setRight(RootPanel.get().getOffsetWidth() - left, Unit.PX); if (top < verticalCenter) { // Place popup below top of relative s.setTop(top + PIXEL_OFFSET, Unit.PX); } else { // Place popup above bottom of relative s.setBottom(RootPanel.get().getOffsetHeight() - bottom + PIXEL_OFFSET, Unit.PX); } } else { // Place popup right of relative's right s.setLeft(right, Unit.PX); if (top < verticalCenter) { // Place popup below top of relative s.setTop(top + PIXEL_OFFSET, Unit.PX); } else { // Place popup above bottom of relative s.setBottom(RootPanel.get().getOffsetHeight() - bottom + PIXEL_OFFSET, Unit.PX); } } } p.getStyle().setVisibility(Visibility.VISIBLE); } }); }
Example #20
Source File: ListRelativePopupPositioner.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public void setPopupPositionAndMakeVisible(final Element relative, final Element p) { ScheduleCommand.addCommand(new Scheduler.Task() { public void execute() { Style s = p.getStyle(); int horizontalCenter = RootPanel.get().getOffsetWidth() / 2; int verticalCenter = RootPanel.get().getOffsetHeight() / 2; int left = relative.getAbsoluteLeft(); int right = relative.getAbsoluteRight(); int top = relative.getAbsoluteTop(); int bottom = relative.getAbsoluteBottom(); if (inHorizontalList) { // Place popup above or below relative if (right > horizontalCenter) { // Place popup left of relative's right s.setRight(RootPanel.get().getOffsetWidth() - right + PIXEL_OFFSET, Unit.PX); if (top < verticalCenter) { // Place popup below bottom of relative s.setTop(bottom, Unit.PX); } else { // Place popup above top of relative s.setBottom(RootPanel.get().getOffsetHeight() - top, Unit.PX); } } else { // Place popup right of relative's left s.setLeft(left + PIXEL_OFFSET, Unit.PX); if (top < verticalCenter) { // Place popup below bottom of relative s.setTop(bottom, Unit.PX); } else { // Place popup above top of relative s.setBottom(RootPanel.get().getOffsetHeight() - top, Unit.PX); } } } else { // Place popup on left or right side of relative if (right > horizontalCenter) { // Place popup left of relative's left s.setRight(RootPanel.get().getOffsetWidth() - left, Unit.PX); if (top < verticalCenter) { // Place popup below top of relative s.setTop(top + PIXEL_OFFSET, Unit.PX); } else { // Place popup above bottom of relative s.setBottom(RootPanel.get().getOffsetHeight() - bottom + PIXEL_OFFSET, Unit.PX); } } else { // Place popup right of relative's right s.setLeft(right, Unit.PX); if (top < verticalCenter) { // Place popup below top of relative s.setTop(top + PIXEL_OFFSET, Unit.PX); } else { // Place popup above bottom of relative s.setBottom(RootPanel.get().getOffsetHeight() - bottom + PIXEL_OFFSET, Unit.PX); } } } p.getStyle().setVisibility(Visibility.VISIBLE); } }); }
Example #21
Source File: CellBrowser.java From consulo with Apache License 2.0 | 4 votes |
protected <T> CellBrowser(Builder<T> builder) { super(builder.viewModel); if (template == null) { template = GWT.create(Template.class); } Resources resources = builder.resources(); this.style = resources.cellBrowserStyle(); this.style.ensureInjected(); this.cellListResources = new CellListResourcesImpl(resources); this.loadingIndicator = builder.loadingIndicator; this.pagerFactory = builder.pagerFactory; this.pageSize = builder.pageSize; initWidget(new SplitLayoutPanel()); getElement().getStyle().setOverflow(Overflow.AUTO); setStyleName(this.style.cellBrowserWidget()); // Initialize the open and close images strings. ImageResource treeOpen = resources.cellBrowserOpen(); ImageResource treeClosed = resources.cellBrowserClosed(); openImageHtml = getImageHtml(treeOpen); closedImageHtml = getImageHtml(treeClosed); imageWidth = Math.max(treeOpen.getWidth(), treeClosed.getWidth()); minWidth = imageWidth + 20; // Add a placeholder to maintain the scroll width. scrollLock = Document.get().createDivElement(); scrollLock.getStyle().setPosition(Position.ABSOLUTE); scrollLock.getStyle().setVisibility(Visibility.HIDDEN); scrollLock.getStyle().setZIndex(-32767); scrollLock.getStyle().setTop(0, Unit.PX); if (LocaleInfo.getCurrentLocale().isRTL()) { scrollLock.getStyle().setRight(0, Unit.PX); } else { scrollLock.getStyle().setLeft(0, Unit.PX); } scrollLock.getStyle().setHeight(1, Unit.PX); scrollLock.getStyle().setWidth(1, Unit.PX); getElement().appendChild(scrollLock); // Associate the first view with the rootValue. appendTreeNode(getNodeInfo(builder.rootValue), builder.rootValue); // Catch scroll events. sinkEvents(Event.ONSCROLL); }