Example usage for com.vaadin.ui Component getHeight

List of usage examples for com.vaadin.ui Component getHeight

Introduction

In this page you can find the example usage for com.vaadin.ui Component getHeight.

Prototype

public float getHeight();

Source Link

Document

Gets the height of the object.

Usage

From source file:com.cms.utils.CommonUtils.java

public static String getHeight(Component co) {
    return (co.getHeight() + "" + co.getHeightUnits().getSymbol());
}

From source file:com.foc.vaadin.FocCentralPanel.java

License:Apache License

protected void afterChangeCentralPanelContent(ICentralPanel iCentralPanel) {
    Component central = (Component) iCentralPanel;
    if (central != null && central instanceof FocXMLLayout) {
        FocXMLLayout xmlLayout = (FocXMLLayout) central;
        if (xmlLayout != null && xmlLayout.getLayouts() != null && xmlLayout.getLayouts().size() > 0) {
            Component rootComp = (Component) xmlLayout.getLayouts().get(0);
            if (rootComp != null) {
                if (centralPanel != null) {
                    centralPanel.setWidth(rootComp.getWidth(), rootComp.getWidthUnits());
                    //                  centralPanel.setHeight("-1px");
                    //                  centralPanel.setHeight("100%");//NO_PANEL
                    //When the main layout is 100% this means that there will be no vertical srcoll
                    //When the main layout is -1px this means that there will be a  vertical srcoll
                    //    And then we can use expandRatio to the table or any other component inside
                    if (this instanceof FocWebVaadinWindow) {
                        centralPanel.setHeight(rootComp.getHeight(), rootComp.getHeightUnits());
                        setHeight("100%");//NO_PANEL
                    } else {
                        centralPanel.setHeight(rootComp.getHeight(), rootComp.getHeightUnits());
                        setHeight(rootComp.getHeight(), rootComp.getHeightUnits());
                        //This means we are in a Popup 
                        //                     centralPanel.setHeight("100%");
                        //                     setHeight("100%");//NO_PANEL
                    }//from w w w.  j  a  v a2 s  .c om
                }
                //               setWidth(rootComp.getWidth(), rootComp.getWidthUnits());
                //setHeight(rootComp.getHeight(), rootComp.getHeightUnits());

                //               setHeight("-1px");
                //               setHeight("100%");//NO_PANEL               
                markAsDirty();
                //               requestRepaint();
            }
        }
    }
}

From source file:com.foc.vaadin.FocCentralPanel.java

License:Apache License

@Override
public void addUtilityPanel(IRightPanel utilityPanel) {
    if (utilityPanel != null) {
        try {// w w  w . j a  v  a 2  s .  c o  m
            Component utilityPanelAsComponent = (Component) utilityPanel;
            //            Window window = getParent(Window.class);

            utilityWindow = new Window("Dictionary");
            utilityWindow.setSizeFull();
            utilityWindow.setWidth(utilityPanelAsComponent.getWidth(), utilityPanelAsComponent.getWidthUnits());
            utilityWindow.setHeight(utilityPanelAsComponent.getHeight(),
                    utilityPanelAsComponent.getHeightUnits());
            utilityWindow.setContent(utilityPanelAsComponent);

            getUI().addWindow(utilityWindow);
        } catch (Exception e) {
            Globals.logException(e);
        }
    }
}

From source file:com.mymita.vaadlets.VaadletsBuilder.java

License:Apache License

private static void setComponentAttributes(final com.vaadin.ui.Component vaadinComponent,
        final com.mymita.vaadlets.core.Component c) {
    vaadinComponent.setCaption(c.getCaption());
    vaadinComponent.setEnabled(c.isEnabled());
    vaadinComponent.setReadOnly(c.isReadonly());
    vaadinComponent.setVisible(c.isVisible());
    if (c.getHeight() != null) {
        vaadinComponent.setHeight(c.getHeight());
    }/*w w  w .  j  a v  a  2 s  .  com*/
    if (c.getWidth() != null) {
        vaadinComponent.setWidth(c.getWidth());
    }
    if (c.isSizeUndefined() != null && c.isSizeUndefined().booleanValue()) {
        vaadinComponent.setSizeUndefined();
    }
    if (c.isSizeFull() != null && c.isSizeFull().booleanValue()) {
        vaadinComponent.setSizeFull();
    }
}

From source file:info.magnolia.ui.vaadin.richtext.TextAreaStretcher.java

License:Open Source License

public TextAreaStretcher() {
    registerRpc(new TextAreaStretcherServerRpc() {
        @Override// www  .  j a va  2s.  co m
        public void toggle(int initialWidth, int initialHeight) {
            getState().isCollapsed = !getState().isCollapsed;
            final Component parent = (Component) getParent();
            if (getState().isCollapsed) {
                // Restore size info from the state.
                parent.setWidth(getState().collapsedStateWidth);
                parent.setHeight(getState().collapsedStateHeight);
            } else {

                // We save the initial dimensions and clear size info from the state.
                getState().collapsedStateHeight = parent.getHeight() + parent.getHeightUnits().toString();
                getState().collapsedStateWidth = parent.getWidth() + parent.getWidthUnits().toString();
                parent.setWidth("");
                parent.setHeight("");
            }
        }
    });
}

From source file:org.vaadin.addons.portallayout.portlet.Portlet.java

License:Apache License

private void delegateSizeManagement(boolean initial) {
    final Component c = getParent();
    String width = String.format("%d%s", (int) c.getWidth(), c.getWidthUnits().getSymbol());

    if (c.getWidth() >= 0 && !"100%".equals(width)) {
        c.setWidth("100%");
        getState().width = width;/*ww w .j  a  v a 2 s. co  m*/
    }

    String height = String.format("%d%s", (int) c.getHeight(), c.getHeightUnits().getSymbol());
    if (c.getHeight() >= 0 && !"100%".equals(height)) {
        c.setHeight("100%");
        getState().height = height;
    }
    getParent().beforeClientResponse(initial);
}

From source file:songstock.web.SongStockUI.java

License:Open Source License

/**
 * Shows a modal popup window with the given title and content.
 * @param title of the popup window// w  w  w . j  ava 2 s . c  o m
 * @param content of the popup window
 */
public void showPopupWindow(String title, Component content) {
    // Create a new popup window
    popupWindow = new Window(title);
    popupWindow.setModal(true);
    // Add content to the popup window
    popupWindow.setContent(content);
    // Set the height of the popup window
    popupWindow.setHeight(content.getHeight() + 50, content.getHeightUnits());
    // Set the width of the popup window
    popupWindow.setWidth(content.getWidth(), content.getWidthUnits());

    // Add popup window to the app's main window
    addWindow(popupWindow);
}