use of com.vaadin.ui.CssLayout in project Activiti by Activiti.
the class TaskDetailPanel method initDescription.
protected void initDescription(HorizontalLayout layout) {
final CssLayout descriptionLayout = new CssLayout();
descriptionLayout.setWidth(100, UNITS_PERCENTAGE);
layout.addComponent(descriptionLayout);
layout.setExpandRatio(descriptionLayout, 1.0f);
layout.setComponentAlignment(descriptionLayout, Alignment.MIDDLE_LEFT);
String descriptionText = null;
if (task.getDescription() != null && !"".equals(task.getDescription())) {
descriptionText = task.getDescription();
} else {
descriptionText = i18nManager.getMessage(Messages.TASK_NO_DESCRIPTION);
}
final Label descriptionLabel = new Label(descriptionText);
descriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
descriptionLayout.addComponent(descriptionLabel);
descriptionLayout.addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
// layout for textarea + ok button
final VerticalLayout editLayout = new VerticalLayout();
editLayout.setSpacing(true);
// textarea
final TextArea descriptionTextArea = new TextArea();
descriptionTextArea.setNullRepresentation("");
descriptionTextArea.setWidth(100, UNITS_PERCENTAGE);
descriptionTextArea.setValue(task.getDescription());
editLayout.addComponent(descriptionTextArea);
// ok button
Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
editLayout.addComponent(okButton);
editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
// replace
descriptionLayout.replaceComponent(descriptionLabel, editLayout);
// When OK is clicked -> update task data + ui
okButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
// Update data
task.setDescription(descriptionTextArea.getValue().toString());
taskService.saveTask(task);
// Update UI
descriptionLabel.setValue(task.getDescription());
descriptionLayout.replaceComponent(editLayout, descriptionLabel);
}
});
}
}
});
}
use of com.vaadin.ui.CssLayout in project Activiti by Activiti.
the class TaskDetailPanel method initTaskForm.
protected void initTaskForm() {
// Check if task requires a form
TaskFormData formData = formService.getTaskFormData(task.getId());
if (formData != null && formData.getFormProperties() != null && !formData.getFormProperties().isEmpty()) {
taskForm = new FormPropertiesForm();
taskForm.setSubmitButtonCaption(i18nManager.getMessage(Messages.TASK_COMPLETE));
taskForm.setCancelButtonCaption(i18nManager.getMessage(Messages.TASK_RESET_FORM));
taskForm.setFormHelp(i18nManager.getMessage(Messages.TASK_FORM_HELP));
taskForm.setFormProperties(formData.getFormProperties());
taskForm.addListener(new FormPropertiesEventListener() {
private static final long serialVersionUID = -3893467157397686736L;
@Override
protected void handleFormSubmit(FormPropertiesEvent event) {
Map<String, String> properties = event.getFormProperties();
formService.submitTaskFormData(task.getId(), properties);
notificationManager.showInformationNotification(Messages.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(ExplorerLayout.STYLE_DETAIL_BLOCK);
buttonLayout.setWidth(100, UNITS_PERCENTAGE);
centralLayout.addComponent(buttonLayout);
completeButton = new Button(i18nManager.getMessage(Messages.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(Messages.TASK_COMPLETED, task.getName());
taskPage.refreshSelectNext();
}
});
completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner());
buttonLayout.addComponent(completeButton);
}
}
use of com.vaadin.ui.CssLayout in project Activiti by Activiti.
the class HistoricTaskDetailPanel method initDescription.
protected void initDescription() {
CssLayout descriptionLayout = new CssLayout();
descriptionLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
descriptionLayout.setWidth(100, UNITS_PERCENTAGE);
if (historicTask.getDescription() != null) {
Label descriptionLabel = new Label(historicTask.getDescription());
descriptionLayout.addComponent(descriptionLabel);
}
centralLayout.addComponent(descriptionLayout);
}
use of com.vaadin.ui.CssLayout in project Activiti by Activiti.
the class MainLayout method initMain.
protected void initMain() {
main = new CssLayout();
main.setSizeFull();
main.addStyleName(ExplorerLayout.STYLE_MAIN_CONTENT);
addComponent(main);
setExpandRatio(main, 1.0f);
}
use of com.vaadin.ui.CssLayout in project Activiti by Activiti.
the class MainLayout method initHeader.
protected void initHeader() {
header = new CssLayout();
header.addStyleName(ExplorerLayout.STYLE_HEADER);
header.setWidth(100, UNITS_PERCENTAGE);
addComponent(header);
}
Aggregations