Java源码示例:com.vaadin.ui.CheckBox

示例1
private VerticalLayout initView() {
    final Label label = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_DESC));

    checkBox = new CheckBox(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_ENABLE));
    checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID);
    checkBox.setImmediate(true);
    checkBox.addValueChangeListener(
            event -> switchAutoAssignmentInputsVisibility((boolean) event.getProperty().getValue()));

    actionTypeOptionGroupLayout = new ActionTypeOptionGroupAutoAssignmentLayout(i18n);
    dsCombo = new DistributionSetSelectComboBox(i18n);

    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.addComponent(label);
    verticalLayout.addComponent(checkBox);
    verticalLayout.addComponent(actionTypeOptionGroupLayout);
    verticalLayout.addComponent(dsCombo);

    return verticalLayout;
}
 
示例2
private static void addValueChangeListener(final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
        final CheckBox enableMaintenanceWindowControl, final Link maintenanceWindowHelpLinkControl) {
    actionTypeOptionGroupLayout.getActionTypeOptionGroup()
            .addValueChangeListener(new Property.ValueChangeListener() {
                private static final long serialVersionUID = 1L;

                @Override
                // Vaadin is returning object so "==" might not work
                @SuppressWarnings("squid:S4551")
                public void valueChange(final Property.ValueChangeEvent event) {

                    if (event.getProperty().getValue()
                            .equals(AbstractActionTypeOptionGroupLayout.ActionTypeOption.DOWNLOAD_ONLY)) {
                        enableMaintenanceWindowControl.setValue(false);
                        enableMaintenanceWindowControl.setEnabled(false);
                        maintenanceWindowHelpLinkControl.setEnabled(false);

                    } else {
                        enableMaintenanceWindowControl.setEnabled(true);
                        maintenanceWindowHelpLinkControl.setEnabled(true);
                    }

                }
            });
}
 
示例3
@SuppressWarnings("unchecked")
private void addTargetTableForUpdate(final SoftwareModuleType swModuleType, final boolean mandatory) {
    if (getTwinTables().getSelectedTableContainer() == null) {
        return;
    }
    final Item saveTblitem = getTwinTables().getSelectedTableContainer().addItem(swModuleType.getId());
    getTwinTables().getSourceTable().removeItem(swModuleType.getId());
    saveTblitem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeName())
            .setValue(swModuleType.getName());
    final CheckBox mandatoryCheckbox = new CheckBox("", mandatory);
    mandatoryCheckbox.setId(swModuleType.getName());
    saveTblitem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeMandatory())
            .setValue(mandatoryCheckbox);

    final Item originalItem = originalSelectedTableContainer.addItem(swModuleType.getId());
    originalItem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeName())
            .setValue(swModuleType.getName());
    originalItem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeMandatory())
            .setValue(mandatoryCheckbox);

    getWindow().updateAllComponents(mandatoryCheckbox);
}
 
示例4
private void stopAllButtonClick(ClickEvent event) {
    // ダイアログの表示オプション
    HorizontalLayout optionLayout = new HorizontalLayout();
    final CheckBox checkBox = new CheckBox(ViewMessages.getMessage("IUI-000033"), false);
    checkBox.setImmediate(true);
    optionLayout.addComponent(checkBox);

    // 確認ダイアログを表示
    String message = ViewMessages.getMessage("IUI-000010");
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancelConfirm, optionLayout);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }

            boolean stopInstance = (Boolean) checkBox.getValue();
            stopAll(stopInstance);
        }
    });
    getApplication().getMainWindow().addWindow(dialog);
}
 
示例5
public TicketOverdueWidget() {
    super(UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS) + " (0)", new CssLayout());

    final CheckBox myItemsOnly = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    myItemsOnly.addValueChangeListener(valueChangeEvent -> {
        if (searchCriteria != null) {
            boolean selectMyItemsOnly = myItemsOnly.getValue();
            if (selectMyItemsOnly) {
                searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
            } else {
                searchCriteria.setAssignUser(null);
            }
            ticketOverdueComponent.setSearchCriteria(searchCriteria);
        }
    });

    this.addHeaderElement(myItemsOnly);

    ticketOverdueComponent = new TicketOverduePagedList();
    bodyContent.addComponent(ticketOverdueComponent);
}
 
示例6
public void display() {
    final CheckBox noDateSetMilestone = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET));
    noDateSetMilestone.setValue(false);

    final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed));
    includeClosedMilestone.setValue(false);

    noDateSetMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue()));
    includeClosedMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue()));

    addHeaderElement(noDateSetMilestone);
    addHeaderElement(includeClosedMilestone);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));

    bodyContent.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}
 
示例7
public void display(List<Integer> projectIds) {
    CheckBox includeNoDateSet = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET));
    includeNoDateSet.setValue(false);

    CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed));
    includeClosedMilestone.setValue(false);

    includeNoDateSet.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue()));
    includeClosedMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue()));

    addHeaderElement(includeNoDateSet);
    addHeaderElement(includeClosedMilestone);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(projectIds));
    searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));

    bodyContent.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}
 
示例8
public UserUnresolvedTicketWidget() {
    super("", new CssLayout());
    this.setWidth("100%");
    final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    myItemsSelection.addValueChangeListener(valueChangeEvent -> {
        boolean isMyItemsOption = myItemsSelection.getValue();
        if (searchCriteria != null) {
            if (isMyItemsOption) {
                searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
            } else {
                searchCriteria.setAssignUser(null);
            }
            updateSearchResult();
        }
    });
    ticketList = new DefaultBeanPagedList<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket>
            (AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(true), 10) {
        @Override
        protected String stringWhenEmptyList() {
            return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET);
        }
    };
    this.addHeaderElement(myItemsSelection);
    this.bodyContent.addComponent(ticketList);
}
 
示例9
public ProjectOverdueTicketsWidget() {
    super(String.format("%s (0)", UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS)), new CssLayout());
    this.setWidth("100%");

    CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    myItemsSelection.addValueChangeListener(valueChangeEvent -> {
        boolean isMyItemsOption = myItemsSelection.getValue();
        if (isMyItemsOption) {
            searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
        } else {
            searchCriteria.setAssignUser(null);
        }
        updateSearchResult();
    });

    ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class),
            new TicketRowDisplayHandler(false), 10) {
        @Override
        protected String stringWhenEmptyList() {
            return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_OVERDUE_TICKET);
        }
    };
    this.addHeaderElement(myItemsSelection);
    bodyContent.addComponent(ticketList);
}
 
示例10
public ProjectUnresolvedTicketsWidget() {
    super("", new CssLayout());
    this.setWidth("100%");
    final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    myItemsSelection.addValueChangeListener(valueChangeEvent -> {
        boolean isMyItemsOption = myItemsSelection.getValue();
        if (isMyItemsOption) {
            searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
        } else {
            searchCriteria.setAssignUser(null);
        }
        updateSearchResult();
    });
    ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class),
            new TicketRowDisplayHandler(false), 10) {
        @Override
        protected String stringWhenEmptyList() {
            return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET);
        }
    };
    addHeaderElement(myItemsSelection);
    bodyContent.addComponent(ticketList);
}
 
示例11
@Override
public void valueChange(final ValueChangeEvent event) {

    if (!(event.getProperty() instanceof CheckBox)) {
        return;
    }

    notifyConfigurationChanged();

    final CheckBox checkBox = (CheckBox) event.getProperty();
    BooleanConfigurationItem configurationItem;

    if (gatewaySecTokenCheckBox.equals(checkBox)) {
        configurationItem = gatewaySecurityTokenAuthenticationConfigurationItem;
    } else if (targetSecTokenCheckBox.equals(checkBox)) {
        configurationItem = targetSecurityTokenAuthenticationConfigurationItem;
    } else if (certificateAuthCheckbox.equals(checkBox)) {
        configurationItem = certificateAuthenticationConfigurationItem;
    } else if (downloadAnonymousCheckBox.equals(checkBox)) {
        configurationItem = anonymousDownloadAuthenticationConfigurationItem;
    } else {
        return;
    }

    if (checkBox.getValue()) {
        configurationItem.configEnable();
    } else {
        configurationItem.configDisable();
    }
}
 
示例12
@Override
public void valueChange(final ValueChangeEvent event) {

    if (!(event.getProperty() instanceof CheckBox)) {
        return;
    }

    notifyConfigurationChanged();

    final CheckBox checkBox = (CheckBox) event.getProperty();
    BooleanConfigurationItem configurationItem;

    if (actionAutocloseCheckBox.equals(checkBox)) {
        configurationItem = actionAutocloseConfigurationItem;
    } else if (actionAutocleanupCheckBox.equals(checkBox)) {
        configurationItem = actionAutocleanupConfigurationItem;
    } else if (multiAssignmentsCheckBox.equals(checkBox)) {
        configurationItem = multiAssignmentsConfigurationItem;
        actionAutocloseCheckBox.setEnabled(!checkBox.getValue());
        actionAutocloseConfigurationItem.setEnabled(!checkBox.getValue());
    } else {
        return;
    }

    if (checkBox.getValue()) {
        configurationItem.configEnable();
    } else {
        configurationItem.configDisable();
    }
}
 
示例13
private static HorizontalLayout createHorizontalLayout(final CheckBox maintenanceWindowControl,
        final Link maintenanceWindowHelpLink) {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(maintenanceWindowControl);
    layout.addComponent(maintenanceWindowHelpLink);
    return layout;
}
 
示例14
private static CheckBox maintenanceWindowControl(final VaadinMessageSource i18n,
        final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle) {
    final CheckBox enableMaintenanceWindow = new CheckBox(i18n.getMessage("caption.maintenancewindow.enabled"));
    enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
    enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
    enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
    enableMaintenanceWindow.addValueChangeListener(event -> {
        final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
        maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
        maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
        saveButtonToggle.accept(!isMaintenanceWindowEnabled);
        maintenanceWindowLayout.clearAllControls();
    });
    return enableMaintenanceWindow;
}
 
示例15
private CheckBox createTargetVisibleField() {
    final CheckBox checkBox = new CheckBox();
    checkBox.setId(UIComponentIdProvider.METADATA_TARGET_VISIBLE_ID);
    checkBox.setCaption(i18n.getMessage("metadata.targetvisible"));
    checkBox.addValueChangeListener(this::onCheckBoxChange);

    return checkBox;
}
 
示例16
private void createOriginalSelectedTableContainer() {
    originalSelectedTableContainer = new IndexedContainer();
    originalSelectedTableContainer.addContainerProperty(
            DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeName(), String.class, "");
    originalSelectedTableContainer.addContainerProperty(
            DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeDescription(), String.class, "");
    originalSelectedTableContainer.addContainerProperty(
            DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeMandatory(), CheckBox.class, null);
}
 
示例17
@SuppressWarnings("unchecked")
private void getSelectedTableItemData(final Long id) {
    Item saveTblitem;
    if (selectedTableContainer != null) {
        saveTblitem = selectedTableContainer.addItem(id);
        saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(
                sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_NAME).getValue());
        final CheckBox mandatoryCheckBox = new CheckBox();
        saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(mandatoryCheckBox);
        saveTblitem.getItemProperty(DIST_TYPE_DESCRIPTION).setValue(
                sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
    }
}
 
示例18
private boolean isValuesChanged(final Component currentChangedComponent, final Object newValue) {
    for (final AbstractField<?> field : allComponents) {
        Object originalValue = orginalValues.get(field);
        if (field instanceof CheckBox && originalValue == null) {
            originalValue = Boolean.FALSE;
        }
        final Object currentValue = getCurrentValue(currentChangedComponent, newValue, field);

        if (!Objects.equals(originalValue, currentValue)) {
            return true;
        }
    }
    return false;
}
 
示例19
public List<Long> getSelectedValues() {
    List<Long> componentNos = new ArrayList<Long>();
    for (Long componentNo : getItemIds()) {
        CheckBox checkBox = getCheckBox(getItem(componentNo));
        if (checkBox.booleanValue()) {
            componentNos.add(componentNo);
        }
    }

    return componentNos;
}
 
示例20
TicketsComp(Version beanItem) {
    withMargin(false).withFullWidth().withStyleName(WebThemes.NO_SCROLLABLE_CONTAINER);

    CheckBox openSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Open), true);
    openSelection.addValueChangeListener(valueChangeEvent -> {
        if (openSelection.getValue()) {
            searchCriteria.setOpen(new SearchField());
        } else {
            searchCriteria.setOpen(null);
        }
        updateSearchStatus();
    });

    CheckBox overdueSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Overdue), false);
    overdueSelection.addValueChangeListener(valueChangeEvent -> {
        if (overdueSelection.getValue()) {
            searchCriteria.setDueDate(new DateSearchField(DateTimeUtils.getCurrentDateWithoutMS().toLocalDate(),
                    DateSearchField.LESS_THAN));
        } else {
            searchCriteria.setDueDate(null);
        }
        updateSearchStatus();
    });

    MHorizontalLayout header = new MHorizontalLayout(openSelection, overdueSelection);

    ticketList = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowRenderer());

    searchCriteria = new ProjectTicketSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.TASK));
    searchCriteria.setVersionIds(new SetSearchField<>(beanItem.getId()));
    searchCriteria.setOpen(new SearchField());
    updateSearchStatus();

    this.with(header, ticketList);
}
 
示例21
TicketsComp(SimpleComponent beanItem) {
    withMargin(false).withFullWidth().withStyleName(WebThemes.NO_SCROLLABLE_CONTAINER);

    CheckBox openSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Open), true);
    openSelection.addValueChangeListener(valueChangeEvent -> {
        if (openSelection.getValue()) {
            searchCriteria.setOpen(new SearchField());
        } else {
            searchCriteria.setOpen(null);
        }
        updateSearchStatus();
    });

    CheckBox overdueSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Overdue), false);
    overdueSelection.addValueChangeListener(valueChangeEvent -> {
        if (overdueSelection.getValue()) {
            searchCriteria.setDueDate(new DateSearchField(DateTimeUtils.getCurrentDateWithoutMS().toLocalDate(),
                    DateSearchField.LESS_THAN));
        } else {
            searchCriteria.setDueDate(null);
        }
        updateSearchStatus();
    });

    MHorizontalLayout header = new MHorizontalLayout(openSelection, overdueSelection);

    ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowRenderer());

    searchCriteria = new ProjectTicketSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    searchCriteria.setComponentIds(new SetSearchField<>(beanItem.getId()));
    searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.TASK));
    searchCriteria.setOpen(new SearchField());
    updateSearchStatus();

    this.with(header, ticketList);
}
 
示例22
@Override
protected Component initContent() {
    ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class);
    List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId, AppUI.getAccountId());
    CssLayout container = new CssLayout();
    container.setStyleName("followers-container");
    final CheckBox selectAllCheckbox = new CheckBox("All", defaultSelectAll);
    selectAllCheckbox.addValueChangeListener(valueChangeEvent -> {
        boolean val = selectAllCheckbox.getValue();
        for (FollowerCheckbox followerCheckbox : memberSelections) {
            followerCheckbox.setValue(val);
        }
    });
    container.addComponent(selectAllCheckbox);
    for (SimpleUser user : members) {
        final FollowerCheckbox memberCheckbox = new FollowerCheckbox(user);
        memberCheckbox.addValueChangeListener(valueChangeEvent -> {
            if (!memberCheckbox.getValue()) {
                selectAllCheckbox.setValue(false);
            }
        });
        if (defaultSelectAll || selectedUsers.contains(user.getUsername())) {
            memberCheckbox.setValue(true);
        }
        memberSelections.add(memberCheckbox);
        container.addComponent(memberCheckbox);
    }
    return container;
}
 
示例23
@AutoGenerated
private VerticalLayout buildVerticalLayout_2() {
	// common part: create layout
	verticalLayout_2 = new VerticalLayout();
	verticalLayout_2.setImmediate(false);
	verticalLayout_2.setWidth("-1px");
	verticalLayout_2.setHeight("-1px");
	verticalLayout_2.setMargin(true);
	verticalLayout_2.setSpacing(true);
	
	// textFieldIssuer
	textFieldIssuer = new TextField();
	textFieldIssuer.setCaption("Issuer");
	textFieldIssuer.setImmediate(false);
	textFieldIssuer.setWidth("-1px");
	textFieldIssuer.setHeight("-1px");
	verticalLayout_2.addComponent(textFieldIssuer);
	
	// checkBoxMustBePresent
	checkBoxMustBePresent = new CheckBox();
	checkBoxMustBePresent.setCaption("Attribute Must Be Present");
	checkBoxMustBePresent.setImmediate(false);
	checkBoxMustBePresent.setWidth("-1px");
	checkBoxMustBePresent.setHeight("-1px");
	verticalLayout_2.addComponent(checkBoxMustBePresent);
	
	return verticalLayout_2;
}
 
示例24
protected void initElements() {
	type2 = new ComboBox();
	type2.setImmediate(true);
	type2.setWidth(WIDTH);
	lbMeta = new Label("Meta:");
	cbMeta = new CheckBox();
	cbMeta.setDescription("Is this element Meta data");
	
	optional.setWidth(WIDTH);
	type = new ComboBox();
	type.setWidth(WIDTH);
	type.setNullSelectionAllowed(false);
	type.setImmediate(true);
	type.addItem(SINGLE_FILE);
	type.addItem(MULTI_FILE);
	type.select(SINGLE_FILE);
	type.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = -1134955257251483403L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if(type.getValue().toString().contentEquals(SINGLE_FILE)) {
				getSingleFileUI();
			} else if(type.getValue().toString().contentEquals(MULTI_FILE)){
				getMultipleFilesUI();
			}
		}
	});
}
 
示例25
private void initElements() {
	
	lbName = new Label("Display name:");
	lbId = new Label();
	lbDescription = new Label("Description:");
	lbOptional = new Label("Optional:");
	
	name = new TextField();
	name.setWidth(WIDTH);
	name.setDescription("Display name for the element");
	name.setImmediate(true);
	name.addTextChangeListener(new CSCTextChangeListener(this));
	
	id = new TextField();
	id.setDescription("file name or unique identification");
	id.setImmediate(true);
	id.setRequired(true);
	id.setRequiredError(REQUIRED_TEXT);
	id.setWidth(WIDTH);
	id.addTextChangeListener(new CSCTextChangeListener(this, true));
	
	description = new TextArea();
	description.setWidth(WIDTH);
	description.setDescription("Short description");
	
	layout = new HorizontalLayout();
	
	prefix = new TextField();
	postfix = new TextField();
	
	layout.addComponent(prefix);
	layout.addComponent(new Label(MULTI_FILE_TEXT));
	layout.addComponent(postfix);
	
	optional = new CheckBox();
	optional.setDescription("Is this element optional");
	optional.setImmediate(true);
}
 
示例26
/**
 * Create the Assignment Confirmation Tab
 *
 * @param actionTypeOptionGroupLayout
 *            the action Type Option Group Layout
 * @param maintenanceWindowLayout
 *            the Maintenance Window Layout
 * @param saveButtonToggle
 *            The event listener to derimne if save button should be enabled
 *            or not
 * @param i18n
 *            the Vaadin Message Source for multi language
 * @param uiProperties
 *            the UI Properties
 * @return the Assignment Confirmation tab
 */
public static ConfirmationTab createAssignmentTab(
        final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
        final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle,
        final VaadinMessageSource i18n, final UiProperties uiProperties) {

    final CheckBox maintenanceWindowControl = maintenanceWindowControl(i18n, maintenanceWindowLayout,
            saveButtonToggle);
    final Link maintenanceWindowHelpLink = maintenanceWindowHelpLinkControl(uiProperties, i18n);
    final HorizontalLayout layout = createHorizontalLayout(maintenanceWindowControl, maintenanceWindowHelpLink);
    actionTypeOptionGroupLayout.selectDefaultOption();

    initMaintenanceWindow(maintenanceWindowLayout, saveButtonToggle);
    addValueChangeListener(actionTypeOptionGroupLayout, maintenanceWindowControl, maintenanceWindowHelpLink);
    return createAssignmentTab(actionTypeOptionGroupLayout, layout, maintenanceWindowLayout);
}
 
示例27
protected void createSelectedTableContainer() {
    selectedTableContainer = new IndexedContainer();
    selectedTableContainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
    selectedTableContainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
    selectedTableContainer.addContainerProperty(DIST_TYPE_MANDATORY, CheckBox.class, null);
}
 
示例28
protected static boolean isMandatoryModuleType(final Item item) {
    final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(getDistTypeMandatory()).getValue();
    return mandatoryCheckBox.getValue();
}
 
示例29
public void show(List<ComponentDto> components) {
    this.components = components;

    removeAllItems();

    if (components == null) {
        return;
    }

    for (ComponentDto component : components) {
        // チェックボックス
        CheckBox checkBox = new CheckBox();
        checkBox.setImmediate(true);
        checkBox.setEnabled(false);
        if (selectedComponentNos.contains(component.getComponent().getComponentNo())) {
            checkBox.setValue(true);
        } else {
            checkBox.setValue(false);
        }

        checkBox.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                // チェックボックスの有効/無効を制御
                changeCheckEnabled();

                // テーブル再描画
                requestRepaint();
            }
        });

        // サービス名
        String serviceName = component.getComponent().getComponentName();
        if (StringUtils.isNotEmpty(component.getComponent().getComment())) {
            serviceName = component.getComponent().getComment() + "\n[" + serviceName + "]";
        }
        Label serviceNameLabel = new Label(serviceName, Label.CONTENT_PREFORMATTED);
        serviceNameLabel.setHeight(COLUMN_HEIGHT);

        // ステータス
        String status = null;
        if (instance != null) {
            for (ComponentInstanceDto componentInstance : instance.getComponentInstances()) {
                if (componentInstance.getComponentInstance().getComponentNo()
                        .equals(component.getComponent().getComponentNo())) {
                    status = componentInstance.getComponentInstance().getStatus();
                    break;
                }
            }
        }
        if (StringUtils.isEmpty(status)) {
            status = "Stopped";
        } else {
            status = StringUtils.capitalize(StringUtils.lowerCase(status));
        }

        Icons statusIcon = Icons.fromName(status);
        Label statusLabel = new Label(IconUtils.createImageTag(getApplication(), statusIcon, status),
                Label.CONTENT_XHTML);
        statusLabel.setHeight(COLUMN_HEIGHT);

        addItem(new Object[] { checkBox, serviceNameLabel, statusLabel },
                component.getComponent().getComponentNo());
    }

    changeCheckEnabled();
}
 
示例30
private CheckBox getCheckBox(Item item) {
    return (CheckBox) item.getItemProperty("check").getValue();
}