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

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

Introduction

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

Prototype

public void setPosition(Position value) 

Source Link

Usage

From source file:org.eclipse.che.ide.ui.window.CompositeWindowView.java

License:Open Source License

private void addModality() {
    windowFrameGlassPanel = new HTMLPanel("div", "");

    Style style = windowFrameGlassPanel.getElement().getStyle();
    style.setPosition(FIXED);
    style.setWidth(100., PCT);//from   w w w.ja v  a2s .c  o  m
    style.setHeight(100., PCT);
    style.setTop(0., PX);
    style.setLeft(0., PX);

    RootPanel.get().add(windowFrameGlassPanel);
}

From source file:org.guvnor.client.editors.GeneralTextEditorScreenView.java

License:Apache License

@PostConstruct
public void setup() {
    initWidget(editor);//from w  w w  . ja  v a 2  s.  c  o m

    final Style s = getElement().getStyle();
    s.setPosition(Style.Position.ABSOLUTE);
    s.setOverflow(Style.Overflow.HIDDEN);
    s.setTop(0.0, Style.Unit.PX);
    s.setLeft(0.0, Style.Unit.PX);
    s.setWidth(100.0, Style.Unit.PCT);
    s.setHeight(100.0, Style.Unit.PCT);

    editor.startEditor();
    editor.setTheme(AceEditorTheme.CLOUD9_NIGHT);
}

From source file:org.guvnor.client.editors.GeneralTextEditorScreenView.java

License:Apache License

@Override
public void onAttach() {
    super.onAttach();
    final Style s = editor.getElement().getParentElement().getStyle();
    s.setPosition(Style.Position.ABSOLUTE);
    s.setOverflow(Style.Overflow.HIDDEN);
    s.setTop(0.0, Style.Unit.PX);
    s.setLeft(0.0, Style.Unit.PX);
    s.setWidth(100.0, Style.Unit.PCT);
    s.setHeight(100.0, Style.Unit.PCT);
}

From source file:org.gwtbootstrap3.extras.gallery.client.ui.GalleryImage.java

License:Apache License

@Override
public void add(final Widget child) {
    if (child instanceof Image) {
        if (image != null) {
            image.removeFromParent();/*from   w  w w. j a v a  2 s.c  o m*/
        }

        image = (Image) child;
        setHref(image.getUrl());

        super.add(image);
    } else if (child instanceof HasClickHandlers) {
        ((HasClickHandlers) child).addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                event.stopPropagation();
            }
        });

        Scheduler.get().scheduleDeferred(new Command() {
            @Override
            public void execute() {
                Style style = child.getElement().getStyle();
                style.setPosition(Position.RELATIVE);
                style.setBottom((double) image.getHeight(), Unit.PX);
                style.setLeft(4, Unit.PX);
            }
        });

        super.add(child);
    } else {
        super.add(child);
    }
}

From source file:org.jboss.errai.mvp.client.presenters.RootView.java

License:Apache License

public void ensureGlass() {
    if (glass == null) {
        glass = Document.get().createDivElement();

        Style style = glass.getStyle();
        style.setPosition(Style.Position.ABSOLUTE);
        style.setLeft(0, Style.Unit.PX);
        style.setTop(0, Style.Unit.PX);
        style.setRight(0, Style.Unit.PX);
        style.setBottom(0, Style.Unit.PX);
        style.setZIndex(2147483647); // Maximum z-index
    }//www.  jav a2 s .c om
}

From source file:org.kie.dockerui.client.widgets.container.navigator.item.view.NavigationDateItemView.java

License:Apache License

private void positionItems() {

    // Day text./*from  www  .j  av  a2  s  . c  om*/
    final Style dayStyle = day.getElement().getStyle();
    dayStyle.setPosition(Style.Position.ABSOLUTE);
    dayStyle.setMarginTop((ICON_SIZE / 2) * -1, Style.Unit.PX);
    dayStyle.setMarginLeft((ICON_SIZE / 2) + 10, Style.Unit.PX);

    // Month text.
    final Style monthStyle = month.getElement().getStyle();
    monthStyle.setPosition(Style.Position.ABSOLUTE);
    monthStyle.setMarginTop(25, Style.Unit.PX);
    monthStyle.setMarginLeft((ICON_SIZE / 2) + (month.getOffsetWidth() / 2), Style.Unit.PX);

    // Count number.
    final Style countStyle = countText.getElement().getStyle();
    countStyle.setPosition(Style.Position.ABSOLUTE);
    countStyle.setMarginTop(20, Style.Unit.PX);
    countStyle.setMarginLeft((ICON_SIZE - 20), Style.Unit.PX);
}

From source file:org.kie.dockerui.client.widgets.container.navigator.item.view.NavigationItemView.java

License:Apache License

private void show(final String id, final String _title, final String _text, final SafeUri imageUri,
        final int containersRunningCount) {
    showTitle(_title);//from  w w  w .j  a v  a  2s  .co  m
    showRunningContainers(id, containersRunningCount);

    // Show the navigation item image.
    final boolean isImage = imageUri != null;
    if (isImage) {
        image.setUrl(imageUri);
        image.setSize(getSizeInPx(), getSizeInPx());
    }
    image.setVisible(isImage);

    // Show the navigation item text.
    final boolean isText = _text != null;
    if (isText) {
        text.setText(new SafeHtmlBuilder().appendEscaped(_text).toSafeHtml().asString());
    }

    // Styles for placing the text over the image.
    final Style textStyle = text.getElement().getStyle();
    if (isImage && isText) {
        textStyle.setPosition(Style.Position.ABSOLUTE);
        textStyle.setMarginTop(size / 2, Style.Unit.PX);
        final int tSize = (int) (_text.length() * 5);
        textStyle.setMarginLeft((size / 2) - tSize, Style.Unit.PX);
    } else if (isText) {
        textStyle.setPosition(Style.Position.RELATIVE);
        textStyle.clearMarginTop();
        textStyle.clearMarginLeft();
    }
    text.setVisible(isText);

    // Add the click handler.
    addItemDetailClickHandler(id);
}

From source file:org.kie.uberfire.wires.core.client.palette.StencilPaletteBuilder.java

License:Apache License

private void setDragProxyPosition(final LienzoPanel dragProxyParentPanel, final LienzoPanel dragProxyPanel,
        final double proxyWidth, final double proxyHeight, final NodeMouseDownEvent event) {
    Style style = dragProxyPanel.getElement().getStyle();
    style.setPosition(Style.Position.ABSOLUTE);
    style.setLeft(dragProxyParentPanel.getAbsoluteLeft() + event.getX() - (proxyWidth / 2), Style.Unit.PX);
    style.setTop(dragProxyParentPanel.getAbsoluteTop() + event.getY() - (proxyHeight / 2), Style.Unit.PX);
    style.setZIndex(ZINDEX);//from   w  w w  .  j  a va 2 s .c o  m
}

From source file:org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandlerImpl.java

License:Apache License

private void setDragProxyPosition(final LienzoPanel dragProxyPanel, final double proxyWidth,
        final double proxyHeight, final double x, final double y) {
    Style style = dragProxyPanel.getElement().getStyle();
    style.setPosition(Style.Position.ABSOLUTE);
    style.setLeft(x - (proxyWidth / 2), Style.Unit.PX);
    style.setTop(y - (proxyHeight / 2), Style.Unit.PX);
    style.setZIndex(ZINDEX);//from   w w  w .j av a  2 s . com
}

From source file:org.komodo.web.client.panels.vdb.VdbEditPanel.java

License:Apache License

private Widget createObjectPropertiesPanel() {
    Style objPropPanelStyle = objectPropertiesPanel.getElement().getStyle();

    /*//from  w w  w.j a v  a 2  s  .  c  o m
     * Want to position the properties panel so its always to the right
     * of the diagram panel, even when zoomed in. Float: left fails to
     * work at this point since zoom in enough and the properties
     * panel jumps down below.
     */

    /*
     * Set the position of the properties panel to absolute so that we
     * are now in charge of its location
     */
    objPropPanelStyle.setPosition(Position.ABSOLUTE);

    /*
     * Set its position as being on same level as diagram panel
     */
    objPropPanelStyle.setTop(0, Unit.EM);

    /*
     * Move it to the right of the diagram panel which is the
     * diagram panel width + border width + an extra 2 units
     * to account for the vertical scrollbar width
     */
    objPropPanelStyle.setLeft(DIAGRAM_PANEL_WIDTH + BORDER_WIDTH + 2, Unit.EM);

    /*
     * Set its width and height to appropriate values
     */
    objPropPanelStyle.setWidth((DIAGRAM_PANEL_WIDTH * 3) / 5, Unit.EM);
    objPropPanelStyle.setHeight(EDIT_PANEL_HEIGHT, Unit.EM);

    /*
     * Set its background colour to a subtle shade that just frames the panel
     */
    objPropPanelStyle.setBackgroundColor("#fAfAfA"); //$NON-NLS-1$

    /*
     * Set overflow to use scrollbars if required
     */
    objPropPanelStyle.setOverflow(Overflow.AUTO);

    /*
     * Add the title
     */
    Label propertyTitle = new Label("Property Editor"); //$NON-NLS-1$
    Style titleStyle = propertyTitle.getElement().getStyle();

    /*
     * Centre the title
     * Set its font size and make it bold
     * Set its height as this ensures a value we can know when
     * passing on the remaining content area to the sub panels, ie.
     * SUB_PANEL_HEIGHT = DIAGRAM_PANEL_HEIGHT
     *                                          - PROPERTY_TITLE_HEIGHT + (BORDER_WIDTH * 2)
     */
    titleStyle.setTextAlign(TextAlign.CENTER);
    titleStyle.setFontSize(1, Unit.EM);
    titleStyle.setFontWeight(FontWeight.BOLD);
    titleStyle.setLineHeight(PROPERTY_TITLE_HEIGHT, Unit.EM);
    titleStyle.setHeight(PROPERTY_TITLE_HEIGHT, Unit.EM);
    objectPropertiesPanel.add(propertyTitle);

    return objectPropertiesPanel;
}