List of usage examples for com.vaadin.ui Window Window
public Window(String caption)
From source file:com.trivago.mail.pigeon.web.components.mail.ActionButtonColumnGenerator.java
License:Apache License
@Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { HorizontalLayout hl = new HorizontalLayout(); Button showNlConentButton = new Button(); showNlConentButton.setDescription("View"); showNlConentButton.setImmediate(true); showNlConentButton.setIcon(new ThemeResource("../runo/icons/16/document-txt.png")); showNlConentButton.addListener(new Button.ClickListener() { @Override//from ww w .jav a 2s .c om public void buttonClick(Button.ClickEvent event) { Mail m = new Mail((Long) itemId); Window nlConentView = new Window("Newsletter Contents of ID " + itemId); // Create an empty tab sheet. TabSheet tabsheet = new TabSheet(); Panel pText = new Panel("Text Content"); Panel pHtml = new Panel("Text Content"); RichTextArea textArea = new RichTextArea(); textArea.setValue(m.getText()); textArea.setReadOnly(true); RichTextArea richTextArea = new RichTextArea(); richTextArea.setValue(m.getHtml()); richTextArea.setReadOnly(true); pText.addComponent(textArea); pHtml.addComponent(richTextArea); richTextArea.setHeight("50%"); richTextArea.setWidth("100%"); textArea.setHeight("50%"); textArea.setWidth("100%"); nlConentView.setResizable(true); nlConentView.setWidth("800px"); nlConentView.setHeight("600px"); tabsheet.addTab(pText); tabsheet.getTab(pText).setCaption("Text Version"); tabsheet.addTab(pHtml); tabsheet.getTab(pHtml).setCaption("Html Version"); nlConentView.addComponent(tabsheet); source.getWindow().addWindow(nlConentView); nlConentView.setVisible(true); } }); final Button showOpenendMails = new Button(); showOpenendMails.setDescription("Show recipients of this mailling"); showOpenendMails.setIcon(new ThemeResource("../runo/icons/16/users.png")); showOpenendMails.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Mail m = new Mail((Long) itemId); ModalRecipientListByMail modalRecipientListByMail = new ModalRecipientListByMail(m); source.getWindow().addWindow(modalRecipientListByMail); modalRecipientListByMail.setVisible(true); } }); hl.addComponent(showNlConentButton); hl.addComponent(showOpenendMails); return hl; }
From source file:com.trivago.mail.pigeon.web.MainApp.java
License:Apache License
@Override public void init() { //DOMConfigurator.configure(Thread.currentThread().getContextClassLoader().getResource("log4j.xml")); // BasicConfigurator.configure(); window = new Window("Mail Pigeon"); setMainWindow(window);/*from w w w . j a va 2 s . co m*/ int senderSize; try { senderSize = Sender.getAll().size(); } catch (NoSuchElementException e) { senderSize = 0; } int recipientGroupSize; try { recipientGroupSize = RecipientGroup.getAll().size(); } catch (NoSuchElementException e) { recipientGroupSize = 0; } if (senderSize == 0 && recipientGroupSize == 0) { startWizard(); } else { menu = new MenuBar(this); window.addComponent(menu); setDashBoard(); } }
From source file:com.wft.ui.WelcomeLoginApplication.java
License:Apache License
@Override public void init() { window = new Window("Web Foot Tournament"); subwindow = new Window("Connexion"); // ...and make it modal subwindow.setModal(true);// w ww. j a v a 2 s . com subwindow.setClosable(false); subwindow.setResizable(false); subwindow.setWidth("50%"); subwindow.setHeight("50%"); // Configure the windows layout; by default a VerticalLayout verticalLayout = new VerticalLayout(); subwindow.setContent(verticalLayout); verticalLayout.setMargin(true); verticalLayout.setSpacing(true); verticalLayout.setSizeFull(); wftLoginForm.setSizeFull(); verticalLayout.addComponent(wftLoginForm); verticalLayout.setComponentAlignment(wftLoginForm, new Alignment(Bits.ALIGNMENT_HORIZONTAL_CENTER | Bits.ALIGNMENT_VERTICAL_CENTER)); Button createUserBtn = new Button(); createUserBtn.setCaption("Not yet an user ? Create an account !"); createUserBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { switchToCreateUserForm(); } }); verticalLayout.addComponent(createUserBtn); window.addWindow(subwindow); setMainWindow(window); }
From source file:com.worldmediahd.ui.MyVaadinApplication.java
License:Apache License
@Override public void init() { this.setTheme("wmhd"); this.getContext().addTransactionListener(this); this.mainWindow = new Window("My Vaadin Application"); this.setMainWindow(mainWindow); mainWindow.setContent(new LoginScreen(this)); }
From source file:com.zklogtool.web.components.MainLayout.java
License:Apache License
public MainLayout() { buildMainLayout();/*from w ww .j a v a 2 s . c o m*/ 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();// www. ja v a2 s .co 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//from w w w. ja va 2s . 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 *///from w w w . ja va2 s .co 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/* w w w . j a v a 2 s . com*/ * @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);/* w ww .j av a 2 s.c o m*/ modalWin.setWidth("400px"); modalWin.setHeight("250px"); modalWin.center(); UI.getCurrent().addWindow(modalWin); }