Search in sources :

Example 1 with LinkkiConverterFactory

use of org.linkki.core.ui.converters.LinkkiConverterFactory in project linkki by linkki-framework.

the class UIDateFieldIntegrationTest method setUp.

@Override
@Before
public void setUp() {
    super.setUp();
    VaadinSession vaadinSession = mock(VaadinSession.class);
    LinkkiConverterFactory converterFactory = new LinkkiConverterFactory(() -> Arrays.<AutoDiscoveredConverter>asList(new LocalDateToDateConverter(), new JodaLocalDateToDateConverter()));
    when(vaadinSession.getConverterFactory()).thenReturn(converterFactory);
    VaadinSession.setCurrent(vaadinSession);
}
Also used : VaadinSession(com.vaadin.server.VaadinSession) LinkkiConverterFactory(org.linkki.core.ui.converters.LinkkiConverterFactory) JodaLocalDateToDateConverter(org.linkki.core.ui.converters.JodaLocalDateToDateConverter) LocalDateToDateConverter(org.linkki.core.ui.converters.LocalDateToDateConverter) JodaLocalDateToDateConverter(org.linkki.core.ui.converters.JodaLocalDateToDateConverter) Before(org.junit.Before)

Example 2 with LinkkiConverterFactory

use of org.linkki.core.ui.converters.LinkkiConverterFactory in project linkki by linkki-framework.

the class ApplicationFrame method init.

/**
 * Initializes the layout for the given UI.
 * <p>
 * Can't be done in a layout's constructor as we need the other beans to be injected and also
 * the UI which is still under construction at this point in time.
 */
public void init(UI ui) {
    // init converters
    VaadinSession vaadinSession = VaadinSession.getCurrent();
    if (vaadinSession != null) {
        vaadinSession.setConverterFactory(new LinkkiConverterFactory());
    }
    content = new VerticalLayout();
    content.setMargin(false);
    content.setSizeFull();
    // Header
    content.addComponent(header);
    header.init();
    // Main area
    mainArea = new VerticalLayout();
    mainArea.setSizeFull();
    content.addComponent(mainArea);
    content.setExpandRatio(mainArea, 1);
    // Footer
    content.addComponent(footer);
    navigator = createNavigator(ui, mainArea);
    navigator.addProvider(getViewProvider());
}
Also used : VaadinSession(com.vaadin.server.VaadinSession) LinkkiConverterFactory(org.linkki.core.ui.converters.LinkkiConverterFactory) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 3 with LinkkiConverterFactory

use of org.linkki.core.ui.converters.LinkkiConverterFactory 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)

Aggregations

VaadinSession (com.vaadin.server.VaadinSession)3 LinkkiConverterFactory (org.linkki.core.ui.converters.LinkkiConverterFactory)3 VerticalLayout (com.vaadin.ui.VerticalLayout)2 Theme (com.vaadin.annotations.Theme)1 Page (com.vaadin.server.Page)1 VaadinRequest (com.vaadin.server.VaadinRequest)1 Notification (com.vaadin.ui.Notification)1 UI (com.vaadin.ui.UI)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 Before (org.junit.Before)1 BindingManager (org.linkki.core.binding.BindingManager)1 JodaLocalDateToDateConverter (org.linkki.core.ui.converters.JodaLocalDateToDateConverter)1 LocalDateToDateConverter (org.linkki.core.ui.converters.LocalDateToDateConverter)1 AbstractSection (org.linkki.core.ui.section.AbstractSection)1 DefaultPmoBasedSectionFactory (org.linkki.core.ui.section.DefaultPmoBasedSectionFactory)1 RegistrationBindingManager (org.linkki.samples.messages.binding.RegistrationBindingManager)1 MessagesPanel (org.linkki.samples.messages.components.MessagesPanel)1 User (org.linkki.samples.messages.model.User)1 RegistrationSectionPmo (org.linkki.samples.messages.pmo.RegistrationSectionPmo)1 RegistrationValidationService (org.linkki.samples.messages.pmo.RegistrationValidationService)1