Example usage for com.vaadin.ui VerticalLayout setSizeFull

List of usage examples for com.vaadin.ui VerticalLayout setSizeFull

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setSizeFull.

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.ripla.web.RiplaApplication.java

License:Open Source License

private boolean initializeLayout(final IAppConfiguration inConfiguration) {
    setStyleName("ripla-window"); //$NON-NLS-1$

    requestHandler = setRequestHandler();
    SkinRegistry.INSTANCE.setDefaultSkin(inConfiguration.getDftSkinID());
    final ISkin lSkin = SkinRegistry.INSTANCE.getActiveSkin();

    final VerticalLayout lLayout = new VerticalLayout();
    lLayout.setSizeFull();
    lLayout.setStyleName("ripla-main");
    setContent(lLayout);//from   w ww  . jav  a 2s. com

    bodyView = createBody();
    lLayout.addComponent(bodyView);
    lLayout.setExpandRatio(bodyView, 1);

    if (!beforeLogin(this)) {
        return false;
    }

    if (inConfiguration.getLoginAuthenticator() == null) {
        bodyView.addComponent(createBodyView(lSkin));
    } else {
        bodyView.addComponent(createLoginView(inConfiguration, lSkin));
    }

    if (lSkin.hasFooter()) {
        final Component lFooter = lSkin.getFooter();
        lLayout.addComponent(lFooter);
        lLayout.setExpandRatio(lFooter, 0);
    }
    return true;
}

From source file:org.ripla.web.RiplaApplication.java

License:Open Source License

/**
 * Creates the application's login view.<br />
 * Subclasses may override.//w  w w .  j av  a2 s .c o m
 * 
 * @param inConfiguration
 *            {@link IAppConfiguration} the application's configuration
 *            object
 * @param inSkin
 *            {@link ISkin} the actual application skin
 * @return {@link Component} the application's login view
 */
private Component createLoginView(final IAppConfiguration inConfiguration, final ISkin inSkin) {
    final VerticalLayout out = new VerticalLayout();
    out.setStyleName("ripla-body");
    out.setSizeFull();

    if (inSkin.hasHeader()) {
        final Component lHeader = inSkin.getHeader(inConfiguration.getAppName());
        out.addComponent(lHeader);
        out.setExpandRatio(lHeader, 0);
    }

    final RiplaLogin lLogin = new RiplaLogin(inConfiguration, this, UseCaseRegistry.INSTANCE.getUserAdmin());
    out.addComponent(lLogin);
    out.setExpandRatio(lLogin, 1);
    return out;
}

From source file:org.semanticsoft.vaaclipse.app.VaadinApplication.java

License:Open Source License

@Override
public void init() {
    context = VaadinE4Application.getInstance().getAppContext();
    logger = VaadinE4Application.getInstance().getLogger();

    //--user agent detection
    //      if (this.getContext() instanceof WebApplicationContext) {
    //         String userAgent = ((WebApplicationContext)this.getContext()).getBrowser().getBrowserApplication();
    //         if (userAgent.contains("MSIE"))
    //         {//from w  w w .ja  v a 2s .  c o  m
    //            String str = "<html><br/>Vaaclipse currently does not support Internet Explorer.<br/><br/>" +
    //                  "Please use one of the browser from list:<br/><ul><li>Mozilla Firefox (recomended)</li> <li>Google Chrome or Chromium</li> <li>Opera</li> <li>Safari</li> <li>Rekonq</li> <li>Any other not listed browser based on Webkit</li></ul></html>";
    //            Label errorLabel = new Label(str, Label.CONTENT_XHTML);
    //            mainWindow.getContent().addComponent(errorLabel);
    //            return;
    //         }
    //      }
    //--

    //-------------------------------------
    prepareEnvironment(context);

    IEventBroker eventBroker = appContext.get(EventBroker.class);

    eventBroker.subscribe(ThemeConstants.Events.setThemeEvent, new EventHandler() {

        @Override
        public void handleEvent(Event event) {
            Theme theme = (Theme) event.getProperty(IEventBroker.DATA);
            if (theme != null) {
                HttpSession session = ((WebApplicationContext) getContext()).getHttpSession();
                session.setAttribute(ThemeConstants.Attrubutes.themeid, theme.getId());
                setThemeInternal(theme.getWebId());
            }
        }
    });

    String themeId = VaadinE4Application.getInstance().getCssTheme();
    ThemeManager themeManager = appContext.get(ThemeManager.class);
    themeManager.setTheme(themeId);

    String authProvider = VaadinE4Application.getInstance().getApplicationAuthenticationProvider();

    if (authProvider == null || authProvider.trim().isEmpty()) {
        //start workbench as usually
        e4Workbench = createE4Workbench(context);
        e4Workbench.createAndRunUI(e4Workbench.getApplication());
    } else {
        final Window window = new Window("Login");
        window.setSizeFull();
        setMainWindow(window);

        eventBroker.subscribe(AuthenticationConstants.Events.Authentication, new EventHandler() {

            @Override
            public void handleEvent(Event event) {
                Object data = event.getProperty(EventUtils.DATA);
                if (data instanceof User) {
                    //login user:
                    user = (User) data;

                    //TODO: Now we can load persistande model of this user (not implemented yet, just load initial model)
                    e4Workbench = createE4Workbench(context);
                    e4Workbench.createAndRunUI(e4Workbench.getApplication());
                }
            }
        });

        IContributionFactory contributionFactory = (IContributionFactory) appContext
                .get(IContributionFactory.class.getName());
        IEclipseContext authConext = appContext.createChild();
        VerticalLayout windowContent = new VerticalLayout();
        windowContent.setSizeFull();
        window.setContent(windowContent);
        authConext.set(ComponentContainer.class, windowContent);
        authConext.set(VerticalLayout.class, windowContent);
        Object authProviderObj = contributionFactory.create(authProvider, authConext);
        System.out.println(authProvider);
    }
}

From source file:org.semanticsoft.vaaclipse.app.webapp.VaadinUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    context = VaadinE4Application.getInstance().getAppContext();
    logger = VaadinE4Application.getInstance().getLogger();

    String sessionId = getSession().getSession().getId();
    Object[] prevUser = tempUserStore.remove(sessionId);
    if (prevUser != null) {
        this.user = prevUser[0];
        this.userClass = (Class<Object>) prevUser[1];
    }/*from   w  w w .j a va  2s.c  o  m*/

    // -------------------------------------
    prepareEnvironment(context);

    IEventBroker eventBroker = appContext.get(EventBroker.class);
    eventBroker.subscribe(ThemeConstants.Events.setThemeEvent, new EventHandler() {
        @Override
        public void handleEvent(org.osgi.service.event.Event event) {
            Theme theme = (Theme) event.getProperty(IEventBroker.DATA);
            if (theme != null) {
                HttpSession httpSession = ((WrappedHttpSession) getSession().getSession()).getHttpSession();
                httpSession.setAttribute(ThemeConstants.Attrubutes.themeid, theme.getId());
                setThemeInternal(theme.getWebId());
            }
        }
    });

    String authProvider = VaadinE4Application.getInstance().getApplicationAuthenticationProvider();

    if (authProvider == null || authProvider.trim().isEmpty()) {
        // start workbench as usually
        e4Workbench = createE4Workbench(context);
        e4Workbench.createAndRunUI(e4Workbench.getApplication());
    } else {

        IContributionFactory contributionFactory = (IContributionFactory) appContext
                .get(IContributionFactory.class.getName());
        IEclipseContext authConext = appContext.createChild();

        VerticalLayout content = new VerticalLayout();
        content.setSizeFull();
        setContent(content);

        authConext.set(ComponentContainer.class, content);
        authConext.set(VerticalLayout.class, content);
        Object authProviderObj = contributionFactory.create(authProvider, authConext);
    }

    push = new ICEPush();
    push.extend(this);

    eventBroker.subscribe(AuthenticationConstants.Events.Authentication.name, new EventHandler() {
        @SuppressWarnings("unchecked")
        @Override
        public void handleEvent(org.osgi.service.event.Event event) {

            user = event.getProperty(EventUtils.DATA);
            userClass = (Class<Object>) event
                    .getProperty(AuthenticationConstants.Events.Authentication.userClass);

            if (e4Workbench != null) {
                String sessionId = getSession().getSession().getId();
                tempUserStore.put(sessionId, new Object[] { user, userClass });
                e4Workbench.close();
            } else {
                e4Workbench = createE4Workbench(context);
                e4Workbench.createAndRunUI(e4Workbench.getApplication());
            }

        }
    });

    VaadinOSGiCommunicationManager man = (VaadinOSGiCommunicationManager) appContext
            .get(VaadinExecutorService.class);
    man.exec();
}

From source file:org.semanticsoft.vaaclipse.presentation.fastview.SingleElementFastViewManager.java

License:Open Source License

public synchronized void showStack(boolean show) {
    Component ctf = (Component) minimizedElement.getWidget();

    if (show && !isShowing) {
        hostPane = getHostPane();/*ww  w.  j  a va2s . c o  m*/
        VerticalLayout vl = new VerticalLayout();
        vl.setSizeFull();
        hostPane.setContent(vl);

        ctf.setVisible(true);

        TrimmedWindowContent windowContent = (TrimmedWindowContent) vaadinWindow.getContent();
        ExtendedVerticalLayout clientArea = windowContent.getClientArea();

        hostPane.setTrimmedWindowClientArea(clientArea);
        //hostPane.setContent(ctf);
        vl.addComponent(ctf);

        vaadinUI.addWindow(hostPane);
        vaadinWindow.addClickListener(layoutClickListener);

        isShowing = true;
    } else if (!show && isShowing) {
        if (hostPane != null) {
            vaadinUI.removeWindow(hostPane);
            // capture the current shell's bounds
            toolBar.getPersistedState().put(STATE_XSIZE, Float.toString(Float.valueOf(hostPane.getWidth())));
            toolBar.getPersistedState().put(STATE_YSIZE, Float.toString(Float.valueOf(hostPane.getHeight())));
        }

        fixToolItemSelection(null);

        vaadinWindow.removeClickListener(layoutClickListener);

        partService.requestActivation();

        isShowing = false;
    }
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.PartRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    VerticalLayout pane = new VerticalLayout();
    pane.setSizeFull();
    final MPart part = (MPart) element;

    CssLayout toolbarArea = new CssLayout();
    toolbarArea.setStyleName("mparttoolbararea");
    toolbarArea.setSizeUndefined();/*from w  ww . j  a v  a2  s.  c  o  m*/
    toolbarArea.setWidth("100%");
    pane.addComponent(toolbarArea);

    //create toolbar
    MToolBar toolbar = part.getToolbar();
    if (toolbar != null && toolbar.isToBeRendered()) {
        Component toolbarWidget = (Component) renderingEngine.createGui(toolbar);
        ((AbstractLayout) toolbarWidget).setSizeUndefined();
        toolbarWidget.setStyleName("mparttoolbar");
        toolbarArea.addComponent(toolbarWidget);
    }

    VerticalLayout contributionArea = new VerticalLayout();
    contributionArea.setSizeFull();
    pane.addComponent(contributionArea);
    pane.setExpandRatio(contributionArea, 100);

    pane.setStyleName("part");
    element.setWidget(pane);

    IEclipseContext localContext = part.getContext();
    localContext.set(Component.class, contributionArea);
    localContext.set(ComponentContainer.class, contributionArea);
    localContext.set(VerticalLayout.class, contributionArea);
    localContext.set(MPart.class, part);
    SavePromptSetup savePromptProvider = new SavePromptSetup();
    savePrompts.put(part, savePromptProvider);
    localContext.set(SavePromptSetup.class, savePromptProvider);
    if (part instanceof MInputPart)
        localContext.set(MInputPart.class, (MInputPart) part);

    IContributionFactory contributionFactory = (IContributionFactory) localContext
            .get(IContributionFactory.class.getName());
    Object newPart = contributionFactory.create(part.getContributionURI(), localContext);

    part.setObject(newPart);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.PerspectiveRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MPerspective))
        return;/*from  w  w  w .  j  ava 2 s .  c om*/

    VerticalLayout perspectivePanel = new VerticalLayout();
    perspectivePanel.setSizeFull();
    element.setWidget(perspectivePanel);

    MPerspective p = (MPerspective) element;

    if (p.getIconURI() == null && p.getLabel() == null) {
        p.setIconURI(
                "platform:/plugin/org.semanticsoft.vaaclipse.resources/VAADIN/themes/vaaclipse_default_theme/img/blank_perspective.png");
    }
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.PerspectiveStackRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (perspectiveSwitcherPanel == null)
        initializedPerspectiveSwticherPanel((MPerspectiveStack) element);

    VerticalLayout perspectiveStackContent = new VerticalLayout();
    perspectiveStackContent.setSizeFull();
    element.setWidget(perspectiveStackContent);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.PlaceholderRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    MPlaceholder ph = (MPlaceholder) element;
    final MUIElement ref = ph.getRef();
    ref.setCurSharedRef(ph);/*  www.j  av a  2s  .c  om*/

    VerticalLayout phComp = new VerticalLayout();
    //ExtendedVerticalLayout phComp = new ExtendedVerticalLayout();
    phComp.setSizeFull();
    phComp.setMargin(false);
    ph.setWidget(phComp);

    Component refWidget = (Component) ref.getWidget();
    if (refWidget == null) {
        ref.setToBeRendered(true);
        refWidget = (Component) renderingEngine.createGui(ref);
    }

    if (refWidget.getParent() != phComp) {
        phComp.addComponent(refWidget);
    }

    if (ref instanceof MContext) {
        IEclipseContext context = ((MContext) ref).getContext();
        IEclipseContext newParentContext = getContext(ph);
        if (context.getParent() != newParentContext) {
            context.setParent(newParentContext);
        }
    }
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.SashRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MPartSashContainer)) {
        return;/*from   www .  ja  v  a 2 s . c  o  m*/
    }
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();

    element.setWidget(layout);
}