Example usage for com.vaadin.ui PopupView setHideOnMouseOut

List of usage examples for com.vaadin.ui PopupView setHideOnMouseOut

Introduction

In this page you can find the example usage for com.vaadin.ui PopupView setHideOnMouseOut.

Prototype

public void setHideOnMouseOut(boolean hideOnMouseOut) 

Source Link

Document

Should the popup automatically hide when the user takes the mouse cursor out of the popup area?

Usage

From source file:org.opencms.ui.components.CmsToolBar.java

License:Open Source License

/**
 * Creates the app select drop down.<p>
 *
 * @return the drop down component/*ww  w . j  a  va 2 s  .  c  o  m*/
 */
private Component createQuickLaunchDropDown() {

    PopupView pv = new PopupView(new PopupView.Content() {

        private static final long serialVersionUID = 1L;

        public String getMinimizedValueAsHTML() {

            return getDropDownButtonHtml(FontOpenCms.APPS);
        }

        public Component getPopupComponent() {

            CmsObject cms = A_CmsUI.getCmsObject();
            Locale locale = UI.getCurrent().getLocale();
            HorizontalLayout layout = new HorizontalLayout();
            layout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
            layout.addStyleName(OpenCmsTheme.QUICK_LAUNCH);
            //    layout.setSpacing(true);
            layout.setMargin(true);
            for (I_CmsWorkplaceAppConfiguration config : OpenCms.getWorkplaceAppManager()
                    .getQuickLaunchConfigurations(cms)) {
                layout.addComponent(CmsDefaultAppButtonProvider.createAppButton(cms, config, locale));
            }
            return layout;
        }
    });
    pv.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_QUICK_LAUNCH_TITLE_0));
    pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN);
    pv.setHideOnMouseOut(false);

    return pv;

}

From source file:org.opencms.ui.components.CmsToolBar.java

License:Open Source License

/**
 * Creates the user info drop down.<p>
 *
 * @return the drop down component//  w ww .  ja  v a  2  s . c o  m
 */
private Component createUserInfoDropDown() {

    PopupView pv = new PopupView(new PopupView.Content() {

        private static final long serialVersionUID = 1L;

        public String getMinimizedValueAsHTML() {

            CmsObject cms = A_CmsUI.getCmsObject();
            return getDropDownButtonHtml(new ExternalResource(OpenCms.getWorkplaceAppManager()
                    .getUserIconHelper().getSmallIconPath(cms, cms.getRequestContext().getCurrentUser())));
        }

        public Component getPopupComponent() {

            return new CmsUserInfo(new I_UploadListener() {

                public void onUploadFinished(List<String> uploadedFiles) {

                    handleUpload(uploadedFiles);
                }
            }, getDialogContext());
        }
    });
    pv.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_USER_INFO_TITLE_0));
    pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN);
    pv.setHideOnMouseOut(false);
    pv.addStyleName(OpenCmsTheme.USER_INFO);
    return pv;
}

From source file:org.ripla.web.demo.widgets.views.FormView.java

License:Open Source License

/**
 * FormView constructor./*from ww  w  . j a va 2s  . c o  m*/
 * 
 * @param inController
 *            {@link FormController} this view's controller
 */
public FormView(final FormController inController) {
    super();

    final IMessages lMessages = Activator.getMessages();
    final VerticalLayout lLayout = initLayout(lMessages, "widgets.title.page.form"); //$NON-NLS-1$

    final FormBean lFormItem = new FormBean();
    final RegistrationFormCreator lFormCreator = new RegistrationFormCreator(lFormItem);
    lLayout.addComponent(lFormCreator.createForm());

    final PopupContent lPopupContent = new PopupContent();
    final PopupView lPopup = new PopupView(lPopupContent);
    lPopup.setHideOnMouseOut(false);
    lPopup.setPopupVisible(false);
    lLayout.addComponent(lPopup);

    final Button lSave = new Button(lMessages.getMessage("widgets.view.button.label.save"));
    lSave.setClickShortcut(KeyCode.ENTER);
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            try {
                lFormCreator.commit();
                final String lFeedback = inController.save(lFormItem);
                lPopupContent.setFeedback(lFeedback);
                lPopup.setPopupVisible(true);
            } catch (final CommitException exc) {
                Notification.show(exc.getCause().getMessage(), Type.ERROR_MESSAGE);
            }
        }
    });
    lLayout.addComponent(lSave);
}

From source file:org.vaadin.tori.component.DebugControlPanel.java

License:Apache License

public DebugControlPanel(final DebugAuthorizationService authorizationService) {
    Page.getCurrent().getStyles()//from   w w w . ja  v  a 2s .  c om
            .add(".v-popupview-popup { background: #fff; } .v-popupview-popup .v-widget { font-size: 12px; }");
    addStyleName("debugcontrolpanel");
    this.authorizationService = authorizationService;
    ToriNavigator.getCurrent().addViewChangeListener(new ViewChangeListener() {
        @Override
        public void afterViewChange(final ViewChangeEvent event) {
            currentView = event.getNewView();
        }

        @Override
        public boolean beforeViewChange(final ViewChangeEvent event) {
            return true;
        }
    });

    final PopupView popupButton = new PopupView("Debug Control Panel", new Panel());
    popupButton.setHideOnMouseOut(false);
    popupButton.addStyleName("v-button");
    popupButton.addPopupVisibilityListener(this);
    setCompositionRoot(popupButton);
    setSizeUndefined();
}

From source file:org.vaadin.tori.component.DebugControlPanel.java

License:Apache License

private Component createPostControl(final Method setter, final List<Post> posts) throws Exception {
    if (posts == null || posts.isEmpty()) {
        final Label label = new Label(getNameForCheckBox(setter));
        label.setEnabled(false);// www. j  a v  a2 s.c o m
        return label;
    }

    Component content = new CustomComponent() {
        {
            final CssLayout root = new CssLayout();
            root.addStyleName("postselect-content");
            root.addStyleName(setter.getName());
            setCompositionRoot(root);
            root.setWidth("100%");
            setWidth("400px");

            root.addComponent(new Label(setter.getName()));

            for (final Post post : posts) {
                final Method getter = getGetterFrom(setter);
                final boolean getterValue = (Boolean) getter.invoke(authorizationService, post.getId());

                final String authorName = post.getAuthor().getDisplayedName();

                String postBody = post.getBodyRaw();
                if (postBody.length() > 20) {
                    postBody = postBody.substring(0, 20);
                }

                final CheckBox checkbox = new CheckBox(authorName + " :: " + postBody);
                checkbox.setValue(getterValue);
                checkbox.addValueChangeListener(new PostCheckboxListener(post, setter));
                checkbox.setImmediate(true);
                checkbox.setWidth("100%");
                root.addComponent(checkbox);
            }
        }
    };
    final PopupView popup = new PopupView(getNameForCheckBox(setter), content);
    popup.setHideOnMouseOut(false);
    popup.setHeight(30.0f, Unit.PIXELS);
    return popup;
}