List of usage examples for com.vaadin.ui Window setCloseShortcut
@Deprecated public void setCloseShortcut(int keyCode, int... modifiers)
From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java
private void openWindow() { Window myWindow = new Window("Cliente"); myWindow.addStyleName("profile-window"); myWindow.setId(ID);//from ww w .ja v a 2s .c o m Responsive.makeResponsive(this); myWindow.setModal(true); myWindow.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null); myWindow.setResizable(false); myWindow.setClosable(false); myWindow.setHeight(90.0f, Unit.PERCENTAGE); VerticalLayout layout = new VerticalLayout(); CustomerPanelView customerPanelView = new CustomerPanelView(); layout.addComponent(customerPanelView.buildCustomerPanel(null)); layout.addComponent(builtButton()); myWindow.setContent(layout); myWindow.setVisible(true); UI.getCurrent().addWindow(myWindow); myWindow.focus(); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private void initView() { setCompositionRoot(root);/* w w w . j a v a 2 s. co m*/ root.setSizeFull(); root.setSplitPosition(15); root.setStyleName("small previews"); previewArea.setWidth("100%"); previewTabs = new VerticalLayout(); previewTabs.setSizeFull(); previewTabs.setHeight(null); compoundTabs = new VerticalLayout(); compoundTabs.setSizeFull(); compoundTabs.setHeight(null); bennuStylesTabs = new VerticalLayout(); bennuStylesTabs.setSizeFull(); bennuStylesTabs.setHeight(null); VerticalLayout menu = new VerticalLayout(); menu.setSizeFull(); menu.setStyleName("sidebar-menu"); Button syncThemes = new Button("Sync Themes", new ClickListener() { @Override public void buttonClick(ClickEvent event) { syncThemes(); } }); menu.addComponent(syncThemes); menu.addComponent(new Label("Single Components")); menu.addComponent(previewTabs); menu.addComponent(new Label("Compound Styles")); menu.addComponent(compoundTabs); menu.addComponent(new Label("Bennu Styles")); menu.addComponent(bennuStylesTabs); root.setFirstComponent(menu); CssLayout toolbar = new CssLayout(); toolbar.setWidth("100%"); toolbar.setStyleName("toolbar"); toolbar.addComponent(editorToggle); final Window downloadWindow = new Window("Download Theme"); GridLayout l = new GridLayout(3, 2); l.setSizeUndefined(); l.setMargin(true); l.setSpacing(true); downloadWindow.setContent(l); downloadWindow.setModal(true); downloadWindow.setResizable(false); downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null); downloadWindow.addStyleName("opaque"); Label caption = new Label("Theme Name"); l.addComponent(caption); l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER); final TextField name = new TextField(); name.setValue("my-chameleon"); name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed")); name.setRequired(true); name.setRequiredError("Please give a name for the theme"); downloadWindow.addComponent(name); Label info = new Label( "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.", Label.CONTENT_XHTML); info.addStyleName("tiny"); info.setWidth("200px"); l.addComponent(info, 1, 1, 2, 1); Button download = new Button(null, new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { getApplication().getMainWindow().addWindow(downloadWindow); name.focus(); } }); download.setDescription("Donwload the current theme"); download.setIcon(new ThemeResource("download.png")); download.setStyleName("icon-only"); toolbar.addComponent(download); menu.addComponent(toolbar); menu.setExpandRatio(toolbar, 1); menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER); }
From source file:org.processbase.ui.servlet.MainWindow.java
License:Open Source License
void openLogoutWindow() { Window logout = new Window(((PbApplication) getApplication()).getPbMessages().getString("btnLogout")); logout.setModal(true);//from w ww . j ava 2 s.c o m // logout.setStyleName(Reindeer.WINDOW_BLACK); logout.setWidth("260px"); logout.setResizable(false); logout.setClosable(false); logout.setDraggable(false); logout.setCloseShortcut(KeyCode.ESCAPE, null); Label helpText = new Label("Are you sure you want to log out?", Label.CONTENT_XHTML); logout.addComponent(helpText); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button yes = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnLogout"), new Button.ClickListener() { public void buttonClick(ClickEvent event) { WebApplicationContext applicationContext = (WebApplicationContext) getApplication() .getContext(); getApplication().close(); applicationContext.getHttpSession().invalidate(); } }); yes.setStyleName(Reindeer.BUTTON_DEFAULT); yes.focus(); buttons.addComponent(yes); Button no = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnCancel"), new Button.ClickListener() { public void buttonClick(ClickEvent event) { removeWindow(event.getButton().getWindow()); } }); buttons.addComponent(no); logout.addComponent(buttons); ((VerticalLayout) logout.getContent()).setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); ((VerticalLayout) logout.getContent()).setSpacing(true); addWindow(logout); }
From source file:ru.codeinside.gses.webui.components.ShowDiagramComponent.java
License:Mozilla Public License
private void buildLayout(final ShowDiagramComponentParameterObject param) { setSizeFull();//from w ww .j a v a2s . c o m setSpacing(true); final Panel panel = new Panel(); panel.getContent().setSizeUndefined(); panel.setCaption(param.caption); TaskGraph tg = new TaskGraph(param.processDefinitionId, param.executionId); if (param.height != null) { tg.setHeight(param.height); } if (param.width != null) { tg.setWidth(param.width); } tg.setStyleName("scheme-image"); final TaskGraph bigGraph = new TaskGraph(param.processDefinitionId, param.executionId); tg.addListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 1L; @Override public void click(MouseEvents.ClickEvent event) { final Window schemeWindow = new Window(param.windowHeader); getWindow().addWindow(schemeWindow); schemeWindow.addComponent(bigGraph); schemeWindow.setWidth("90%"); schemeWindow.setHeight("90%"); schemeWindow.center(); schemeWindow.focus(); schemeWindow.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, 0); bigGraph.addListener(new MouseEvents.ClickListener() { @Override public void click(MouseEvents.ClickEvent event) { getWindow().removeWindow(schemeWindow); } }); } }); panel.addComponent(tg); addComponent(panel); }