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

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

Introduction

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

Prototype

public void setDisplay(Display value) 

Source Link

Usage

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

License:Open Source License

/**
 *  Method to create the colorlist for the toolbar *.
 *
 * @return the color label/*from  w w  w .  ja  va2 s  .  c  o  m*/
 */
private ColorLabel createColorList() {

    colorlist = new ColorLabel();
    Style style = colorlist.getElement().getStyle();

    style.setDisplay(Display.BLOCK);
    style.setPropertyPx("lineHeight", 14);
    style.setCursor(Cursor.POINTER);
    colorlist.setWidth("60px");

    colorlist.addMessageHandler(m_color_handler);
    return colorlist;
}

From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControl.java

License:Open Source License

@SuppressWarnings("rawtypes")
private void updateVelocity(MouseEvent e) {
    int eventRelativeX = e.getRelativeX(panButton.getElement());
    int eventRelativeY = e.getRelativeY(panButton.getElement());

    final int panButtonWidth = panButton.getOffsetWidth();
    final int panButtonHeight = panButton.getOffsetHeight();

    if (eventRelativeX > 0 && eventRelativeX < panButtonWidth && eventRelativeY > 0
            && eventRelativeY < panButtonHeight) {
        final Style clickHighlightStyle = clickHighlight.getStyle();
        clickHighlightStyle.setDisplay(Display.BLOCK);
        clickHighlightStyle.setLeft(eventRelativeX - (clickHighlight.getClientWidth() / 3), Unit.PX);
        clickHighlightStyle.setTop(eventRelativeY - (clickHighlight.getClientHeight() / 3), Unit.PX);

        m_dx = m_presenter.calculateDelta(panButtonWidth, eventRelativeX, m_maxPanPixels);
        m_dy = -m_presenter.calculateDelta(panButtonHeight, eventRelativeY, m_maxPanPixels);
    }//from  ww  w .j a va  2  s . co  m
}

From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControl.java

License:Open Source License

private void stopPanLoop() {
    final Style clickHighlightStyle = clickHighlight.getStyle();
    clickHighlightStyle.setDisplay(Display.NONE);
    m_panning = false;//from   www . ja v  a  2 s. com
    m_panButtonTimer.cancel();
}

From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControlLegacy.java

License:Open Source License

@SuppressWarnings("rawtypes")
private void updateVelocity(MouseEvent e) {
    int eventRelativeX = e.getRelativeX(panButton.getElement());
    int eventRelativeY = e.getRelativeY(panButton.getElement());

    final int panButtonWidth = panButton.getOffsetWidth();
    final int panButtonHeight = panButton.getOffsetHeight();

    if (eventRelativeX > 0 && eventRelativeX < panButtonWidth && eventRelativeY > 0
            && eventRelativeY < panButtonHeight) {
        final Style clickHighlightStyle = clickHighlight.getElement().getStyle();
        clickHighlightStyle.setDisplay(Display.BLOCK);
        clickHighlightStyle.setLeft(eventRelativeX - (clickHighlight.getElement().getClientWidth() / 3),
                Unit.PX);//  w  ww  . ja v a2 s.com
        clickHighlightStyle.setTop(eventRelativeY - (clickHighlight.getElement().getClientHeight() / 3),
                Unit.PX);

        m_dx = m_presenter.calculateDelta(panButtonWidth, eventRelativeX, m_maxPanPixels);
        m_dy = -m_presenter.calculateDelta(panButtonHeight, eventRelativeY, m_maxPanPixels);
    }
}

From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControlLegacy.java

License:Open Source License

private void stopPanLoop() {
    final Style clickHighlightStyle = clickHighlight.getElement().getStyle();
    clickHighlightStyle.setDisplay(Display.NONE);
    m_panning = false;/*w  w  w.  j  a  v  a2 s .co  m*/
    m_panButtonTimer.cancel();
}

From source file:com.sciencegadgets.client.algebra.EquationWrapper.java

License:Open Source License

private void fillSelectionDetails() {
    LinkedList<Widget> detailsList = new LinkedList<Widget>();

    TypeSGET type = node.getType();/* w  w  w. j a v a 2s. c  o m*/
    TypeSGET operationType = null;
    // FitParentHTML typeLabel = new FitParentHTML(type.getIcon());
    HTML typeLabel = new HTML(type.toString());
    detailsList.add(typeLabel);

    switch (type) {
    case Number:
        String fullValue = node.getAttribute(MathAttribute.Value);
        if ("".equals(fullValue)) {
            fullValue = node.getAttribute(MathAttribute.Randomness);
        } else {
            try {
                new BigDecimal(fullValue);
                // FitParentHTML valueHTML = new
                // FitParentHTML(fullValue);
                final TextBox valueHTML = new TextBox();
                valueHTML.setText(fullValue);
                valueHTML.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        valueHTML.selectAll();
                    }
                });
                valueHTML.addStyleName(CSS.SELECTION_DETAILS_Value);
                valueHTML.getElement().getStyle().setProperty("textShadow", "inherit");
                detailsList.add(valueHTML);
            } catch (NumberFormatException ex) {
            }
        }

        UnitAttribute unit = node.getUnitAttribute();
        if (!"".equals(unit.toString())) {
            HTML unitHTML = new HTML();
            unitHTML.getElement().appendChild(UnitHTML.create(unit, false));
            detailsList.add(unitHTML);
        }

        break;
    case Variable:
        UnitAttribute qKind = node.getUnitAttribute();
        if (!"".equals(qKind.toString())) {
            // FitParentHTML qKindHTML = new FitParentHTML();
            HTML qKindHTML = new HTML();
            qKindHTML.getElement().appendChild(UnitHTML.create(qKind, false));
            detailsList.add(qKindHTML);
        }
        break;
    case Operation:
        operationType = node.getParentType();
        String[] parts = { node.getPrevSibling().getType().toString(), node.getSymbol(),
                node.getNextSibling().getType().toString() };

        typeLabel.setHTML("");
        Element typeEl = typeLabel.getElement();
        for (String part : parts) {
            Element partEl = new HTML(part).getElement();
            Style partSt = partEl.getStyle();
            partSt.setMargin(2, Unit.PX);
            partSt.setDisplay(Display.INLINE_BLOCK);
            partSt.setVerticalAlign(VerticalAlign.MIDDLE);
            typeEl.appendChild(partEl);
        }
    default:
        break;
    }

    FlowPanel detailsPanel = new FlowPanel();
    detailsPanel.addStyleName(CSS.SELECTION_DETAILS);
    for (Widget s : detailsList) {
        detailsPanel.add(s);
    }
    algebraActivity.detailsArea.clear();
    algebraActivity.detailsArea.add(detailsPanel);

    Widget typeParent = typeLabel.getParent();
    if (typeParent != null) {
        // typeParent.addStyleName(type.getCSSClassName());
        // typeParent.addStyleName(CSS.PARENT_WRAPPER);
        if (operationType != null) {
            typeParent.addStyleName(operationType.getCSSClassName());
        }
    }
}

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 w  w w .ja  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.SimpleTree.java

License:Apache License

public SimpleTree() {
    setElement(Document.get().createDivElement());
    Style style = getElement().getStyle();
    style.setProperty("whiteSpace", "nowrap");
    style.setPadding(3, Unit.PX);//from  w  ww.  ja  v  a2s  .com
    style.setPaddingLeft(12, Unit.PX);
    // handle styling
    style = handle.getStyle();
    style.setDisplay(Display.NONE);
    style.setTextAlign(TextAlign.CENTER);
    style.setWidth(0.5, Unit.EM);
    style.setHeight(0.5, Unit.EM);
    style.setCursor(Cursor.POINTER);
    style.setBackgroundColor("gray");
    style.setColor("white");
    style.setPadding(4, Unit.PX);
    style.setMarginRight(3, Unit.PX);
    style.setLineHeight(0.5, Unit.EM);
    handle.setInnerHTML("+");
    getElement().appendChild(handle);
    getElement().appendChild(text);
    // children styling
    style = children.getStyle();
    style.setPaddingLeft(1.5, Unit.EM);
    style.setDisplay(Display.NONE);

    getElement().appendChild(children);
    addDomHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (event.getNativeEvent().getEventTarget().cast() == handle) {
                if (children.getStyle().getDisplay().intern() == Display.NONE.getCssName()) {
                    open(event.getNativeEvent().getAltKey());
                } else {
                    close();
                }

            } else if (event.getNativeEvent().getEventTarget().cast() == text) {
                select(event);
            }
        }
    }, ClickEvent.getType());
}

From source file:com.vaadin.client.ui.VCustomScrollTable.java

License:Apache License

private void announceScrollPosition() {
    if (scrollPositionElement == null) {
        scrollPositionElement = DOM.createDiv();
        scrollPositionElement.setClassName(getStylePrimaryName() + "-scrollposition");
        scrollPositionElement.getStyle().setPosition(Position.ABSOLUTE);
        scrollPositionElement.getStyle().setDisplay(Display.NONE);
        getElement().appendChild(scrollPositionElement);
    }/* w ww  .j a v a2 s.  co m*/

    Style style = scrollPositionElement.getStyle();
    style.setMarginLeft(getElement().getOffsetWidth() / 2 - 80, Unit.PX);
    style.setMarginTop(-scrollBodyPanel.getOffsetHeight(), Unit.PX);

    // indexes go from 1-totalRows, as rowheaders in index-mode indicate
    int last = (firstRowInViewPort + pageLength);
    if (last > totalRows) {
        last = totalRows;
    }
    scrollPositionElement
            .setInnerHTML("<span>" + (firstRowInViewPort + 1) + " &ndash; " + (last) + "..." + "</span>");
    style.setDisplay(Display.BLOCK);
}

From source file:com.vaadin.client.widgets.JsniWorkaround.java

License:Apache License

/**
 * Creates a new Escalator widget instance.
 *///from   ww  w .j  a v a 2 s.c om
public Escalator() {

    detectAndApplyPositionFunction();
    getLogger().info("Using " + position.getClass().getSimpleName() + " for position");

    final Element root = DOM.createDiv();
    setElement(root);

    setupScrollbars(root);

    tableWrapper = DivElement.as(DOM.createDiv());

    root.appendChild(tableWrapper);

    final Element table = DOM.createTable();
    tableWrapper.appendChild(table);

    table.appendChild(headElem);
    table.appendChild(bodyElem);
    table.appendChild(footElem);

    Style hCornerStyle = headerDeco.getStyle();
    hCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(), Unit.PX);
    hCornerStyle.setDisplay(Display.NONE);
    root.appendChild(headerDeco);

    Style fCornerStyle = footerDeco.getStyle();
    fCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(), Unit.PX);
    fCornerStyle.setDisplay(Display.NONE);
    root.appendChild(footerDeco);

    Style hWrapperStyle = horizontalScrollbarDeco.getStyle();
    hWrapperStyle.setDisplay(Display.NONE);
    hWrapperStyle.setHeight(horizontalScrollbar.getScrollbarThickness(), Unit.PX);
    root.appendChild(horizontalScrollbarDeco);

    setStylePrimaryName("v-escalator");

    spacerDecoContainer.setAttribute("aria-hidden", "true");

    // init default dimensions
    setHeight(null);
    setWidth(null);
}