Search in sources :

Example 11 with VaadinRequest

use of com.vaadin.server.VaadinRequest in project opennms by OpenNMS.

the class NodeInfoWindowTest method setUp.

@Before
public void setUp() throws Exception {
    Node testNode1 = new Node(9, "192.0.2.10", "Cartman");
    final URL url = new URL("http://localhost:8080/");
    window = new NodeInfoWindow(null, url);
    window2 = new NodeInfoWindow(testNode1, url);
    mainWindow = new Window();
    app = new // Empty Application
    UI() {

        private static final long serialVersionUID = -6798973775063082899L;

        @Override
        public void init(VaadinRequest request) {
        }
    };
}
Also used : InfoWindow(org.opennms.features.topology.api.support.InfoWindow) Window(com.vaadin.ui.Window) VaadinRequest(com.vaadin.server.VaadinRequest) URL(java.net.URL) Before(org.junit.Before)

Example 12 with VaadinRequest

use of com.vaadin.server.VaadinRequest in project opennms by OpenNMS.

the class AuthWindowTest method setup.

@SuppressWarnings("serial")
@Before
public void setup() {
    normalWindow = new AuthWindow(testHost, testPort);
    noPortWindow = new AuthWindow(testHost, emptyPort);
    noHostWindow = new AuthWindow(emptyHost, testPort);
    emptyWindow = new AuthWindow(emptyHost, emptyPort);
    invalidHostWindow = new AuthWindow(invalidHost, testPort);
    mainWindow = new Window();
    app = new // Empty Application
    UI() {

        @Override
        public void init(VaadinRequest request) {
        }
    };
    app.addWindow(normalWindow);
    app.addWindow(noHostWindow);
    app.addWindow(noPortWindow);
    app.addWindow(emptyWindow);
    app.addWindow(invalidHostWindow);
    UI.setCurrent(app);
}
Also used : Window(com.vaadin.ui.Window) VaadinRequest(com.vaadin.server.VaadinRequest) Before(org.junit.Before)

Example 13 with VaadinRequest

use of com.vaadin.server.VaadinRequest in project linkki by linkki-framework.

the class MessageUI method init.

@Override
protected void init(VaadinRequest request) {
    Page.getCurrent().setTitle("linkki Samples :: Validation Messages");
    VaadinSession.getCurrent().setConverterFactory(new LinkkiConverterFactory());
    MessagesPanel messagesPanel = new MessagesPanel();
    messagesPanel.setVisible(false);
    User user = new User();
    RegistrationSectionPmo registrationPmo = new RegistrationSectionPmo(user, u -> handleRegistration(messagesPanel, u));
    // tag::validation-service[]
    validationService = new RegistrationValidationService(registrationPmo);
    bindingManager = new RegistrationBindingManager(validationService, ml -> messagesPanel.updateMessages(ml));
    // end::validation-service[]
    DefaultPmoBasedSectionFactory sectionFactory = new DefaultPmoBasedSectionFactory();
    AbstractSection section = sectionFactory.createSection(registrationPmo, bindingManager.getExistingContextOrStartNewOne(getClass()));
    setContent(new VerticalLayout(messagesPanel, section));
}
Also used : MessagesPanel(org.linkki.samples.messages.components.MessagesPanel) ValoTheme(com.vaadin.ui.themes.ValoTheme) RegistrationSectionPmo(org.linkki.samples.messages.pmo.RegistrationSectionPmo) AbstractSection(org.linkki.core.ui.section.AbstractSection) ValidationMode(org.linkki.samples.messages.pmo.RegistrationValidationService.ValidationMode) VerticalLayout(com.vaadin.ui.VerticalLayout) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) UI(com.vaadin.ui.UI) VaadinRequest(com.vaadin.server.VaadinRequest) BindingManager(org.linkki.core.binding.BindingManager) Theme(com.vaadin.annotations.Theme) MessagesPanel(org.linkki.samples.messages.components.MessagesPanel) User(org.linkki.samples.messages.model.User) VaadinSession(com.vaadin.server.VaadinSession) Notification(com.vaadin.ui.Notification) LinkkiConverterFactory(org.linkki.core.ui.converters.LinkkiConverterFactory) Page(com.vaadin.server.Page) RegistrationValidationService(org.linkki.samples.messages.pmo.RegistrationValidationService) RegistrationBindingManager(org.linkki.samples.messages.binding.RegistrationBindingManager) User(org.linkki.samples.messages.model.User) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) RegistrationSectionPmo(org.linkki.samples.messages.pmo.RegistrationSectionPmo) LinkkiConverterFactory(org.linkki.core.ui.converters.LinkkiConverterFactory) AbstractSection(org.linkki.core.ui.section.AbstractSection) VerticalLayout(com.vaadin.ui.VerticalLayout) RegistrationBindingManager(org.linkki.samples.messages.binding.RegistrationBindingManager) RegistrationValidationService(org.linkki.samples.messages.pmo.RegistrationValidationService)

Example 14 with VaadinRequest

use of com.vaadin.server.VaadinRequest in project cuba by cuba-platform.

the class LinkHandler method handle.

/**
 * Called to handle the link.
 */
public void handle() {
    try {
        ExternalLinkContext linkContext = new ExternalLinkContext(requestParams, action, app);
        for (LinkHandlerProcessor processor : processors) {
            if (processor.canHandle(linkContext)) {
                processor.handle(linkContext);
                break;
            }
        }
    } finally {
        VaadinRequest request = VaadinService.getCurrentRequest();
        WrappedSession wrappedSession = request.getWrappedSession();
        wrappedSession.removeAttribute(AppUI.LAST_REQUEST_PARAMS_ATTR);
        wrappedSession.removeAttribute(AppUI.LAST_REQUEST_ACTION_ATTR);
    }
}
Also used : LinkHandlerProcessor(com.haulmont.cuba.web.sys.linkhandling.LinkHandlerProcessor) WrappedSession(com.vaadin.server.WrappedSession) VaadinRequest(com.vaadin.server.VaadinRequest) ExternalLinkContext(com.haulmont.cuba.web.sys.linkhandling.ExternalLinkContext)

Aggregations

VaadinRequest (com.vaadin.server.VaadinRequest)14 Before (org.junit.Before)6 UI (com.vaadin.ui.UI)5 Window (com.vaadin.ui.Window)5 VaadinSession (com.vaadin.server.VaadinSession)3 VerticalLayout (com.vaadin.ui.VerticalLayout)3 IdpSession (com.haulmont.cuba.security.global.IdpSession)2 Connection (com.haulmont.cuba.web.Connection)2 Theme (com.vaadin.annotations.Theme)2 WebBrowser (com.vaadin.server.WebBrowser)2 Notification (com.vaadin.ui.Notification)2 URL (java.net.URL)2 Refresher (com.github.wolfie.refresher.Refresher)1 Strings (com.google.common.base.Strings)1 Lists (com.google.common.collect.Lists)1 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)1 AppUI (com.haulmont.cuba.web.AppUI)1 DefaultApp (com.haulmont.cuba.web.DefaultApp)1 ConnectionImpl (com.haulmont.cuba.web.security.ConnectionImpl)1 ExternalUserCredentials (com.haulmont.cuba.web.security.ExternalUserCredentials)1