List of usage examples for com.vaadin.ui Window setWidth
@Override public void setWidth(String width)
From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SetGoogleAuthenticatorCredentialClickListener.java
License:Apache License
@Override public void buttonClick(final ClickEvent event) { final SetGoogleAuthenticatorCredentialResponse response = (SetGoogleAuthenticatorCredentialResponse) applicationManager .service(googleAuthRequest); if (ServiceResult.SUCCESS == response.getResult()) { try {/*from w w w . j av a2 s. c o m*/ final URI keyUri = new URI(response.getOtpAuthTotpURL()); final QRCode qrCode = new QRCode(QR_CODE, keyUri.toASCIIString()); qrCode.setHeight(QR_CODE_IMAGE_SIZE); qrCode.setWidth(QR_CODE_IMAGE_SIZE); final Window mywindow = new Window(GOOGLE_AUTHENTICATOR_QR_CODE); mywindow.setHeight(MODAL_WINDOW_SIZE); mywindow.setWidth(MODAL_WINDOW_SIZE); mywindow.setPositionX(WINDOW_POSITION); mywindow.setPositionY(WINDOW_POSITION); final VerticalLayout panelContent = new VerticalLayout(); mywindow.setContent(panelContent); panelContent.addComponent(qrCode); mywindow.setModal(true); UI.getCurrent().addWindow(mywindow); } catch (final URISyntaxException e) { LOGGER.warn(PROBLEM_DISPLAYING_QR_CODE, e); Notification.show(PROBLEM_DISPLAYING_QR_CODE, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE); } } else { Notification.show(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE); LOGGER.info(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR_SESSIONID, googleAuthRequest.getSessionId()); } }
From source file:com.hris.connection.ErrorLoggedNotification.java
public static void showErrorLoggedOnWindow(String error, String className) { VerticalLayout v = new VerticalLayout(); v.setSizeFull();/*from w ww.j a v a2 s . c o m*/ v.setMargin(true); Window sub = new Window("ERROR MESSAGE!", v); sub.setWidth("500px"); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.setModal(true); Panel panel = new Panel(); panel.setSizeFull(); panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML)); panel.getContent().setHeightUndefined(); sub.setContent(panel); sub.getContent().setHeightUndefined(); }
From source file:com.iton.gittest.HelloWorld.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);//from w ww. j ava 2 s . com Button button = new Button("Click Me"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Window win = new Window("PopUp Form"); win.setModal(true); win.setScrollable(false); win.setDraggable(false); win.setResizable(false); win.center(); win.setWidth("350px"); win.addComponent(new Form()); window.addWindow(win); } }); window.addComponent(button); }
From source file:com.lizardtech.expresszip.vaadin.MapToolbarViewComponent.java
License:Apache License
@Override public void buttonClick(ClickEvent event) { Button b = event.getButton(); if (b == btnJobQueueStatus) { Window subWindow = new Window("Job Manager"); subWindow.setWidth("500px"); subWindow.center();/* w w w. j a v a 2s . c o m*/ getApplication().getMainWindow().addWindow(subWindow); Panel p = new Panel(new JobsStatusViewComponent(getApplication().getURL())); p.getContent().setWidth("100%"); p.setWidth("100%"); subWindow.addComponent(p); subWindow.setModal(true); } else if (b == help) { String HelpURL = getApplication().getURL().toExternalForm() + "doc"; getApplication().getMainWindow().open(new ExternalResource(HelpURL), "_blank"); } else if (b == restart) { ((ExpressZipWindow) getApplication().getMainWindow()).getApplication().close(); } }
From source file:com.mechanicshop.components.TableLayout.java
public void createCustomMessage() { final TextArea textArea = new TextArea(); textArea.setImmediate(true);//w w w . j a va2s . co m textArea.setColumns(30); textArea.setRows(10); textArea.addStyleName(ValoTheme.TEXTAREA_SMALL); textArea.setRequired(true); final Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("350px"); subWindow.setWidth("500px"); subWindow.setCaption("Insert Message"); subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); subWindow.setClosable(false); subWindow.setResizable(false); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); Button sendBtn = new Button("Send"); sendBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { textArea.validate(); String message = textArea.getValue(); smsSenderService.sendMessageMassive(message); subWindow.close(); Notification.show("Message Sent"); } catch (Exception e) { } } }); sendBtn.setImmediate(true); sendBtn.setStyleName(ValoTheme.BUTTON_TINY); sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button cancelBtn = new Button("Cancel"); cancelBtn.setStyleName(ValoTheme.BUTTON_TINY); cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER); cancelBtn.setImmediate(true); cancelBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); layoutButtons.setSizeUndefined(); layoutButtons.setSpacing(true); layoutButtons.addComponents(cancelBtn, sendBtn); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(textArea); layout.addComponent(layoutButtons); layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(textArea, 3); layout.setSizeFull(); subWindow.setContent(layout); subWindow.center(); getUI().addWindow(subWindow); }
From source file:com.oodrive.nuage.webui.component.window.VvrAttributesWindow.java
License:Apache License
@SuppressWarnings("serial") @Override//from ww w .ja va2 s . com public final Window init(final AbstractItemModel model) { // Cast model in vvrModel final VvrModel vvrModel = (VvrModel) model; // Add new window final Window vvrAttributesWindow = new Window("VVR Attributes"); vvrAttributesWindow.center(); vvrAttributesWindow.setWidth("400px"); vvrAttributesWindow.setResizable(false); final VerticalLayout layout = new VerticalLayout(); vvrAttributesWindow.setContent(layout); layout.setMargin(true); final FormLayout vvrAttributesLayout = new FormLayout(); layout.addComponent(vvrAttributesLayout); vvrAttributesLayout.setMargin(true); // Enter NAME String value = vvrModel.getVvrName(); if (value == null) { value = ""; } final TextField name = new TextField("Name", value); name.setSizeFull(); vvrAttributesLayout.addComponent(name); // Enter description value = vvrModel.getVvrDescription(); if (value == null) { value = ""; } final TextField desc = new TextField("Description", value); desc.setSizeFull(); vvrAttributesLayout.addComponent(desc); // Enter name final TextField vvrUUID = new TextField("UUID"); vvrUUID.setValue(vvrUuid.toString()); vvrUUID.setReadOnly(true); vvrUUID.setSizeFull(); vvrAttributesLayout.addComponent(vvrUUID); // OK button final HorizontalLayout hzlayout = new HorizontalLayout(); layout.addComponent(hzlayout); hzlayout.setSizeFull(); final Button okButton = new Button("OK"); hzlayout.addComponent(okButton); hzlayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); okButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { WaitingComponent.executeBackground(vvrModel, new Background() { @Override public void processing() { vvrModel.setVvrName(name.getValue()); vvrModel.setVvrDescription(desc.getValue()); } @Override public void postProcessing() { } }); vvrAttributesWindow.close(); } }); // Cancel button final Button cancelButton = new Button("Cancel"); hzlayout.addComponent(cancelButton); hzlayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); cancelButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { // Just close the window vvrAttributesWindow.close(); } }); return vvrAttributesWindow; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
Window getDeleteWindow() { final Window sub = new Window("DELETE EVENT"); sub.setWidth("250px"); Button deleteBtn = new Button("DELETE EVENT?"); deleteBtn.setWidth("100%"); deleteBtn.addListener(new Button.ClickListener() { @Override/*www.j a va 2 s . c o m*/ public void buttonClick(Button.ClickEvent event) { boolean result = calendarService .removeEvent(utilities.convertStringToInteger(eventDataId.getValue().toString())); if (result) { getApplication().getMainWindow().removeWindow(sub); close(); getCalendar().removeEvent(getEvent().getCalendarEvent()); } } }); sub.addComponent(deleteBtn); return sub; }
From source file:com.openhris.commons.AboutHris.java
public Window aboutHris() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/* w w w. j av a2 s. c o m*/ vlayout.setMargin(true); final Window subWindow = new Window("About HRMS", vlayout); subWindow.setWidth("300px"); Label version = new Label("Version: <b>1.0</b>"); version.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(version); Label title = new Label("Title: <b>Human Resource Information System</b>"); title.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(title); Label developer = new Label("Developed By: <b>Engr. Godfrey D. Beray</b>"); developer.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(developer); Label framework = new Label("Framework: <b>VAADIN - Sept2012</b>"); framework.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(framework); return subWindow; }
From source file:com.openhris.commons.reports.AdvancesReport.java
public void openAdvancesReport() { Connection conn = getConnection.connection(); File reportFile = new File("C:/reportsJasper/AdvancesReport.jasper"); final HashMap hm = new HashMap(); hm.put("CORPORATE", getCorporate()); hm.put("PAYROLL_DATE", getPayrollDate()); Window subWindow = new Window("Advances Report"); ((VerticalLayout) subWindow.getContent()).setSizeFull(); subWindow.setWidth("800px"); subWindow.setHeight("600px"); subWindow.center();/*from w w w . j a va2 s. c o m*/ try { JasperPrint jpReport = JasperFillManager.fillReport(reportFile.getAbsolutePath(), hm, conn); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String timestamp = df.format(new Date()); final String filePath = "C:/reportsPdf/AdvancesReport_" + timestamp + ".pdf"; JasperExportManager.exportReportToPdfFile(jpReport, filePath); StreamResource.StreamSource source = new StreamResource.StreamSource() { @Override public InputStream getStream() { try { File f = new File(filePath); FileInputStream fis = new FileInputStream(f); return fis; } catch (Exception e) { e.getMessage(); return null; } } }; StreamResource resource = new StreamResource(source, filePath, getApplication()); resource.setMIMEType("application/pdf"); Embedded e = new Embedded(); e.setMimeType("application/pdf"); e.setType(Embedded.TYPE_OBJECT); e.setSizeFull(); e.setSource(resource); e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename()); subWindow.addComponent(e); getApplication().getMainWindow().open(resource, "_blank"); } catch (Exception e) { e.getMessage(); } }
From source file:com.openhris.employee.EmployeeAddress.java
private Window removeAddressWindow(final int addressId) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/* www. j av a2s. c om*/ vlayout.setMargin(true); final Window window = new Window("REMOVE POSITION", vlayout); window.setWidth("300px"); Button removeBtn = new Button("Remove Address?"); removeBtn.setWidth("100%"); removeBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { boolean result = eaService.removeEmployeeAddress(addressId); if (result) { employeeAddressTable(); (window.getParent()).removeWindow(window); clearFields(); } else { getWindow().showNotification("Cannot Remove Address, Contact your DBA!", Window.Notification.TYPE_ERROR_MESSAGE); } } }); removeBtn.setImmediate(true); window.addComponent(removeBtn); return window; }