List of usage examples for com.vaadin.ui Window Window
public Window(String caption)
From source file:com.oodrive.nuage.webui.component.window.AbstractConfirmationWindow.java
License:Apache License
@SuppressWarnings("serial") @Override/* w ww . j a v a 2 s . c om*/ public Window init(final AbstractItemModel model) { // Add new window final Window vvrConfirmationWindow = new Window("Confirmation"); vvrConfirmationWindow.center(); vvrConfirmationWindow.setResizable(false); final VerticalLayout vvrConfirmationLayout = new VerticalLayout(); vvrConfirmationLayout.setMargin(true); vvrConfirmationWindow.setContent(vvrConfirmationLayout); // Message to display before buttons final Label confirmationMessage = new Label(confirmation); vvrConfirmationLayout.addComponent(confirmationMessage); vvrConfirmationLayout.setComponentAlignment(confirmationMessage, Alignment.MIDDLE_CENTER); vvrConfirmationLayout.setSpacing(true); final HorizontalLayout buttonLayout = new HorizontalLayout(); vvrConfirmationLayout.addComponent(buttonLayout); // Button OK final Button okButton = new Button("OK"); buttonLayout.setSizeFull(); buttonLayout.addComponent(okButton); buttonLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); okButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { action.execute(model); vvrConfirmationWindow.close(); } catch (final Exception e) { vvrConfirmationWindow.close(); } } }); // Button cancel final Button cancelButton = new Button("Cancel"); buttonLayout.addComponent(cancelButton); buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); cancelButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { // Just close the window vvrConfirmationWindow.close(); } }); return vvrConfirmationWindow; }
From source file:com.oodrive.nuage.webui.component.window.ErrorWindow.java
License:Apache License
@SuppressWarnings("serial") @Override/*from www. java 2 s.com*/ public final Window init(final AbstractItemModel model) { // Add new window with title "Error" final Window vvrErrorWindow = new Window("Error"); vvrErrorWindow.center(); vvrErrorWindow.setResizable(false); final VerticalLayout vvrErrorLayout = new VerticalLayout(); vvrErrorLayout.setMargin(true); vvrErrorWindow.setContent(vvrErrorLayout); // Display message final Label errorMessage = new Label(message); vvrErrorLayout.addComponent(errorMessage); vvrErrorLayout.setComponentAlignment(errorMessage, Alignment.MIDDLE_CENTER); vvrErrorLayout.setSpacing(true); // Button OK final Button okButton = new Button("OK"); vvrErrorLayout.addComponent(okButton); vvrErrorLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER); okButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { // Just close the window vvrErrorWindow.close(); } }); return vvrErrorWindow; }
From source file:com.oodrive.nuage.webui.component.window.VvrAttributesWindow.java
License:Apache License
@SuppressWarnings("serial") @Override/*w w w. j av a2 s . co m*/ 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.oodrive.nuage.webui.component.window.VvrCreateWindow.java
License:Apache License
public VvrCreateWindow(final PostProcessing postProcessing) { super(false); this.vvrCreateWindow = new Window("Create a new VVR"); this.postProcessing = postProcessing; }
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//from w ww.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.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. jav a 2 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.pms.component.ganttchart.DemoUI.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("Step Editor"); win.setResizable(false);// w w w.j a v a 2 s . com win.center(); final Collection<Component> hidden = new ArrayList<Component>(); BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step); final FieldGroup group = new FieldGroup(item); group.setBuffered(true); TextField captionField = new TextField("Caption"); captionField.setNullRepresentation(""); group.bind(captionField, "caption"); TextField descriptionField = new TextField("Description"); descriptionField.setNullRepresentation(""); group.bind(descriptionField, "description"); descriptionField.setVisible(false); hidden.add(descriptionField); NativeSelect captionMode = new NativeSelect("Caption Mode"); captionMode.addItem(Step.CaptionMode.TEXT); captionMode.addItem(Step.CaptionMode.HTML); group.bind(captionMode, "captionMode"); captionMode.setVisible(false); hidden.add(captionMode); final NativeSelect parentStepSelect = new NativeSelect("Parent Step"); parentStepSelect.setEnabled(false); if (!gantt.getSteps().contains(step)) { // new step parentStepSelect.setEnabled(true); for (Step parentStepCanditate : gantt.getSteps()) { parentStepSelect.addItem(parentStepCanditate); parentStepSelect.setItemCaption(parentStepCanditate, parentStepCanditate.getCaption()); if (step instanceof SubStep) { if (parentStepCanditate.getSubSteps().contains(step)) { parentStepSelect.setValue(parentStepCanditate); parentStepSelect.setEnabled(false); break; } } } } parentStepSelect.setVisible(false); hidden.add(parentStepSelect); TextField bgField = new TextField("Background color"); bgField.setNullRepresentation(""); group.bind(bgField, "backgroundColor"); bgField.setVisible(false); hidden.add(bgField); DateField startDate = new DateField("Start date"); startDate.setLocale(gantt.getLocale()); startDate.setTimeZone(gantt.getTimeZone()); startDate.setResolution(Resolution.SECOND); startDate.setConverter(new DateToLongConverter()); group.bind(startDate, "startDate"); DateField endDate = new DateField("End date"); endDate.setLocale(gantt.getLocale()); endDate.setTimeZone(gantt.getTimeZone()); endDate.setResolution(Resolution.SECOND); endDate.setConverter(new DateToLongConverter()); group.bind(endDate, "endDate"); CheckBox showMore = new CheckBox("Show all settings"); showMore.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (Component c : hidden) { c.setVisible((Boolean) event.getProperty().getValue()); } win.center(); } }); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); content.addComponent(captionField); content.addComponent(captionMode); content.addComponent(descriptionField); content.addComponent(parentStepSelect); content.addComponent(bgField); content.addComponent(startDate); content.addComponent(endDate); content.addComponent(showMore); HorizontalLayout buttons = new HorizontalLayout(); content.addComponent(buttons); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { group.commit(); AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean(); gantt.markStepDirty(step); if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) { SubStep subStep = addSubStep(parentStepSelect, step); step = subStep; } if (step instanceof Step && !gantt.getSteps().contains(step)) { gantt.addStep((Step) step); } if (ganttListener != null && step instanceof Step) { ganttListener.stepModified((Step) step); } win.close(); } catch (CommitException e) { Notification.show("Commit failed", e.getMessage(), Type.ERROR_MESSAGE); e.printStackTrace(); } } private SubStep addSubStep(final NativeSelect parentStepSelect, AbstractStep dataSource) { SubStep subStep = new SubStep(); subStep.setCaption(dataSource.getCaption()); subStep.setCaptionMode(dataSource.getCaptionMode()); subStep.setStartDate(dataSource.getStartDate()); subStep.setEndDate(dataSource.getEndDate()); subStep.setBackgroundColor(dataSource.getBackgroundColor()); subStep.setDescription(dataSource.getDescription()); subStep.setStyleName(dataSource.getStyleName()); ((Step) parentStepSelect.getValue()).addSubStep(subStep); return subStep; } }); Button cancel = new Button("Cancel", new ClickListener() { @Override public void buttonClick(ClickEvent event) { group.discard(); win.close(); } }); Button delete = new Button("Delete", new ClickListener() { @Override public void buttonClick(ClickEvent event) { AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean(); if (step instanceof SubStep) { SubStep substep = (SubStep) step; substep.getOwner().removeSubStep(substep); } else { gantt.removeStep((Step) step); if (ganttListener != null) { ganttListener.stepDeleted((Step) step); } } win.close(); } }); buttons.addComponent(ok); buttons.addComponent(cancel); buttons.addComponent(delete); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("More Info"); win.setResizable(false);/* ww w.j a v a2 s.com*/ win.center(); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); String taskName = step.getCaption(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project); TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task"); Task task1 = taskDAO.getTaskFromUserStroyNameAndTaskName(userStory.getName(), taskName); TextField userStoryNameField = new TextField("Task Name"); userStoryNameField.setValue(task1.getName()); TextField userStoryPriority = new TextField("Priority"); userStoryPriority.setValue(String.valueOf(task1.getPriority())); TextField userStoryState = new TextField("State"); userStoryState.setValue(task1.getState()); TextField projectName = new TextField("Project Name"); projectName.setValue(project.getName()); TextField userStoryName = new TextField("UserStoryName Name"); userStoryName.setValue(userStory.getName()); content.addComponent(userStoryNameField); content.addComponent(userStoryPriority); content.addComponent(userStoryState); content.addComponent(projectName); content.addComponent(userStoryName); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); content.addComponent(ok); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("More Info"); win.setResizable(false);//from w w w . j a v a 2s .c o m win.center(); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); String userStoryName = step.getCaption(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getUserStoryFormProjectNameAndUserStoryName(project.getName(), userStoryName); TextField userStoryNameField = new TextField("User Story Name"); userStoryNameField.setValue(userStory.getName()); TextField userStoryPriority = new TextField("Priority"); userStoryPriority.setValue(String.valueOf(userStory.getPriority())); TextField userStoryState = new TextField("State"); userStoryState.setValue(userStory.getState()); TextField projectName = new TextField("Project Name"); projectName.setValue(project.getName()); content.addComponent(userStoryNameField); content.addComponent(userStoryPriority); content.addComponent(userStoryState); content.addComponent(projectName); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); content.addComponent(ok); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.purebred.core.MainApplication.java
License:Open Source License
@Override public void init() { setInstance(this); setTheme(mainEntryPoints.getTheme()); customizeConfirmDialogStyle();//from w w w . j av a 2 s .c om Window mainWindow = new Window(messageSource.getMessage("mainApplication.caption")); mainWindow.addStyleName("p-main-window"); mainWindow.getContent().setSizeUndefined(); setMainWindow(mainWindow); mainEntryPoints.addStyleName("p-main-entry-points"); mainWindow.addComponent(mainEntryPoints); mainEntryPoints.postWire(); }