com.vaadin.ui.CheckBox Java Examples

The following examples show how to use com.vaadin.ui.CheckBox. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DistributionSetSelectWindow.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: ServiceButtonsTop.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: TicketOverdueWidget.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #4
Source File: MilestoneTimelineWidget.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
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);
                    }

                }
            });
}
 
Example #6
Source File: AllMilestoneTimelineWidget.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: UserUnresolvedTicketWidget.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #8
Source File: UpdateDistributionSetTypeLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@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);
}
 
Example #9
Source File: ProjectUnresolvedTicketsWidget.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #10
Source File: ProjectOverdueTicketsWidget.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #11
Source File: WinServerAttachService.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #12
Source File: RepositoryConfigurationView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@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();
    }
}
 
Example #13
Source File: VersionPreviewForm.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #14
Source File: ComponentPreviewForm.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #15
Source File: ProjectSubscribersComp.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #16
Source File: AttributeSelectionWindow.java    From XACML with MIT License 5 votes vote down vote up
@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;
}
 
Example #17
Source File: InputOutputUI.java    From chipster with MIT License 5 votes vote down vote up
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();
			}
		}
	});
}
 
Example #18
Source File: BasicModel.java    From chipster with MIT License 5 votes vote down vote up
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);
}
 
Example #19
Source File: UpdateDistributionSetTypeLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example #20
Source File: AuthenticationConfigurationView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@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();
    }
}
 
Example #21
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static HorizontalLayout createHorizontalLayout(final CheckBox maintenanceWindowControl,
        final Link maintenanceWindowHelpLink) {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(maintenanceWindowControl);
    layout.addComponent(maintenanceWindowHelpLink);
    return layout;
}
 
Example #22
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #23
Source File: SwMetadataPopupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: DistributionSetTypeSoftwareModuleSelectLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@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());
    }
}
 
Example #25
Source File: CommonDialogWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #26
Source File: ToggleMilestoneSummaryField.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
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 CheckBox();
        toggleStatusSelect.setValue(milestone.isCompleted());
        this.addComponent(toggleStatusSelect);
        this.addComponent(ELabel.EMPTY_SPACE());
        displayTooltip();

        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.setOpen(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, AppUI.getSiteName()),
                        UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS),
                        UserUIContext.getMessage(GenericI18Enum.ACTION_YES),
                        UserUIContext.getMessage(GenericI18Enum.ACTION_NO),
                        confirmDialog -> {
                            if (confirmDialog.isConfirmed()) {
                                genericTaskService.closeSubAssignmentOfMilestone(milestone.getId());
                            }
                        });
            }
        });
    }

    titleLinkLbl = ELabel.h3(buildMilestoneLink()).withStyleName(WebThemes.LABEL_WORD_WRAP).withUndefinedWidth();
    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 MTextField editField = new MTextField(milestone.getName()).withFullWidth();
                editField.focus();
                ToggleMilestoneSummaryField.this.addComponent(editField);
                ToggleMilestoneSummaryField.this.removeStyleName("editable-field");
                editField.addShortcutListener(new ShortcutListener("enter", ShortcutAction.KeyCode.ENTER, (int[]) null) {
                    @Override
                    public void handleAction(Object sender, Object target) {
                        updateFieldValue(editField);
                    }
                });
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withDescription(UserUIContext.getMessage(MilestoneI18nEnum.OPT_EDIT_PHASE_NAME))
                .withIcon(VaadinIcons.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, AppUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.ACTION_YES),
                    UserUIContext.getMessage(GenericI18Enum.ACTION_NO),
                    confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            AppContextUtil.getSpringBean(MilestoneService.class).removeWithSession(milestone,
                                    UserUIContext.getUsername(), AppUI.getAccountId());
                            TicketRowRender rowRenderer = UIUtils.getRoot(ToggleMilestoneSummaryField.this, TicketRowRender.class);
                            if (rowRenderer != null) {
                                rowRenderer.selfRemoved();
                            }
                            EventBusFactory.getInstance().post(new MilestoneEvent.MilestoneDeleted(this, milestone.getId()));
                        }
                    });
        }).withIcon(VaadinIcons.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(removeBtn);
    }
    if (buttonControls.getComponentCount() > 0) {
        this.addComponent(buttonControls);
    }
}
 
Example #27
Source File: WinServerAttachService.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
private CheckBox getCheckBox(Item item) {
    return (CheckBox) item.getItemProperty("check").getValue();
}
 
Example #28
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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);
}
 
Example #29
Source File: PolicyEditor.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private HorizontalLayout buildHorizontalLayoutToolbar() {
	// common part: create layout
	horizontalLayoutToolbar = new HorizontalLayout();
	horizontalLayoutToolbar.setImmediate(false);
	horizontalLayoutToolbar.setWidth("-1px");
	horizontalLayoutToolbar.setHeight("-1px");
	horizontalLayoutToolbar.setMargin(true);
	horizontalLayoutToolbar.setSpacing(true);
	
	// checkBoxReadOnly
	checkBoxReadOnly = new CheckBox();
	checkBoxReadOnly.setCaption("Read Only");
	checkBoxReadOnly.setImmediate(false);
	checkBoxReadOnly
			.setDescription("Check this to turn-off policy editing.");
	checkBoxReadOnly.setWidth("-1px");
	checkBoxReadOnly.setHeight("-1px");
	horizontalLayoutToolbar.addComponent(checkBoxReadOnly);
	
	// checkBoxAutoSave
	checkBoxAutoSave = new CheckBox();
	checkBoxAutoSave.setCaption("Auto Save");
	checkBoxAutoSave.setImmediate(false);
	checkBoxAutoSave
			.setDescription("Check this to turn-on automatic saving of policy when a change occurs.");
	checkBoxAutoSave.setWidth("-1px");
	checkBoxAutoSave.setHeight("-1px");
	horizontalLayoutToolbar.addComponent(checkBoxAutoSave);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setDescription("Click to save the policy.");
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	horizontalLayoutToolbar.addComponent(buttonSave);
	
	// buttonViewXML
	buttonViewXML = new Button();
	buttonViewXML.setCaption("View XML");
	buttonViewXML.setImmediate(true);
	buttonViewXML.setWidth("-1px");
	buttonViewXML.setHeight("-1px");
	horizontalLayoutToolbar.addComponent(buttonViewXML);
	
	// buttonExport
	buttonExport = new Button();
	buttonExport.setCaption("Export Policy");
	buttonExport.setImmediate(false);
	buttonExport.setWidth("-1px");
	buttonExport.setHeight("-1px");
	horizontalLayoutToolbar.addComponent(buttonExport);
	
	return horizontalLayoutToolbar;
}
 
Example #30
Source File: ExpressionBuilderComponent.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_1() {
	// common part: create layout
	horizontalLayout_1 = new HorizontalLayout();
	horizontalLayout_1.setImmediate(false);
	horizontalLayout_1.setWidth("-1px");
	horizontalLayout_1.setHeight("-1px");
	horizontalLayout_1.setMargin(false);
	horizontalLayout_1.setSpacing(true);
	
	// buttonAddExpression
	buttonAddExpression = new Button();
	buttonAddExpression.setCaption("Add Expression");
	buttonAddExpression.setImmediate(true);
	buttonAddExpression.setWidth("-1px");
	buttonAddExpression.setHeight("-1px");
	horizontalLayout_1.addComponent(buttonAddExpression);
	
	// buttonDeleteExpression
	buttonDeleteExpression = new Button();
	buttonDeleteExpression.setCaption("Delete Expression");
	buttonDeleteExpression.setImmediate(true);
	buttonDeleteExpression.setWidth("-1px");
	buttonDeleteExpression.setHeight("-1px");
	horizontalLayout_1.addComponent(buttonDeleteExpression);
	
	// buttonClearAll
	buttonClearAll = new Button();
	buttonClearAll.setCaption("Clear All");
	buttonClearAll.setImmediate(true);
	buttonClearAll.setDescription("Clears all the expressions.");
	buttonClearAll.setWidth("-1px");
	buttonClearAll.setHeight("-1px");
	horizontalLayout_1.addComponent(buttonClearAll);
	
	// checkBoxShortName
	checkBoxShortName = new CheckBox();
	checkBoxShortName.setCaption("Display Short XACML ID's");
	checkBoxShortName.setImmediate(false);
	checkBoxShortName
			.setDescription("If checked, the right-most string of the function and datatype URI's will only be displayed.");
	checkBoxShortName.setWidth("-1px");
	checkBoxShortName.setHeight("-1px");
	horizontalLayout_1.addComponent(checkBoxShortName);
	
	return horizontalLayout_1;
}