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) 

Source Link

Document

Creates a new checkbox with a set caption.

Usage

From source file:org.jumpmind.vaadin.ui.sqlexplorer.DbImportDialog.java

License:Open Source License

protected void createImportLayout() {
    importLayout = new VerticalLayout();
    importLayout.setSizeFull();//from w  ww.ja va  2 s  .  c o m
    importLayout.addStyleName("v-scrollable");
    importLayout.setMargin(true);
    importLayout.setSpacing(true);

    importLayout.addComponent(new Label("Please select from the following options"));

    FormLayout formLayout = new FormLayout();
    formLayout.setSizeFull();
    importLayout.addComponent(formLayout);
    importLayout.setExpandRatio(formLayout, 1);

    formatSelect = new ComboBox("Format");
    for (DbImportFormat format : DbImportFormat.values()) {
        formatSelect.addItem(format);
    }
    formatSelect.setNullSelectionAllowed(false);
    formatSelect.setValue(DbImportFormat.SQL);
    formatSelect.addValueChangeListener(new Property.ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            DbImportFormat format = (DbImportFormat) formatSelect.getValue();

            switch (format) {
            case SQL:
                listOfTablesSelect.setEnabled(false);
                alter.setEnabled(false);
                alterCase.setEnabled(false);
                break;
            case XML:
                listOfTablesSelect.setEnabled(false);
                alter.setEnabled(true);
                alterCase.setEnabled(true);
                break;
            case CSV:
                listOfTablesSelect.setEnabled(true);
                alter.setEnabled(false);
                alterCase.setEnabled(false);
                importButton.setEnabled(importButtonEnable());
                break;
            case SYM_XML:
                listOfTablesSelect.setEnabled(false);
                alter.setEnabled(false);
                alterCase.setEnabled(false);
                break;
            }
        }
    });
    formLayout.addComponent(formatSelect);

    catalogSelect = new ComboBox("Catalog");
    catalogSelect.setImmediate(true);
    CommonUiUtils.addItems(getCatalogs(), catalogSelect);
    catalogSelect.select(databasePlatform.getDefaultCatalog());
    catalogSelect.setNullSelectionAllowed(false);
    formLayout.addComponent(catalogSelect);

    schemaSelect = new ComboBox("Schema");
    schemaSelect.setImmediate(true);
    CommonUiUtils.addItems(getSchemas(), schemaSelect);
    if (selectedTablesSet.iterator().hasNext()) {
        schemaSelect.select(selectedTablesSet.iterator().next().getSchema());
    } else {
        schemaSelect.select(databasePlatform.getDefaultSchema());
    }
    schemaSelect.setNullSelectionAllowed(false);
    schemaSelect.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            populateListOfTablesSelect();
        }
    });
    formLayout.addComponent(schemaSelect);

    listOfTablesSelect = new ComboBox("Tables");
    populateListOfTablesSelect();
    listOfTablesSelect.setEnabled(false);
    listOfTablesSelect.setNullSelectionAllowed(false);

    if (!this.selectedTablesSet.isEmpty()) {
        if (this.selectedTablesSet.size() == 1) {
            this.selectedTable = this.selectedTablesSet.iterator().next();
            listOfTablesSelect.select(this.selectedTable.getName());
            this.selectedTablesSet.clear();
        } else {
            List<Table> list = new ArrayList<Table>(this.selectedTablesSet);
            listOfTablesSelect.select(list.get(0).getName());
            this.selectedTable = list.get(0);
            this.selectedTablesSet.clear();
        }
    }
    formLayout.addComponent(listOfTablesSelect);

    commitField = new TextField("Rows to Commit");
    commitField.addTextChangeListener(new TextChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            commitField.setValue(event.getText());
            if (fileSelected) {
                importButton.setEnabled(importButtonEnable());
            }
        }
    });
    commitField.setImmediate(true);
    commitField.setTextChangeEventMode(TextChangeEventMode.EAGER);
    commitField.setValue("10000");
    formLayout.addComponent(commitField);

    force = new CheckBox("Force");
    formLayout.addComponent(force);

    ignore = new CheckBox("Ignore");
    formLayout.addComponent(ignore);

    replace = new CheckBox("Replace");
    formLayout.addComponent(replace);

    alter = new CheckBox("Alter");
    alter.setEnabled(false);
    formLayout.addComponent(alter);

    alterCase = new CheckBox("Alter Case");
    alterCase.setEnabled(false);
    formLayout.addComponent(alterCase);

    upload = new Upload("File", new Receiver() {

        private static final long serialVersionUID = 1L;

        @Override
        public OutputStream receiveUpload(String filename, String mimeType) {
            try {
                file = File.createTempFile("dbimport", formatSelect.getValue().toString());
                out = new FileOutputStream(file);
                return new BufferedOutputStream(new FileOutputStream(file));
            } catch (Exception e) {
                log.warn(e.getMessage(), e);
                CommonUiUtils.notify("Failed to import " + filename, e);
            }
            return null;
        }
    });
    upload.addSucceededListener(new SucceededListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void uploadSucceeded(SucceededEvent event) {
            createDbImport();
            try {
                doDbImport();
            } catch (FileNotFoundException e) {
                log.warn(e.getMessage(), e);
                Notification.show(e.getMessage());
            }
            deleteFileAndResource();
            close();
        }
    });
    upload.addChangeListener(new ChangeListener() {

        private static final long serialVersionUID = 1L;

        public void filenameChanged(ChangeEvent event) {
            fileSelected = true;
            importButton.setEnabled(importButtonEnable());
        }
    });
    upload.setButtonCaption(null);
    formLayout.addComponent(upload);

    cancelButton = new Button("Cancel", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(DbImportDialog.this);
        }
    });

    importButton = CommonUiUtils.createPrimaryButton("Import", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            upload.submitUpload();
        }
    });
    importButton.setEnabled(false);

    addComponent(importLayout, 1);
    addComponent(buildButtonFooter(cancelButton, importButton));
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.SettingsDialog.java

License:Open Source License

protected AbstractLayout createSettingsLayout() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();//from  ww  w .  j  a v  a  2 s .  c om
    layout.setMargin(new MarginInfo(false, true, false, true));
    layout.addStyleName("v-scrollable");
    FormLayout settingsLayout = new FormLayout();

    Settings settings = settingsProvider.get();
    TypedProperties properties = settings.getProperties();

    rowsToFetchField = new TextField("Max Results");
    rowsToFetchField.setColumns(6);
    rowsToFetchField.setValidationVisible(true);
    rowsToFetchField.setConverter(Integer.class);
    rowsToFetchField.setValue(properties.getProperty(SQL_EXPLORER_MAX_RESULTS, "100"));
    settingsLayout.addComponent(rowsToFetchField);

    delimiterField = new TextField("Delimiter");
    delimiterField.setValue(properties.getProperty(SQL_EXPLORER_DELIMITER, ";"));
    settingsLayout.addComponent(delimiterField);

    excludeTablesWithPrefixField = new TextField("Hide Tables (regex)");
    excludeTablesWithPrefixField.setValue(properties.getProperty(SQL_EXPLORER_EXCLUDE_TABLES_REGEX));
    settingsLayout.addComponent(excludeTablesWithPrefixField);

    resultAsTextBox = new CheckBox("Result As Text");
    String resultAsTextValue = (properties.getProperty(SQL_EXPLORER_RESULT_AS_TEXT, "false"));
    if (resultAsTextValue.equals("true")) {
        resultAsTextBox.setValue(true);
    } else {
        resultAsTextBox.setValue(false);
    }
    settingsLayout.addComponent(resultAsTextBox);

    ignoreErrorsWhenRunningScript = new CheckBox("Ignore Errors When Running Scripts");
    String ignoreErrorsWhenRunningScriptTextValue = (properties
            .getProperty(SQL_EXPLORER_IGNORE_ERRORS_WHEN_RUNNING_SCRIPTS, "false"));
    if (ignoreErrorsWhenRunningScriptTextValue.equals("true")) {
        ignoreErrorsWhenRunningScript.setValue(true);
    } else {
        ignoreErrorsWhenRunningScript.setValue(false);
    }
    settingsLayout.addComponent(ignoreErrorsWhenRunningScript);

    autoCommitBox = new CheckBox("Auto Commit");
    String autoCommitValue = (properties.getProperty(SQL_EXPLORER_AUTO_COMMIT, "true"));
    if (autoCommitValue.equals("true")) {
        autoCommitBox.setValue(true);
    } else {
        autoCommitBox.setValue(false);
    }
    settingsLayout.addComponent(autoCommitBox);

    showRowNumbersBox = new CheckBox("Show Row Numbers");
    String showRowNumbersValue = (properties.getProperty(SQL_EXPLORER_SHOW_ROW_NUMBERS, "true"));
    if (showRowNumbersValue.equals("true")) {
        showRowNumbersBox.setValue(true);
    } else {
        showRowNumbersBox.setValue(false);
    }
    settingsLayout.addComponent(showRowNumbersBox);

    showResultsInNewTabsBox = new CheckBox("Always Put Results In New Tabs");
    String showResultsInNewTabsValue = (properties.getProperty(SQL_EXPLORER_SHOW_RESULTS_IN_NEW_TABS, "false"));
    if (showResultsInNewTabsValue.equals("true")) {
        showResultsInNewTabsBox.setValue(true);
    } else {
        showResultsInNewTabsBox.setValue(false);
    }
    settingsLayout.addComponent(showResultsInNewTabsBox);

    layout.addComponent(settingsLayout);
    return layout;

}

From source file:org.lunifera.examples.runtime.web.vaadin.databinding.DatabindingDemoUI.java

License:Open Source License

private void row2(GridLayout layout) {
    CheckBox readonly = new CheckBox("readonly");
    readonly.setImmediate(true);/*from  w  w  w .j  a  v  a 2s  .  co  m*/
    readonly.setBuffered(false);

    TextField textField = new TextField("field2");
    textField.setImmediate(true);
    textField.setBuffered(false);

    layout.addComponent(readonly, 0, 1);
    layout.addComponent(textField, 1, 1);

    dbc.bindValue(VaadinObservables.observeReadonly(textField), VaadinObservables.observeValue(readonly));
}

From source file:org.lunifera.examples.runtime.web.vaadin.databinding.DatabindingDemoUI.java

License:Open Source License

private void row3(GridLayout layout) {
    CheckBox required = new CheckBox("required");
    required.setImmediate(true);/*from w w  w . jav  a  2  s  .co  m*/
    required.setBuffered(false);

    TextField requiredError = new TextField("requiredError");
    requiredError.setImmediate(true);
    requiredError.setBuffered(false);

    TextField input = new TextField("input");
    input.setImmediate(true);
    input.setBuffered(false);
    input.setValidationVisible(true);

    layout.addComponent(required, 0, 2);
    layout.addComponent(requiredError, 1, 2);
    layout.addComponent(input, 2, 2);

    IVaadinModelObservableValue value_requiredObservable = VaadinObservables.observeValue(required);
    IVaadinModelObservableValue value_errorString = VaadinObservables.observeValue(requiredError);
    IVaadinModelObservableValue readonly_errorString = VaadinObservables.observeReadonly(requiredError);

    IVaadinComponentObservableValue required_Input = VaadinObservables.observeRequired(input);
    IVaadinComponentObservableValue errorMessage_Input = VaadinObservables.observeRequiredError(input);

    dbc.bindValue(value_requiredObservable, required_Input);
    dbc.bindValue(value_requiredObservable, readonly_errorString);
    dbc.bindValue(value_errorString, errorMessage_Input);
}

From source file:org.milleni.dunning.ui.prcstart.BulkDunningProcessStartPanel.java

License:Apache License

protected void initSettingsProperties() {
    panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);/*ww w. j a  v a2  s  .c  o  m*/
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(panelLayout);

    processDate = new DateField("Sre Balama Zaman");
    panelLayout.addComponent(processDate);
    // Database type

    textArea = new TextArea("");
    textArea.setRequired(true);
    textArea.setEnabled(true);
    textArea.setRows(10);
    textArea.setColumns(50);
    check = new CheckBox("Gn gemi stepi yapma");
    panelLayout.addComponent(check);
    panelLayout.addComponent(textArea);

    Button claimButton = new Button("Balat");
    claimButton.setIcon(Images.EXECUTE);
    claimButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            String customerIds = (String) textArea.getValue();
            Date processDateValue = (Date) processDate.getValue();

            boolean startStepFirst = false;
            if ((Boolean) check.getValue()) {
                startStepFirst = true;
            }

            String[] customerIdArray = customerIds.split("\n");
            List<Long> customerIdList = new ArrayList<Long>();
            for (String strCustomerId : customerIdArray) {
                strCustomerId = strCustomerId.trim();
                if (StringUtils.hasText(strCustomerId)) {
                    customerIdList.add(Long.parseLong(strCustomerId));
                }
            }

            for (Long customerId : customerIdList) {
                Map<String, Object> variables = new HashMap<String, Object>();
                variables.put(Constants.customerId, customerId);
                if (loggedInUser != null)
                    variables.put(Constants.user, loggedInUser.getFullName());
                if (startStepFirst)
                    variables.put(Constants.firstStepNext, true);
                if (processDateValue != null)
                    variables.put(Constants.processStartDate, processDateValue);
                runtimeService.startProcessInstanceByKey(Constants.FL100_DunningProcessInitializer, variables);
            }
            textArea.setValue("");
        }
    });

    panelLayout.addComponent(claimButton);
}

From source file:org.milleni.dunning.ui.prcstart.StepSelectStartDunningProcessPanel.java

License:Apache License

protected void initSettingsProperties() {
    panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);//www .  j  a v a2 s. co  m
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(panelLayout);

    processDate = new DateField("Sre Balama Zaman");
    panelLayout.addComponent(processDate);
    // Database type

    textArea = new TextArea("");
    textArea.setRequired(true);
    textArea.setEnabled(true);
    textArea.setRows(10);
    textArea.setColumns(50);
    check = new CheckBox("Gn gemi stepi yapma");

    panelLayout.addComponent(policyCombo);
    panelLayout.addComponent(stepCombo);
    panelLayout.addComponent(textArea);

    Button claimButton = new Button("Balat");
    claimButton.setIcon(Images.EXECUTE);
    claimButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (selectedProcessStep == null)
                throw new RuntimeException("Adm bo olamaz");
            String customerIds = (String) textArea.getValue();
            Date processDateValue = (Date) processDate.getValue();

            String[] customerIdArray = customerIds.split("\n");
            List<Long> customerIdList = new ArrayList<Long>();
            for (String strCustomerId : customerIdArray) {
                strCustomerId = strCustomerId.trim();
                if (StringUtils.hasText(strCustomerId)) {
                    customerIdList.add(Long.parseLong(strCustomerId));
                }
            }

            for (Long customerId : customerIdList) {
                Map<String, Object> variables = new HashMap<String, Object>();
                variables.put(Constants.customerId, customerId);
                if (loggedInUser != null)
                    variables.put(Constants.user, loggedInUser.getFullName());
                if (processDateValue != null)
                    variables.put(Constants.processStartDate, processDateValue);

                if (selectedProcessStep != null) {
                    variables.put(Constants.userSelectedProcessStep, selectedProcessStep.getStepId());
                }
                runtimeService.startProcessInstanceByKey(Constants.FL100_DunningProcessInitializer, variables);
            }
            textArea.setValue("");
        }
    });

    panelLayout.addComponent(claimButton);

}

From source file:org.mpavel.app.views.LoginView.java

License:Apache License

public LoginView(final String fragmentAndParameters) {
    setCaption("Login");

    VerticalLayout layout = new VerticalLayout();
    final TextField username = new TextField("Username");
    layout.addComponent(username);// w  w w .ja  v a2  s  .c  o m

    final PasswordField password = new PasswordField("Password");
    layout.addComponent(password);

    final CheckBox rememberMe = new CheckBox("Remember Me");
    layout.addComponent(rememberMe);

    username.focus();

    // TODO: Remove these two lines before production release
    username.setValue("admin");
    password.setValue("admin");

    if (ApplicationSecurity.isRemembered()) {
        username.setValue(ApplicationSecurity.whoIsRemembered());
        rememberMe.setValue(ApplicationSecurity.isRemembered());
        password.focus();
    }

    @SuppressWarnings("serial")
    final Button login = new Button("Login", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final Navigator navigator = UI.getCurrent().getNavigator();
            if (ApplicationSecurity.login(username.getValue(), password.getValue(), rememberMe.getValue())) {
                final String location = (fragmentAndParameters == null) ? ApplicationView.NAME
                        : fragmentAndParameters;

                navigator.navigateTo(location);
            } else {
                navigator.navigateTo(LoginView.NAME);
            }
        }
    });
    layout.addComponent(login);
    setContent(layout);
}

From source file:org.opencms.ui.dialogs.CmsCopyMoveDialog.java

License:Open Source License

/**
 * Initializes the form fields.<p>
 *
 * @return the form component//  ww w .  j  a  va 2s  . co  m
 */
private FormLayout initForm() {

    FormLayout form = new FormLayout();
    form.setWidth("100%");
    m_targetPath = new CmsPathSelectField();
    m_targetPath.setCaption(
            CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_TARGET_0));
    m_targetPath.setFileSelectCaption(
            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_SELECT_TARGET_CAPTION_0));
    m_targetPath.setResourceFilter(CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireFolder());
    m_targetPath.setWidth("100%");
    form.addComponent(m_targetPath);

    if (m_dialogMode != DialogMode.move) {
        m_actionCombo = new ComboBox();
        m_actionCombo
                .setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_COPYPAGE_COPY_MODE_0));
        m_actionCombo.setNullSelectionAllowed(false);
        m_actionCombo.setNewItemsAllowed(false);
        m_actionCombo.setWidth("100%");
        //            m_actionCombo.addItem(Action.automatic);
        //            m_actionCombo.setItemCaption(
        //                Action.automatic,
        //                CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_AUTOMATIC_0));
        //            m_actionCombo.setValue(Action.automatic);
        if (m_context.getResources().size() == 1) {
            if (m_context.getResources().get(0).isFile()) {
                m_actionCombo.addItem(Action.copy_all);
                m_actionCombo.setItemCaption(Action.copy_all, CmsVaadinUtils
                        .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_AS_NEW_0));
                m_actionCombo.addItem(Action.copy_sibling_all);
                m_actionCombo.setItemCaption(Action.copy_sibling_all, CmsVaadinUtils
                        .getMessageText(org.opencms.workplace.commons.Messages.GUI_CREATE_SIBLING_0));
                if (m_dialogMode == DialogMode.copy_and_move) {
                    m_actionCombo.addItem(Action.move);
                    m_actionCombo.setItemCaption(Action.move, CmsVaadinUtils
                            .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_MOVE_FILE_0));
                }
            } else {
                CmsResource folder = m_context.getResources().get(0);
                m_hasContainerPageDefaultFile = hasContainerPageDefaultFile(folder);
                if (m_hasContainerPageDefaultFile) {
                    m_actionCombo.addItem(Action.container_page_automatic);
                    m_actionCombo.setItemCaption(Action.container_page_automatic,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_AUTOMATIC_0));
                    m_actionCombo.addItem(Action.container_page_copy);
                    m_actionCombo.setItemCaption(Action.container_page_copy,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_CONTAINERPAGE_COPY_0));
                    m_actionCombo.addItem(Action.container_page_reuse);
                    m_actionCombo.setItemCaption(Action.container_page_reuse,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_CONTAINERPAGE_REUSE_0));
                }
                if (CmsResourceTypeFolderSubSitemap.isSubSitemap(folder)) {
                    m_actionCombo.addItem(Action.sub_sitemap);
                    m_actionCombo.setItemCaption(Action.sub_sitemap,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_SUBSITEMAP_0));
                }
                m_actionCombo.addItem(Action.copy_sibling_mixed);
                m_actionCombo.setItemCaption(Action.copy_sibling_mixed, CmsVaadinUtils
                        .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_NO_SIBLINGS_0));
                m_actionCombo.addItem(Action.copy_all);
                m_actionCombo.setItemCaption(Action.copy_all,
                        CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_0));
                m_actionCombo.addItem(Action.copy_sibling_all);
                m_actionCombo.setItemCaption(Action.copy_sibling_all, CmsVaadinUtils.getMessageText(
                        org.opencms.workplace.commons.Messages.GUI_COPY_MULTI_CREATE_SIBLINGS_0));
                if (m_dialogMode == DialogMode.copy_and_move) {
                    m_actionCombo.addItem(Action.move);
                    m_actionCombo.setItemCaption(Action.move, CmsVaadinUtils.getMessageText(
                            org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_MOVE_FOLDER_0));
                }
            }
        } else {
            m_actionCombo.addItem(Action.copy_sibling_mixed);
            m_actionCombo.setItemCaption(Action.copy_sibling_mixed, CmsVaadinUtils
                    .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_NO_SIBLINGS_0));
            m_actionCombo.addItem(Action.copy_all);
            m_actionCombo.setItemCaption(Action.copy_all,
                    CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_0));
            m_actionCombo.addItem(Action.copy_sibling_all);
            m_actionCombo.setItemCaption(Action.copy_sibling_all, CmsVaadinUtils
                    .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MULTI_CREATE_SIBLINGS_0));
            if (m_dialogMode == DialogMode.copy_and_move) {
                m_actionCombo.addItem(Action.move);
                m_actionCombo.setItemCaption(Action.move, CmsVaadinUtils
                        .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_MOVE_RESOURCES_0));
            }
        }
        m_actionCombo.setItemStyleGenerator(new ItemStyleGenerator() {

            private static final long serialVersionUID = 1L;

            public String getStyle(ComboBox source, Object itemId) {

                String style = null;
                if (m_defaultActions.contains(itemId)) {
                    style = "bold";
                }
                return style;
            }
        });
        form.addComponent(m_actionCombo);
    }
    if (m_context.getResources().size() > 1) {
        m_overwriteExisting = new CheckBox(CmsVaadinUtils
                .getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MULTI_OVERWRITE_0));
        m_overwriteExisting.setValue(Boolean.FALSE);
        form.addComponent(m_overwriteExisting);
    }

    return form;
}

From source file:org.opencms.ui.dialogs.CmsPublishScheduledDialog.java

License:Open Source License

/**
 * Initializes the form fields.<p>
 *
 * @return the form component/*  w  ww  . jav  a2 s  . c om*/
 */
private FormLayout initForm() {

    FormLayout form = new FormLayout();
    form.setWidth("100%");
    m_dateField = new CmsDateField();
    m_dateField.setCaption(CmsVaadinUtils
            .getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_DATE_PUBLISH_SCHEDULED_0));
    form.addComponent(m_dateField);
    m_includeSubResources = new CheckBox(CmsVaadinUtils
            .getMessageText(org.opencms.workplace.commons.Messages.GUI_PUBLISH_MULTI_SUBRESOURCES_0));
    if (hasFolders()) {
        form.addComponent(m_includeSubResources);
    }

    return form;
}

From source file:org.opennms.features.jmxconfiggenerator.webui.ui.mbeans.NameEditForm.java

License:Open Source License

public NameEditForm(MBeansController controller, final FormParameter parameter) {
    this.controller = controller;
    this.parameter = parameter;
    setFormFieldFactory(new FormFieldFactory() {
        @Override/*w  ww .  j av a  2  s .  com*/
        public Field<?> createField(Item item, Object propertyId, Component uiContext) {
            if (propertyId.toString().equals(MetaMBeanItem.SELECTED)) {
                CheckBox c = new CheckBox(MetaMBeanItem.SELECTED);
                return c;
            }
            if (propertyId.toString().equals(parameter.getNonEditablePropertyName())) {
                final TextField tf = new TextField(parameter.getNonEditablePropertyName()) {
                    @Override
                    public void setReadOnly(boolean readOnly) {
                        super.setReadOnly(true); // never ever edit me
                    }
                };
                tf.setWidth(100, UNITS_PERCENTAGE);
                return tf;
            }
            if (propertyId.toString().equals(parameter.getEditablePropertyName())) {
                TextField tf = new TextField(parameter.getEditablePropertyName());
                tf.setWidth(100, UNITS_PERCENTAGE);
                tf.setValidationVisible(true);
                tf.setRequired(true);
                tf.setRequiredError("You must provide a name.");
                tf.addValidator(nameValidator);
                return tf;
            }
            return null;
        }
    });
    setWidth(100, Unit.PERCENTAGE);
    setHeight(Config.NAME_EDIT_FORM_HEIGHT + (parameter.hasFooter() ? 0 : -60), Unit.PIXELS);
    setReadOnly(true);
    setImmediate(true);
    setBuffered(true);
    if (parameter.hasFooter())
        setFooter(footer);
    addFooterHooks();
    setCaption(parameter.getCaption());
    setVisibleItemProperties(parameter.getVisiblePropertieNames());
}