Example usage for com.vaadin.ui CheckBox CheckBox

List of usage examples for com.vaadin.ui CheckBox CheckBox

Introduction

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

Prototype

public CheckBox(String caption, boolean initialState) 

Source Link

Document

Creates a new checkbox with a caption and a set initial state.

Usage

From source file:HSE.Tables.Table_H_WorkPlan.java

public Table_H_WorkPlan(BeanItemContainer<WorkPlan> beanContainer, List list) {
    super(beanContainer, list);

    addGeneratedColumn("finished1", (final Table source, final Object row, Object column) -> {
        CheckBox cb = new CheckBox("", ((WorkPlan) row).getFinished());
        cb.setEnabled(false);// w w  w . j  a  va2s . c  o  m

        return cb;
    });

    setVisibleColumns("startDate1", "FK_FuelStation", "contractor", /*"subContractor", */
            /* "worktype", "termin", "duration", */ "finished1", "endDate1" /* ",comment" */);
    setColumnHeaders("Start date", "Fuel Station", "Contractor", /* "Subcontractor", */
            /* "Worktype", "Termin", "Duration", */ "Finished ?", "End Date" /*, "Comment" */);

    setColumnWidth("finished1", 80);
    setColumnAlignment("finished1", Align.CENTER);
    setColumnWidth("startDate1", 110);
}

From source file:jp.primecloud.auto.ui.ServerButtonsBottom.java

License:Open Source License

private void startButtonClick(Button.ClickEvent event) {
    final InstanceDto instance = (InstanceDto) sender.serverPanel.serverTable.getValue();
    PlatformDto platform = instance.getPlatform();

    // AWS??//  w w w.j  a v a2 s.c om
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatform().getPlatformType())) {
        // ????????
        if (BooleanUtils.isTrue(platform.getPlatformAws().getVpc())
                && StringUtils.isEmpty(instance.getAwsInstance().getSubnetId())) {
            throw new AutoApplicationException("IUI-000111");
        }
    }
    // Azure??
    else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatform().getPlatformType())) {
        // ????????
        if (StringUtils.isEmpty(instance.getAzureInstance().getSubnetId())) {
            throw new AutoApplicationException("IUI-000111");
        }

        // ?
        ProcessService processService = BeanContext.getBean(ProcessService.class);
        boolean startupErrFlg = processService.checkStartup(platform.getPlatform().getPlatformType(),
                instance.getAzureInstance().getInstanceName(), instance.getAzureInstance().getInstanceNo());
        if (startupErrFlg == true) {
            // ????????????
            // ?No???
            throw new AutoApplicationException("IUI-000133");
        }
    }

    // ?
    VerticalLayout optionLayout = null;
    final CheckBox checkBox;
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        optionLayout = new VerticalLayout();
        checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false);
        checkBox.setImmediate(true);
        optionLayout.addComponent(checkBox);
        optionLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_CENTER);
    } else {
        checkBox = null;
    }

    // ?
    String actionName = event.getButton().getDescription();
    String message = ViewMessages.getMessage("IUI-000013",
            new Object[] { instance.getInstance().getInstanceName(), actionName });
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancel, optionLayout);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }

            boolean startService = (checkBox == null) ? false : (Boolean) checkBox.getValue();
            start(instance.getInstance().getInstanceNo(), startService);
        }
    });

    getApplication().getMainWindow().addWindow(dialog);
}

From source file:jp.primecloud.auto.ui.ServerButtonsTop.java

License:Open Source License

private void startAllButtonClick(ClickEvent event) {
    // ?/*from   ww  w  . j a v a2  s . c  om*/
    VerticalLayout optionLayout = null;
    final CheckBox checkBox;
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        optionLayout = new VerticalLayout();
        checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false);
        checkBox.setImmediate(true);
        optionLayout.addComponent(checkBox);
        optionLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_CENTER);
    } else {
        checkBox = null;
    }

    // ?
    String message = ViewMessages.getMessage("IUI-000011");
    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 startService = (checkBox == null) ? false : (Boolean) checkBox.getValue();
            startAll(startService);
        }
    });

    getApplication().getMainWindow().addWindow(dialog);
}

From source file:jp.primecloud.auto.ui.ServerTable.java

License:Open Source License

public void playButtonClick(Button.ClickEvent event) {
    final InstanceDto dto = (InstanceDto) this.getValue();
    final int index = this.getCurrentPageFirstItemIndex();
    final PlatformDto platform = dto.getPlatform();

    ProcessService processService = BeanContext.getBean(ProcessService.class);

    boolean vpc = false;
    String subnetId = null;/*from ww w  .  j  a  v a  2  s .c  o  m*/
    boolean subnetErrFlg;
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatform().getPlatformType())) {
        // ??
        vpc = platform.getPlatformAws().getVpc();
        subnetId = dto.getAwsInstance().getSubnetId();
        subnetErrFlg = processService.checkSubnet(platform.getPlatform().getPlatformType(), vpc, subnetId);
        if (subnetErrFlg == true) {
            //EC2+VPC??????????
            DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"),
                    ViewMessages.getMessage("IUI-000111"));
            getApplication().getMainWindow().addWindow(dialog);
            return;
        }
    }
    if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatform().getPlatformType())) {
        // ??
        subnetId = dto.getAzureInstance().getSubnetId();
        subnetErrFlg = processService.checkSubnet(platform.getPlatform().getPlatformType(), vpc, subnetId);
        if (subnetErrFlg == true) {
            // ???????
            DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"),
                    ViewMessages.getMessage("IUI-000111"));
            getApplication().getMainWindow().addWindow(dialog);
            return;
        }
        // ?
        boolean startupErrFlg;
        startupErrFlg = processService.checkStartup(platform.getPlatform().getPlatformType(),
                dto.getAzureInstance().getInstanceName(), dto.getAzureInstance().getInstanceNo());
        if (startupErrFlg == true) {
            // ????????????
            // ?No???
            DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"),
                    ViewMessages.getMessage("IUI-000133"));
            getApplication().getMainWindow().addWindow(dialog);
            return;
        }
    }

    HorizontalLayout optionLayout = new HorizontalLayout();
    final CheckBox checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false);
    checkBox.setImmediate(true);
    optionLayout.addComponent(checkBox);

    String actionName = event.getButton().getDescription();
    String message = ViewMessages.getMessage("IUI-000013",
            new Object[] { dto.getInstance().getInstanceName(), actionName });
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancel, optionLayout);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }

            ProcessService processService = BeanContext.getBean(ProcessService.class);
            Long farmNo = ViewContext.getFarmNo();
            List<Long> list = new ArrayList<Long>();
            list.add(dto.getInstance().getInstanceNo());
            boolean startService = (Boolean) checkBox.getValue();

            //
            AutoApplication apl = (AutoApplication) getApplication();
            apl.doOpLog("SERVER", "Start Server", dto.getInstance().getInstanceNo(), null, null,
                    String.valueOf(startService));

            processService.startInstances(farmNo, list, startService);
            sender.refreshTable();

            // ?????????
            for (Object itemId : getItemIds()) {
                InstanceDto dto2 = (InstanceDto) itemId;
                if (dto.getInstance().getInstanceNo().equals(dto2.getInstance().getInstanceNo())) {
                    select(itemId);
                    setCurrentPageFirstItemIndex(index);
                    setButtonStatus(dto2.getInstance());
                    break;
                }
            }
        }
    });
    getApplication().getMainWindow().addWindow(dialog);
}

From source file:jp.primecloud.auto.ui.ServiceButtonsTop.java

License:Open Source License

private void stopAllButtonClick(ClickEvent event) {
    // ?//  w w w .  j  av a2  s.  co m
    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);
}

From source file:jp.primecloud.auto.ui.ServiceTable.java

License:Open Source License

public void stopButtonClick(Button.ClickEvent event) {
    final ComponentDto dto = (ComponentDto) this.getValue();
    final int index = this.getCurrentPageFirstItemIndex();

    HorizontalLayout optionLayout = new HorizontalLayout();
    final CheckBox checkBox = new CheckBox(ViewMessages.getMessage("IUI-000033"), false);
    checkBox.setImmediate(true);//from   w  ww  . java 2 s  .  c  o  m
    optionLayout.addComponent(checkBox);

    String message = ViewMessages.getMessage("IUI-000017", dto.getComponent().getComponentName());
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancel, optionLayout);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }
            ProcessService processService = BeanContext.getBean(ProcessService.class);
            Long farmNo = ViewContext.getFarmNo();
            List<Long> list = new ArrayList<Long>();
            list.add(dto.getComponent().getComponentNo());
            boolean stopInstance = (Boolean) checkBox.getValue();
            processService.stopComponents(farmNo, list, stopInstance);
            sender.refreshTable();

            // ????????
            for (Object itemId : getItemIds()) {
                ComponentDto dto2 = (ComponentDto) itemId;
                if (dto.getComponent().getComponentNo().equals(dto2.getComponent().getComponentNo())) {
                    select(itemId);
                    setCurrentPageFirstItemIndex(index);
                    setButtonStatus(dto2);
                    break;
                }
            }
        }
    });
    getApplication().getMainWindow().addWindow(dialog);
}

From source file:org.activiti.explorer.ui.management.processdefinition.ChangeProcessSuspensionStatePopupWindow.java

License:Apache License

protected void addTimeSection(boolean suspend) {
    Label timeLabel = new Label(
            suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION)
                    : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION));
    verticalLayout.addComponent(timeLabel);
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));

    nowCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_NOW), true);
    nowCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
    nowCheckBox.setImmediate(true);// www . j  a v  a  2s .c o  m
    nowCheckBox.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (nowCheckBox.booleanValue() == true) {
                dateField.setValue(null);
                dateCheckBox.setValue(false);
            } else {
                dateCheckBox.setValue(true);
                dateField.setValue(new Date());
            }
        }
    });
    verticalLayout.addComponent(nowCheckBox);

    HorizontalLayout dateLayout = new HorizontalLayout();
    verticalLayout.addComponent(dateLayout);

    dateCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DATE));
    dateCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
    dateCheckBox.setImmediate(true);
    dateCheckBox.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (dateCheckBox.booleanValue() == true) {
                dateField.setValue(new Date());
                nowCheckBox.setValue(false);
            } else {
                dateField.setValue(null);
                nowCheckBox.setValue(true);
            }
        }
    });
    dateLayout.addComponent(dateCheckBox);

    dateField = new DateField();
    dateField.setImmediate(true);
    dateField.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            if (dateField.getValue() != null) {
                nowCheckBox.setValue(false);
                dateCheckBox.setValue(true);
            }
        }

    });
    dateLayout.addComponent(dateField);
}

From source file:org.activiti.explorer.ui.management.processdefinition.ChangeProcessSuspensionStatePopupWindow.java

License:Apache License

protected void addIncludeProcessInstancesSection(boolean suspend) {
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));

    includeProcessInstancesCheckBox = new CheckBox(suspend
            ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION)
            : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION),
            true);/*from   w w w . ja v  a 2  s .  c o m*/
    verticalLayout.addComponent(includeProcessInstancesCheckBox);
}

From source file:org.eclipse.hawkbit.ui.distributions.disttype.CreateUpdateDistSetTypeLayout.java

License:Open Source License

@SuppressWarnings("unchecked")
private void addTargetTableforUpdate(final SoftwareModuleType swModuleType, final boolean mandatory) {

    if (selectedTableContainer == null) {
        return;/*  w  ww . j a  va 2s  .co  m*/
    }
    final Item saveTblitem = selectedTableContainer.addItem(swModuleType.getId());
    sourceTable.removeItem(swModuleType.getId());
    saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(swModuleType.getName());
    final CheckBox mandatoryCheckbox = new CheckBox("", mandatory);
    mandatoryCheckbox.setId(swModuleType.getName());
    saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(mandatoryCheckbox);

    final Item originalItem = originalSelectedTableContainer.addItem(swModuleType.getId());
    originalItem.getItemProperty(DIST_TYPE_NAME).setValue(swModuleType.getName());
    originalItem.getItemProperty(DIST_TYPE_MANDATORY).setValue(mandatoryCheckbox);

    window.updateAllComponents(mandatoryCheckbox);
}

From source file:org.eclipse.hawkbit.ui.distributions.disttype.UpdateDistributionSetTypeLayout.java

License:Open Source License

@SuppressWarnings("unchecked")
private void addTargetTableForUpdate(final SoftwareModuleType swModuleType, final boolean mandatory) {
    if (getTwinTables().getSelectedTableContainer() == null) {
        return;/*from ww w.j  a va 2  s .c om*/
    }
    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);
}