use of com.vaadin.event.LayoutEvents.LayoutClickEvent 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.event.LayoutEvents.LayoutClickEvent in project Activiti by Activiti.
the class DescriptionComponent method initLayoutClickListener.
protected void initLayoutClickListener() {
addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
// textarea
final TextArea descriptionTextArea = new TextArea();
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
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());
replaceComponent(editLayout, descriptionLabel);
}
});
}
}
});
}
use of com.vaadin.event.LayoutEvents.LayoutClickEvent in project Activiti by Activiti.
the class SelectEditorComponent method createTableDrivenEditorChoice.
protected void createTableDrivenEditorChoice() {
tableEditorLayout = new HorizontalLayout();
tableEditorLayout.setWidth("300px");
tableEditorLayout.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
addComponent(tableEditorLayout);
tableEditorButton = new Button();
tableEditorButton.setIcon(Images.PROCESS_EDITOR_TABLE);
tableEditorButton.setStyleName(Reindeer.BUTTON_LINK);
tableEditorLayout.addComponent(tableEditorButton);
tableEditorLayout.setComponentAlignment(tableEditorButton, Alignment.MIDDLE_LEFT);
VerticalLayout tableEditorTextLayout = new VerticalLayout();
tableEditorLayout.addComponent(tableEditorTextLayout);
tableEditorLayout.setExpandRatio(tableEditorTextLayout, 1.0f);
tableEditorLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_TABLE));
tableEditorLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
tableEditorTextLayout.addComponent(tableEditorLabel);
tableEditorDescriptionLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_TABLE_DESCRIPTION));
tableEditorDescriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
tableEditorDescriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
tableEditorTextLayout.addComponent(tableEditorDescriptionLabel);
tableEditorLayout.addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
preferTableDrivenEditor();
}
});
tableEditorButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
preferTableDrivenEditor();
}
});
}
use of com.vaadin.event.LayoutEvents.LayoutClickEvent in project Activiti by Activiti.
the class SelectEditorComponent method createModelerEditorChoice.
protected void createModelerEditorChoice() {
modelerLayout = new HorizontalLayout();
modelerLayout.setWidth("300px");
modelerLayout.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
addComponent(modelerLayout);
modelerButton = new Button();
modelerButton.setIcon(Images.PROCESS_EDITOR_BPMN);
modelerButton.setStyleName(Reindeer.BUTTON_LINK);
modelerLayout.addComponent(modelerButton);
modelerLayout.setComponentAlignment(modelerButton, Alignment.MIDDLE_LEFT);
VerticalLayout modelerTextLayout = new VerticalLayout();
modelerLayout.addComponent(modelerTextLayout);
modelerLayout.setExpandRatio(modelerTextLayout, 1.0f);
modelerLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER));
modelerLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
modelerTextLayout.addComponent(modelerLabel);
modelerDescriptionLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER_DESCRIPTION));
modelerDescriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
modelerDescriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
modelerTextLayout.addComponent(modelerDescriptionLabel);
modelerLayout.addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
preferModeler();
}
});
modelerButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
preferModeler();
}
});
}
Aggregations