Search in sources :

Example 1 with LayoutClickListener

use of com.vaadin.event.LayoutEvents.LayoutClickListener 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);
                    }
                });
            }
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) CssLayout(com.vaadin.ui.CssLayout) TextArea(com.vaadin.ui.TextArea) Button(com.vaadin.ui.Button) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) ClaimTaskClickListener(org.activiti.explorer.ui.task.listener.ClaimTaskClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 2 with LayoutClickListener

use of com.vaadin.event.LayoutEvents.LayoutClickListener 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);
                    }
                });
            }
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) TextArea(com.vaadin.ui.TextArea) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 3 with LayoutClickListener

use of com.vaadin.event.LayoutEvents.LayoutClickListener 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();
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 4 with LayoutClickListener

use of com.vaadin.event.LayoutEvents.LayoutClickListener 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();
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Aggregations

LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)4 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)4 Button (com.vaadin.ui.Button)4 ClickEvent (com.vaadin.ui.Button.ClickEvent)4 ClickListener (com.vaadin.ui.Button.ClickListener)4 Label (com.vaadin.ui.Label)3 VerticalLayout (com.vaadin.ui.VerticalLayout)3 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 TextArea (com.vaadin.ui.TextArea)2 CssLayout (com.vaadin.ui.CssLayout)1 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)1 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)1