List of usage examples for com.google.gwt.dom.client Style setBottom
public void setBottom(double value, Unit unit)
From source file:org.gwtbootstrap3.extras.gallery.client.ui.GalleryImage.java
License:Apache License
@Override public void setHeight(String height) { super.setHeight(height); image.setHeight(height);/*from w w w . ja v a 2 s. c o m*/ Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { for (Widget child : GalleryImage.this) { if (child instanceof HasClickHandlers && !(child instanceof Image)) { Style style = child.getElement().getStyle(); style.setBottom((double) image.getHeight(), Unit.PX); } } } }); }
From source file:org.jboss.errai.mvp.client.presenters.RootView.java
License:Apache License
public void ensureGlass() { if (glass == null) { glass = Document.get().createDivElement(); Style style = glass.getStyle(); style.setPosition(Style.Position.ABSOLUTE); style.setLeft(0, Style.Unit.PX); style.setTop(0, Style.Unit.PX); style.setRight(0, Style.Unit.PX); style.setBottom(0, Style.Unit.PX); style.setZIndex(2147483647); // Maximum z-index }/* w w w.ja v a2s . co m*/ }
From source file:org.rstudio.core.client.widget.FullscreenPopupPanel.java
License:Open Source License
public FullscreenPopupPanel(Widget titleWidget, Widget mainWidget, int margin, boolean closeOnEscape) { super(false, false, closeOnEscape); NineUpBorder border = new NineUpBorder(RES, 32, 20, 17, 20); if (titleWidget != null) addTitleWidget(border, titleWidget); addCloseButton(border);/* ww w . j a va 2 s. c o m*/ border.setSize("100%", "100%"); border.setFillColor("white"); border.setWidget(mainWidget); setWidget(border); setGlassEnabled(true); Style popupStyle = getElement().getStyle(); popupStyle.setZIndex(1001); popupStyle.setPosition(Style.Position.ABSOLUTE); popupStyle.setTop(margin, Unit.PX); popupStyle.setBottom(margin, Unit.PX); popupStyle.setLeft(margin, Unit.PX); popupStyle.setRight(margin, Unit.PX); Style contentStyle = ((Element) getElement().getFirstChild()).getStyle(); contentStyle.setWidth(100, Unit.PCT); contentStyle.setHeight(100, Unit.PCT); }
From source file:org.rstudio.studio.client.workbench.views.presentation.zoom.PresentationZoomPopup.java
License:Open Source License
public static void show() { Label mainWidget = new Label("mainWidget"); mainWidget.setSize("100%", "100%"); LayoutPanel layoutPanel = new LayoutPanel(); layoutPanel.setSize("100%", "100%"); layoutPanel.add(mainWidget);//from w w w . j a va 2 s . c o m layoutPanel.setWidgetLeftRight(mainWidget, 0, Unit.PX, 0, Unit.PX); layoutPanel.setWidgetTopBottom(mainWidget, 0, Unit.PX, 0, Unit.PX); ModalPopupPanel popup = new ModalPopupPanel(false, false, true); Resources res = GWT.<Resources>create(Resources.class); NineUpBorder border = new NineUpBorder(res, 32, 20, 17, 20); addCloseButton(popup, border); border.setSize("100%", "100%"); border.setFillColor("white"); border.setWidget(layoutPanel); popup.setWidget(border); popup.setGlassEnabled(true); Style popupStyle = popup.getElement().getStyle(); popupStyle.setZIndex(1001); popupStyle.setPosition(Style.Position.ABSOLUTE); popupStyle.setTop(0, Unit.PX); popupStyle.setBottom(0, Unit.PX); popupStyle.setLeft(0, Unit.PX); popupStyle.setRight(0, Unit.PX); Style contentStyle = ((Element) popup.getElement().getFirstChild()).getStyle(); contentStyle.setWidth(100, Unit.PCT); contentStyle.setHeight(100, Unit.PCT); popup.center(); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ChunkPlotPage.java
License:Open Source License
public ChunkPlotPage(final String url, NotebookPlotMetadata metadata, int ordinal, final Command onRenderComplete, ChunkOutputSize chunkOutputSize) { super(ordinal); thumbnail_ = new HTMLPanel(""); if (ChunkPlotWidget.isFixedSizePlotUrl(url)) { final Image thumbnail = new Image(); thumbnail_.add(thumbnail);/* w w w . j a v a2 s.c om*/ thumbnail_.getElement().getStyle().setTextAlign(TextAlign.CENTER); plot_ = new ChunkPlotWidget(url, metadata, new Command() { @Override public void execute() { ImageElementEx plot = plot_.getElement().cast(); ImageElementEx img = thumbnail.getElement().cast(); if (plot.naturalHeight() < plot.naturalWidth()) { img.getStyle().setProperty("width", "100%"); img.getStyle().setProperty("height", "auto"); } else { img.getStyle().setProperty("height", "100%"); img.getStyle().setProperty("width", "auto"); } thumbnail.setUrl(url); onRenderComplete.execute(); } }, chunkOutputSize); } else { // automatically expand non-fixed plots thumbnail_.add(new FixedRatioWidget(new Image(url), ChunkOutputUi.OUTPUT_ASPECT, 100)); plot_ = new ChunkPlotWidget(url, metadata, onRenderComplete, chunkOutputSize); } // look for messages or warnings in metadata boolean hasMessages = false; boolean hasWarnings = false; if (metadata != null) { for (int i = 0; i < metadata.getConditions().length(); i++) { int condition = metadata.getConditions().get(i).getInt(0); if (condition == ChunkConditionBar.CONDITION_MESSAGE) hasMessages = true; else if (condition == ChunkConditionBar.CONDITION_WARNING) hasWarnings = true; } } if (hasMessages || hasWarnings) { Image condImage = new Image(); if (hasWarnings) condImage.setResource(new ImageResource2x(ThemeResources.INSTANCE.warningSmall2x())); else if (hasMessages) condImage.setResource(new ImageResource2x(ThemeResources.INSTANCE.infoSmall2x())); condImage.setWidth("8px"); condImage.setHeight("7px"); Style style = condImage.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setBottom(5, Unit.PX); style.setRight(5, Unit.PX); thumbnail_.add(condImage); } }
From source file:org.vectomatic.svg.edit.client.command.DndCommandFactory.java
License:Open Source License
/** * Returns true if the drag start event comes from a valid drag source * @param event a drag start event// w w w.j a v a 2 s. c om * @return true if the drag start event comes from a valid drag source */ public boolean isValidSource(DNDEvent event, List<SVGElementModel> sourceElements) { targetElement = null; validTarget = false; this.sourceElements = sourceElements; for (IDndHandler handler : handlers) { if (handler.isValidSource(event, sourceElements)) { dndGhost = new DNDGhost(sourceElements, event); proxy = event.getStatus(); proxy.update(dndGhost.getElement()); targetElement = null; setHandler(handler); /* * The drag and drop elements in GXT are positionned as follows: * div container (x-dd-drag-proxy) * div icon (x-dd-drop-icon) * div proxy (x-dd-drag-ghost) * div ghost (custom ghost) * * x-dd-drag-ghost needs to be altered to be made absolute * in order to support custom ghost with absolute positioning */ Style proxyStyle = dndGhost.getElement().getParentElement().getStyle(); proxyStyle.setPosition(Position.ABSOLUTE); proxyStyle.setLeft(0, Unit.PX); proxyStyle.setRight(0, Unit.PX); proxyStyle.setTop(0, Unit.PX); proxyStyle.setBottom(0, Unit.PX); return true; } } return false; }
From source file:org.waveprotocol.wave.client.wavepanel.view.dom.DomUtil.java
License:Apache License
/** * Puts cover element on the covered element. * The cover and covered elements have the same position and size. * // w w w. j a v a2 s .co m * @param cover the cover element * @param covered the covered element */ public static void putCover(Element cover, Element covered) { Element parent = covered.getParentElement(); Rect coveredRect = DomUtil.getElementAbsoluteRect(covered); Rect parentRect = DomUtil.getElementAbsoluteRect(parent); Style coverStyle = cover.getStyle(); coverStyle.setPosition(Style.Position.ABSOLUTE); coverStyle.setTop(coveredRect.getTop() - parentRect.getTop(), Style.Unit.PX); coverStyle.setLeft(coveredRect.getLeft() - parentRect.getLeft(), Style.Unit.PX); coverStyle.setRight(parentRect.getRight() - coveredRect.getRight(), Style.Unit.PX); coverStyle.setBottom(parentRect.getBottom() - coveredRect.getBottom(), Style.Unit.PX); parent.appendChild(cover); }
From source file:org.waveprotocol.wave.client.widget.popup.ListRelativePopupPositioner.java
License:Apache License
/** * {@inheritDoc}/*from www. j ava 2 s . c o m*/ */ 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); } }); }
From source file:stroom.dashboard.client.vis.VisFrame.java
License:Apache License
public VisFrame() { super("vis.html");// + "?time=" + System.currentTimeMillis()); final Style style = getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setLeft(0, Unit.PX);/* ww w. j a v a 2 s . c o m*/ style.setRight(0, Unit.PX); style.setTop(0, Unit.PX); style.setBottom(0, Unit.PX); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setMargin(0, Unit.PX); style.setPadding(0, Unit.PX); style.setBorderWidth(0, Unit.PX); messageSupport = new MessageSupport(getElement()); }