Example usage for com.vaadin.ui TextField setValue

List of usage examples for com.vaadin.ui TextField setValue

Introduction

In this page you can find the example usage for com.vaadin.ui TextField setValue.

Prototype

@Override
public void setValue(String value) 

Source Link

Document

Sets the value of this text field.

Usage

From source file:com.mycollab.module.project.view.milestone.ToggleGenericTaskSummaryField.java

License:Open Source License

ToggleGenericTaskSummaryField(final ProjectGenericTask genericTask) {
    this.genericTask = genericTask;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildGenericTaskLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    this.addComponent(titleLinkLbl);
    if ((genericTask.isTask() && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS))
            || (genericTask.isBug() && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS))
            || (genericTask.isRisk()//from w w w .ja  va2s.  c o  m
                    && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.RISKS))) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
        Button instantEditBtn = new Button(null, new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                if (isRead) {
                    removeComponent(titleLinkLbl);
                    removeComponent(buttonControls);
                    final TextField editField = new TextField();
                    editField.setValue(genericTask.getName());
                    editField.setWidth("100%");
                    editField.focus();
                    addComponent(editField);
                    removeStyleName("editable-field");
                    editField.addValueChangeListener(new Property.ValueChangeListener() {
                        @Override
                        public void valueChange(Property.ValueChangeEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    editField.addBlurListener(new FieldEvents.BlurListener() {
                        @Override
                        public void blur(FieldEvents.BlurEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    isRead = !isRead;
                }
            }
        });
        instantEditBtn.setDescription("Edit task name");
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setIcon(FontAwesome.EDIT);
        buttonControls.with(instantEditBtn);

        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.milestone.ToggleMilestoneSummaryField.java

License:Open Source License

ToggleMilestoneSummaryField(final SimpleMilestone milestone, int maxLength, boolean toggleStatusSupport,
        boolean isDeleteSupport) {
    this.milestone = milestone;
    this.maxLength = maxLength;
    this.setWidth("100%");
    this.addStyleName("editable-field");
    if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        toggleStatusSelect = new CssCheckBox();
        toggleStatusSelect.setSimpleMode(true);
        toggleStatusSelect.setValue(milestone.isCompleted());
        this.addComponent(toggleStatusSelect);
        this.addComponent(ELabel.EMPTY_SPACE());
        displayTooltip();/*w w  w  . j  a  v a 2 s . c  o  m*/

        toggleStatusSelect.addValueChangeListener(valueChangeEvent -> {
            if (milestone.isCompleted()) {
                milestone.setStatus(MilestoneStatus.InProgress.name());
                titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED);
            } else {
                milestone.setStatus(MilestoneStatus.Closed.name());
                titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
            }
            displayTooltip();
            MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
            milestoneService.updateSelectiveWithSession(milestone, UserUIContext.getUsername());
            ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria();
            searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
            searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.RISK,
                    ProjectTypeConstants.TASK));
            searchCriteria.setMilestoneId(NumberSearchField.equal(milestone.getId()));
            searchCriteria.setIsOpenned(new SearchField());
            ProjectTicketService genericTaskService = AppContextUtil.getSpringBean(ProjectTicketService.class);
            int openAssignmentsCount = genericTaskService.getTotalCount(searchCriteria);
            if (openAssignmentsCount > 0) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, MyCollabUI.getSiteName()),
                        UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                            if (confirmDialog.isConfirmed()) {
                                genericTaskService.closeSubAssignmentOfMilestone(milestone.getId());
                            }
                        });
            }
        });
    }

    titleLinkLbl = ELabel.h3(buildMilestoneLink()).withStyleName(UIConstants.LABEL_WORD_WRAP)
            .withWidthUndefined();
    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withStyleName("toggle");
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleMilestoneSummaryField.this.removeComponent(titleLinkLbl);
                ToggleMilestoneSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(milestone.getName());
                editField.setWidth("100%");
                editField.focus();
                ToggleMilestoneSummaryField.this.addComponent(editField);
                ToggleMilestoneSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withDescription(UserUIContext.getMessage(MilestoneI18nEnum.OPT_EDIT_PHASE_NAME))
                .withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(instantEditBtn);
    }
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES)) {
        MButton removeBtn = new MButton("", clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            AppContextUtil.getSpringBean(MilestoneService.class).removeWithSession(milestone,
                                    UserUIContext.getUsername(), MyCollabUI.getAccountId());
                            BlockRowRender rowRenderer = UIUtils.getRoot(ToggleMilestoneSummaryField.this,
                                    BlockRowRender.class);
                            if (rowRenderer != null) {
                                rowRenderer.selfRemoved();
                            }
                            EventBusFactory.getInstance()
                                    .post(new MilestoneEvent.MilestoneDeleted(this, milestone.getId()));
                        }
                    });
        }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(removeBtn);
    }
    if (buttonControls.getComponentCount() > 0) {
        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.milestone.ToggleTicketSummaryField.java

License:Open Source License

public ToggleTicketSummaryField(final ProjectTicket ticket) {
    this.ticket = ticket;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildTicketLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    if (ticket.isClosed()) {
        titleLinkLbl.addStyleName(WebUIConstants.LINK_COMPLETED);
    } else if (ticket.isOverdue()) {
        titleLinkLbl.addStyleName(WebUIConstants.LINK_OVERDUE);
    }/*from www  . j  av a2 s . c  o m*/
    this.addComponent(titleLinkLbl);
    if (CurrentProjectVariables.canWriteTicket(ticket)) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                removeComponent(titleLinkLbl);
                removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(ticket.getName());
                editField.setWidth("100%");
                editField.focus();
                addComponent(editField);
                removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ONLY,
                ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT));
        buttonControls.with(instantEditBtn);

        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.task.components.ToggleTaskSummaryField.java

License:Open Source License

public ToggleTaskSummaryField(final SimpleTask task, int maxLength) {
    this.setWidth("100%");
    this.maxLength = maxLength;
    this.task = task;
    titleLinkLbl = ELabel.html(buildTaskLink()).withWidthUndefined().withStyleName(UIConstants.LABEL_WORD_WRAP);

    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        this.addStyleName("editable-field");

        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleTaskSummaryField.this.removeComponent(titleLinkLbl);
                ToggleTaskSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(task.getTaskname());
                editField.setWidth("100%");
                editField.focus();//w  w  w.  j  a  v a2 s  .  com
                ToggleTaskSummaryField.this.addComponent(editField);
                ToggleTaskSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ONLY,
                ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription("Edit task name");
        buttonControls.with(instantEditBtn);
        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.task.TaskEditFormFieldFactory.java

License:Open Source License

private void calculateDurationBaseOnStartAndEndDates() {
    DateTimeOptionField startDateField = (DateTimeOptionField) fieldGroup.getField(Task.Field.startdate.name());
    DateTimeOptionField endDateField = (DateTimeOptionField) fieldGroup.getField(Task.Field.enddate.name());
    TextField durationField = (TextField) fieldGroup.getField(Task.Field.duration.name());
    Date startDate = null, endDate = null;
    if (startDateField != null) {
        startDate = startDateField.getValue();
    }//from  w  w  w . j a  v  a  2s .com
    if (endDateField != null) {
        endDate = endDateField.getValue();
    }
    if (startDate != null && endDate != null && startDate.before(endDate) && durationField != null) {
        LocalDate jodaStartDate = new LocalDate(startDate);
        LocalDate jodaEndDate = new LocalDate(endDate);
        int durationInDays = BusinessDayTimeUtils.duration(jodaStartDate, jodaEndDate);
        durationField.setValue(durationInDays + " d");
    }
}

From source file:com.mycollab.module.project.view.task.ToggleTaskSummaryField.java

License:Open Source License

public ToggleTaskSummaryField(final SimpleTask task, int maxLength, boolean toggleStatusSupport,
        boolean canRemove) {
    this.setWidth("100%");
    this.maxLength = maxLength;
    this.task = task;
    titleLinkLbl = ELabel.html(buildTaskLink()).withWidthUndefined().withStyleName(UIConstants.LABEL_WORD_WRAP);

    if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        toggleStatusSelect = new CssCheckBox();
        toggleStatusSelect.setSimpleMode(true);
        toggleStatusSelect.setValue(task.isCompleted());
        displayTooltip();//from w  ww. j a  v  a2s.  c  om
        toggleStatusSelect.addValueChangeListener(valueChangeEvent -> {
            if (task.isCompleted()) {
                task.setStatus(StatusI18nEnum.Open.name());
                task.setPercentagecomplete(0d);
                titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED);
            } else {
                task.setStatus(StatusI18nEnum.Closed.name());
                task.setPercentagecomplete(100d);
                titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
            }
            displayTooltip();
            ProjectTaskService projectTaskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
            projectTaskService.updateWithSession(task, UserUIContext.getUsername());

            if (StatusI18nEnum.Closed.name().equals(task.getStatus())) {
                Integer countOfOpenSubTasks = projectTaskService.getCountOfOpenSubTasks(task.getId());
                if (countOfOpenSubTasks > 0) {
                    ConfirmDialogExt.show(UI.getCurrent(),
                            UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, MyCollabUI.getSiteName()),
                            UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS),
                            UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                            UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                                if (confirmDialog.isConfirmed()) {
                                    projectTaskService.massUpdateTaskStatuses(task.getId(),
                                            StatusI18nEnum.Closed.name(), MyCollabUI.getAccountId());
                                }
                            });
                }
            }
        });
        this.addComponent(toggleStatusSelect);
        this.addComponent(ELabel.EMPTY_SPACE());
    }

    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withStyleName("toggle");
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        this.addStyleName("editable-field");

        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleTaskSummaryField.this.removeComponent(titleLinkLbl);
                ToggleTaskSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(task.getName());
                editField.setWidth("100%");
                editField.focus();
                ToggleTaskSummaryField.this.addComponent(editField);
                ToggleTaskSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(TaskI18nEnum.OPT_EDIT_TASK_NAME));
        buttonControls.with(instantEditBtn);
    }

    if (canRemove && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) {
        MButton removeBtn = new MButton("", clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            AppContextUtil.getSpringBean(ProjectTaskService.class).removeWithSession(task,
                                    UserUIContext.getUsername(), MyCollabUI.getAccountId());
                            BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTaskSummaryField.this,
                                    BlockRowRender.class);
                            if (rowRenderer != null) {
                                rowRenderer.selfRemoved();
                            }
                            EventBusFactory.getInstance().post(new TaskEvent.TaskDeleted(this, task.getId()));
                        }
                    });
        }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(removeBtn);
    }
    if (buttonControls.getComponentCount() > 0) {
        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.ticket.ToggleTicketSummaryField.java

License:Open Source License

public ToggleTicketSummaryField(final ProjectTicket ticket) {
    this.ticket = ticket;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildTicketLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    if (ticket.isClosed()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
    } else if (ticket.isOverdue()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_OVERDUE);
    }//from   www .  j  a va  2 s  .  c  om
    this.addComponent(titleLinkLbl);
    if (CurrentProjectVariables.canWriteTicket(ticket)) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
                .withStyleName("toggle");
        buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT);
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                removeComponent(titleLinkLbl);
                removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(ticket.getName());
                editField.setWidth("100%");
                editField.focus();
                addComponent(editField);
                removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT));
        buttonControls.with(instantEditBtn);

        if ((ticket.isRisk() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.RISKS))
                || (ticket.isBug() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.BUGS))
                || (ticket.isTask()
                        && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS))) {
            MButton removeBtn = new MButton("", clickEvent -> {
                ConfirmDialogExt.show(UI.getCurrent(),
                        UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                        UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                            if (confirmDialog.isConfirmed()) {
                                AppContextUtil.getSpringBean(ProjectTicketService.class).removeTicket(ticket,
                                        UserUIContext.getUsername());
                                BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTicketSummaryField.this,
                                        BlockRowRender.class);
                                if (rowRenderer != null) {
                                    rowRenderer.selfRemoved();
                                }
                                EventBusFactory.getInstance()
                                        .post(new TicketEvent.HasTicketPropertyChanged(this, "all"));
                            }
                        });
            }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
            buttonControls.with(removeBtn);
        }

        this.addComponent(buttonControls);
    }
}

From source file:com.mymita.vaadlets.demo.AddonDemoApplication.java

License:Apache License

private static void fillEditorWithDefaultXML(final VaadletsBuilder vaadlets) {
    vaadlets.<Panel>getComponent("content").getContent().removeAllComponents();
    final TextField editor = vaadlets.getComponent("editor");
    try {/*from   w  w w . ja v  a2s  .c  o  m*/
        editor.setValue(CharStreams.toString(new InputStreamReader(
                new ClassPathResource("startingPoint.xml", AddonDemoApplication.class).getInputStream(),
                "UTF-8")));
    } catch (final IOException e) {
    }
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.tagging.TaggingViewImpl.java

License:Open Source License

private void addCustomTag(final TextField newTagTextField) {
    listener.onTagCreated(newTagTextField.getValue());
    newTagTextField.setValue(null);
}

From source file:com.oodrive.nuage.webui.component.DeviceItemComponent.java

License:Apache License

/**
 * Create attributes component.//from   w w  w  .  j a  v  a2  s .c  o m
 * 
 * @return the component
 */
private final AbstractComponent createAttributes() {

    final VerticalLayout layout = new VerticalLayout();

    final FormLayout deviceAttributesLayout = new FormLayout();
    deviceAttributesLayout.setMargin(true);
    deviceAttributesLayout.setWidth(null);
    deviceAttributesLayout.setImmediate(true);
    layout.addComponent(deviceAttributesLayout);
    layout.setComponentAlignment(deviceAttributesLayout, Alignment.MIDDLE_CENTER);

    // Enter NAME
    WebUiUtils.createFieldString(new StringAttributeOperation() {
        @Override
        public void setStringValue(final String value) {
            model.setDeviceName(value);
        }

        @Override
        public String getStringValue() {
            return model.getDeviceName();
        }
    }, "Name", deviceAttributesLayout, model);

    // Enter DESCRIPTION
    WebUiUtils.createFieldString(new StringAttributeOperation() {
        @Override
        public void setStringValue(final String value) {
            model.setDeviceDescription(value);
        }

        @Override
        public String getStringValue() {
            return model.getDeviceDescription();
        }
    }, "Description", deviceAttributesLayout, model);

    // Enter UUID (not editable)
    final TextField deviceUUID = new TextField("UUID", model.getItemUuid().toString());
    deviceUUID.setReadOnly(true);
    deviceUUID.setWidth("300px");
    deviceAttributesLayout.addComponent(deviceUUID);

    // Enter active
    final TextField deviceActive = new TextField("Active");
    if (model.isDeviceActive()) {
        deviceActive.setValue("yes");
    } else {
        deviceActive.setValue("no");
    }
    deviceActive.setReadOnly(true);
    deviceActive.setSizeFull();
    deviceAttributesLayout.addComponent(deviceActive);

    // Enter read only
    final TextField deviceReadOnly = new TextField("Read Only");
    if (model.isDeviceReadOnly()) {
        deviceReadOnly.setValue("yes");
    } else {
        deviceReadOnly.setValue("no");
    }
    deviceReadOnly.setReadOnly(true);
    deviceReadOnly.setSizeFull();
    deviceAttributesLayout.addComponent(deviceReadOnly);

    // Enter size
    WebUiUtils.createFieldLong(new LongAttributeOperation() {
        @Override
        public void setLongValue(final long value) {
            model.setDeviceSize(value);
        }

        @Override
        public long getLongValue() {
            return model.getDeviceSize();
        }

    }, "Size", deviceAttributesLayout, model);

    // Enter IQN
    WebUiUtils.createFieldString(new StringAttributeOperation() {
        @Override
        public void setStringValue(final String value) {
            model.setDeviceIqn(value);
        }

        @Override
        public String getStringValue() {
            return model.getDeviceIqn();
        }
    }, "IQN", deviceAttributesLayout, model);

    // Enter Alias
    WebUiUtils.createFieldString(new StringAttributeOperation() {
        @Override
        public void setStringValue(final String value) {
            model.setDeviceIscsiAlias(value);
        }

        @Override
        public String getStringValue() {
            return model.getDeviceIscsiAlias();
        }
    }, "iSCSI Alias", deviceAttributesLayout, model);

    // Enter iscsi block size
    WebUiUtils.createFieldInteger(new IntegerAttributeOperation() {
        @Override
        public void setIntegerValue(final int value) {
            model.setDeviceIscsiBlockSize(value);
        }

        @Override
        public int getIntegerValue() {
            return model.getDeviceIscsiBlockSize();
        }

    }, "iSCSI Block Size", deviceAttributesLayout, model, true);
    return layout;
}