List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadField.java
License:Open Source License
public BasicUploadField(ImageProvider imageProvider, UiContext uiContext, BasicUploadFieldDefinition definition, SimpleTranslator i18n) {// ww w . j a v a2 s . co m super(); // Propagate definition. populateFromDefinition(definition); this.imageProvider = imageProvider; this.layout = new CssLayout(); this.layout.setSizeUndefined(); this.uiContext = uiContext; this.i18n = i18n; setRootLayout(createDropZone(layout)); // Update Style Name addStyleName("upload-image-field"); addStyleName("no-horizontal-drag-hints"); addStyleName("no-vertical-drag-hints"); }
From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadProgressIndicator.java
License:Open Source License
public BasicUploadProgressIndicator(String inProgressCaption, String inProgressRatioCaption, SimpleTranslator i18n) {/* www.java2 s . com*/ this.inProgressCaption = inProgressCaption; this.inProgressRatioCaption = inProgressRatioCaption; this.i18n = i18n; uploadFileLocation = new Label(""); uploadFileLocation.setSizeUndefined(); uploadFileLocation.addStyleName("uploading-file"); uploadFileRatio = new Label(""); uploadFileRatio.setSizeUndefined(); uploadFileRatio.addStyleName("uploaded-file"); uploadFileProgress = new Label(""); uploadFileProgress.setSizeUndefined(); uploadFileProgress.addStyleName("uploading-file-progress"); progressIndicator = new ProgressBar(); progressIndicator.setVisible(false); progressIndicator.setWidth("100%"); mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.addComponent(uploadFileLocation); CssLayout progressLayout = new CssLayout(); progressLayout.addStyleName("progress-layout"); progressLayout.addComponent(progressIndicator); progressLayout.addComponent(uploadFileProgress); progressLayout.setWidth("100%"); mainLayout.addComponent(progressLayout); mainLayout.addComponent(uploadFileRatio); Iterator<Component> it = mainLayout.iterator(); while (it.hasNext()) { Component c = it.next(); mainLayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER); } mainLayout.setMargin(new MarginInfo(false, true, false, true)); setCompositionRoot(mainLayout); addStyleName("uploading-progress-indicator"); }
From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java
License:Open Source License
private void addOkHandler(BaseDialog dialog, String okButtonText, final OverlayCloser overlayCloser, final AlertCallback cb) { CssLayout footer = new CssLayout(); footer.setWidth(100, Unit.PERCENTAGE); footer.addStyleName("v-align-right"); Button okButton = new Button(okButtonText, new ClickListener() { @Override/*from www.ja v a 2 s . c o m*/ public void buttonClick(ClickEvent event) { cb.onOk(); overlayCloser.close(); } }); okButton.focus(); footer.addComponent(okButton); dialog.setFooterToolbar(footer); }
From source file:info.magnolia.ui.vaadin.dialog.ConfirmationDialog.java
License:Open Source License
public void init(String confirmLabel, String cancelLabel, boolean cancelIsDefault) { CssLayout footer = new CssLayout(); footer.addStyleName("v-align-right"); confirmButton = new Button(confirmLabel, new ClickListener() { @Override/*from w ww . jav a2s .com*/ public void buttonClick(ClickEvent event) { confirm(); } }); confirmButton.setDisableOnClick(true); cancelButton = new Button(cancelLabel, new ClickListener() { @Override public void buttonClick(ClickEvent event) { cancel(); } }); cancelButton.setDisableOnClick(true); footer.addComponent(cancelButton); footer.addComponent(confirmButton); cancelButton.addStyleName("btn-dialog"); cancelButton.addStyleName("cancel"); confirmButton.addStyleName("btn-dialog"); confirmButton.addStyleName("commit"); footer.setWidth(100, Unit.PERCENTAGE); setFooterToolbar(footer); // Add a class to the default button if (cancelIsDefault) { cancelButton.focus(); } else { confirmButton.focus(); } }
From source file:info.magnolia.ui.vaadin.dialog.Notification.java
License:Open Source License
public Notification(final MessageStyleType type) { layout = new CssLayout(); layout.addStyleName("light-dialog-panel"); layout.addStyleName("notification-dialog"); layout.addStyleName(type.getCssClass()); CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass()); icon.setStyleName("dialog-icon"); layout.addComponent(icon);//from ww w . j a va2 s. co m layout.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { layout.addStyleName("notification-dialog-selected"); } }); closeButton.addStyleName("close"); closeButton.setDisableOnClick(true); closeButton.setHtmlContentAllowed(true); closeButton.setCaption("<span class=\"m-closebutton icon-close m-closebutton-dialog\"></span>"); closeButton.focus(); layout.addComponent(closeButton); }
From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.admin.letturafiltri.LetturaFiltriPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) { taskForm = new GreenareaFormPropertiesForm(); taskForm.setMainTitle(taskPage.getMainTitle()); if (task.getTaskDefinitionKey().equals("elencoFiltri")) ((Form) ((FormPropertiesComponent) taskForm.getComponent(1)).getComponent(0)) .setLayout(new GreenareaFormLayout()); taskForm.setFormProperties(formData.getFormProperties()); final LetturaFiltriPanel letturaFiltriPanel = this; taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override/* w ww .j a va 2 s. c o m*/ protected void handleFormSubmit(FormPropertiesEvent event) { Map<String, String> properties = event.getFormProperties(); formService.submitTaskFormData(task.getId(), properties); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); List<Task> tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()) .active().list(); if (tasks.size() == 1) { task = tasks.get(0); letturaFiltriPanel.setTask(task); letturaFiltriPanel.attach(); } else taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page centralLayout.addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, UNITS_PERCENTAGE); centralLayout.addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(TASK_COMPLETE)); completeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived // then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }
From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.DettaglioPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) { taskForm = new GreenareaFormPropertiesForm(); taskForm.setMainTitle(taskPage.getMainTitle()); taskForm.setFormProperties(formData.getFormProperties()); taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override/*from w ww . ja va2s. c om*/ protected void handleFormSubmit(FormPropertiesEvent event) { Map<String, String> properties = event.getFormProperties(); formService.submitTaskFormData(task.getId(), properties); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, UNITS_PERCENTAGE); addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(TASK_COMPLETE)); completeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived // then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }
From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.operatorelogistico.anagrafeveicoli.AnagrafeVeicoliOpPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) { taskForm = new GreenareaFormPropertiesForm(); taskForm.setMainTitle(taskPage.getMainTitle()); if (task.getTaskDefinitionKey().equals("elencoParametri") || task.getTaskDefinitionKey().equals("elencoVeicoli")) ((Form) ((FormPropertiesComponent) taskForm.getComponent(1)).getComponent(0)) .setLayout(new GreenareaFormLayout()); taskForm.setFormProperties(formData.getFormProperties()); final AnagrafeVeicoliOpPanel aggiornaStatoVeicoliOpPanel = this; taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override/*w w w . j a v a 2 s. com*/ protected void handleFormSubmit(FormPropertiesEvent event) { Map<String, String> properties = event.getFormProperties(); formService.submitTaskFormData(task.getId(), properties); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); List<Task> tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()) .active().list(); if (tasks.size() == 1) { task = tasks.get(0); aggiornaStatoVeicoliOpPanel.setTask(task); aggiornaStatoVeicoliOpPanel.attach(); } else taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page centralLayout.addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, UNITS_PERCENTAGE); centralLayout.addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(TASK_COMPLETE)); completeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived // then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }
From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.operatorelogistico.richiedireportmissioni.RichiediReportMissioniOpPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) { taskForm = new GreenareaFormPropertiesForm(); taskForm.setMainTitle(taskPage.getMainTitle()); if (task.getTaskDefinitionKey().equals("visualizzaReportDettaglioConsegne") || task.getTaskDefinitionKey().equals("visualizzaReportSintesiMissioni") || task.getTaskDefinitionKey().equals("visualizzaReportDettaglioMissioni")) ((Form) ((FormPropertiesComponent) taskForm.getComponent(1)).getComponent(0)) .setLayout(new GreenareaFormLayout()); taskForm.setFormProperties(formData.getFormProperties()); taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override//from www . j a va 2 s . c o m protected void handleFormSubmit(FormPropertiesEvent event) { Map<String, String> properties = event.getFormProperties(); formService.submitTaskFormData(task.getId(), properties); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page centralLayout.addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, UNITS_PERCENTAGE); centralLayout.addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(TASK_COMPLETE)); completeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived // then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }
From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.operatorelogistico.verificastatoconsegneeritiri.VerificaStatoConsegneERitiriPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) { taskForm = new GreenareaFormPropertiesForm(); taskForm.setMainTitle(taskPage.getMainTitle()); if (task.getTaskDefinitionKey().equals("elencoStati") || task.getTaskDefinitionKey().equals("elencoMissioni") || task.getTaskDefinitionKey().equals("missioneRichiesta")) ((Form) ((FormPropertiesComponent) taskForm.getComponent(1)).getComponent(0)) .setLayout(new GreenareaFormLayout()); taskForm.setFormProperties(formData.getFormProperties()); final VerificaStatoConsegneERitiriPanel verificaStatoConsegneERitiriPanel = this; taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override/* ww w . ja va 2 s .c o m*/ protected void handleFormSubmit(FormPropertiesEvent event) { Map<String, String> properties = event.getFormProperties(); String missioni_autorizzate_op_missione = properties.get("consegne_e_ritiri_missione"); if (missioni_autorizzate_op_missione != null && missioni_autorizzate_op_missione.equals("")) properties.remove("consegne_e_ritiri_missione"); formService.submitTaskFormData(task.getId(), properties); Messaggio messaggio = null; try { messaggio = (Messaggio) taskService.createTaskQuery().includeProcessVariables() .processInstanceId(task.getProcessInstanceId()).active().singleResult() .getProcessVariables().get("messaggio"); } catch (Exception ex) { logger.debug("Processo non trovato"); } if (messaggio == null || messaggio.getTipo().equals(NESSUNERRORE) || messaggio.getCategoria().equals(OK)) notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); else notificationManager.showErrorNotification(messaggio.getCategoria() + "", i18nManager.getMessage(messaggio.getTipo() + "")); List<Task> tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()) .active().list(); if (tasks.size() == 1) { task = tasks.get(0); verificaStatoConsegneERitiriPanel.setTask(task); verificaStatoConsegneERitiriPanel.attach(); } else taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page centralLayout.addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, UNITS_PERCENTAGE); centralLayout.addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(TASK_COMPLETE)); completeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived // then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }