List of usage examples for com.vaadin.ui Window setModal
public void setModal(boolean modal)
From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java
private void openComplaintWindow(Complaint complaint) { WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); Window window = new Window("Registro de Queja"); window.setModal(true); if (webBrowser.getScreenWidth() < 1024) { window.setSizeFull();//from w w w. j a va 2 s. c o m } else { window.setHeight(90.0f, Unit.PERCENTAGE); window.setWidth(90.0f, Unit.PERCENTAGE); } // TextField nameField = new TextField(); // nameField.setInputPrompt("Introduzca el ttulo de la queja"); // nameField.setWidth("100%"); TextArea notesArea = new TextArea(); notesArea.setInputPrompt("Introduzca el contenido de la queja"); notesArea.setSizeFull(); // CheckBox doneField = new CheckBox("Atendido"); HorizontalLayout horizontal = new HorizontalLayout(); horizontal.setSpacing(true); horizontal.addComponent(createDeleteButton(window)); horizontal.addComponent(createOkButton(window)); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.addComponent(complaintType); layout.addComponent(notesArea); // layout.addComponent(doneField); layout.addComponent(horizontal); layout.setComponentAlignment(horizontal, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(complaintType, 1); layout.setExpandRatio(notesArea, 8); // layout.setExpandRatio(doneField, 1); layout.setExpandRatio(horizontal, 1); BeanItem beanItem = new BeanItem<>(complaint); fieldGroup = new BeanFieldGroup<>(Complaint.class); fieldGroup.setItemDataSource(beanItem); fieldGroup.bind(complaintType, "complaintType"); fieldGroup.bind(notesArea, "notes"); // fieldGroup.bind(doneField, "done"); window.setContent(layout); getUI().addWindow(window); // Window windowComplaint = new Window(complaintView); // WidgetActions actions = new WidgetActions(){ // // @Override // public void saveAction() { // refreshBind(); // windowComplaint.close(); // } // // @Override // public void deleteAction() { // appointment.getComplaints().remove(complaint); // refreshBind(); // windowComplaint.close(); // } // // }; // complaintView.bind(complaint); // complaintView.setActions(actions); // getUI().addWindow(windowComplaint); }
From source file:com.terralcode.gestion.frontend.view.widgets.example.crudtestform.CrudExampleForm.java
private void openProductWindow(Item beanItem, String caption) { Window window = new Window(caption); window.setModal(true); FormLayout layout = new FormLayout(); layout.setMargin(true);//from w w w .java2 s . com window.setContent(layout); fieldGroup = new BeanFieldGroup<TestProduct>(TestProduct.class); fieldGroup.setItemDataSource(beanItem); for (Object propertyId : fieldGroup.getUnboundPropertyIds()) { layout.addComponent(fieldGroup.buildAndBind(propertyId)); } layout.addComponent(createOkButton(window)); getUI().addWindow(window); }
From source file:com.tripoin.util.ui.calendar.BeanItemContainerTestUI.java
License:Apache License
/** * Opens up a modal dialog window where an event can be modified * /*from w w w .j av a 2 s . c o m*/ * @param event * The event to modify */ private void editEvent(final BasicEvent event) { Window modal = new Window("Add event"); modal.setModal(true); modal.setResizable(false); modal.setDraggable(false); modal.setWidth("300px"); final FieldGroup fieldGroup = new FieldGroup(); FormLayout formLayout = new FormLayout(); TextField captionField = new TextField("Caption"); captionField.setImmediate(true); TextField descriptionField = new TextField("Description"); descriptionField.setImmediate(true); DateField startField = new DateField("Start"); startField.setResolution(Resolution.MINUTE); startField.setImmediate(true); DateField endField = new DateField("End"); endField.setImmediate(true); endField.setResolution(Resolution.MINUTE); formLayout.addComponent(captionField); formLayout.addComponent(descriptionField); formLayout.addComponent(startField); formLayout.addComponent(endField); fieldGroup.bind(captionField, ContainerEventProvider.CAPTION_PROPERTY); fieldGroup.bind(descriptionField, ContainerEventProvider.DESCRIPTION_PROPERTY); fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY); fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY); fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event, Arrays.asList(ContainerEventProvider.CAPTION_PROPERTY, ContainerEventProvider.DESCRIPTION_PROPERTY, ContainerEventProvider.STARTDATE_PROPERTY, ContainerEventProvider.ENDDATE_PROPERTY))); modal.setContent(formLayout); modal.addCloseListener(new Window.CloseListener() { /** * */ private static final long serialVersionUID = -3427881784024691882L; @Override public void windowClose(CloseEvent e) { // Commit changes to bean try { fieldGroup.commit(); } catch (CommitException e1) { e1.printStackTrace(); } if (events.containsId(event)) { /* * BeanItemContainer does not notify container listeners * when the bean changes so we need to trigger a * ItemSetChange event */ BasicEvent dummy = new BasicEvent(); events.addBean(dummy); events.removeItem(dummy); } else { events.addBean(event); } } }); getUI().addWindow(modal); }
From source file:com.zklogtool.web.components.MainLayout.java
License:Apache License
public MainLayout() { buildMainLayout();/* www .j av a 2s .c om*/ setCompositionRoot(mainLayout); versionLabel.setValue("zklogtoolwebapp " + projectVersion()); MenuItem fileMenuItem = menuBar_1.addItem("File", null, null); fileMenuItem.addItem("Open transaction log", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { final Window window = new Window("Open transaction log file"); window.setModal(true); OpenTransactionLogFileDialog openFileDialog = new OpenTransactionLogFileDialog(tabSheet_1, window); window.setHeight(300, Unit.PIXELS); window.setWidth(600, Unit.PIXELS); window.setContent(openFileDialog); UI.getCurrent().addWindow(window); } }); fileMenuItem.addItem("Open snapshot", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { final Window window = new Window("Open snapshot file"); window.setModal(true); OpenSnapshotFileDialog openFileDialog = new OpenSnapshotFileDialog(tabSheet_1, window); window.setHeight(250, Unit.PIXELS); window.setWidth(600, Unit.PIXELS); window.setContent(openFileDialog); UI.getCurrent().addWindow(window); } }); MenuItem helpMenuItem = menuBar_1.addItem("Help", null, null); helpMenuItem.addItem("About", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { final Window window = new Window("About"); window.setModal(true); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.addComponent(new Label("This is zklogtool web front end in development")); window.setContent(verticalLayout); UI.getCurrent().addWindow(window); } }); }
From source file:com.zklogtool.web.components.TransactionLogView.java
License:Apache License
public TransactionLogView(final File transactionLogFile, final File snapshotDir, final boolean follow, final boolean startFromLast, final TabSheet displayTabSheet, final String name) { buildMainLayout();/*from ww w .j a va 2 s . c o m*/ setCompositionRoot(mainLayout); descriptionLabel.setContentMode(ContentMode.PREFORMATTED); final Container container = new IndexedContainer(); container.addContainerProperty("zxid", String.class, 0); container.addContainerProperty("cxid", String.class, 0); container.addContainerProperty("client id", String.class, 0); //container.addContainerProperty("time", Date.class, 0); container.addContainerProperty("operation", ZkOperations.class, ""); container.addContainerProperty("path", String.class, ""); reconstructDataTreeButton.setVisible(false); filterTable.setContainerDataSource(container); filterTable.setFilterBarVisible(true); filterTable.setFilterDecorator(new TransactionFilterDecoder()); filterTable.setSelectable(true); filterTable.setImmediate(true); final TransactionLog transactionLog; final Iterator<Transaction> iterator; final Map<String, Transaction> transactionMap = new HashMap<String, Transaction>(); filterTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (filterTable.getValue() == null) return; StringBuilder description = new StringBuilder(); TransactionPrinter printer = new TransactionPrinter(description, new UnicodeDecoder()); printer.print(transactionMap.get("0x" + filterTable.getValue().toString())); descriptionLabel.setValue(description.toString()); if (snapshotDir != null && transactionLogFile.isDirectory()) { reconstructDataTreeButton.setVisible(true); } } }); if (transactionLogFile.isFile()) { transactionLog = new TransactionLog(transactionLogFile, new TransactionLogReaderFactory()); } else { transactionLog = new TransactionLog(new DataDirTransactionLogFileList(transactionLogFile), new TransactionLogReaderFactory()); } iterator = transactionLog.iterator(); if (startFromLast) { while (iterator.hasNext()) { iterator.next(); } } final Runnable fillData = new Runnable() { @Override public void run() { // TODO Auto-generated method stub while (iterator.hasNext()) { Transaction t = iterator.next(); transactionMap.put(Util.longToHexString(t.getTxnHeader().getZxid()), t); Item item = container.addItem(Long.toHexString(t.getTxnHeader().getZxid())); item.getItemProperty("zxid").setValue(Util.longToHexString(t.getTxnHeader().getZxid())); item.getItemProperty("cxid").setValue(Util.longToHexString(t.getTxnHeader().getCxid())); item.getItemProperty("client id") .setValue(Util.longToHexString(t.getTxnHeader().getClientId())); /*item.getItemProperty("time").setValue( new Date(t.getTxnHeader().getTime()));*/ switch (t.getTxnHeader().getType()) { case OpCode.create: CreateTxn createTxn = (CreateTxn) t.getTxnRecord(); item.getItemProperty("operation").setValue(ZkOperations.CREATE); item.getItemProperty("path").setValue(createTxn.getPath()); break; case OpCode.delete: DeleteTxn deleteTxn = (DeleteTxn) t.getTxnRecord(); item.getItemProperty("operation").setValue(ZkOperations.DELTE); item.getItemProperty("path").setValue(deleteTxn.getPath()); break; case OpCode.setData: SetDataTxn setDataTxn = (SetDataTxn) t.getTxnRecord(); item.getItemProperty("operation").setValue(ZkOperations.SET_DATA); item.getItemProperty("path").setValue(setDataTxn.getPath()); break; case OpCode.setACL: SetACLTxn setACLTxn = (SetACLTxn) t.getTxnRecord(); item.getItemProperty("operation").setValue(ZkOperations.SET_ACL); item.getItemProperty("path").setValue(setACLTxn.getPath()); break; case OpCode.check: CheckVersionTxn checkVersionTxn = (CheckVersionTxn) t.getTxnRecord(); item.getItemProperty("operation").setValue(ZkOperations.CHECK); item.getItemProperty("path").setValue(checkVersionTxn.getPath()); break; case OpCode.multi: item.getItemProperty("operation").setValue(ZkOperations.MULTI); break; case OpCode.createSession: item.getItemProperty("operation").setValue(ZkOperations.CREATE_SESSION); break; case OpCode.closeSession: item.getItemProperty("operation").setValue(ZkOperations.CLOSE_SESSION); break; case OpCode.error: item.getItemProperty("operation").setValue(ZkOperations.ERROR); break; } } } }; fillData.run(); Thread monitorThread = new Thread(new Runnable() { @Override public void run() { while (true) { //push UI UI.getCurrent().access(fillData); try { Thread.sleep(250); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); if (follow) { monitorThread.start(); } reconstructDataTreeButton.addClickListener(new ClickListener() { @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { DataDirHelper dataDirHelper = new DataDirHelper(transactionLogFile, snapshotDir); List<File> snapshots = dataDirHelper.getSortedSnapshotList(); DataDirTransactionLogFileList l = new DataDirTransactionLogFileList(transactionLogFile); TransactionLog transactionLog = new TransactionLog(l, new TransactionLogReaderFactory()); File snapFile = null; DataState dataState = null; long currentZxid = Long.parseLong(filterTable.getValue().toString(), 16); int i = snapshots.size() - 1; while (i >= 0) { long snapZxid = Util.getZxidFromName(snapshots.get(i).getName()); if (snapZxid <= currentZxid) { if (i == 0) { snapFile = snapshots.get(0); } else { snapFile = snapshots.get(i - 1); } break; } i--; } if (snapFile == null) { dispalyNotEnoughDataErrorMessage(); return; } long TS = Util.getZxidFromName(snapFile.getName()); //catch this exception and print error SnapshotFileReader snapReader = new SnapshotFileReader(snapFile, TS); try { dataState = snapReader.restoreDataState(transactionLog.iterator()); } catch (Exception ex) { //dispay error dialog //not enough information dispalyNotEnoughDataErrorMessage(); return; } //set iterator to last zxid TransactionIterator iterator = transactionLog.iterator(); Transaction t; do { t = iterator.next(); } while (t.getTxnHeader().getZxid() < TS); while (iterator.nextTransactionState() == TransactionState.OK && dataState.getLastZxid() < currentZxid) { dataState.processTransaction(iterator.next()); } HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setCaption(name + " at zxid 0x" + Long.toString(currentZxid, 16)); horizontalLayout.addComponent(new SnapshotView(dataState)); horizontalLayout.setWidth("100%"); horizontalLayout.setHeight("100%"); Tab snapshotTab = displayTabSheet.addTab(horizontalLayout); snapshotTab.setClosable(true); displayTabSheet.setSelectedTab(snapshotTab); } void dispalyNotEnoughDataErrorMessage() { final Window window = new Window("Error"); window.setModal(true); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.addComponent(new Label("Not enough data to reconstruct data tree")); window.setContent(verticalLayout); UI.getCurrent().addWindow(window); } }); }
From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java
/** * Adds click listeners to the buttons//w ww . jav a 2 s.c om */ private void addClickListeners() { this.likes.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Post post = componentPostService.updateLikeRating(postId); numberOfLikes = post.getLikeCount(); numberOfDisagrees = post.getHateCount(); updateHateLike(); } }); this.disagrees.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Post post = componentPostService.updateDisagreeRating(postId); numberOfLikes = post.getLikeCount(); numberOfDisagrees = post.getHateCount(); updateHateLike(); } }); this.tags.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.tags")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(110, Unit.PIXELS); subWindow.setResizable(false); Panel panel = new Panel(); panel.setSizeFull(); HorizontalLayout tagsWrapper = new HorizontalLayout(); tagsWrapper.setStyleName("margin-left-big"); panel.setContent(tagsWrapper); tagsWrapper.setSpacing(true); tagsWrapper.setMargin(true); tagsWrapper.setSizeUndefined(); for (Tag t : postService.getPostTags(postId)) { CustomLayout tag = new CustomLayout("tag"); Button tagLabel = new Button(t.getTagName()); tag.addComponent(tagLabel, "button"); tagsWrapper.addComponent(tag); } subWindow.setContent(panel); UI.getCurrent().addWindow(subWindow); } }); this.comments.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.comments")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(600, Unit.PIXELS); subWindow.setResizable(true); ComponentPostComments componentPostComments = applicationContext .getBean(ComponentPostComments.class, postId); subWindow.setContent(componentPostComments); UI.getCurrent().addWindow(subWindow); } }); this.name.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("header.profile") + "- " + name.getCaption()); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(350, Unit.PIXELS); subWindow.setResizable(true); Users user = postService.getPostById(postId).getUser(); ComponentProfilePost profilePost = applicationContext.getBean(ComponentProfilePost.class, user); subWindow.setContent(profilePost); UI.getCurrent().addWindow(subWindow); } }); }
From source file:cz.zcu.pia.social.network.frontend.components.profile.friends.ComponentFriends.java
/** * Function for manage friends requests button */// w w w. j a va 2 s . c o m private void manageFriendsRequestsButtonFunction() { Window subWindow = new Window(msgs.getMessage("post.comments")); ComponentManageFriendRequest manageFriendRequest = applicationContext .getBean(ComponentManageFriendRequest.class); manageFriendRequest.setParentReference(this); manageFriendRequest.setSizeFull(); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(500, Unit.PIXELS); subWindow.setHeight(400, Unit.PIXELS); subWindow.setResizable(true); subWindow.setContent(manageFriendRequest); UI.getCurrent().addWindow(subWindow); }
From source file:cz.zcu.pia.social.network.frontend.views.ViewHome.java
/** * Add button function/*from ww w . j a v a2 s . c o m*/ * @param event click event */ private void addButtonFunction(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.add.new")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(300, Unit.PIXELS); ComponentPostAdd postAdd = applicationContext.getBean(ComponentPostAdd.class); postAdd.setComponentParent(this); postAdd.setWindow(subWindow); postAdd.setMargin(true); subWindow.setContent(postAdd); UI.getCurrent().addWindow(subWindow); }
From source file:de.akquinet.engineering.vaadin.vaangular.demo.VaangularUI.java
License:Apache License
private void showPopup(String eintrag) { Window modalWin = new Window("E-Mail is being sent..."); modalWin.setContent(new Label("<div style=\"margin: 10px; \">" + "<h2>Season's greetings</h2>" + "<p>" + eintrag + "</p>" + "</div>", ContentMode.HTML)); modalWin.setModal(true); modalWin.setWidth("400px"); modalWin.setHeight("250px"); modalWin.center();// w ww.j a v a2 s . c o m UI.getCurrent().addWindow(modalWin); }
From source file:de.catma.ui.dialog.wizard.WizardFactory.java
License:Open Source License
public Window createWizardWindow(String caption, String width, String height) { Wizard wizard = new Wizard(); wizard.getFinishButton().setEnabled(false); Window wizardWindow = new Window(caption); wizardWindow.setModal(true); wizardWindow.setContent(wizard);/*from w ww. jav a 2 s . com*/ wizardWindow.setWidth(width); wizardWindow.setHeight(height); wizard.addListener(new WizardManager(wizardWindow)); wizard.addListener(wizardProgressListener); addSteps(wizard); return wizardWindow; }