Example usage for com.google.gwt.dom.client Style setZIndex

List of usage examples for com.google.gwt.dom.client Style setZIndex

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Style setZIndex.

Prototype

public void setZIndex(int value) 

Source Link

Usage

From source file:com.alkacon.geranium.client.util.DebugLog.java

License:Open Source License

/**
 * Constructor.<p>//from   w w w . ja  va2s. com
 */
@SuppressWarnings("unused")
private DebugLog() {

    if (!DEBUG) {
        return;
    }
    m_html = new HTML();
    initWidget(m_html);
    Style style = getElement().getStyle();
    style.setWidth(200, Unit.PX);
    style.setHeight(500, Unit.PX);
    style.setPadding(10, Unit.PX);
    style.setOverflow(Overflow.AUTO);
    style.setBorderStyle(BorderStyle.SOLID);
    style.setBorderColor(I_LayoutBundle.INSTANCE.constants().css().borderColor());
    style.setBorderWidth(1, Unit.PX);
    style.setPosition(Position.FIXED);
    style.setTop(50, Unit.PX);
    style.setRight(50, Unit.PX);
    style.setBackgroundColor(I_LayoutBundle.INSTANCE.constants().css().backgroundColorDialog());
    style.setZIndex(10);
}

From source file:com.allen_sauer.gwt.dnd.client.MouseDragHandler.java

License:Apache License

private void initCapturingWidget() {
    capturingWidget = new FocusPanel();
    capturingWidget.addMouseMoveHandler(this);
    capturingWidget.addMouseUpHandler(this);
    capturingWidget.addTouchMoveHandler(this);
    capturingWidget.addTouchEndHandler(this);
    capturingWidget.addTouchCancelHandler(this);
    Style style = capturingWidget.getElement().getStyle();
    // workaround for IE8 opacity http://code.google.com/p/google-web-toolkit/issues/detail?id=5538
    style.setProperty("filter", "alpha(opacity=0)");
    style.setOpacity(0);/*from   w ww . j av a2 s .c o  m*/
    style.setZIndex(1000);
    style.setMargin(0, Style.Unit.PX);
    style.setBorderStyle(BorderStyle.NONE);
    style.setBackgroundColor("blue");
}

From source file:com.dianaui.universal.core.client.ui.DateTimePicker.java

License:Apache License

@Override
public void setVisible(final boolean visible) {
    Style style = container.getElement().getStyle();

    if (visible) {
        style.setDisplay(Style.Display.BLOCK);
        style.setZIndex(9999);
        style.setPosition(Style.Position.ABSOLUTE);
        style.setProperty("right", "auto");
    } else {//from  ww w  .  j  ava  2  s . co  m
        super.setVisible(false);

        style.clearDisplay();
        style.clearZIndex();
        style.clearPosition();
        style.clearTop();
        style.clearLeft();
    }
}

From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java

License:Open Source License

/**
 * Inits the popup panel./*from  w w  w.j ava2 s  .  c  om*/
 */
private void initPopupPanel() {
    m_ap_shadow = new HTMLPanel("div", "");
    m_ap_content = new HTMLPanel("div", "");
    m_ap_line = new HTMLPanel("div", "");

    Style style = m_ap_content.getElement().getStyle();
    style.setProperty("border", "solid 1px skyblue");
    style.setBackgroundColor("white");
    style.setPadding(5, Unit.PX);
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(1000000);

    style = m_ap_shadow.getElement().getStyle();
    style.setBackgroundColor("#f0f0f0");
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(999999);

    m_ap_line.setHeight("1px");
    style = m_ap_line.getElement().getStyle();
    style.setBackgroundColor("white");
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(1000001);

    RootPanel.get().add(m_ap_shadow);
    RootPanel.get().add(m_ap_content);
    RootPanel.get().add(m_ap_line);

    m_ap_content.setVisible(false);

    m_ap_shadow.setVisible(false);

    m_ap_line.setVisible(false);

}

From source file:com.vaadin.client.debug.internal.Highlight.java

License:Apache License

/**
 * Highlight the given {@link Element} using the given color.
 * <p>/*from  w ww. j av a 2  s  .  c  o m*/
 * Pass the returned highlight {@link Element} to {@link #hide(Element)} to
 * remove this particular highlight.
 * </p>
 * 
 * @param element
 *            Element to highlight
 * @param color
 *            Color of highlight
 * @return Highlight element
 */
static Element show(Element element, String color) {
    if (element != null) {
        if (highlights == null) {
            highlights = new HashSet<Element>();
        }

        Element highlight = DOM.createDiv();
        Style style = highlight.getStyle();
        style.setTop(element.getAbsoluteTop(), Unit.PX);
        style.setLeft(element.getAbsoluteLeft(), Unit.PX);
        int width = element.getOffsetWidth();
        if (width < MIN_WIDTH) {
            width = MIN_WIDTH;
        }
        style.setWidth(width, Unit.PX);
        int height = element.getOffsetHeight();
        if (height < MIN_HEIGHT) {
            height = MIN_HEIGHT;
        }
        style.setHeight(height, Unit.PX);
        RootPanel.getBodyElement().appendChild(highlight);

        style.setPosition(Position.ABSOLUTE);
        style.setZIndex(VWindow.Z_INDEX + 1000);
        style.setBackgroundColor(color);
        style.setOpacity(DEFAULT_OPACITY);
        if (BrowserInfo.get().isIE()) {
            style.setProperty("filter", "alpha(opacity=" + (DEFAULT_OPACITY * 100) + ")");
        }

        highlights.add(highlight);

        return highlight;
    }
    return null;
}

From source file:com.vaadin.client.metadata.ConnectorBundleLoader.java

License:Apache License

private void notice(String productName) {
    if (notice == null) {
        notice = new HTML();
        notice.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                notice.removeFromParent();
            }/*from www. j  a  v  a 2  s.  com*/
        });
        notice.addTouchStartHandler(new TouchStartHandler() {
            public void onTouchStart(TouchStartEvent event) {
                notice.removeFromParent();
            }
        });
    }
    String msg = notice.getText().trim();
    msg += msg.isEmpty() ? "Using Evaluation License of: " : ", ";
    notice.setText(msg + productName);
    RootPanel.get().add(notice);

    notice.getElement().setClassName("");
    Style s = notice.getElement().getStyle();

    s.setPosition(Position.FIXED);
    s.setTextAlign(TextAlign.CENTER);
    s.setRight(0, Unit.PX);
    s.setLeft(0, Unit.PX);
    s.setBottom(0, Unit.PX);
    s.setProperty("padding", "0.5em 1em");

    s.setProperty("font-family", "sans-serif");
    s.setFontSize(12, Unit.PX);
    s.setLineHeight(1.1, Unit.EM);

    s.setColor("white");
    s.setBackgroundColor("black");
    s.setOpacity(0.7);

    s.setZIndex(2147483646);
    s.setProperty("top", "auto");
    s.setProperty("width", "auto");
    s.setDisplay(Display.BLOCK);
    s.setWhiteSpace(WhiteSpace.NORMAL);
    s.setVisibility(Visibility.VISIBLE);
    s.setMargin(0, Unit.PX);
}

From source file:com.vaadin.client.ui.calendar.schedule.DateCellDayEvent.java

License:Apache License

@Override
public void onMouseDown(MouseDownEvent event) {
    startX = event.getClientX();// w  w w  .  j a  va 2  s . c  o m
    startY = event.getClientY();
    if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
        return;
    }

    clickTarget = Element.as(event.getNativeEvent().getEventTarget());
    mouseMoveCanceled = false;

    if (weekGrid.getCalendar().isEventMoveAllowed() || clickTargetsResize()) {
        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) calendarEvent.getStartTime().clone();
        startDatetimeTo = (Date) calendarEvent.getEndTime().clone();
        Event.setCapture(getElement());
    }

    // make sure the right cursor is always displayed
    if (clickTargetsResize()) {
        addGlobalResizeStyle();
    }

    /*
     * We need to stop the event propagation or else the WeekGrid range
     * select will kick in
     */
    event.stopPropagation();
    event.preventDefault();
}

From source file:com.vaadin.client.ui.calendar.schedule.DateCellDayEvent.java

License:Apache License

@Override
public void onMouseUp(MouseUpEvent event) {
    if (mouseMoveCanceled || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
        return;//from  www  . jav a  2s  .  c om
    }

    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().isDisabledOrReadOnly() && mouseMoved) {
            // Event Move:
            // - calendar must be enabled
            // - calendar must not be in read-only mode
            weekGrid.eventMoved(this);
        } else if (!weekGrid.getCalendar().isDisabled()) {
            // Event 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().getEventClickListener() != null) {
                    weekGrid.getCalendar().getEventClickListener().eventClick(calendarEvent);
                }
            }
        }

    } else { // click targeted resize bar
        removeGlobalResizeStyle();
        if (weekGrid.getCalendar().getEventResizeListener() != null) {
            weekGrid.getCalendar().getEventResizeListener().eventResized(calendarEvent);
        }
        dateCell.recalculateEventWidths();
    }
}

From source file:com.vaadin.client.ui.calendar.schedule.DateCellDayEvent.java

License:Apache License

private void cancelMouseMove() {
    mouseMoveCanceled = true;//ww w.j  a  va2s . c  o  m

    // 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();

    calendarEvent.setStartTime(startDatetimeFrom);
    calendarEvent.setEndTime(startDatetimeTo);

    long startFromMinutes = (startDatetimeFrom.getHours() * 60) + startDatetimeFrom.getMinutes();
    long range = calendarEvent.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()).recalculateEventWidths();
}

From source file:fr.putnami.pwt.core.widget.client.Affix.java

License:Open Source License

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);
    }//ww  w. jav  a 2 s.  c  o  m

    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;
    }
}