Java Code Examples for com.google.gwt.dom.client.Style#setZIndex()
The following examples show how to use
com.google.gwt.dom.client.Style#setZIndex() .
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: MaterialCutOut.java From gwt-material-addins with Apache License 2.0 | 5 votes |
protected void setCutOutStyle() { Style style = getElement().getStyle(); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setPosition(Position.FIXED); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); style.setZIndex(10000); focusElement.setClassName(AddinsCssName.MATERIAL_CUTOUT_FOCUS); style = focusElement.getStyle(); style.setProperty("content", "\'\'"); style.setPosition(Position.ABSOLUTE); style.setZIndex(-1); }
Example 2
Source File: MaterialCutOut.java From gwt-material-addins with Apache License 2.0 | 5 votes |
/** * Gets the computed background color, based on the backgroundColor CSS * class. */ protected void setupComputedBackgroundColor() { // temp is just a widget created to evaluate the computed background // color MaterialWidget temp = new MaterialWidget(Document.get().createDivElement()); temp.setBackgroundColor(backgroundColor); // setting a style to make it invisible for the user Style style = temp.getElement().getStyle(); style.setPosition(Position.FIXED); style.setWidth(1, Unit.PX); style.setHeight(1, Unit.PX); style.setLeft(-10, Unit.PX); style.setTop(-10, Unit.PX); style.setZIndex(-10000); // adding it to the body (on Chrome the component must be added to the // DOM before getting computed values). String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor); // convert rgb to rgba, considering the opacity field if (opacity < 1 && computed.startsWith("rgb(")) { computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")"); } computedBackgroundColor = computed; }
Example 3
Source File: Affix.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
protected void toggleAffix(Affixed affix) { Element e = this.getElement(); Style style = e.getStyle(); if (this.affixed != affix) { this.clearElementStyle(); this.affixed = affix; StyleUtils.addStyle(e, this.affixed); } switch (affix) { case AFFIX: style.setTop(this.offsetTop, Unit.PX); style.setWidth(this.offsetWidth, Unit.PX); style.setHeight(this.offsetHeight, Unit.PX); style.setZIndex(this.layerIndex); e.getParentElement().getStyle().setPaddingTop(this.offsetHeight, Unit.PX); break; case BOTTOM: int docHeigth = Document.get().getScrollHeight(); int scrollTop = Window.getScrollTop(); int bottom = this.offsetBottom - (docHeigth - scrollTop - this.clientHeigth); if (this.fixBottom != Integer.MIN_VALUE) { bottom = Math.max(bottom, this.fixBottom); } style.setPosition(Position.FIXED); style.setBottom(bottom, Unit.PX); style.setWidth(this.offsetWidth, Unit.PX); style.setHeight(this.offsetHeight, Unit.PX); style.setZIndex(this.layerIndex); break; default: break; } }
Example 4
Source File: DomTextEditor.java From jetpad-projectional-open-source with Apache License 2.0 | 5 votes |
public DomTextEditor(Element root) { myRoot = root; Style rootStyle = myRoot.getStyle(); rootStyle.setPosition(Style.Position.RELATIVE); myTextContainer = DOM.createSpan(); Style textStyle = myTextContainer.getStyle(); textStyle.setZIndex(10); textStyle.setWhiteSpace(Style.WhiteSpace.NOWRAP); myRoot.appendChild(myTextContainer); Element caretDiv = DOM.createDiv(); Style caretStyle = caretDiv.getStyle(); caretStyle.setPosition(Style.Position.ABSOLUTE); caretStyle.setZIndex(10); myRoot.appendChild(caretDiv); myCaretDiv = caretDiv; Element selectionDiv = DOM.createDiv(); Style selectionStyle = selectionDiv.getStyle(); selectionStyle.setPosition(Style.Position.ABSOLUTE); selectionStyle.setZIndex(1); myRoot.appendChild(selectionDiv); mySelectionDiv = selectionDiv; update(); updateCaretVisibility(); updateSelectionVisibility(); updateCaretAndSelection(); }
Example 5
Source File: DateCellDayItem.java From calendar-component with Apache License 2.0 | 4 votes |
@Override public void onMouseDown(MouseDownEvent event) { startX = event.getClientX(); startY = event.getClientY(); if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) { return; } clickTarget = Element.as(event.getNativeEvent().getEventTarget()); mouseMoveCanceled = false; if ((weekGrid.getCalendar().isItemMoveAllowed() && getCalendarItem().isMoveable()) || (clickTargetsResize() && getCalendarItem().isResizeable())) { moveRegistration = addMouseMoveHandler(this); setFocus(true); try { startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight); startXrelative = (event.getRelativeX(weekGrid.getElement()) - weekGrid.timebar.getOffsetWidth()) % getDateCellWidth(); } catch (Exception e) { GWT.log("Exception calculating relative start position", e); } mouseMoveStarted = false; Style s = getElement().getStyle(); s.setZIndex(1000); startDatetimeFrom = (Date) calendarItem.getStartTime().clone(); startDatetimeTo = (Date) calendarItem.getEndTime().clone(); Event.setCapture(getElement()); } // make sure the right cursor is always displayed if (clickTargetsResize() && getCalendarItem().isResizeable()) { addGlobalResizeStyle(); } /* * We need to stop the event propagation or else the WeekGrid range * select will kick in */ event.stopPropagation(); event.preventDefault(); }
Example 6
Source File: DateCellDayItem.java From calendar-component with Apache License 2.0 | 4 votes |
@Override public void onMouseUp(MouseUpEvent event) { if (mouseMoveCanceled || event.getNativeButton() != NativeEvent.BUTTON_LEFT) { return; } Event.releaseCapture(getElement()); setFocus(false); if (moveRegistration != null) { moveRegistration.removeHandler(); moveRegistration = null; } int endX = event.getClientX(); int endY = event.getClientY(); int xDiff = 0, yDiff = 0; if (startX != -1 && startY != -1) { // Drag started xDiff = startX - endX; yDiff = startY - endY; } startX = -1; startY = -1; mouseMoveStarted = false; Style s = getElement().getStyle(); s.setZIndex(1); if (!clickTargetsResize()) { // check if mouse has moved over threshold of 3 pixels boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3); if (!weekGrid.getCalendar().isDisabled() && mouseMoved) { // Item Move: // - calendar must be enabled // - calendar must not be in read-only mode weekGrid.itemMoved(this); } else if (!weekGrid.getCalendar().isDisabled() && getCalendarItem().isClickable()) { // Item Click: // - calendar must be enabled (read-only is allowed) EventTarget et = event.getNativeEvent().getEventTarget(); Element e = Element.as(et); if (e == caption || e == eventContent || e.getParentElement() == caption) { if (weekGrid.getCalendar().getItemClickListener() != null) { weekGrid.getCalendar().getItemClickListener().itemClick(calendarItem); } } } } else { // click targeted resize bar removeGlobalResizeStyle(); if (weekGrid.getCalendar().getItemResizeListener() != null) { weekGrid.getCalendar().getItemResizeListener().itemResized(calendarItem); } dateCell.recalculateItemWidths(); } }
Example 7
Source File: DateCellDayItem.java From calendar-component with Apache License 2.0 | 4 votes |
private void cancelMouseMove() { mouseMoveCanceled = true; // reset and remove everything related to the event handling Event.releaseCapture(getElement()); setFocus(false); if (moveRegistration != null) { moveRegistration.removeHandler(); moveRegistration = null; } mouseMoveStarted = false; removeGlobalResizeStyle(); Style s = getElement().getStyle(); s.setZIndex(1); // reset the position of the event int dateCellWidth = getDateCellWidth(); int dayOffset = startXrelative / dateCellWidth; s.clearLeft(); calendarItem.setStartTime(startDatetimeFrom); calendarItem.setEndTime(startDatetimeTo); long startFromMinutes = (startDatetimeFrom.getHours() * 60) + startDatetimeFrom.getMinutes(); long range = calendarItem.getRangeInMinutes(); startFromMinutes = calculateStartFromMinute(startFromMinutes, startDatetimeFrom, startDatetimeTo, dayOffset); if (startFromMinutes < 0) { range += startFromMinutes; } updatePosition(startFromMinutes, range); startY = -1; startX = -1; // to reset the event width ((DateCell) getParent()).recalculateItemWidths(); }