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() 

Source Link

Document

Creates a new checkbox.

Usage

From source file:de.catma.ui.analyzer.MarkupResultPanel.java

License:Open Source License

private CheckBox createCheckbox(final TreeEntrySelectionHandler treeEntrySelectionHandler) {
    final CheckBox cbShowInKwicView = new CheckBox();
    cbShowInKwicView.setImmediate(true);
    cbShowInKwicView.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            boolean selected = cbShowInKwicView.booleanValue();

            fireShowInKwicViewSelected(treeEntrySelectionHandler, selected);
        }/*from   w  w w  .  j av  a 2  s  .c o  m*/
    });
    return cbShowInKwicView;
}

From source file:de.catma.ui.analyzer.PhraseResultPanel.java

License:Open Source License

private CheckBox createKwicCheckbox(final GroupedQueryResult phraseResult) {
    final CheckBox cbShowInKwicView = new CheckBox();
    cbShowInKwicView.setImmediate(true);
    cbShowInKwicView.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            boolean selected = (Boolean) event.getProperty().getValue();

            fireShowInKwicViewSelected(phraseResult, selected);
        }/*from  w w  w.j a  v a  2 s.c  o  m*/

    });
    return cbShowInKwicView;
}

From source file:de.catma.ui.repository.CorpusContentSelectionDialog.java

License:Open Source License

private CheckBox createCheckBox(final boolean editable) {
    CheckBox cb = new CheckBox();

    cb.setValue(true);// w  ww .  jav a  2 s .  c o m
    cb.setImmediate(true);

    cb.addValidator(new Validator() {

        public boolean isValid(Object value) {
            return editable || ((Boolean) value);
        }

        public void validate(Object value) throws InvalidValueException {
            if (!editable && !(Boolean) value) {
                throw new InvalidValueException("Source Document has to be included!");
            }
        }
    });

    cb.setInvalidAllowed(false);

    return cb;
}

From source file:de.catma.ui.tagger.MarkupCollectionsPanel.java

License:Open Source License

private CheckBox createCheckbox(final TagsetDefinition tagsetDefinition) {
    CheckBox cbShowTagInstances = new CheckBox();
    cbShowTagInstances.setImmediate(true);
    cbShowTagInstances.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            boolean selected = event.getButton().booleanValue();
            for (TagDefinition tagDefinition : tagsetDefinition) {
                if (tagDefinition.getParentUuid().isEmpty()) {
                    Item tagDefItem = markupCollectionsTree.getItem(tagDefinition);
                    Property visibleProp = tagDefItem.getItemProperty(MarkupCollectionsTreeProperty.visible);
                    CheckBox cb = (CheckBox) visibleProp.getValue();
                    cb.setValue(selected);
                    fireTagDefinitionSelected(tagDefinition, selected);
                }/*  ww w  .  j  av  a2  s . c o m*/
            }
        }
    });
    return cbShowTagInstances;
}

From source file:de.catma.ui.tagger.MarkupCollectionsPanel.java

License:Open Source License

private CheckBox createCheckbox(final TagDefinition tagDefinition) {
    CheckBox cbShowTagInstances = new CheckBox();
    cbShowTagInstances.setImmediate(true);
    cbShowTagInstances.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            boolean selected = event.getButton().booleanValue();

            fireTagDefinitionSelected(tagDefinition, selected);
        }/* w ww.  ja va  2  s . c  o  m*/

    });
    return cbShowTagInstances;
}

From source file:de.catma.ui.tagger.MarkupCollectionsPanel.java

License:Open Source License

private CheckBox createCheckbox(final UserMarkupCollection userMarkupCollection) {

    CheckBox cbIsWritableUserMarkupColl = new CheckBox();
    cbIsWritableUserMarkupColl.setImmediate(true);
    cbIsWritableUserMarkupColl.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {

            boolean selected = event.getButton().booleanValue();
            handleUserMarkupCollectionSelectionRequest(selected, userMarkupCollection);
        }//from w w  w . j  a v  a2s. c  om
    });
    return cbIsWritableUserMarkupColl;
}

From source file:de.decidr.ui.view.ProfileSettingsComponent.java

License:Apache License

/**
 * This method initializes the components of the
 * {@link ProfileSettingsComponent}.// w  ww . ja va 2s .  c om
 */
private void init() {
    settingsForm.setWriteThrough(false);
    settingsItem = new BeanItem(user.getUserProfile(), properties);
    settingsForm.setItemDataSource(settingsItem);
    settingsForm.setFormFieldFactory(new SettingsFieldFactory());

    settingsForm.setVisibleItemProperties(properties);

    addressPanel = new Panel();
    usernamePanel = new Panel();
    profileButtonPanel = new Panel();

    usernameGridLayout = new GridLayout(2, 2);
    verticalLayout = new VerticalLayout();
    addressVerticalLayout = new VerticalLayout();
    profileButtonHorizontalLayout = new HorizontalLayout();

    myProfileLabel = new Label("<h2> My Profile </h2>");
    myProfileLabel.setContentMode(Label.CONTENT_XHTML);
    usernameLabel = new Label("Username: ");
    emailLabel = new Label("Email address: ");
    usernameNameLabel = new Label(user.getUserProfile().getUsername());
    emailNameLabel = new Label(user.getEmail());

    changeEmailLink = new Button("Change email", new ShowChangeEmailAction());
    changeEmailLink.setStyleName(Button.STYLE_LINK);
    changePasswordLink = new Button("Change password", new ShowChangePasswordAction());
    changePasswordLink.setStyleName(Button.STYLE_LINK);
    leaveTenantLink = new Button("Leave tenant", new ShowLeaveTenantDialogAction());
    leaveTenantLink.setStyleName(Button.STYLE_LINK);

    saveButton = new Button("Save", new SaveProfileAction());
    settingsForm.addField("button", saveButton);

    statusCheckBox = new CheckBox();
    statusCheckBox.setValue(user.getUnavailableSince() != null ? true : false);
    statusCheckBox.addListener(new ChangeStatusAction(user.getId()));
    statusCheckBox.setImmediate(true);

    this.setCompositionRoot(verticalLayout);

    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(myProfileLabel);
    verticalLayout.addComponent(usernamePanel);

    usernamePanel.addComponent(usernameGridLayout);
    usernameGridLayout.setSpacing(true);
    usernameGridLayout.addComponent(usernameLabel, 0, 0);
    usernameGridLayout.addComponent(usernameNameLabel, 1, 0);
    usernameGridLayout.addComponent(emailLabel, 0, 1);
    usernameGridLayout.addComponent(emailNameLabel, 1, 1);

    verticalLayout.addComponent(profileButtonPanel);

    profileButtonPanel.addComponent(profileButtonHorizontalLayout);
    profileButtonHorizontalLayout.setSpacing(true);
    profileButtonHorizontalLayout.addComponent(changeEmailLink);
    profileButtonHorizontalLayout.addComponent(changePasswordLink);
    profileButtonHorizontalLayout.addComponent(leaveTenantLink);
    profileButtonHorizontalLayout.addComponent(statusCheckBox);
    statusCheckBox.setCaption("Set my status to unavailable");
    profileButtonHorizontalLayout.setComponentAlignment(statusCheckBox, Alignment.TOP_RIGHT);

    verticalLayout.addComponent(addressPanel);

    addressPanel.addComponent(addressVerticalLayout);

    addressVerticalLayout.setSpacing(true);
    addressVerticalLayout.addComponent(settingsForm);
}

From source file:de.decidr.ui.view.windows.StartConfigurationWindow.java

License:Apache License

private void init() {
    VerticalLayout mainVerticalLayout = new VerticalLayout();
    HorizontalLayout buttonHorizontalLayout = new HorizontalLayout();
    checkBox = new CheckBox();

    this.setContent(mainVerticalLayout);

    this.setCaption("Start configuration window");
    this.setModal(true);
    this.setWidth("800px");
    this.setHeight("500px");
    this.setResizable(false);

    mainVerticalLayout.setSpacing(true);
    mainVerticalLayout.setMargin(true);//from  w w  w. j a  va 2 s  .  c  om

    if (workflow.getVariables() != null && workflow.getVariables().getVariable().size() > 0) {
        configVariableForm = new ConfigVariableForm(workflow.getVariables());
        configVariableForm.setCaption("Configuration variables");
        configVariableForm.setWriteThrough(false);
        configVariableForm.setInvalidCommitted(false);
    }

    if (workflow.getRoles() != null) {
        configRoles = new ConfigRoles(workflow.getRoles());
    }

    if (configRoles != null && configVariableForm != null) {
        // Set up split panel.
        SplitPanel splitPanel = new SplitPanel();
        splitPanel.setOrientation(SplitPanel.ORIENTATION_HORIZONTAL);
        splitPanel.setSplitPosition(450, Sizeable.UNITS_PIXELS);
        splitPanel.setHeight("400px");
        splitPanel.setLocked(true);

        splitPanel.setFirstComponent(configRoles);
        splitPanel.setSecondComponent(configVariableForm);

        mainVerticalLayout.addComponent(splitPanel);
    } else {
        // At least one of the components is unneeded, so no split panel
        this.setWidth("600px");
        if (configRoles != null) {
            mainVerticalLayout.addComponent(configRoles);
        } else if (configVariableForm != null) {
            mainVerticalLayout.addComponent(configVariableForm);
        }
    }

    okButton = new Button("OK", new SaveStartConfigurationAction(configRoles, configVariableForm,
            tConfiguration, workflowModelId, checkBox.booleanValue()));
    cancelButton = new Button("Cancel", new HideDialogWindowAction());
    mainVerticalLayout.addComponent(buttonHorizontalLayout);

    buttonHorizontalLayout.setSpacing(true);
    buttonHorizontalLayout.addComponent(checkBox);
    checkBox.setCaption("Start Immediately");
    buttonHorizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_RIGHT);
    buttonHorizontalLayout.addComponent(okButton);
    buttonHorizontalLayout.addComponent(cancelButton);
}

From source file:de.escidoc.admintool.view.user.UserEditForm.java

License:Open Source License

private void addActiveStatusCheckBox() {
    activeStatus = new CheckBox();
    activeStatus.setWriteThrough(false);
    panel.addComponent(LayoutHelper.create(ViewConstants.ACTIVE_STATUS, activeStatus, LABEL_WIDTH, false));
}

From source file:de.metas.ui.web.vaadin.window.components.FieldEditorFactory.java

License:Open Source License

public Field<?> createEditor(final DataFieldPropertyDescriptor descriptor) {
    final int displayType = descriptor.getDisplayType();
    final int adReferenceId = descriptor.getAD_Reference_Value_ID();
    String caption = descriptor.getCaption();

    final Field<?> field;
    if (displayType == DisplayType.List || displayType == DisplayType.Button && adReferenceId > 0) {
        field = createField_ComboBox(descriptor);
    } else if (displayType == DisplayType.TableDir || displayType == DisplayType.Table) {
        field = createField_ComboBox(descriptor);
    } else if (displayType == DisplayType.Search) {
        field = createField_LazyComboBox(descriptor);
    } else if (descriptor.isLongTextField()) {
        final TextArea textArefield = new TextArea();
        field = textArefield;/*from  w  ww  . j a v a2s .  co  m*/
    } else if (DisplayType.isText(displayType)) {
        final TextField textField = new TextField();
        field = textField;
    } else if (DisplayType.isDate(displayType)) {
        final DateField dateField = new DateField();
        field = dateField;
    } else if (DisplayType.isNumeric(displayType)) {
        final TextField textField = new TextField();
        field = textField;
    } else if (DisplayType.YesNo == displayType) {
        final CheckBox checkbox = new CheckBox();
        if (gridMode) {
            caption = "";
        }
        field = checkbox;
    } else {
        // final Class<?> type = DisplayType.getClass(displayType, true);
        // field = defaultFieldFactory.createField(type, Field.class);
        field = null;
    }

    if (field == null) {
        return null;
    }

    field.setCaption(caption);
    return field;
}