Java 类com.google.gwt.dom.client.Style.Position 实例源码

项目:ImageViewer    文件:VImageViewer.java   
public VImageViewer() {
    /* Create widget's root panel */
    panelRoot = new FlowPanel();
    Style style = panelRoot.getElement().getStyle();
    style.setPosition(Position.RELATIVE);
    setStyleName(CLASSNAME);
    panelRoot.setStyleName(CLASSNAME + "-flow");
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);

    /* Create image container */
    imageContainer = new FlowPanel();
    style = imageContainer.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setOverflow(Overflow.HIDDEN);

    /* Add widgets */
    setWidget(panelRoot);
    panelRoot.add(imageContainer);

    /* Register handlers */
    addDomHandler(this, KeyDownEvent.getType());
    addDomHandler(this, ClickEvent.getType());
    addMouseWheelHandler(new MouseWheelHandler() {
        public void onMouseWheel(MouseWheelEvent event) {
            event.preventDefault();
            if (event.isNorth()) {
                moveImages(true);
            } else {
                moveImages(false);
            }
        }
    });
}
项目:empiria.player    文件:LabelledImgContent.java   
private void alignWidget(Widget widget, Point anchorPoint, String horizontalAlign, String verticalAlign) {
    Style style = widget.getElement().getStyle();
    double xPos = anchorPoint.getX();
    double yPos = anchorPoint.getY();

    if ("center".equals(horizontalAlign)) {
        xPos -= widget.getOffsetWidth() / 2;
    } else if ("right".equals(horizontalAlign)) {
        xPos -= widget.getOffsetWidth();
    }

    if ("center".equals(verticalAlign)) {
        yPos -= widget.getOffsetHeight() / 2;
    } else if ("bottom".equals(verticalAlign)) {
        yPos -= widget.getOffsetHeight();
    }

    style.setPosition(Position.ABSOLUTE);
    style.setTop(yPos, Unit.PX);
    style.setLeft(xPos, Unit.PX);
}
项目:empiria.player    文件:VideoFullScreenHelper.java   
protected void openFullscreenIE(MediaWrapper<?> mediaWrapper, Element template) {
    if (mediaWrapper != null && template != null) {
        clearFullScreenView();
        lastMediaWrapper = mediaWrapper;
        VideoFullScreenView parent = getFullScreenView();
        Widget widget = mediaWrapper.getMediaObject();
        parent.getContainer().add(widget);
        resizeToFullScreen(parent.asWidget(), Position.FIXED);
        resizeToFullScreen(widget, Position.ABSOLUTE);
        parseTemplate(mediaWrapper, template, parent.getControls());
        fireEvent(true, mediaWrapper);
        RootPanel.get().add(parent);
        resizeToFullScreen(lastMediaWrapper.getMediaObject(), Position.FIXED);
        resizeToFullScreen(view.asWidget(), Position.FIXED);
        resizeToFullScreen(widget, Position.ABSOLUTE);
    }
}
项目:empiria.player    文件:VolumeMediaButton.java   
@Override
protected void onClick() {
    setActive(!isActive());
    if (!attached) {
        volumeScrollBar.getElement().getStyle().setPosition(Position.ABSOLUTE);
        ((Panel) getParent()).add(volumeScrollBar);
        attached = true;
    }
    changeStyleForClick();
    if (isActive()) {
        volumeScrollBar.setVisible(true);
        int width = volumeScrollBar.getElement().getAbsoluteRight() - volumeScrollBar.getElement().getAbsoluteLeft();
        width = getElement().getAbsoluteRight() - getElement().getAbsoluteLeft() - width;
        volumeScrollBar.getElement().getStyle().setLeft(getElement().getAbsoluteLeft() + width / 2, Unit.PX);
        int height = volumeScrollBar.getElement().getAbsoluteBottom() - volumeScrollBar.getElement().getAbsoluteTop();
        volumeScrollBar.getElement().getStyle().setTop(getElement().getAbsoluteTop() - height, Unit.PX);

    } else {
        volumeScrollBar.setVisible(false);
    }
}
项目:empiria.player    文件:PanelCache.java   
@Override
protected KeyValue<FlowPanel, FlowPanel> getElement(Integer index) {
    parent = panelFactory.getFlowPanel();
    FlowPanel childPanel = panelFactory.getFlowPanel();

    Style style = parent.getElement().getStyle();
    parent.getElement().setId(styleNames.QP_PAGE() + index.intValue());

    if (swipeType != SwipeType.DISABLED) {
        style.setPosition(Position.ABSOLUTE);
        style.setTop(0, Unit.PX);
        style.setLeft(WIDTH * index, Unit.PCT);
        style.setWidth(WIDTH, Unit.PCT);
    }

    childPanel.setHeight("100%");
    childPanel.setWidth("100%");
    parent.add(childPanel);
    return new KeyValue<FlowPanel, FlowPanel>(parent, childPanel);
}
项目:empiria.player    文件:MultiPageView.java   
public void setSwipeDisabled(boolean swipeDisabled) {
    Style style = controller.getStyle();
    Style elementStyle = getElement().getStyle();

    style.setWidth(controller.getWidth(), Unit.PCT);

    if (swipeDisabled) {
        style.clearPosition();
        style.clearTop();
        style.clearLeft();
        elementStyle.clearPosition();
    } else {
        style.setPosition(Position.ABSOLUTE);
        style.setTop(0, Unit.PX);
        style.setLeft(0, Unit.PX);
        elementStyle.setPosition(Position.RELATIVE);
    }

    setSwipeLength();
}
项目:empiria.player    文件:PanelCacheGWTTestCase.java   
public void testPageViewWithSwipeAndWithout() {
    PanelCache cache = PlayerGinjectorFactory.getNewPlayerGinjectorForGWTTestCase().getPanelCache();
    assertTrue(cache.isEmpty());
    KeyValue<FlowPanel, FlowPanel> value = cache.getOrCreateAndPut(0);
    Style style = value.getKey().getElement().getStyle();
    assertTrue(style.getPosition().equals(Position.ABSOLUTE.getCssName()));
    assertTrue(style.getTop().equals("0px"));
    assertEquals("0.0%", style.getLeft());
    assertEquals("100.0%", style.getWidth());
    value = cache.getOrCreateAndPut(2);
    style = value.getKey().getElement().getStyle();
    assertEquals(Position.ABSOLUTE.getCssName(), style.getPosition());
    assertEquals("0px", style.getTop());
    assertEquals("200.0%", style.getLeft());
    assertEquals("100.0%", style.getWidth());
    cache.setSwipeType(SwipeType.DISABLED);
    value = cache.getOrCreateAndPut(3);
    assertNotSame(Position.ABSOLUTE.getCssName(), style.getPosition());
    assertNotSame("0px", style.getTop());
    assertNotSame("200.0%", style.getLeft());
    assertNotSame("100.0%", style.getWidth());

}
项目:unitimes    文件:TimeGrid.java   
public SelectionPanel(boolean fixed) {
    setStyleName(fixed ? "selection" : "active-selection");
    if (fixed) {
        iRemove = new P("x"); iRemove.setHTML("&times;");
        iRemove.addMouseDownHandler(new MouseDownHandler() {
            @Override
            public void onMouseDown(MouseDownEvent event) {
                iSelections.remove(SelectionPanel.this);
                if (iSelection != null)
                    iAllSelections.remove(iSelection);
            }
        });
        iRemove.getElement().getStyle().setRight(2, Unit.PX);
        iRemove.getElement().getStyle().setTop(2, Unit.PX);
        iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE);
        add(iRemove);
        iText = new P("text");
        add(iText, 0, 0);
    }

    sinkEvents(Event.ONMOUSEDOWN);
    sinkEvents(Event.ONMOUSEUP);
    sinkEvents(Event.ONMOUSEMOVE);
}
项目:sig-seguimiento-vehiculos    文件:ActionBar.java   
public ActionBar() {
    super();
    setWidth(300);
    setHeaderVisible(false);
    addStyleName(ThemeStyles.get().style().borderBottom());
    setPosition(0, 0);
    getElement().getStyle().setPosition(Position.ABSOLUTE);
    HorizontalPanel horizontalGroup = new HorizontalPanel();
    horizontalGroup.add(getMenuButton());
    horizontalGroup.add(new SeparatorToolItem());
    Image image = new Image(ImageProvider.INSTANCE.menulogoGeowe());
    horizontalGroup.add(image);
    horizontalGroup.add(new SeparatorToolItem());
    horizontalGroup.add(new SeparatorToolItem());                       
    horizontalGroup.add(getGeocodingButton());
    setWidget(horizontalGroup);     
}
项目:riscoss-corporate    文件:WaitWidget.java   
public void show() {
        this.panel.setPopupPositionAndShow( new PositionCallback(){
            @Override
            public void setPosition( int offsetWidth, int offsetHeight )
            {

                panel.getElement().getStyle().setPosition( Position.FIXED );
                panel.getElement().getStyle().setTop( 0, Unit.PX );
//              panel.getElement().getStyle().setLeft( 0, Unit.PX );
//              panel.getElement().getStyle().setBottom( 0, Unit.PX );
                panel.getElement().getStyle().setRight( 0, Unit.PX );
                panel.getElement().getStyle().setProperty( "left", "" );
                panel.getElement().getStyle().setProperty( "bottom", "" );

//              DOM.setStyleAttribute( panel.getElement(), "position", "fixed" );
//              DOM.setStyleAttribute( panel.getElement(), "top", "0" );
//              DOM.setStyleAttribute( panel.getElement(), "left", "" );
//              DOM.setStyleAttribute( panel.getElement(), "bottom", "" );
//              DOM.setStyleAttribute( panel.getElement(), "right", "0px" );
            }
        } );
    }
项目:geowe-core    文件:ActionBar.java   
public ActionBar() {
    super();
    setWidth(300);
    setHeaderVisible(false);
    addStyleName(ThemeStyles.get().style().borderBottom());
    setPosition(0, 0);
    getElement().getStyle().setPosition(Position.ABSOLUTE);
    HorizontalPanel horizontalGroup = new HorizontalPanel();
    horizontalGroup.add(getMenuButton());
    horizontalGroup.add(new SeparatorToolItem());
    Image image = new Image(ImageProvider.INSTANCE.menulogoGeowe());
    horizontalGroup.add(image);
    horizontalGroup.add(new SeparatorToolItem());
    horizontalGroup.add(new SeparatorToolItem());                       
    horizontalGroup.add(getGeocodingButton());
    setWidget(horizontalGroup);     
}
项目:unitime    文件:TimeGrid.java   
public SelectionPanel(boolean fixed) {
    setStyleName(fixed ? "selection" : "active-selection");
    if (fixed) {
        iRemove = new P("x"); iRemove.setHTML("&times;");
        iRemove.addMouseDownHandler(new MouseDownHandler() {
            @Override
            public void onMouseDown(MouseDownEvent event) {
                iSelections.remove(SelectionPanel.this);
                if (iSelection != null)
                    iAllSelections.remove(iSelection);
            }
        });
        iRemove.getElement().getStyle().setRight(2, Unit.PX);
        iRemove.getElement().getStyle().setTop(2, Unit.PX);
        iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE);
        add(iRemove);
        iText = new P("text");
        add(iText, 0, 0);
    }

    sinkEvents(Event.ONMOUSEDOWN);
    sinkEvents(Event.ONMOUSEUP);
    sinkEvents(Event.ONMOUSEMOVE);
}
项目:daris    文件:SimpleTabPanel.java   
public SimpleTabPanel() {

        _hp = new HorizontalPanel();
        _hp.setHeight100();
        _hp.setPosition(Position.ABSOLUTE);
        _hp.setLeft(0);

        AbsolutePanel ap = new AbsolutePanel();
        ap.setOverflow(Overflow.HIDDEN);
        ap.setPreferredHeight(TAB_BAR_HEIGHT);
        ap.add(_hp);
        add(ap);

        _sp = new SimplePanel();
        _sp.fitToParent();
        _sp.setBorderTop(2, BorderStyle.SOLID, TAB_COLOR);
        _sp.setBorderLeft(1, BorderStyle.SOLID, TAB_COLOR);
        _sp.setBorderRight(1, BorderStyle.SOLID, TAB_COLOR);
        _sp.setBorderBottom(1, BorderStyle.SOLID, TAB_COLOR);
        add(_sp);
        _buttons = new HashMap<String, TabButton>();
        _widgets = new HashMap<String, Widget>();
        _listeners = new HashMap<String, TabListener>();
    }
项目:daris    文件:CTabPanel.java   
public TabBar(CTabPanel tabPanel) {

            _tabPanel = tabPanel;

            _tabsArea = new HorizontalPanel();
            _tabsArea.setHeight100();
            _tabsArea.setPosition(Position.ABSOLUTE);
            _tabsArea.setLeft(0);
            _tabsArea.setZIndex(Z_INDEX_TABS);
            add(_tabsArea);

            initControlsAreaLeft();

            initControlsAreaRight();

            setOverflow(Overflow.HIDDEN);
            setBorderBottom(3, Style.BorderStyle.SOLID, TAB_COLOUR_SELECTED);
            setWidth100();
            setPreferredHeight(DEFAULT_TAB_BAR_HEIGHT);
        }
项目:appformer    文件:ResizableMovableHeader.java   
private SpanElement createSpanElement(final Cursor cursor,
                                      final double left,
                                      final double width) {
    final SpanElement span = document.createSpanElement();
    span.setAttribute("title",
                      title);
    final Style style = span.getStyle();
    style.setCursor(cursor);
    style.setPosition(Position.ABSOLUTE);
    style.setBottom(0,
                    PX);
    style.setHeight(source.getOffsetHeight(),
                    PX);
    style.setTop(source.getOffsetTop(),
                 PX);
    style.setWidth(width,
                   PX);
    style.setLeft(left,
                  PX);
    return span;
}
项目:risk    文件:TankMovingAnimation.java   
public TankMovingAnimation(HTML mapContainer, int startX, int startY, int endX, int endY,
    ImageResource resource, Audio sfx, int tankSize) {
  piece = resource;
  this.startX = startX;
  this.startY = startY;
  this.endX = endX;
  this.endY = endY;
  this.startWidth = tankSize;
  this.startHeight = tankSize;
  sound = sfx;
  cancelled = false;

  panel = new AbsolutePanel();
  moving = new Image(resource);
  moving.setPixelSize(startWidth, startHeight);
  panel.add(moving, startX, startY);
  panel.getElement().getStyle().setOverflow(Overflow.VISIBLE);
  panel.getElement().getStyle().setPosition(Position.RELATIVE);
  mapContainer.getElement().insertFirst(panel.getElement());
}
项目:bitcoin-transaction-explorer    文件:Arrow.java   
public Arrow(final Orientation orientation, final int borderWidth) {
  setElement(d);
  this.orientation = orientation;
  this.borderWidth = borderWidth;
  d.appendChild(d1);
  d.appendChild(d2);
  d.getStyle().setPosition(Position.ABSOLUTE);
  d1.getStyle().setPosition(Position.ABSOLUTE);
  d1.getStyle().setHeight(0, Unit.PX);
  d1.getStyle().setWidth(0, Unit.PX);
  d1.getStyle().setPropertyPx(orientation.pos, 0);
  d1.getStyle().setPropertyPx(orientation.altPos, 0);
  d1.getStyle().setBorderStyle(BorderStyle.SOLID);
  d2.getStyle().setPosition(Position.ABSOLUTE);
  d2.getStyle().setHeight(0, Unit.PX);
  d2.getStyle().setWidth(0, Unit.PX);
  d2.getStyle().setPropertyPx(orientation.pos, borderWidth);
  d2.getStyle().setPropertyPx(orientation.altPos, borderWidth);
  d2.getStyle().setBorderStyle(BorderStyle.SOLID);
  topBottom = orientation == Orientation.TOP || orientation == Orientation.BOTTOM;
}
项目:gwt-gantt    文件:GanttChartView.java   
public void init() {
        taskScrollPanel.getElement().getStyle().setPosition(Position.ABSOLUTE);
        taskScrollPanel.getElement().getStyle().setOverflow(Overflow.SCROLL);

        //initialize the SVG panel
        initSVG();

        //add scroll handler
        taskScrollPanel.addScrollHandler(new ScrollHandler() {

            @Override
            public void onScroll(ScrollEvent event) {
                int hscroll = taskScrollPanel.getHorizontalScrollPosition() * -1;

                firstHeaderRow.getElement().getStyle().setLeft(hscroll, Unit.PX);
                secondHeaderRow.getElement().getStyle().setLeft(hscroll, Unit.PX);
                taskBackgroundPanel.getElement().getStyle().setLeft(hscroll, Unit.PX);
                display.fireEvent(event);
//                view.onScroll(taskScrollPanel.getHorizontalScrollPosition(),
//                        taskScrollPanel.getScrollPosition());
            }
        });
    }
项目:gwt-gantt    文件:GanttChartView.java   
public void initSVG() {
    svgPanel = new SVGPanel();
    svgPanel.setPointerEvents("none");
    svgPanel.setShapeRendering("crispEdges");
    svgPanel.getElement().getStyle().setOverflow(Overflow.HIDDEN);
    svgPanel.getElement().getStyle().setPosition(Position.ABSOLUTE);
    svgPanel.getElement().getStyle().setTop(0, Unit.PX);
    svgPanel.getElement().getStyle().setLeft(0, Unit.PX);

    // add the arrow marker to the svg panel
    svgArrowMarker = new SVGMarker("Triangle", .5, "black", "black");
    svgArrowMarker.setViewBox("0 0 8 8");
    svgArrowMarker.setRefX(0);
    svgArrowMarker.setRefY(4);
    svgArrowMarker.setMarkerWidth(8);
    svgArrowMarker.setMarkerHeight(8);
    svgArrowMarker.add(new SVGPath("M 0 0 L 8 4 L 0 8 z"));
    svgArrowMarker.setOrient("auto");
    svgArrowMarker.setMarkerUnits("strokeWidth");

    svgDefs = new SVGDefs();
    svgDefs.add(svgArrowMarker);
    svgPanel.add(svgDefs);
}
项目:gwt-gantt    文件:GanttChartView.java   
@Override
public void renderTaskMilestone(T task, Rectangle bounds) {
    TaskWidget taskWidget = new TaskWidget(task);

    //add the task widget
    taskWidget.setStyleName("milestone");
    taskWidget.getElement().setInnerHTML("&diams;");
    taskWidget.addStyleDependentName(display.getProvidesTask().getStyle(task));
    taskWidget.getElement().getStyle().setPosition(Position.ABSOLUTE);
    taskWidget.getElement().getStyle().setWidth(bounds.getWidth(), Unit.PX);
    taskWidget.getElement().getStyle().setHeight(bounds.getHeight(), Unit.PX);
    taskWidget.getElement().getStyle().setTop(bounds.getTop(), Unit.PX);
    taskWidget.getElement().getStyle().setLeft(bounds.getLeft(), Unit.PX);
    taskWidget.getElement().getStyle().setZIndex(taskWidgetsById.size() + 1);
    taskWidgetsById.put(display.getProvidesTask().getUID(task), taskWidget);
    taskFlowPanel.add(taskWidget);

    //calculate the estimated size of the task area
    calculateEstimatedSize(bounds);
}
项目:gwt-ol3    文件:DemoUtils.java   
/**
 * Create a MapBox logo.
 *
 * @return MapBox logo
 */
public static Control createMapboxLogo() {

    ControlOptions controlOptions = new ControlOptions();

    LinkElement mapboxLogo = Document.get().createLinkElement();
    mapboxLogo.setHref("https://mapbox.com/about/maps");
    mapboxLogo.setTarget("_blank");

    mapboxLogo.getStyle().setPosition(Position.ABSOLUTE);
    mapboxLogo.getStyle().setLeft(2, Unit.PX);
    mapboxLogo.getStyle().setBottom(5, Unit.PX);
    mapboxLogo.getStyle().setWidth(126, Unit.PX);
    mapboxLogo.getStyle().setHeight(40, Unit.PX);
    mapboxLogo.getStyle().setDisplay(Display.BLOCK);
    mapboxLogo.getStyle().setOverflow(Overflow.HIDDEN);

    mapboxLogo.getStyle().setBackgroundImage("url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAAoCAMAAAAFWtJHAAAAwFBMVEUAAAAAAAAAAABtbW0AAAAAAAAAAAAAAAAAAAAAAAClpaUAAADp6ekAAAD5+fna2toAAAAMDAzv7+/Nzc0AAAA2Njb8/Pz9/f3T09MAAAAAAAD7+/sAAAArKyuxsbH39/fs7OwbGxuIiIjz8/N8fHyenp7u7u74+PgAAAC8vLxWVlbx8fF1dXXl5eVcXFyUlJTQ0NDFxcVCQkLAwMC4uLj19fXo6OjW1tarq6ve3t77+/vi4uL6+vrKysrNzc3///8w7gSSAAAAP3RSTlMAOQNdPSYBPywKexLLGPCxNEHXnzFL+v2nGwf1IEiE6dBFad9jd9PuLo1V2mDDV3Cjl06SiuXIq4C3973ym6BQMVUPAAAEXElEQVR4Ae2WCVP6OBiH05L0l1IqrVbkKHJ54I0oHn+PfP9vtUle0z/YdhbH2XVnd58ZnRJIeHiPJOx//mH4vQSAN+8FjAhFxgHIaPvJeZ99hxwEElon5iAQbj85Y98g8ODwjEOMAvGFyeE3FEKgodTBqj0BJGN9DhyNd5Ta3ean9QEopfaA+LsKhnEKRExqg4FSP6Og7oEkAjBWnxSCgBX4xF+kcLoPcOBQrSv0e5kH7s1j37jECQieCTPiFGxL5VHw2zQWCeeJiPt6kjRQw0XSkIdVChf67xGa4alSnZlT6HEQ8CK9ANbhvXUF9xlDkBfTuHDWScgC9+z5FQpPI12TlwC6+sV7ixR8CUMKiwjm2GQeOQWHMGuHGdbnObJAwCEqFJpNU5H6uaPUaEIKiQfg+PHk1+u4OwW9PlWW2ctbA4BHCtp+cNK+H8Jos4gDmC5ar4Nx9waaG/2B13NgDqS7+vm2RgEtEws82P+kwIHhs/pgkQKcFIhfd7CogtGNjYMHTLpurD0ERbYFw4JaD3GlQuNAL/JEsSAF4HqlCnaHACk4WhOn4OgCkMD5hSpYNYDJTD8Y46n+jsE1kPhVCuR6QBXhFK7MUOu9O6b1SWF3b+/9ZVWMGOlu93E8UDaAhgc7bfH+0DHqKXCkHzoNDFfU+zxiVQrUC9QXTuHYtKpN59OA3IxCG4b7jh6ZFuVockaNTW09mkJzOaPU49a6mE9cAchZpQJNpUWcwgV9r6FJswsFKrITp2B5pMBMdnS0z2HZNy2+BNKxSZxZfglkrFYBJxQnpzA5sN/HheR2aFQoZBLAi149dQoyAYYjW0hHlHguBAdMcR0DuDZ5omevX6+AI8qcU7ikKT3GBHCnXwydgmCC0tRwCnGQ2Wp6Be71yNIWfQSkOl9vAI1SBCNWrwC01RROgX7BuT2HI4r7tFAw086p/NwZEdOEa7R1uAFuNmQPuKAEAjYNQ0CyeoUEWHYBnpQVQgpvc0Ph+gsKlAnKg1+vEHsw5LKciLKCAJobiWBzYFGbCKpHqkZZrxBFHEASyFI59vJPCskcwNVGOWZAOqsrR+pKbaNeAMT1CixMEtlnsqopNxUMzVJT3tY35aXZm6a6Y9QhwMN6BUJWbE1lhbMO1WehkO7poO0sK7em9MJGxp1XSbC1gtugzzSLQmGsX7VntJGSwsPZ2d2z3bIPKzdoOp3Wzqt8G4XyMVUoFIxLx1S7+piaHtCvR3FeRVsq0GFdp9C5TbGpcNqsPqyHKxcfd14h21KhuLKUFU4f3osrC7F6uV3WXFnadL7wyAPeKDXw2RoJCO5GY4DouYvb/gepVXheLoewzPseQG9N/vzilrMIjoStE3++zvle4eSurw7XEe76ynI4aq+v7lEyt1x5awiFlFLQbHKIpabnM3eJLym4Szzzc/du7SU+zOXv9UNpECH7IoH/gecURPlN9vdQpeD47yhIFNX0U0QgvID9nENm+yxk/xb+AGAjNfRZuk9qAAAAAElFTkSuQmCC)");

    controlOptions.setElement(mapboxLogo);

    return new Control(controlOptions);
}
项目:avro-ui    文件:AbstractFieldWidget.java   
public FieldWidgetLabel(final FormField field) {
    this.getElement().getStyle().setPosition(Position.RELATIVE);
    this.getElement().getStyle().setProperty("display", "flex");
    Label label = new Label(field.getDisplayName());
    if (field.isOverride()) {
        overrideBox = new CheckBox();
        label.getElement().getStyle().setLeft(28, Unit.PX);
        overrideBox.setValue(field.isChanged());
        overrideBox.setEnabled(!readOnly && !field.isReadOnly());
        add(overrideBox);
        if (!readOnly && !field.isReadOnly()) {
            registrations.add(overrideBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                @Override
                public void onValueChange(ValueChangeEvent<Boolean> event) {
                    field.setChanged(event.getValue(), true);
                    fireChanged();
                }
            }));
            field.addChangeListener(this);
        }
    }
    if (!field.isOptional()) {
        label.addStyleName(style.requiredField());
    }      
    add(label);
}
项目:hexa.tools    文件:DragDrop.java   
public Ghost( int x, int y, int w, int h, Element source, Callback<T> callback, T cookie )
{
    this.source = source;
    this.callback = callback;
    this.cookie = cookie;

    Element ghost = DOM.createDiv();

    Style style = ghost.getStyle();
    style.setPosition( Position.FIXED );
    style.setLeft( x, Unit.PX );
    style.setTop( y, Unit.PX );
    // style.setWidth( w, Unit.PX );
    // style.setHeight( h, Unit.PX );

    // style.setBackgroundColor( "rgba(200,200,200,0.5)" );

    style.setProperty( "pointerEvents", "none" );

    setElement( ghost );
}
项目:hexa.tools    文件:GrowingTextArea.java   
void resize()
{
    if( fakeDiv == null )
    {
        fakeDiv = DOM.createDiv();
        fakeDiv.getStyle().setPosition( Position.FIXED );
        fakeDiv.getStyle().setLeft( -10000, Unit.PX );
        getElement().getParentElement().insertAfter( fakeDiv, getElement() );
        applyStyle( fakeDiv );
    }

    int width = getElement().getAbsoluteRight() - getElement().getAbsoluteLeft();
    fakeDiv.getStyle().setWidth( width - 10 - 2, Unit.PX );

    fakeDiv.setInnerText( getText() );

    int height = getElement().getClientHeight();
    int newHeight = fakeDiv.getClientHeight() + 25;
    if( height < newHeight )
        getElement().getStyle().setHeight( newHeight, Unit.PX );
}
项目:QMAClone    文件:WidgetTimeProgressBar.java   
private void update() {
    long currentTime = System.currentTimeMillis();
    int time = (int) (currentTime - startTime);

    int left = time * WIDTH / MAX_TIME;
    int width = WIDTH - left;
    String message = second == 0 ? "時間切れ" : ("残り時間約" + second + "秒");
    String color = Utility.createBackgroundColorString((double) width / (double) WIDTH);
    SafeStyles styles = new SafeStylesBuilder()
            .position(Position.ABSOLUTE)
            .top(0, Unit.PX)
            .left(left, Unit.PX)
            .width(width, Unit.PX)
            .height(32, Unit.PX)
            .trustedBackgroundColor(color)
            .zIndex(-5)
            .toSafeStyles();
    SafeHtml safeHtml = TEMPLATE.bar(message, styles);
    html.setHTML(safeHtml);
}
项目:ListBuilder    文件:VListBuilder.java   
/** For internal use only. May be removed or replaced in the future. */
public void setInternalWidths() {
    getElement().getStyle().setPosition(Position.RELATIVE);
    int bordersAndPaddings = WidgetUtil.measureHorizontalPaddingAndBorder(buttons.getElement(), 0);
    int upDownBordersAndPaddings = WidgetUtil.measureHorizontalPaddingAndBorder(upDownButtons.getElement(), 0);
    int buttonWidth = WidgetUtil.getRequiredWidth(buttons);
    int upDownButtonsWidth = WidgetUtil.getRequiredWidth(upDownButtons);
    int totalWidth = getOffsetWidth();

    int spaceForSelect = (totalWidth - buttonWidth - upDownButtonsWidth - bordersAndPaddings
            - upDownBordersAndPaddings) / 2;

    optionsListBox.setWidth(spaceForSelect + "px");
    if (optionsCaption != null) {
        optionsCaption.setWidth(spaceForSelect + "px");
    }

    selectionsListBox.setWidth(spaceForSelect + "px");
    if (selectionsCaption != null) {
        selectionsCaption.setWidth(spaceForSelect + "px");
    }
    captionWrapper.setWidth("100%");
}
项目:geomajas-project-client-gwt2    文件:ZoomStepControl.java   
/**
 * Create a new instance for the given map.
 * 
 * @param mapPresenter
 *            The map presenter.
 * @param resource
 *            Custom resource bundle in case you want to provide your own style for this widget.
 */
public ZoomStepControl(MapPresenter mapPresenter, ZoomStepControlResource resource) {
    super(mapPresenter);
    this.resource = resource;
    this.resource.css().ensureInjected();
    viewPort = mapPresenter.getViewPort();

    initWidget(UI_BINDER.createAndBindUi(this));
    getElement().getStyle().setPosition(Position.ABSOLUTE);
    getElement().getStyle().setTop(60, Unit.PX);
    getElement().getStyle().setLeft(17, Unit.PX);

    mapPresenter.getEventBus().addViewPortChangedHandler(new ViewPortChangedHandler() {

        public void onViewPortChanged(ViewPortChangedEvent event) {
            if (!stretched) {
                positionZoomHandle();
            }
        }
    });
}
项目:gwtutil    文件:ResizableHeader.java   
private SpanElement createSpanElement(String innerText, String title, String backgroundColor, Cursor cursor, double left){
    final SpanElement span = document.createSpanElement();
    span.setInnerText(innerText);
    span.setAttribute("title", title);
    final Style style = span.getStyle();
    style.setCursor(cursor);
    style.setPosition(Position.ABSOLUTE);
    style.setBottom(0, PX);
    style.setHeight(source.getOffsetHeight(), PX);
    style.setTop(source.getOffsetTop(), PX);
    style.setColor(FOREGROUND_COLOR);
    style.setWidth(RESIZE_HANDLE_WIDTH, PX);
    style.setLeft(left, PX);
    style.setBackgroundColor(backgroundColor);
    return span;
}
项目:hypothesis    文件:MaskConnector.java   
protected void mask() {
    if (null == maskElement && widget != null) {
        Element parentElement = widget.getElement();
        maskElement = Document.get().createDivElement();
        parentElement.appendChild(maskElement);
        Style style = maskElement.getStyle();
        style.setPosition(Position.ABSOLUTE);
        style.setZIndex(1000000000);
        style.setTop(0, Unit.PX);
        style.setLeft(0, Unit.PX);
        style.setWidth(100, Unit.PCT);
        style.setHeight(100, Unit.PCT);

        style.setProperty("background", getState().color);
        // style.setOpacity(getState().opacity);

        if (null == position) {
            widget.getElement().getStyle().setPosition(Style.Position.RELATIVE);
        }
    }
}
项目:swarm    文件:U_Image.java   
private static Element createImage(Element container, String imagePath, int zIndex, boolean cached)
{
    Element part = DOM.createElement("img");
    part.getStyle().setZIndex(zIndex);
    part.getStyle().setPosition(Position.ABSOLUTE);
    String path = cached ? imagePath : imagePath + U_Caching.calcRandomVersion();
    part.setAttribute("src", path);

    if( container != null )
    {
        container.appendChild(part);
    }

    part.getStyle().setLeft(0, Unit.PX);
    part.getStyle().setTop(0, Unit.PX);

    return part;
}
项目:swarm    文件:Animation.java   
public Animation(double frameRate, String ... imagePaths)
{
    m_frameRate = frameRate;

    m_container = DOM.createDiv();

    m_elements = new Element[imagePaths.length];

    for( int i = 0; i < imagePaths.length; i++ )
    {
        Element frame = U_Image.createNonCachedImage(m_container, imagePaths[i], 1);
        frame.getStyle().setPosition(Position.ABSOLUTE);
        U_Css.setPosition(frame, 0, 0);
        frame.getStyle().setDisplay(Display.NONE);

        m_elements[i] = frame;
    }

    m_currentIndex = 0;
    m_time = 0;

    showFrame(0);
}
项目:touchkit    文件:VSwipeView.java   
public VSwipeView() {
    setStyleName(CLASSNAME);
    getElement().getStyle().setProperty("webkitUserSelect", "none");

    /*
     * Touch scrolling using one finger handled by TouchScrollDelegate.
     */
    sinkEvents(Event.TOUCHEVENTS);
    scrollElement = getElement();
    Style style = scrollElement.getStyle();
    style.setOverflow(Overflow.AUTO);
    style.setHeight(100, Unit.PCT);
    style.setPosition(Position.ABSOLUTE);
    sinkEvents(Event.MOUSEEVENTS);
    DOM.sinkEvents(scrollElement, Event.ONSCROLL);
    touchScrollDelegate = new TouchScrollDelegate(scrollElement);

    initHandlers();
}
项目:touchkit    文件:Ios7SafariHackLoader.java   
@Override
public boolean execute() {
    onScreenKeyboardMightBeVisible &= Document.get()
            .getDocumentElement().getOffsetHeight() != getWindowHeight();
    if (onScreenKeyboardMightBeVisible && !iPad) {
        return true;
    }
    if (state == State.ADJUSTING) {
        Window.scrollTo(0, 0);
        ignoreNextScrollEvent = true;
    }
    if (height != getWindowHeight()) {
        height = getWindowHeight();
        bodyStyle.setHeight(height, Unit.PX);
        bodyStyle.setPosition(Position.FIXED);
        state = State.ADJUSTING;
    } else if (state == State.ADJUSTING) {
        state = State.STOPPED;
        forceLayout();
        if (repetitions > 0) {
            schedule(repetitions);
        }
        return false;
    }
    return true;
}
项目:empiria.player    文件:MenuView.java   
private PushButton getShowMoreButton() {
    if (showMoreButton != null) {
        return showMoreButton;
    }
    showMoreButton = new PushButton("Show more");
    showMoreButton.setStylePrimaryName(styleNameConstants.QP_DICTIONARY_SHOW_MORE_BUTTON());
    showMoreButton.getElement().getElementsByTagName("input").getItem(0).getStyle().setPosition(Position.RELATIVE);
    showMoreButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            showMore();
        }
    });
    return showMoreButton;
}
项目:empiria.player    文件:MathModule.java   
private void placeGaps() {
    for (MathGap gap : getMathGaps()) {
        Widget gapContainer = gap.getContainer();
        Style gapStyle = gapContainer.getElement().getStyle();

        gapStyle.setTop(0, Unit.PX);
        gapStyle.setLeft(0, Unit.PX);
        gapStyle.setPosition(Position.ABSOLUTE);
    }
}
项目:empiria.player    文件:MathModule.java   
private void initializePanels() {
    applyIdAndClassToView(mainPanel);

    outerPanel.getElement().getStyle().setOverflow(Overflow.VISIBLE);
    gapsPanel.getElement().getStyle().setOverflow(Overflow.VISIBLE);

    Style mainPanelStyle = mainPanel.getElement().getStyle();
    mainPanelStyle.setPosition(Position.ABSOLUTE);
    mainPanelStyle.setTop(0, Unit.PX);
    mainPanelStyle.setLeft(0, Unit.PX);
}
项目:empiria.player    文件:HTML5VideoForcePosterHack.java   
private void createPosterImageLayer(Element mediaContainerElement, BaseMediaConfiguration baseMediaConfiguration) {
    posterImageElement = DOM.createImg();
    DOM.setImgSrc(posterImageElement, baseMediaConfiguration.getPoster());
    posterImageElement.getStyle().setLeft(0, Unit.PX);
    posterImageElement.getStyle().setTop(0, Unit.PX);
    posterImageElement.getStyle().setPosition(Position.ABSOLUTE);
    posterImageElement.getStyle().setWidth(baseMediaConfiguration.getWidth(), Unit.PX);
    posterImageElement.getStyle().setHeight(baseMediaConfiguration.getHeight(), Unit.PX);
    posterImageElement.getStyle().setPadding(0, Unit.PX);
    posterImageElement.getStyle().setMargin(0, Unit.PX);
    posterImageElement.getStyle().setVisibility(Visibility.VISIBLE);

    mediaContainerElement.appendChild(posterImageElement);
}
项目:empiria.player    文件:VideoFullScreenHelper.java   
protected void resizeToFullScreen(Widget widget, Position position) {
    Style style = widget.getElement().getStyle();
    style.setPosition(position);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
}
项目:empiria.player    文件:VideoFullScreenHelper.java   
protected void openFullScreenDesktop(MediaWrapper<?> mediaWrapper, Element template) {
    if (mediaWrapper != null && template != null) {
        clearFullScreenView();
        lastMediaWrapper = mediaWrapper;
        VideoFullScreenView parent = getFullScreenView();
        parseTemplate(mediaWrapper, template, parent.getControls());
        fireEvent(true, mediaWrapper);
        RootPanel.get().add(parent);
        html5FullScreenHelper.requestFullScreen(parent.getElement());
        resizeToFullScreen(lastMediaWrapper.getMediaObject(), Position.FIXED);
    }
}
项目:empiria.player    文件:ObjectTemplateParser.java   
protected Widget getMediaObject() {
    Widget mediaObjectWidget;
    if (isFullScreen) {
        mediaObjectWidget = fullScreenMediaWrapper.getMediaObject();
    } else {
        FlowPanel videoContainer = new FlowPanel();
        videoContainer.add(mediaWrapper.getMediaObject());
        videoContainer.getElement().getStyle().setPosition(Position.RELATIVE);
        mediaObjectWidget = videoContainer;
    }
    return mediaObjectWidget;
}