@Override public StylesBuilder top(double value, Unit unit) { delegate.assertCanAddStyleProperty().setTop(value, unit); return this; }
public void fillParent(Element elem) { Style style = elem.getStyle(); style.setPosition(Position.ABSOLUTE); style.setLeft(0, PX); style.setTop(0, PX); style.setRight(0, PX); style.setBottom(0, PX); }
/** * Update the layout. */ private void forceLayout() { // No sense in doing layout if we aren't attached or have no content. if (!isAttached() || content == null) { return; } // Resize the content area to fit between the header and footer. int remainingHeight = getElement().getClientHeight(); if (header != null) { int height = Math.max(0, headerContainer.getOffsetHeight()); remainingHeight -= height; contentContainer.getStyle().setTop(height, Unit.PX); } else { contentContainer.getStyle().setTop(0.0, Unit.PX); } if (footer != null) { remainingHeight -= footerContainer.getOffsetHeight(); } contentContainer.getStyle().setHeight(Math.max(0, remainingHeight), Unit.PX); // Provide resize to child. if (content instanceof RequiresResize) { ((RequiresResize) content).onResize(); } }
/** * When enabled, the background will be blocked with a semi-transparent pane * the next time it is shown. If the PopupPanel is already visible, the glass * will not be displayed until it is hidden and shown again. * * @param enabled true to enable, false to disable */ public void setGlassEnabled(boolean enabled) { this.isGlassEnabled = enabled; if (enabled && glass == null) { glass = Document.get().createDivElement(); glass.setClassName(glassStyleName); glass.getStyle().setPosition(Position.ABSOLUTE); glass.getStyle().setLeft(0, Unit.PX); glass.getStyle().setTop(0, Unit.PX); } }
protected static DivElement createRuler(Unit widthUnit, Unit heightUnit) { DivElement ruler = Document.get().createDivElement(); ruler.setInnerHTML(" "); Style style = ruler.getStyle(); style.setPosition(Position.ABSOLUTE); style.setZIndex(-32767); // Position the ruler off the top edge, double the size just to be // extra sure it doesn't show up on the screen. style.setTop(-20, heightUnit); // Note that we are making the ruler element 10x10, because some browsers // generate non-integral ratios (e.g., 1em == 13.3px), so we need a little // extra precision. style.setWidth(10, widthUnit); style.setHeight(10, heightUnit); style.setVisibility(Visibility.HIDDEN); State.HIDDEN.set(ruler, true); return ruler; }
public HeaderPanel() { // Create the outer element Element elem = Document.get().createDivElement().cast(); elem.getStyle().setPosition(Position.RELATIVE); elem.getStyle().setOverflow(Overflow.HIDDEN); setElement(elem); // Create a delegate to handle resize from the header and footer. ResizeLayoutPanel.Impl.Delegate resizeDelegate = new ResizeLayoutPanel.Impl.Delegate() { public void onResize() { scheduledLayout(); } }; // Create the header container. headerContainer = createContainer(); headerContainer.getStyle().setTop(0.0, Unit.PX); headerImpl.init(headerContainer, resizeDelegate); elem.appendChild(headerContainer); // Create the footer container. footerContainer = createContainer(); footerContainer.getStyle().setBottom(0.0, Unit.PX); footerImpl.init(footerContainer, resizeDelegate); elem.appendChild(footerContainer); // Create the content container. contentContainer = createContainer(); contentContainer.getStyle().setOverflow(Overflow.HIDDEN); contentContainer.getStyle().setTop(0.0, Unit.PX); contentContainer.getStyle().setHeight(0.0, Unit.PX); elem.appendChild(contentContainer); }
/** * Construct a new {@link SplitLayoutPanel} with the specified splitter size * in pixels. * * @param splitterSize the size of the splitter in pixels */ public SplitLayoutPanel(int splitterSize) { super(Unit.PX); this.splitterSize = splitterSize; setStyleName("gwt-SplitLayoutPanel"); if (glassElem == null) { glassElem = Document.get().createDivElement(); glassElem.getStyle().setPosition(Position.ABSOLUTE); glassElem.getStyle().setTop(0, Unit.PX); glassElem.getStyle().setLeft(0, Unit.PX); glassElem.getStyle().setMargin(0, Unit.PX); glassElem.getStyle().setPadding(0, Unit.PX); glassElem.getStyle().setBorderWidth(0, Unit.PX); // We need to set the background color or mouse events will go right // through the glassElem. If the SplitPanel contains an iframe, the // iframe will capture the event and the slider will stop moving. glassElem.getStyle().setProperty("background", "white"); glassElem.getStyle().setOpacity(0.0); } }
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);
@Override public void onResize() { getParent().getElement().getStyle().setBackgroundColor("#F6F6F6"); content.getElement().getStyle().setTop(60, Style.Unit.PX); }
/** * Recalculate the height and width of a native scrollbar. */ private static void maybeRecalculateNativeScrollbarSize() { // Check if the size has already been calculated. if (nativeHeight > -1) { return; } // Create a scrollable element and attach it to the body. Element scrollable = Document.get().createDivElement(); scrollable.getStyle().setPosition(Position.ABSOLUTE); scrollable.getStyle().setTop(-1000.0, Unit.PX); scrollable.getStyle().setLeft(-1000.0, Unit.PX); scrollable.getStyle().setHeight(100.0, Unit.PX); scrollable.getStyle().setWidth(100.0, Unit.PX); scrollable.getStyle().setOverflow(Overflow.SCROLL); scrollable.getStyle().setProperty("direction", "rtl"); Document.get().getBody().appendChild(scrollable); // Add some content. Element content = Document.get().createDivElement(); content.setInnerText("content"); scrollable.appendChild(content); // Measure the height and width. nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight(); nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth(); nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft()); // Detach the scrollable element. scrollable.removeFromParent(); }
@Override public void showPreloader() { preloaderFadeOut.cancel(); preloaderRemoverTimer.cancel(); if (tabPanel != preloader.getParent()) { preloader.getElement().getStyle().setTop(0, Unit.PX); preloader.getElement().getStyle().setZIndex(10000); tabPanel.add(preloader); } }
private void renderTransformed() { getElement().getStyle().setLeft(deltaX - panX, Unit.PX); getElement().getStyle().setTop(deltaY - panY, Unit.PX); for (int i = 0; i < getChildCount(); i++) { TransformableWidget w = (TransformableWidget) getChild(i); w.setScale(scaleX, scaleY); w.setTranslation(panX, panY); } }
private void shrinkLayout() { stretched = false; getElement().getStyle().setTop(top, Unit.PX); getElement().getStyle().setLeft(left, Unit.PX); int y = viewPort.getZoomStrategy().getZoomStepCount() * ZOOMSTEP_HEIGHT; setSize(ZOOMBUTTON_SIZE + "px", (y + 1 + (ZOOMBUTTON_SIZE * 2)) + "px"); applyPositions(); }
private void showDropTarget( int x, int y, int width, int height ) { dropTargetHighlight.getStyle().setLeft( x, Style.Unit.PX ); dropTargetHighlight.getStyle().setWidth( width, Style.Unit.PX ); dropTargetHighlight.getStyle().setTop( y, Style.Unit.PX ); dropTargetHighlight.getStyle().setHeight( height, Style.Unit.PX ); dropTargetHighlight.getStyle().setVisibility( Style.Visibility.VISIBLE ); dropTargetHighlight.getStyle().setDisplay( Style.Display.BLOCK ); }
private void hideDropTarget() { dropTargetHighlight.getStyle().setVisibility( Style.Visibility.HIDDEN ); dropTargetHighlight.getStyle().setDisplay( Style.Display.NONE ); dropTargetHighlight.getStyle().setLeft( 0, Style.Unit.PX ); dropTargetHighlight.getStyle().setWidth( 0, Style.Unit.PX ); dropTargetHighlight.getStyle().setTop( 0, Style.Unit.PX ); dropTargetHighlight.getStyle().setHeight( 0, Style.Unit.PX ); dropTargetPosition = CompassPosition.NONE; }
protected LoadTracker() { if(Document.get().getElementById(m_trackerDivId) == null) { Element div = DOM.createDiv(); div.getStyle().setPosition(Position.ABSOLUTE); div.getStyle().setTop(0.0, Unit.PX); div.getStyle().setLeft(-9999.0, Unit.PX); div.getStyle().setVisibility(Visibility.HIDDEN); div.setId("loadTracker"); Document.get().getBody().appendChild(div); } }