List of usage examples for com.vaadin.ui Component getWidthUnits
public Unit getWidthUnits();
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 }// ww w .ja va 2 s . co m } // 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 {/*from www . ja va 2s .c om*/ 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:info.magnolia.ui.vaadin.richtext.TextAreaStretcher.java
License:Open Source License
public TextAreaStretcher() { registerRpc(new TextAreaStretcherServerRpc() { @Override/*from www . j a va 2 s. c om*/ 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.opencms.ui.components.CmsToolBar.java
License:Open Source License
/** * Calculates the width required by the layout components * * @param items the layout// w ww. j ava 2 s. c o m * * @return the width */ private int estimateRequiredWidth(AbstractOrderedLayout items) { int result = 0; if (items != null) { for (Component comp : items) { if (comp == m_foldedButtonsMenu) { continue; } else if ((comp instanceof Button) || (comp instanceof PopupView) || (comp instanceof MenuBar)) { // assume all buttons have a with of 50px result += 50; } else if (comp == m_appIndicator) { // assume app indicator requires 150px result += 50; } else { float compWidth = comp.getWidth(); if ((compWidth > 0) && (comp.getWidthUnits() == Unit.PIXELS)) { // also add 10px margin result += compWidth + 10; } else { result += 200; } } } } return result; }
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;/*from w w w .java 2 s .c o 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//from www . ja v a2 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); }