List of usage examples for com.google.gwt.dom.client Style setPosition
public void setPosition(Position value)
From source file:com.vaadin.client.ui.calendar.schedule.DateCellDayEvent.java
License:Apache License
public DateCellDayEvent(DateCell dateCell, WeekGrid parent, CalendarEvent event) { super();// www .j a v a2s.c o m this.dateCell = dateCell; handlers = new LinkedList<HandlerRegistration>(); setStylePrimaryName("v-calendar-event"); setCalendarEvent(event); weekGrid = parent; Style s = getElement().getStyle(); if (event.getStyleName().length() > 0) { addStyleDependentName(event.getStyleName()); } s.setPosition(Position.ABSOLUTE); caption = DOM.createDiv(); caption.addClassName("v-calendar-event-caption"); getElement().appendChild(caption); eventContent = DOM.createDiv(); eventContent.addClassName("v-calendar-event-content"); getElement().appendChild(eventContent); if (weekGrid.getCalendar().isEventResizeAllowed()) { topResizeBar = DOM.createDiv(); bottomResizeBar = DOM.createDiv(); topResizeBar.addClassName("v-calendar-event-resizetop"); bottomResizeBar.addClassName("v-calendar-event-resizebottom"); getElement().appendChild(topResizeBar); getElement().appendChild(bottomResizeBar); } eventIndex = event.getIndex(); }
From source file:com.vaadin.client.ui.FocusableScrollPanel.java
License:Apache License
public FocusableScrollPanel() { // Prevent IE standard mode bug when a AbsolutePanel is contained. TouchScrollDelegate.enableTouchScrolling(this, getElement()); Style style = getElement().getStyle(); style.setProperty("zoom", "1"); style.setPosition(Position.RELATIVE); browserInfo = BrowserInfo.get();/*from w ww . j a v a 2 s. c o m*/ }
From source file:com.vaadin.client.ui.FocusableScrollPanel.java
License:Apache License
@Override public void setWidget(Widget w) { super.setWidget(w); if (useFakeFocusElement()) { if (focusElement.getParentElement() == null) { Style style = focusElement.getStyle(); style.setPosition(Position.FIXED); style.setTop(0, Unit.PX);/*from w w w .j av a2 s. com*/ style.setLeft(0, Unit.PX); if (browserInfo.isIE() || browserInfo.isEdge()) { // for #15294: artificially hide little bit more the // focusElement, otherwise IE will make the window to scroll // into it when focused style.setLeft(-999, Unit.PX); } getElement().appendChild(focusElement); /* Sink from focusElemet too as focusa and blur don't bubble */ DOM.sinkEvents(focusElement, Event.FOCUSEVENTS); // revert to original, not focusable getElement().setPropertyObject("tabIndex", null); } else { moveFocusElementAfterWidget(); } } }
From source file:com.vaadin.client.ui.FocusElementPanel.java
License:Apache License
@Override public void setWidget(Widget w) { super.setWidget(w); if (focusElement.getParentElement() == null) { Style style = focusElement.getStyle(); style.setPosition(Position.FIXED); style.setTop(0, Unit.PX);//from w w w. j a v a 2s . co m style.setLeft(0, Unit.PX); getElement().appendChild(focusElement); /* Sink from focusElement too as focus and blur don't bubble */ DOM.sinkEvents(focusElement, Event.FOCUSEVENTS); // revert to original, not focusable getElement().setPropertyObject("tabIndex", null); } else { moveFocusElementAfterWidget(); } }
From source file:com.vaadin.client.ui.layout.VLayoutSlot.java
License:Apache License
public void setCaption(VCaption caption) { if (this.caption != null) { this.caption.removeFromParent(); }//from w w w.ja v a 2 s. c o m this.caption = caption; if (caption != null) { // Physical attach. DOM.insertBefore(wrapper, caption.getElement(), widget.getElement()); Style style = caption.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setTop(0, Unit.PX); } }
From source file:com.vaadin.client.ui.ui.UIConnector.java
License:Apache License
protected void onChildSizeChange() { ComponentConnector child = getContent(); if (child == null) { return;/* www . j a v a 2 s . c om*/ } Style childStyle = child.getWidget().getElement().getStyle(); /* * Must set absolute position if the child has relative height and * there's a chance of horizontal scrolling as some browsers will * otherwise not take the scrollbar into account when calculating the * height. Assuming v-ui does not have an undefined width for now, see * #8460. */ if (child.isRelativeHeight() && !BrowserInfo.get().isIE9()) { childStyle.setPosition(Position.ABSOLUTE); } else { childStyle.clearPosition(); } }
From source file:com.vaadin.client.ui.VCustomLayout.java
License:Apache License
public VCustomLayout() { setElement(DOM.createDiv());// w ww . ja v a 2 s .co m // Clear any unwanted styling Style style = getElement().getStyle(); style.setBorderStyle(BorderStyle.NONE); style.setMargin(0, Unit.PX); style.setPadding(0, Unit.PX); if (BrowserInfo.get().isIE()) { style.setPosition(Position.RELATIVE); } setStyleName(CLASSNAME); }
From source file:com.vaadin.client.ui.VGridLayout.java
License:Apache License
public VGridLayout() { super();// ww w. java 2 s . com setElement(Document.get().createDivElement()); spacingMeasureElement = Document.get().createDivElement(); Style spacingStyle = spacingMeasureElement.getStyle(); spacingStyle.setPosition(Position.ABSOLUTE); getElement().appendChild(spacingMeasureElement); setStyleName(CLASSNAME); addStyleName(StyleConstants.UI_LAYOUT); }
From source file:com.vaadin.client.ui.VWindow.java
License:Apache License
private void fixIE8FocusCaptureIssue() { Element e = DOM.createInputText(); Style elemStyle = e.getStyle(); elemStyle.setPosition(Position.ABSOLUTE); elemStyle.setTop(-10, Unit.PX);//from w w w . j ava 2s .c om elemStyle.setWidth(0, Unit.PX); elemStyle.setHeight(0, Unit.PX); contentPanel.getElement().appendChild(e); e.focus(); contentPanel.getElement().removeChild(e); }
From source file:com.vaadin.client.ui.window.WindowConnector.java
License:Apache License
@Override public void layout() { LayoutManager lm = getLayoutManager(); VWindow window = getWidget();/*w w w. j a va 2s . c o m*/ ComponentConnector content = getContent(); boolean hasContent = (content != null); Element contentElement = window.contentPanel.getElement(); Style contentStyle = window.contents.getStyle(); int headerHeight = lm.getOuterHeight(window.header); contentStyle.setPaddingTop(headerHeight, Unit.PX); contentStyle.setMarginTop(-headerHeight, Unit.PX); int footerHeight = lm.getOuterHeight(window.footer); contentStyle.setPaddingBottom(footerHeight, Unit.PX); contentStyle.setMarginBottom(-footerHeight, Unit.PX); int minWidth = lm.getOuterWidth(window.header) - lm.getInnerWidth(window.header); int minHeight = footerHeight + headerHeight; getWidget().getElement().getStyle().setPropertyPx("minWidth", minWidth); getWidget().getElement().getStyle().setPropertyPx("minHeight", minHeight); /* * Must set absolute position if the child has relative height and * there's a chance of horizontal scrolling as some browsers will * otherwise not take the scrollbar into account when calculating the * height. */ if (hasContent) { Element layoutElement = content.getWidget().getElement(); Style childStyle = layoutElement.getStyle(); // IE8 needs some hackery to measure its content correctly WidgetUtil.forceIE8Redraw(layoutElement); if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) { childStyle.setPosition(Position.ABSOLUTE); Style wrapperStyle = contentElement.getStyle(); if (window.getElement().getStyle().getWidth().length() == 0 && !content.isRelativeWidth()) { /* * Need to lock width to make undefined width work even with * absolute positioning */ int contentWidth = lm.getOuterWidth(layoutElement); wrapperStyle.setWidth(contentWidth, Unit.PX); } else { wrapperStyle.clearWidth(); } } else { childStyle.clearPosition(); } } }