List of usage examples for com.vaadin.client ComputedStyle getHeight
public double getHeight()
From source file:com.haulmont.cuba.web.toolkit.ui.client.tableshared.TableWidgetDelegate.java
License:Apache License
public void showSortMenu(final Element target, final String columnId) { final VOverlay sortDirectionPopup = GWT.create(VOverlay.class); sortDirectionPopup.setOwner(tableWidget.getOwner()); FlowPanel sortDirectionMenu = new FlowPanel(); Label sortByDescendingButton = new Label(tableWidget.getSortDescendingLabel()); Label sortByAscendingButton = new Label(tableWidget.getSortAscendingLabel()); Label sortClearSortButton = new Label(tableWidget.getSortResetLabel()); sortByDescendingButton.addStyleName(TABLE_SORT_CONTEXTMENU_ITEM); sortByAscendingButton.addStyleName(TABLE_SORT_CONTEXTMENU_ITEM); sortClearSortButton.addStyleName(TABLE_SORT_CONTEXTMENU_ITEM); sortDirectionMenu.add(sortByAscendingButton); sortDirectionMenu.add(sortByDescendingButton); sortDirectionMenu.add(sortClearSortButton); sortByDescendingButton.addClickHandler(event -> { updateVariable("sortcolumn", columnId, false); updateVariable("sortascending", false, false); tableWidget.getRowRequestHandler().deferRowFetch(); // some validation + // defer 250ms tableWidget.getRowRequestHandler().cancel(); // instead of waiting tableWidget.getRowRequestHandler().run(); // run immediately sortDirectionPopup.hide();//from w ww. j a v a2s.c om }); sortByAscendingButton.addClickHandler(event -> { updateVariable("sortcolumn", columnId, false); updateVariable("sortascending", true, false); tableWidget.getRowRequestHandler().deferRowFetch(); // some validation + // defer 250ms tableWidget.getRowRequestHandler().cancel(); // instead of waiting tableWidget.getRowRequestHandler().run(); // run immediately sortDirectionPopup.hide(); }); sortClearSortButton.addClickHandler(event -> { updateVariable("resetsortorder", columnId, true); sortDirectionPopup.hide(); }); sortDirectionMenu.addStyleName("c-table-contextmenu"); sortDirectionPopup.setWidget(sortDirectionMenu); sortDirectionPopup.setAutoHideEnabled(true); ComputedStyle sortIndicatorStyle = new ComputedStyle(target); Tools.showPopup(sortDirectionPopup, target.getAbsoluteLeft(), target.getAbsoluteTop() + ((int) sortIndicatorStyle.getHeight())); }
From source file:com.haulmont.cuba.web.toolkit.ui.client.tablesort.TableCustomSortDelegate.java
License:Apache License
public void showSortMenu(final Element sortIndicator, final String columnId) { final VOverlay sortDirectionPopup = new VOverlay(); sortDirectionPopup.setOwner(tableWidget.getOwner()); FlowPanel sortDirectionMenu = new FlowPanel(); Label sortByDescendingButton = new Label(tableWidget.getSortDescendingLabel()); Label sortByAscendingButton = new Label(tableWidget.getSortAscendingLabel()); Label sortClearSortButton = new Label(tableWidget.getSortResetLabel()); sortByDescendingButton.addStyleName("cuba-table-contextmenu-item"); sortByAscendingButton.addStyleName("cuba-table-contextmenu-item"); sortClearSortButton.addStyleName("cuba-table-contextmenu-item"); sortDirectionMenu.add(sortByAscendingButton); sortDirectionMenu.add(sortByDescendingButton); sortDirectionMenu.add(sortClearSortButton); sortByDescendingButton.addClickHandler(new ClickHandler() { @Override//w w w .j av a 2s .c o m public void onClick(ClickEvent event) { tableWidget.getClient().updateVariable(tableWidget.getPaintableId(), "sortcolumn", columnId, false); tableWidget.getClient().updateVariable(tableWidget.getPaintableId(), "sortascending", false, false); tableWidget.getRowRequestHandler().deferRowFetch(); // some validation + // defer 250ms tableWidget.getRowRequestHandler().cancel(); // instead of waiting tableWidget.getRowRequestHandler().run(); // run immediately sortDirectionPopup.hide(); } }); sortByAscendingButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tableWidget.getClient().updateVariable(tableWidget.getPaintableId(), "sortcolumn", columnId, false); tableWidget.getClient().updateVariable(tableWidget.getPaintableId(), "sortascending", true, false); tableWidget.getRowRequestHandler().deferRowFetch(); // some validation + // defer 250ms tableWidget.getRowRequestHandler().cancel(); // instead of waiting tableWidget.getRowRequestHandler().run(); // run immediately sortDirectionPopup.hide(); } }); sortClearSortButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tableWidget.getClient().updateVariable(tableWidget.getPaintableId(), "resetsortorder", columnId, true); sortIndicator.addClassName("cuba-sort-indicator-visible"); sortDirectionPopup.hide(); } }); sortDirectionMenu.addStyleName("cuba-table-contextmenu"); sortDirectionPopup.setWidget(sortDirectionMenu); sortDirectionPopup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { sortIndicator.removeClassName("cuba-sort-indicator-visible"); } }); sortDirectionPopup.setAutoHideEnabled(true); ComputedStyle sortIndicatorStyle = new ComputedStyle(sortIndicator); Tools.showPopup(sortDirectionPopup, sortIndicator.getAbsoluteLeft(), sortIndicator.getAbsoluteTop() + ((int) sortIndicatorStyle.getHeight())); sortIndicator.addClassName("cuba-sort-indicator-visible"); }
From source file:com.haulmont.cuba.web.toolkit.ui.client.tabsheet.CubaTabSheetWidget.java
License:Apache License
@Override public void updateContentNodeHeight() { if (!isDynamicHeight()) { ComputedStyle fullHeight = new ComputedStyle(getElement()); double contentHeight = fullHeight.getHeight(); ComputedStyle tabsCs = new ComputedStyle(tabs); contentHeight -= tabsCs.getHeight(); contentHeight -= deco.getOffsetHeight(); ComputedStyle cs = new ComputedStyle(contentNode); contentHeight -= cs.getPaddingHeight(); contentHeight -= cs.getBorderHeight(); if (contentHeight < 0) { contentHeight = 0;/*from ww w .j a v a 2s . co m*/ } // Set proper values for content element double ceilHeight = Math.ceil(contentHeight); contentNode.getStyle().setHeight(ceilHeight, Style.Unit.PX); } else { contentNode.getStyle().clearHeight(); } }