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:ilarkesto.gwt.client.desktop.fields.FieldEditorDialogBox.java

License:Open Source License

private Label createErrorLabel() {
    Label label = new Label();
    Style style = label.getElement().getStyle();
    style.setDisplay(Display.NONE);
    style.setColor("#cc0000");
    style.setMarginTop(Widgets.defaultSpacing, Unit.PX);
    style.setMarginBottom(Widgets.defaultSpacing, Unit.PX);
    return label;
}

From source file:jetbrains.jetpad.projectional.view.toGwt.TextViewMapper.java

License:Apache License

@Override
protected void registerSynchronizers(SynchronizersConfiguration conf) {
    final DomTextEditor editor = new DomTextEditor(getTarget());
    Style style = getTarget().getStyle();
    style.setPosition(Style.Position.ABSOLUTE);
    style.setDisplay(Style.Display.BLOCK);

    super.registerSynchronizers(conf);

    conf.add(Synchronizers.forPropsOneWay(getSource().selectionVisible(), new WritableProperty<Boolean>() {
        @Override/* ww w.j  a  va 2  s .  co m*/
        public void set(Boolean value) {
            editor.setSelectionVisible(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().selectionStart(), new WritableProperty<Integer>() {
        @Override
        public void set(Integer value) {
            editor.setSelectionStart(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().text(), new WritableProperty<String>() {
        @Override
        public void set(String value) {
            editor.setText(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().textColor(), new WritableProperty<Color>() {
        @Override
        public void set(Color value) {
            editor.setTextColor(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().caretVisible(), new WritableProperty<Boolean>() {
        @Override
        public void set(Boolean value) {
            editor.setCaretVisible(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().caretPosition(), new WritableProperty<Integer>() {
        @Override
        public void set(Integer value) {
            editor.setCaretPosition(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().bold(), new WritableProperty<Boolean>() {
        @Override
        public void set(Boolean value) {
            editor.setBold(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().italic(), new WritableProperty<Boolean>() {
        @Override
        public void set(Boolean value) {
            editor.setItalic(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().fontFamily(), new WritableProperty<FontFamily>() {
        @Override
        public void set(FontFamily value) {
            editor.setFontFamily(value);
        }
    }));
    conf.add(Synchronizers.forPropsOneWay(getSource().fontSize(), new WritableProperty<Integer>() {
        @Override
        public void set(Integer value) {
            editor.setFontSize(value);
        }
    }));
}

From source file:org.cruxframework.crux.smartfaces.client.swappanel.SwapPanel.java

License:Apache License

/**
 * Changes the widget being shown on this widget.
 * @param widget - the widget will be insert in the swapPanel
 * @param animation - type of animation/*from ww  w . j  ava  2 s .  c  om*/
 * @param animationEnabled - type of animation
 */
public void transitTo(final Widget widget, SwapAnimation animation, boolean animationEnabled,
        final SwapAnimationCallback callback) {
    if (!animating) {
        setPanelHeightOnWidgetAttached(widget);

        animating = true;
        nextPanel.clear();
        nextPanel.add(widget);

        if (animationEnabled && animation != null) {
            animation.animate(nextPanel, currentPanel, new SwapAnimationHandler() {
                @Override
                public void setInElementInitialState(Widget in) {
                    Style style = in.getElement().getStyle();
                    style.setDisplay(Display.BLOCK);
                }

                @Override
                public void setInElementFinalState(Widget in) {
                    Style style = in.getElement().getStyle();
                    style.setDisplay(Display.NONE);
                }

                @Override
                public void setOutElementInitialState(Widget out) {
                    Style style = out.getElement().getStyle();
                    style.setDisplay(Display.NONE);
                }

                @Override
                public void setOutElementFinalState(Widget out) {
                    Style style = out.getElement().getStyle();
                    style.setDisplay(Display.BLOCK);
                }
            }, new SwapAnimationCallback() {

                @Override
                public void onAnimationCompleted() {
                    completedAnimation();
                    if (callback != null) {
                        callback.onAnimationCompleted();
                    }
                }
            });
        } else {
            completedAnimation();
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.ShelfPresenter.java

License:Open Source License

public void increaseGlassHeight(Element glass) {

    Style style = glass.getStyle();

    int winWidth = Window.getClientWidth();
    int winHeight = Window.getClientHeight();

    // Hide the glass while checking the document size. Otherwise it would
    // interfere with the measurement.
    style.setDisplay(Display.NONE);
    style.setWidth(0, Unit.PX);//from   w  w  w. j  a va  2 s. co  m
    style.setHeight(0, Unit.PX);

    int width = Document.get().getScrollWidth();
    int height = Document.get().getScrollHeight();

    // Set the glass size to the larger of the window's client size or the
    // document's scroll size.
    style.setWidth(Math.max(width, winWidth), Unit.PX);
    style.setHeight(Math.max(height, winHeight), Unit.PX);

    // The size is set. Show the glass again.
    style.setDisplay(Display.BLOCK);
}

From source file:org.gwtbootstrap3.client.ui.InlineHelpBlock.java

License:Apache License

public InlineHelpBlock() {
    super();//from   w w  w. j a  v a 2  s  . c om
    Style style = getElement().getStyle();
    style.setDisplay(Display.INLINE_BLOCK);
    style.setMarginTop(0, Unit.PX);
    style.setMarginBottom(0, Unit.PX);
    style.setPaddingLeft(10, Unit.PX);
}

From source file:org.opencms.ade.containerpage.client.CmsContainerpageDNDController.java

License:Open Source License

/**
 * Sets styles of helper elements, appends the to the drop target and puts them into a drag info bean.<p>
 * /*from  ww  w.j a  v a 2  s.  co  m*/
 * @param dragHelper the drag helper element
 * @param placeholder the placeholder element
 * @param target the drop target
 * @param handler the drag and drop handler
 */
private void prepareDragInfo(Element dragHelper, Element placeholder, I_CmsDropTarget target,
        CmsDNDHandler handler) {

    target.getElement().appendChild(dragHelper);
    // preparing helper styles
    int width = CmsDomUtil.getCurrentStyleInt(dragHelper, CmsDomUtil.Style.width);
    Style style = dragHelper.getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setMargin(0, Unit.PX);
    style.setWidth(width, Unit.PX);
    style.setZIndex(I_CmsLayoutBundle.INSTANCE.constants().css().zIndexDND());
    dragHelper.addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragging());
    dragHelper.addClassName(org.opencms.gwt.client.ui.css.I_CmsLayoutBundle.INSTANCE.generalCss().shadow());
    if (!CmsDomUtil.hasBackgroundImage(dragHelper)) {
        dragHelper.getStyle().setBackgroundColor(CmsDomUtil.getEffectiveBackgroundColor(dragHelper));
    }
    if (!CmsDomUtil.hasBorder(dragHelper)) {
        dragHelper.addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragElementBorder());
    }
    style.setDisplay(Display.NONE);

    String positioning = CmsDomUtil.getCurrentStyle(target.getElement(),
            org.opencms.gwt.client.util.CmsDomUtil.Style.position);
    // set target relative, if not absolute or fixed
    if (!Position.ABSOLUTE.getCssName().equals(positioning)
            && !Position.FIXED.getCssName().equals(positioning)) {
        target.getElement().getStyle().setPosition(Position.RELATIVE);
    }
    setMinHeight(target);
    m_dragInfos.put(target, new DragInfo(dragHelper, placeholder, width - 15, handler.getCursorOffsetY()));
    handler.addTarget(target);

    // adding drag handle
    Element button = DOM.createDiv();
    button.appendChild((new Image(I_CmsImageBundle.INSTANCE.icons().moveIconActive())).getElement());
    button.addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragHandle());
    dragHelper.appendChild(button);
}

From source file:org.opencms.gwt.client.ui.input.location.CmsLocationPopupContent.java

License:Open Source License

/**
 * Sets the field visibility.<p>//from   ww  w .j a v a2  s .  c  o m
 *
 * @param visible <code>true</code> to show the field
 */
protected void setAddressVisible(boolean visible) {

    Style style = m_addressLabel.getElement().getParentElement().getStyle();
    if (visible) {
        style.clearDisplay();
    } else {
        style.setDisplay(Display.NONE);
    }
}

From source file:org.opencms.gwt.client.ui.input.location.CmsLocationPopupContent.java

License:Open Source License

/**
 * Sets the field visibility.<p>//from w  w w.j  ava 2 s.co m
 *
 * @param visible <code>true</code> to show the field
 */
protected void setLatLngVisible(boolean visible) {

    Style styleLat = m_latitudeLabel.getElement().getParentElement().getStyle();
    Style styleLng = m_longitudeLabel.getElement().getParentElement().getStyle();
    if (visible) {
        styleLat.clearDisplay();
        styleLng.clearDisplay();
    } else {
        styleLat.setDisplay(Display.NONE);
        styleLng.setDisplay(Display.NONE);
    }
}

From source file:org.opencms.gwt.client.ui.input.location.CmsLocationPopupContent.java

License:Open Source License

/**
 * Sets the field visibility.<p>// ww  w.jav  a 2  s.c o  m
 *
 * @param visible <code>true</code> to show the field
 */
protected void setMapVisible(boolean visible) {

    Style style = m_mapCanvas.getStyle();
    if (visible) {
        style.clearDisplay();
    } else {
        style.setDisplay(Display.NONE);
    }
}

From source file:org.opencms.gwt.client.ui.input.location.CmsLocationPopupContent.java

License:Open Source License

/**
 * Sets the field visibility.<p>//  w ww. ja  va2 s  .c o m
 *
 * @param visible <code>true</code> to show the field
 */
protected void setModeVisible(boolean visible) {

    Style style = m_modeLabel.getElement().getParentElement().getStyle();
    if (visible) {
        style.clearDisplay();
    } else {
        style.setDisplay(Display.NONE);
    }
}