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

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

Introduction

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

Prototype

public void setVisibility(Visibility value) 

Source Link

Usage

From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java

License:Apache License

private void configureCurrentPanel() {
    Transition.resetTransition(currentPanel);

    Style style = currentPanel.getElement().getStyle();

    style.setPosition(Position.RELATIVE);
    style.setTop(0, Unit.PX);//from   www  . j a  v  a2 s . c om
    style.setLeft(0, Unit.PX);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.VISIBLE);
    style.setVisibility(Visibility.VISIBLE);
    style.setOpacity(1);
}

From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java

License:Apache License

private void configureNextPanel() {
    Style style = nextPanel.getElement().getStyle();
    style.setTop(0, Unit.PX);//w  w  w .ja  v a2  s .  c om
    style.setLeft(0, Unit.PX);
    style.setPosition(Position.ABSOLUTE);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.VISIBLE);
    style.setVisibility(Visibility.HIDDEN);
    style.setOpacity(0);
}

From source file:org.cruxframework.crux.widgets.client.swappanel.HorizontalSwapPanel.java

License:Apache License

private void prepareNextPanelToSlideIn(Widget w, Direction direction) {
    try {//from ww w  .ja  v a2 s .  c om
        nextPanel.clear();
    } catch (Exception e) {
        nextPanel = new SimplePanel();
    }

    nextPanel.add(w);
    int left;

    if (direction.equals(Direction.FORWARD)) {
        left = contentPanel.getOffsetWidth();
    } else {
        left = -contentPanel.getOffsetWidth();
    }

    Transition.translateX(nextPanel, left, null);
    Style style = nextPanel.getElement().getStyle();
    style.setVisibility(Visibility.VISIBLE);
    style.setOpacity(1);

}

From source file:org.jboss.errai.ui.test.stylebinding.client.res.CompositeStyleBoundTemplate.java

License:Apache License

@TestBinding
private void testBindingStyleUpdate(Style style) {
    if ("0".equals(getTestModel().getTestB())) {
        style.setVisibility(Style.Visibility.HIDDEN);
    } else {// w  w  w.  j  a va 2  s  . c  o  m
        style.clearVisibility();
    }
}

From source file:org.jboss.errai.ui.test.stylebinding.client.res.CompositeStyleBoundTemplate.java

License:Apache License

@ComponentBinding
private void testCustomComponentBindingStyleUpdate(Style style) {
    if ("0".equals(getTestModel().getTestC())) {
        style.setVisibility(Style.Visibility.HIDDEN);
    } else {//w w w.java  2s. com
        style.clearVisibility();
    }
}

From source file:org.opencms.gwt.client.util.CmsTextMetrics.java

License:Open Source License

/**
 * Binds this text metrics instance to an element from which to copy existing
 * CSS styles that can affect the size of the rendered text.<p>
 * //w  w w  .ja  v  a2  s .  co  m
 * @param element the element
 * @param attributes the attributes to bind
 */
protected void bind(Element element, CmsDomUtil.Style... attributes) {

    if (m_elem == null) {
        // create playground
        m_elem = DOM.createDiv();
        Style style = m_elem.getStyle();
        style.setVisibility(Style.Visibility.HIDDEN);
        style.setPosition(Style.Position.ABSOLUTE);
        style.setLeft(-5000, Style.Unit.PX);
        style.setTop(-5000, Style.Unit.PX);
    }
    // copy all relevant CSS properties
    Style style = m_elem.getStyle();
    for (CmsDomUtil.Style attr : attributes) {
        String attrName = attr.toString();
        style.setProperty(attrName, CmsDomUtil.getCurrentStyle(element, attr));
    }
    // append playground
    RootPanel.getBodyElement().appendChild(m_elem);
}

From source file:org.waveprotocol.wave.client.editor.debug.DebugPopupFactory.java

License:Apache License

/**
 * Create a debug popup.//w ww.ja  v  a 2 s . co m
 * @param editorImpl
 */
public static UniversalPopup create(EditorImpl editorImpl) {
    final DebugDialog debugDialog = new DebugDialog(editorImpl);
    RelativePopupPositioner positioner = new RelativePopupPositioner() {
        public void setPopupPositionAndMakeVisible(Element reference, Element popup) {
            com.google.gwt.dom.client.Style popupStyle = popup.getStyle();
            popupStyle.setTop(50, Unit.PX);
            popupStyle.setLeft(50, Unit.PX);
            popupStyle.setVisibility(Visibility.VISIBLE);
            popupStyle.setPosition(Position.FIXED);
        }
    };
    PopupEventListener listener = new PopupEventListener() {
        public void onHide(PopupEventSourcer source) {
            debugDialog.onHide();
        }

        public void onShow(PopupEventSourcer source) {
            debugDialog.onShow();
        }
    };
    final UniversalPopup popup = EditorStaticDeps.createPopup(null, positioner, false, true, debugDialog,
            listener);
    if (popup.getTitleBar() != null) {
        popup.getTitleBar().setTitleText("Editor Debug");
        popup.getTitleBar().addButton(new Button(" X ", new ClickHandler() {
            public void onClick(ClickEvent event) {
                popup.hide();
            }
        }));
    }
    return popup;
}

From source file:org.waveprotocol.wave.client.editor.sugg.InteractiveSuggestionsManager.java

License:Apache License

@Override
public void setPopupPositionAndMakeVisible(Element reference, final Element popup) {
    Style popupStyle = popup.getStyle();

    // TODO(danilatos): Do something more intelligent than arbitrary constants (which might be
    // susceptible to font size changes, etc)
    popupStyle.setLeft(popupAnchor.getAbsoluteLeft() - popup.getOffsetWidth() + 26, Unit.PX);
    popupStyle.setTop(popupAnchor.getAbsoluteBottom() + 5, Unit.PX);

    popupStyle.setVisibility(Visibility.VISIBLE);
}

From source file:org.waveprotocol.wave.client.wavepanel.impl.edit.BlipMenuController.java

License:Apache License

private PopupMenu createPopupMenu() {
    final PopupMenu menu = new PopupMenu(menuContextElement, new RelativePopupPositioner() {

        @Override//  w w w . j a v  a2  s  . c  om
        public void setPopupPositionAndMakeVisible(Element relative, Element popup) {
            int left, top;
            if (DomUtil.doesElementHaveType(menuContextElement, Type.BLIP_MENU_BUTTON)) {
                int popupWidth = popup.getOffsetWidth();
                left = relative.getAbsoluteRight() - popupWidth;
                top = relative.getAbsoluteBottom();
            } else {
                left = menuContextEvent.getClientX();
                top = menuContextEvent.getClientY();
            }
            Style popupStyle = popup.getStyle();
            popupStyle.setLeft(left, Style.Unit.PX);
            popupStyle.setTop(top, Style.Unit.PX);
            popupStyle.setPosition(Style.Position.FIXED);
            popupStyle.setVisibility(Style.Visibility.VISIBLE);
        }
    });

    BlipView blipView = getBlip();
    final ConversationBlip blip = modelProvider.getBlip(blipView);
    boolean beingEdited = blipView.isBeingEdited();
    boolean focused = blipView.isFocused();

    // "Edit" popup menu item.
    if (!beingEdited) {
        menu.addItem(
                messages.edit(), ((focused && inited) ? KeyComboManager
                        .getFirstKeyComboHintByTask(KeyComboContext.WAVE, KeyComboTask.EDIT_BLIP) : null),
                new Command() {

                    @Override
                    public void execute() {
                        actions.startEditing(blip);
                        menu.hide();
                    }
                }, true);
    }

    // "Add" popup menu item.
    if (!beingEdited) {
        String text = navigator.isBlipLastInParentThread(blip) ? messages.add() : messages.insert();
        menu.addItem(text, ((focused && inited) ? KeyComboManager
                .getFirstKeyComboHintByTask(KeyComboContext.TEXT_EDITOR, KeyComboTask.CANCEL_EDITING) : null),
                new Command() {

                    @Override
                    public void execute() {
                        actions.addBlipAfter(blip);
                        menu.hide();
                    }
                }, true);
    }

    // "Reply" popup menu item.
    if (!beingEdited) {
        menu.addItem(
                messages.reply(), ((focused && inited) ? KeyComboManager
                        .getFirstKeyComboHintByTask(KeyComboContext.WAVE, KeyComboTask.REPLY_TO_BLIP) : null),
                new Command() {

                    @Override
                    public void execute() {
                        actions.reply(blip);
                        menu.hide();
                    }
                }, true);
    }

    // "Done" popup menu item.
    if (beingEdited) {
        menu.addItem(messages.done(),
                ((focused && inited) ? KeyComboManager.getFirstKeyComboHintByTask(KeyComboContext.TEXT_EDITOR,
                        KeyComboTask.DONE_WITH_EDITING) : null),
                new Command() {

                    @Override
                    public void execute() {
                        actions.stopEditing(true);
                        menu.hide();
                    }
                }, true);
    }

    // "Delete" popup menu item.
    menu.addItem(messages.delete(),
            ((focused && inited)
                    ? KeyComboManager.getFirstKeyComboHintByTask(KeyComboContext.WAVE, KeyComboTask.DELETE_BLIP)
                    : null),
            new Command() {

                @Override
                public void execute() {
                    actions.deleteBlip(blip, Actions.DeleteOption.WITH_CONFIRMATION);
                    menu.hide();
                }
            }, true);

    // "Delete thread" popup menu item.
    ConversationThread thread = blip.getThread();
    if (!thread.isRoot() && thread.getFirstBlip() == blip && navigator.getChildBlipCount(thread) > 1) {
        menu.addItem(messages.deleteThread(), null, new Command() {

            @Override
            public void execute() {
                actions.deleteParentThread(blip, Actions.DeleteOption.WITH_CONFIRMATION);
                menu.hide();
            }
        }, true);
    }

    // "Link" popup menu item.
    if (!beingEdited) {
        menu.addItem(
                messages.link(), ((focused && inited) ? KeyComboManager
                        .getFirstKeyComboHintByTask(KeyComboContext.WAVE, KeyComboTask.POPUP_LINK) : null),
                new Command() {

                    @Override
                    public void execute() {
                        actions.popupLink(blip);
                        menu.hide();
                    }
                }, true);
    }

    inited = true;

    return menu;
}

From source file:stroom.data.grid.client.MoveHandle.java

License:Apache License

public void move(final NativeEvent event) {
    if (heading != null && moving) {
        final Style style = getElement().getStyle();
        style.setVisibility(Visibility.VISIBLE);
        final int left = event.getClientX() - offset;
        style.setLeft(left, Unit.PX);/*w  w w. ja v  a  2 s. c o  m*/
        style.setTop(heading.getElement().getAbsoluteTop(), Unit.PX);
        style.setWidth(heading.getElement().getOffsetWidth(), Unit.PX);
        style.setHeight(dataGrid.getElement().getOffsetHeight(), Unit.PX);

        final Element parent = heading.getElement().getParentElement();

        insertPos = parent.getChildCount();
        for (int i = 0; i < parent.getChildCount(); i++) {
            final Element child = parent.getChild(i).cast();

            if (i == heading.getColIndex() + 1) {
                // Don't allow the user to insert an item after itself as
                // this doesn't make sense.
                if (child.getAbsoluteLeft() > event.getClientX()) {
                    insertPos = i - 1;
                    break;
                }

            } else if (i == parent.getChildCount() - 1 && heading.getColIndex() == parent.getChildCount() - 1) {
                // Don't allow the user to insert an item after itself as
                // this doesn't make sense.
                insertPos = i;
                break;

            } else if (child.getAbsoluteLeft() + (child.getScrollWidth() / 2) >= event.getClientX()) {
                insertPos = i;
                break;
            }
        }

        // Constrain to the first movable column.
        int firstMovableCol = 0;
        for (int i = 0; i < colSettings.size(); i++) {
            final ColSettings settings = colSettings.get(i);
            if (settings.isMovable()) {
                firstMovableCol = i;
                break;
            }
        }
        insertPos = Math.max(insertPos, firstMovableCol);

        // Show this handle if it isn't already showing.
        show();

        // Show the target line.
        if (insertPos == 0) {
            showTargetLine(dataGrid.getAbsoluteLeft(), dataGrid.getAbsoluteTop(), dataGrid.getOffsetHeight());
        } else {
            final Element child = parent.getChild(insertPos - 1).cast();
            showTargetLine(child.getAbsoluteRight() - HALF_LINE_WIDTH, dataGrid.getAbsoluteTop(),
                    dataGrid.getOffsetHeight());
        }
    }
}