List of usage examples for com.vaadin.server Responsive makeResponsive
public static void makeResponsive(Component... components)
From source file:org.eclipse.hawkbit.ui.HawkbitUI.java
License:Open Source License
@Override protected void init(final VaadinRequest vaadinRequest) { LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId()); if (pushStrategy != null) { pushStrategy.init(getUI());// ww w . j a v a2 s .co m } addDetachListener(this); SpringContextHelper.setContext(context); Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); setResponsive(Boolean.TRUE); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull(); dashboardMenu.init(); dashboardMenu.setResponsive(true); final VerticalLayout contentVerticalLayout = new VerticalLayout(); contentVerticalLayout.setSizeFull(); contentVerticalLayout.setStyleName("main-content"); contentVerticalLayout.addComponent(buildHeader()); contentVerticalLayout.addComponent(buildViewTitle()); final Panel content = buildContent(); contentVerticalLayout.addComponent(content); contentVerticalLayout.setExpandRatio(content, 1); rootLayout.addComponent(dashboardMenu); rootLayout.addComponent(contentVerticalLayout); rootLayout.setExpandRatio(contentVerticalLayout, 1); setContent(rootLayout); final Navigator navigator = new Navigator(this, content); navigator.addViewChangeListener(new ViewChangeListener() { private static final long serialVersionUID = 1L; @Override public boolean beforeViewChange(final ViewChangeEvent event) { return true; } @Override public void afterViewChange(final ViewChangeEvent event) { final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName()); dashboardMenu.postViewChange(new PostViewChangeEvent(view)); if (view == null) { viewTitle.setCaption(null); return; } viewTitle.setCaption(view.getDashboardCaptionLong()); notificationUnreadButton.setCurrentView(event.getNewView()); } }); navigator.setErrorView(errorview); navigator.addProvider(new ManagementViewProvider()); setNavigator(navigator); navigator.addView(EMPTY_VIEW, new Navigator.EmptyView()); // set locale is required for I18N class also, to get the locale from // cookie final String locale = getLocaleId(SPUIDefinitions.getAvailableLocales()); setLocale(new Locale(locale)); if (UI.getCurrent().getErrorHandler() == null) { UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler()); } LOG.info("Current locale of the application is : {}", HawkbitCommonUtil.getLocale()); }
From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java
License:Open Source License
protected Component buildLoginForm() { final VerticalLayout loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined();//from www. j av a 2s . c o m loginPanel.setSpacing(true); loginPanel.addStyleName("login-panel"); Responsive.makeResponsive(loginPanel); loginPanel.addComponent(buildFields()); if (isDemo) { loginPanel.addComponent(buildDisclaimer()); } loginPanel.addComponent(buildLinks()); checkBrowserSupport(loginPanel); return loginPanel; }
From source file:org.eclipse.hawkbit.ui.login.LoginView.java
License:Open Source License
private Component buildLoginForm() { final VerticalLayout loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined();// w w w . java2 s .c o m loginPanel.setSpacing(true); loginPanel.addStyleName("dashboard-view"); loginPanel.addStyleName("login-panel"); Responsive.makeResponsive(loginPanel); loginPanel.addComponent(buildFields()); loginPanel.addComponent(buildLinks()); // Check if IE browser is not supported ( < IE11 ) if (isUnsupportedBrowser()) { // Disable sign-in button and display a message signin.setEnabled(Boolean.FALSE); loginPanel.addComponent(buildUnsupportedMessage()); } return loginPanel; }
From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java
License:BSD License
protected void init() { addStyleName(ValoTheme.PANEL_BORDERLESS); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth("100%"); verticalLayout.setHeight("100%"); verticalLayout.setMargin(true);//from w w w .j a v a 2 s . c o m verticalLayout.addStyleName("dashboard-view"); Responsive.makeResponsive(verticalLayout); Component content = buildContent(); verticalLayout.addComponent(content); verticalLayout.setExpandRatio(content, 1); this.setSizeFull(); this.setContent(verticalLayout); }
From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java
License:BSD License
private Component buildContent() { dashboardPanels = new CssLayout(); dashboardPanels.addStyleName("dashboard-panels"); Responsive.makeResponsive(dashboardPanels); dashboardPanels.addComponent(buildDashboard(this.eventExclusionsTable)); // dashboardPanels.addComponent(buildDashboardChart()); // dashboardPanels.addComponent(buildAnotherChart()); dashboardPanels.addComponent(buildDashboard(this.flowStateTable)); return dashboardPanels; }
From source file:org.ikasan.dashboard.ui.monitor.panel.MonitorViewPanel.java
License:BSD License
private Component buildContent() { dashboardPanels = new CssLayout(); dashboardPanels.addStyleName("dashboard-panels"); Responsive.makeResponsive(dashboardPanels); List<Server> servers = new ArrayList<Server>(); try {//from w w w . j a v a 2s .c o m servers = topologyService.getAllServers(); } catch (Exception e) { logger.warn("An exception has occurred trying to update the topology state cache", e); // Ignoring this exception, as it may be the case that the database is not yet setup. } this.views = new ArrayList<View>(); for (Server server : servers) { MonitorPanel panel = new MonitorPanel(this.topologyService, server); dashboardPanels.addComponent(panel.buildServerComponent()); this.views.add(panel); } return dashboardPanels; }
From source file:org.jumpmind.metl.ui.init.AppUI.java
License:Open Source License
@SuppressWarnings("serial") @Override// w w w. j a v a 2 s . c o m protected void init(VaadinRequest request) { WebApplicationContext ctx = getWebApplicationContext(); backgroundRefresherService = ctx.getBean(BackgroundRefresherService.class); backgroundRefresherService.init(this); UI.getCurrent().setErrorHandler(new DefaultErrorHandler() { public void error(com.vaadin.server.ErrorEvent event) { String intro = "Exception of type <b>"; String message = ""; for (Throwable t = event.getThrowable(); t != null; t = t.getCause()) { if (t.getCause() == null) { intro += t.getClass().getName() + "</b> with the following message:<br/><br/>"; message = t.getMessage(); } } ErrorWindow window = new ErrorWindow(intro, message); window.show(); Throwable ex = event.getThrowable(); if (ex != null) { log.error(ex.getMessage(), ex); } else { log.error("An unexpected error occurred"); } } }); VaadinSession.getCurrent().setConverterFactory(new DefaultConverterFactory() { private static final long serialVersionUID = 1L; @Override protected Converter<Date, ?> createDateConverter(Class<?> sourceType) { return super.createDateConverter(sourceType); } protected Converter<String, ?> createStringConverter(Class<?> sourceType) { if (Double.class.isAssignableFrom(sourceType)) { return new StringToDoubleConverter(); } else if (Float.class.isAssignableFrom(sourceType)) { return new StringToFloatConverter(); } else if (Integer.class.isAssignableFrom(sourceType)) { return new StringToIntegerConverter() { private static final long serialVersionUID = 1L; @Override protected NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; } }; } else if (Long.class.isAssignableFrom(sourceType)) { return new StringToLongConverter() { private static final long serialVersionUID = 1L; @Override protected NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; } }; } else if (BigDecimal.class.isAssignableFrom(sourceType)) { return new StringToBigDecimalConverter(); } else if (Boolean.class.isAssignableFrom(sourceType)) { return new StringToBooleanConverter(); } else if (Date.class.isAssignableFrom(sourceType)) { return new StringToDateConverter(); } else { return null; } } }); Responsive.makeResponsive(this); ApplicationContext appCtx = ctx.getBean(ApplicationContext.class); if (appCtx.getConfigurationService().isUserLoginEnabled()) { LoginDialog login = new LoginDialog(appCtx, this); UI.getCurrent().addWindow(login); } else { User user = appCtx.getConfigurationService().findUserByLoginId(DEFAULT_USER); if (user == null) { user = new User(); user.setLoginId(DEFAULT_USER); appCtx.getConfigurationService().save(user); Group group = new Group(DEFAULT_USER); user.getGroups().add(group); appCtx.getConfigurationService().save(group); for (Privilege priv : Privilege.values()) { GroupPrivilege groupPriv = new GroupPrivilege(group.getId(), priv.name()); group.getGroupPrivileges().add(groupPriv); appCtx.getConfigurationService().save(groupPriv); } UserGroup userGroup = new UserGroup(user.getId(), group.getId()); appCtx.getConfigurationService().save(userGroup); } appCtx.setUser(user); login(user); } }
From source file:org.jumpmind.vaadin.ui.common.AbstractSpringUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { setErrorHandler(new DefaultErrorHandler() { private static final long serialVersionUID = 1L; @Override/*from w w w . j av a2 s . com*/ public void error(com.vaadin.server.ErrorEvent event) { Throwable ex = event.getThrowable(); CommonUiUtils.notify(ex); if (ex != null) { log.error(ex.getMessage(), ex); } else { log.error("An unexpected error occurred"); } } }); VaadinSession.getCurrent().setConverterFactory(new DefaultConverterFactory() { private static final long serialVersionUID = 1L; @Override protected Converter<Date, ?> createDateConverter(Class<?> sourceType) { return super.createDateConverter(sourceType); } protected Converter<String, ?> createStringConverter(Class<?> sourceType) { if (Double.class.isAssignableFrom(sourceType)) { return new StringToDoubleConverter(); } else if (Float.class.isAssignableFrom(sourceType)) { return new StringToFloatConverter(); } else if (Integer.class.isAssignableFrom(sourceType)) { return new StringToIntegerConverter() { private static final long serialVersionUID = 1L; @Override protected NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; } }; } else if (Long.class.isAssignableFrom(sourceType)) { return new StringToLongConverter() { private static final long serialVersionUID = 1L; @Override protected NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; } }; } else if (BigDecimal.class.isAssignableFrom(sourceType)) { return new StringToBigDecimalConverter(); } else if (Boolean.class.isAssignableFrom(sourceType)) { return new StringToBooleanConverter(); } else if (Date.class.isAssignableFrom(sourceType)) { return new StringToDateConverter(); } else { return null; } } }); Responsive.makeResponsive(this); }
From source file:org.lucidj.vaadinui.BaseVaadinUI.java
License:Apache License
private void init_desktop(VaadinRequest vaadinRequest) { Responsive.makeResponsive(this); setLocale(vaadinRequest.getLocale()); if (vaadinRequest instanceof VaadinServletRequest) { VaadinServletRequest vsr = (VaadinServletRequest) vaadinRequest; InetAddress remote_addr = null; // TODO: USE AUTOMATIC KEY AUTHENTICATION FOR SINGLE MODE try {/*from ww w . j a va 2 s .co m*/ remote_addr = InetAddress.getByName(vsr.getRemoteAddr()); } catch (UnknownHostException ignore) { } ; // Login tokens may be used only when browsing from the same machine if (remote_addr != null && remote_addr.isLoopbackAddress() && Login.isValidLoginToken(vsr.getParameter("token"))) { // Autologin into System when browsing from localhost log.warn("Automatic login from localhost using login token"); security.createSystemSubject(); // Erase the token from URL getPage().getJavaScript().execute("window.lucidj_vaadin_helper.clearUrl ()"); } } if (!security.getSubject().isAuthenticated()) { setContent(new Login(security, new Login.LoginListener() { @Override public void loginSuccessful() { show_desktop(); } })); } else { show_desktop(); } }
From source file:org.lucidj.vaadinui.Login.java
License:Apache License
@Override // LoginForm protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) { // Save the predefined components this.userNameField = userNameField; this.passwordField = passwordField; this.loginButton = loginButton; // Make LoginForm container full-screen setSizeFull();/*from www.j a va2s . c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addStyleName("login-wallpaper"); final VerticalLayout loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined(); loginPanel.setMargin(true); loginPanel.setSpacing(true); Responsive.makeResponsive(loginPanel); loginPanel.addStyleName("card"); //-------- // HEADER //-------- final HorizontalLayout labels = new HorizontalLayout(); labels.setWidth("100%"); final Label title = new Label("<h3><strong>LucidJ</strong> Console</h3>", ContentMode.HTML); labels.addComponent(title); labels.setExpandRatio(title, 1); loginPanel.addComponent(labels); //-------- // FIELDS //-------- HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.addStyleName("fields"); userNameField.setImmediate(true); userNameField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); final ShortcutListener username_enter_listener = new ShortcutListener("Next field (Tab)", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object o, Object o1) { passwordField.setValue(""); passwordField.focus(); } }; userNameField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { show_default_message(); int new_username_length = textChangeEvent.getText().length(); // Check for autofill if (userNameField.isEmpty() && new_username_length > 1 && !userNameField_filling) { // This is autofill userNameField.removeShortcutListener(username_enter_listener); userNameField.setCursorPosition(new_username_length); userNameField.setSelectionRange(0, new_username_length); } else { userNameField_filling = true; passwordField.setValue(""); userNameField.addShortcutListener(username_enter_listener); } } }); userNameField.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent focusEvent) { // Cursor on username, Enter jump to password loginButton.removeClickShortcut(); userNameField.addShortcutListener(username_enter_listener); } }); userNameField.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent blurEvent) { // Cursor on password or elsewhere, enter submits userNameField.removeShortcutListener(username_enter_listener); loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); } }); passwordField.setImmediate(true); passwordField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); passwordField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { show_default_message(); } }); loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); loginButton.setDisableOnClick(true); fields.addComponents(userNameField, passwordField, loginButton); fields.setComponentAlignment(loginButton, Alignment.BOTTOM_LEFT); loginPanel.addComponent(fields); //-------- // FOOTER //-------- loginPanel.addComponent(new CheckBox("Remember me", true)); loginPanel.addComponent(message_label); show_default_message(); layout.addComponent(loginPanel); layout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); return (layout); }