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.cruxframework.crux.widgets.client.slider.TouchSlider.java

License:Apache License

/**
 * Constructor/*from  w w w.ja  va  2  s.  c  o  m*/
 */
public TouchSlider() {
    touchPanel = new FocusPanel();
    contentPanel = new FlowPanel();

    touchPanel.add(contentPanel);
    initWidget(touchPanel);

    Style style = contentPanel.getElement().getStyle();
    style.setPosition(Position.RELATIVE);
    style.setOverflow(Overflow.HIDDEN);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);

    touchPanel.addTouchStartHandler(this);

    addAttachHandler(new Handler() {
        private HandlerRegistration orientationHandlerRegistration;

        @Override
        public void onAttachOrDetach(AttachEvent event) {
            if (event.isAttached()) {
                orientationHandlerRegistration = Screen.addOrientationChangeHandler(TouchSlider.this);
            } else if (orientationHandlerRegistration != null) {
                orientationHandlerRegistration.removeHandler();
                orientationHandlerRegistration = null;
            }
        }
    });

}

From source file:org.cruxframework.crux.widgets.client.slider.TouchSlider.java

License:Apache License

/**
 * //from  www . j  ava2  s.c  o m
 * @param contentProvider
 */
public void setContentProvider(ContentProvider contentProvider) {
    this.contentProvider = contentProvider;
    contentPanel.clear();
    for (int i = 0; i < contentProvider.size(); i++) {
        final int index = i;
        LazyPanel itemWrapper = new LazyPanel() {
            @Override
            protected Widget createWidget() {
                return TouchSlider.this.contentProvider.loadWidget(index);
            }
        };
        itemWrapper.setStyleName("touchSliderItem");
        itemWrapper.setVisible(false);
        Style style = itemWrapper.getElement().getStyle();
        style.setPosition(Position.ABSOLUTE);
        style.setTop(0, Unit.PX);
        style.setLeft(0, Unit.PX);
        style.setWidth(100, Unit.PCT);
        style.setHeight(100, Unit.PCT);
        style.setOverflowX(Overflow.HIDDEN);
        style.setOverflowY(Overflow.VISIBLE);
        contentPanel.add(itemWrapper);
    }

    if (this.circularShowing && contentProvider.size() < 3) {
        this.circularShowing = false;
    }
}

From source file:org.cruxframework.crux.widgets.client.slider.TouchSlider.java

License:Apache License

/**
 * //from www.  j  a v a  2s.c o m
 * @param widget
 */
public void add(Widget widget) {
    SimplePanel itemWrapper = new SimplePanel();
    itemWrapper.add(widget);
    itemWrapper.setStyleName("touchSliderItem");
    itemWrapper.setVisible(false);
    Style style = itemWrapper.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.VISIBLE);
    contentPanel.add(itemWrapper);
}

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

License:Apache License

/**
 * Constructor/*from   w  w w . ja va 2s. com*/
 */
public HorizontalSwapPanel() {
    contentPanel = new FlowPanel();
    initWidget(contentPanel);
    setStyleName("crux-HorizontalSwapPanel");

    Style style = contentPanel.getElement().getStyle();
    style.setPosition(Position.RELATIVE);
    style.setOverflow(Overflow.HIDDEN);
    style.setWidth(100, Unit.PCT);
    style.setVisibility(Visibility.VISIBLE);
    style.setOpacity(1);

    configureCurrentPanel();
    configureNextPanel();

    Transition.hideBackface(currentPanel);
    Transition.hideBackface(nextPanel);

    contentPanel.add(currentPanel);
    contentPanel.add(nextPanel);
}

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 . java 2  s  .c o  m*/
    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);/*from  w w  w .j  av  a  2s .  com*/
    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.uploader.FileButton.java

License:Apache License

public FileButton() {
    mainPanel = new FlowPanel();
    mainPanel.getElement().getStyle().setPosition(Position.RELATIVE);

    fileInput = new FileInput();

    Style style = fileInput.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setTextAlign(TextAlign.RIGHT);
    style.setOpacity(0);/*  w  ww . j av  a  2s .com*/
    style.setProperty("cursor", "inherit");
    style.setZIndex(2);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    mainPanel.add(fileInput);

    visibleButton = new Label();
    visibleButton.setStyleName("chooseButton");
    style = visibleButton.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    style.setZIndex(1);
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    mainPanel.add(visibleButton);

    initWidget(mainPanel);
    setStyleName("crux-FileButton");
}

From source file:org.drools.workbench.screens.guided.dtable.client.widget.table.columns.dom.datepicker.DatePickerDOMElement.java

License:Apache License

public DatePickerDOMElement(final DatePicker widget, final GridLayer gridLayer, final GridWidget gridWidget) {
    super(widget, gridLayer, gridWidget);
    final Style style = widget.getElement().getStyle();
    style.setWidth(100, Style.Unit.PCT);
    style.setHeight(HEIGHT, Style.Unit.PX);
    style.setPaddingLeft(2, Style.Unit.PX);
    style.setPaddingRight(2, Style.Unit.PX);
    style.setFontSize(10, Style.Unit.PX);

    // --- Workaround for BS2 ---
    style.setPosition(Style.Position.RELATIVE);
    style.setPaddingTop(0, Style.Unit.PX);
    style.setPaddingBottom(0, Style.Unit.PX);
    style.setProperty("WebkitBoxSizing", "border-box");
    style.setProperty("MozBoxSizing", "border-box");
    style.setProperty("boxSizing", "border-box");
    style.setProperty("lineHeight", "normal");
    // --- End workaround ---

    getContainer().getElement().getStyle().setPaddingLeft(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(5, Style.Unit.PX);
    getContainer().setWidget(widget);//from  ww w. j av  a 2 s  .c o m
}

From source file:org.eclipse.che.datasource.ide.newDatasource.view.NewDatasourceWizardMainPageViewImpl.java

License:Open Source License

@Override
public void reset() {
    datasourceCategoriesPanel.clear();/* w  w  w  .j  a  va2  s . c  o m*/
    categoriesTree = Tree.create(resources, new CategoriesDataAdapter(), new CategoriesNodeRenderer());
    datasourceCategoriesPanel.add(categoriesTree);
    com.google.gwt.dom.client.Style style = categoriesTree.asWidget().getElement().getStyle();
    style.setWidth(100, com.google.gwt.dom.client.Style.Unit.PCT);
    style.setHeight(100, com.google.gwt.dom.client.Style.Unit.PCT);
    style.setPosition(com.google.gwt.dom.client.Style.Position.RELATIVE);
    categoriesTree.setTreeEventHandler(treeEventHandler);
    categoriesTree.getModel().setRoot("");
    categoriesTree.renderTree(0);
}

From source file:org.eclipse.che.ide.ui.smartTree.SpeedSearch.java

License:Open Source License

private void initSearchPopUp() {
    this.searchPopUp = new SearchPopUp();
    Style style = this.searchPopUp.getElement().getStyle();

    style.setBackgroundColor("grey");
    style.setBorderStyle(Style.BorderStyle.SOLID);
    style.setBorderColor("#dbdbdb");
    style.setBorderWidth(1, Style.Unit.PX);
    style.setPadding(2, Style.Unit.PX);
    style.setPosition(Style.Position.FIXED);
    style.setTop(100, Style.Unit.PX);
    style.setLeft(20, Style.Unit.PX);
}