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

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

Introduction

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

Prototype

public void setOverflowY(Overflow value) 

Source Link

Usage

From source file:com.vaadin.client.ui.VMenuBar.java

License:Apache License

private int adjustPopupHeight(int top, final int shadowSpace) {
    // Check that the popup will fit the screen
    int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - top - shadowSpace;
    int missingHeight = popup.getOffsetHeight() - availableHeight;
    if (missingHeight > 0) {
        // First move the top of the popup to get more space
        // Don't move above top of screen, don't move more than needed
        int moveUpBy = Math.min(top - shadowSpace, missingHeight);

        // Update state
        top -= moveUpBy;/*from   w ww  . jav  a  2  s  .  c  o m*/
        missingHeight -= moveUpBy;
        availableHeight += moveUpBy;

        if (missingHeight > 0) {
            int contentWidth = visibleChildMenu.getOffsetWidth();

            // If there's still not enough room, limit height to fit and add
            // a scroll bar
            Style style = popup.getElement().getStyle();
            style.setHeight(availableHeight, Unit.PX);
            style.setOverflowY(Overflow.SCROLL);

            // Make room for the scroll bar by adjusting the width of the
            // popup
            style.setWidth(contentWidth + WidgetUtil.getNativeScrollbarSize(), Unit.PX);
            popup.positionOrSizeUpdated();
        }
    }
    return top;
}

From source file:com.vaadin.terminal.gwt.client.ui.VMenuBar.java

License:Open Source License

private int adjustPopupHeight(int top, final int shadowSpace) {
    // Check that the popup will fit the screen
    int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - top - shadowSpace;
    int missingHeight = popup.getOffsetHeight() - availableHeight;
    if (missingHeight > 0) {
        // First move the top of the popup to get more space
        // Don't move above top of screen, don't move more than needed
        int moveUpBy = Math.min(top - shadowSpace, missingHeight);

        // Update state
        top -= moveUpBy;//from w  ww.  j av a  2  s .  c  o  m
        missingHeight -= moveUpBy;
        availableHeight += moveUpBy;

        if (missingHeight > 0) {
            int contentWidth = visibleChildMenu.getOffsetWidth();

            // If there's still not enough room, limit height to fit and add
            // a scroll bar
            Style style = popup.getElement().getStyle();
            style.setHeight(availableHeight, Unit.PX);
            style.setOverflowY(Overflow.SCROLL);

            // Make room for the scroll bar by adjusting the width of the
            // popup
            style.setWidth(contentWidth + Util.getNativeScrollbarSize(), Unit.PX);
            popup.updateShadowSizeAndPosition();
        }
    }
    return top;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget scrollerY(IsWidget content) {
    SimplePanel panel = new SimplePanel(content.asWidget());
    Style style = panel.getElement().getStyle();
    style.setProperty("width", "auto");
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.SCROLL);
    return panel;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget scroller(IsWidget content) {
    SimplePanel panel = new SimplePanel(content.asWidget());
    Style style = panel.getElement().getStyle();
    style.setProperty("width", "auto");
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.SCROLL);
    return panel;
}

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

License:Apache License

/**
 * //w w  w .  j a v a 2  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

/**
 * // w ww.  j  av a 2  s. 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

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

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

    style.setPosition(Position.RELATIVE);
    style.setTop(0, Unit.PX);/*from www . j a  va  2s  .com*/
    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);/*www . j  a va  2s  . co  m*/
    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.opencms.gwt.client.seo.CmsSeoOptionsDialog.java

License:Open Source License

/**
 * Creates a new dialog instance.<p>
 *
 * @param structureId the structure id of the resource whose aliases are being edited
 * @param infoBean a bean containing the information to display in the resource info box
 * @param aliases the existing aliases of the resource
 * @param propertyConfig the property configuration
 * @param propertyEditorHandler the property editor handler
 *//*from  www. j  a va2  s  .  c o m*/
public CmsSeoOptionsDialog(CmsUUID structureId, CmsListInfoBean infoBean, List<CmsAliasBean> aliases,
        Map<String, CmsXmlContentProperty> propertyConfig, I_CmsPropertyEditorHandler propertyEditorHandler) {

    super(aliasMessages.seoOptions());
    setGlassEnabled(true);
    setAutoHideEnabled(false);
    setModal(true);

    //-----------------------INFO BOX -------------------------------------------

    CmsListItemWidget liWidget = new CmsListItemWidget(infoBean);
    liWidget.setStateIcon(StateIcon.standard);
    m_panel.add(liWidget);

    //------------------------ PROPERTIES ------------------------------------------
    LinkedHashMap<String, CmsXmlContentProperty> props = new LinkedHashMap<String, CmsXmlContentProperty>();
    for (String seoProperty : seoProperties) {
        if (propertyConfig.containsKey(seoProperty)) {
            props.put(seoProperty, propertyConfig.get(seoProperty));
        }
    }
    m_propertyEditor = new CmsSimplePropertyEditor(props, propertyEditorHandler);
    m_propertyEditor.getForm().setFormHandler(this);
    m_formSubmitHandler = new CmsPropertySubmitHandler(propertyEditorHandler);
    m_structureId = structureId;
    m_propertyFieldset.getElement().getStyle().setMarginTop(10, Unit.PX);
    m_propertyFieldset.getContentPanel().getElement().getStyle().setOverflow(Overflow.VISIBLE);
    m_propertyFieldset.setLegend(
            org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.GUI_PROPERTIES_0));
    m_propertyEditor.initializeWidgets(this);
    m_panel.add(m_propertyFieldset);

    //------------------------ ALIASES ------------------------------------------

    CmsFieldSet aliasFieldset = new CmsFieldSet();
    aliasFieldset.setLegend(aliasMessages.aliases());
    m_aliasList = new CmsAliasList(structureId, aliases);
    aliasFieldset.getElement().getStyle().setMarginTop(10, Unit.PX);
    CmsScrollPanel scrollPanel = GWT.create(CmsScrollPanel.class);
    scrollPanel.setWidget(m_aliasList);
    aliasFieldset.addContent(scrollPanel);
    m_panel.add(scrollPanel);
    Style style = scrollPanel.getElement().getStyle();
    style.setProperty("minHeight", "300px"); //$NON-NLS-1$ //$NON-NLS-2$
    style.setProperty("maxHeight", "450px"); //$NON-NLS-1$ //$NON-NLS-2$
    style.setOverflowY(Overflow.AUTO);

    setMainContent(m_panel);
    addButton(createCancelButton());
    addButton(saveButton());

}