Search in sources :

Example 26 with ValueChangeEvent

use of com.vaadin.v7.data.Property.ValueChangeEvent in project opencms-core by alkacon.

the class CmsLogicalCheckboxGroup method add.

/**
 * Adds a check box to the group.<p>
 *
 * @param checkBox the check box to add
 */
public void add(final CheckBox checkBox) {
    checkBox.setValue(Boolean.FALSE);
    m_checkboxes.add(checkBox);
    ValueChangeListener listener = new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("synthetic-access")
        public void valueChange(ValueChangeEvent event) {
            if (m_runningEvent) {
                return;
            } else {
                try {
                    m_runningEvent = true;
                    if (((Boolean) event.getProperty().getValue()).booleanValue()) {
                        if ((m_selected != null) && (m_selected != checkBox)) {
                            m_selected.setValue(Boolean.FALSE);
                        }
                        setActiveCheckBox(checkBox);
                    } else {
                        setActiveCheckBox(null);
                        m_selected = null;
                    }
                // TODO Auto-generated method stub
                } finally {
                    m_runningEvent = false;
                }
            }
        }
    };
    checkBox.addValueChangeListener(listener);
    m_listeners.put(checkBox, listener);
}
Also used : ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener)

Example 27 with ValueChangeEvent

use of com.vaadin.v7.data.Property.ValueChangeEvent in project opencms-core by alkacon.

the class CmsSiteSelectDialog method initForm.

/**
 * Initializes the form component.<p>
 *
 * @return the form component
 */
private FormLayout initForm() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    m_siteComboBox = prepareSiteSelector(org.opencms.workplace.Messages.GUI_LABEL_SITE_0);
    m_siteComboBox.setValue(new CmsExtendedSiteSelector.SiteSelectorOption(A_CmsUI.getCmsObject().getRequestContext().getSiteRoot(), null, null));
    form.addComponent(m_siteComboBox);
    ValueChangeListener changeListener = new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            submit();
        }
    };
    m_siteComboBox.addValueChangeListener(evt -> submit());
    return form;
}
Also used : FormLayout(com.vaadin.ui.FormLayout) ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) CmsExtendedSiteSelector(org.opencms.ui.components.CmsExtendedSiteSelector)

Example 28 with ValueChangeEvent

use of com.vaadin.v7.data.Property.ValueChangeEvent in project opencms-core by alkacon.

the class CmsDataViewPanel method updateFilters.

/**
 * Changes the displayed filters to a new set.<p>
 *
 * @param newFilters the new filters
 */
public void updateFilters(List<CmsDataViewFilter> newFilters) {
    if (newFilters.isEmpty()) {
        m_filterContainer.setVisible(false);
    }
    if (m_filters.equals(newFilters)) {
        return;
    }
    m_filterContainer.removeAllComponents();
    m_filters = newFilters;
    m_filterMap.clear();
    for (CmsDataViewFilter filter : newFilters) {
        m_filterMap.put(filter.getId(), filter);
        final CmsDataViewFilter finalFilter = filter;
        ComboBox select = new ComboBox(filter.getNiceName());
        select.setWidth("175px");
        select.setNullSelectionAllowed(false);
        select.setPageLength(0);
        Map<String, String> options = filter.getOptions();
        for (Map.Entry<String, String> entry : options.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            select.addItem(key);
            select.setItemCaption(key, value);
        }
        select.setValue(filter.getValue());
        if (filter.getHelpText() != null) {
            select.setDescription(filter.getHelpText());
        }
        select.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

            public void valueChange(ValueChangeEvent event) {
                String newValue = (String) (event.getProperty().getValue());
                updateFilter(finalFilter.getId(), newValue);
            }
        });
        m_filterContainer.addComponent(select);
    }
}
Also used : ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) ComboBox(com.vaadin.v7.ui.ComboBox) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CmsDataViewFilter(org.opencms.widgets.dataview.CmsDataViewFilter)

Example 29 with ValueChangeEvent

use of com.vaadin.v7.data.Property.ValueChangeEvent in project opencms-core by alkacon.

the class CmsDbSynchronizationView method addResource.

/**
 * Adds a resource to form.<p>
 *
 * @param path of resource to add
 */
protected void addResource(String path) {
    CmsPathSelectField field = new CmsPathSelectField();
    field.setCmsObject(m_cms);
    field.setUseRootPaths(true);
    field.setValue(path);
    field.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 8646438704383992571L;

        public void valueChange(ValueChangeEvent event) {
            setOkButtonEnabled(true);
        }
    });
    m_componentsToValidate.add(field);
    CmsRemovableFormRow<CmsPathSelectField> row = new CmsRemovableFormRow<CmsPathSelectField>(field, CmsVaadinUtils.getMessageText(Messages.GUI_DATABASEAPP_SYNC_REMOVE_RESOURCE_0));
    row.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_DATABASEAPP_SYNC_RESOURCE_0));
    row.setRemoveRunnable(new Runnable() {

        public void run() {
            setOkButtonEnabled(true);
        }
    });
    m_resources.addComponent(row);
}
Also used : ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) CmsRemovableFormRow(org.opencms.ui.components.CmsRemovableFormRow) CmsPathSelectField(org.opencms.ui.components.fileselect.CmsPathSelectField)

Example 30 with ValueChangeEvent

use of com.vaadin.v7.data.Property.ValueChangeEvent in project opencms-core by alkacon.

the class CmsEditSiteForm method setFieldsForSite.

/**
 * Sets the fields for a given site (m_site).<p>
 *
 * @param enableAll if true, the site is editable
 */
private void setFieldsForSite(boolean enableAll) {
    if (!CmsStringUtil.isEmptyOrWhitespaceOnly(m_site.getSiteRoot())) {
        setTemplateFieldForSiteroot(m_site.getSiteRoot());
        m_simpleFieldTemplate.setEnabled(false);
    }
    m_simpleFieldSiteRoot.setVisible(true);
    m_simpleFieldSiteRoot.setValue(m_site.getSiteRoot());
    m_simpleFieldSiteRoot.setCmsObject(m_clonedCms);
    m_simpleFieldSiteRoot.addValidator(new SiteRootValidator());
    m_simpleFieldSiteRoot.setEnabled(enableAll);
    m_simpleFieldSiteRoot.addValueChangeListener(new ValueChangeListener() {

        /**
         *vaadin serial id.
         */
        private static final long serialVersionUID = 4680456758446195524L;

        public void valueChange(ValueChangeEvent event) {
            setTemplateField();
            checkOnOfflineSiteRoot();
        }
    });
    m_simpleFieldParentFolderName.setVisible(false);
    m_simpleFieldFolderName.setVisible(false);
    String title = m_site.getTitle();
    if (title == null) {
        title = "";
    }
    CmsResourceInfo resourceInfo = new CmsResourceInfo(title, m_site.getSiteRoot(), m_manager.getFavIcon(m_site.getSiteRoot()));
    resourceInfo.addStyleName("o-res-site-info");
    Page.getCurrent().getStyles().add(".o-res-site-info img {max-width: 24px;}");
    displayResourceInfoDirectly(Collections.singletonList(resourceInfo));
    m_tab.removeTab(m_tab.getTab(5));
    m_simpleFieldTitle.removeTextChangeListener(null);
    m_simpleFieldTitle.setEnabled(enableAll);
    m_simpleFieldParentFolderName.setEnabled(false);
    m_simpleFieldParentFolderName.setValue(m_site.getSiteRoot().substring(0, m_site.getSiteRoot().length() - m_site.getSiteRoot().split("/")[m_site.getSiteRoot().split("/").length - 1].length()));
    // can not be changed
    m_simpleFieldFolderName.removeAllValidators();
    m_fieldCreateOU.setVisible(false);
    // Remove current url to avoid validation problem
    m_alreadyUsedURL.remove(m_site.getSiteMatcher().forDifferentScheme("https"));
    m_alreadyUsedURL.remove(m_site.getSiteMatcher().forDifferentScheme("http"));
    setFieldTitle(title);
    setFieldFolder(getFolderNameFromSiteRoot(m_site.getSiteRoot()));
    m_subsiteSelectionEnabled.setValue(Boolean.valueOf(m_site.isSubsiteSelectionEnabled()));
    m_simpleFieldFolderName.setEnabled(false);
    m_simpleFieldTitle.setEnabled(enableAll);
    setFieldServer(m_site.getUrl());
    m_simpleFieldServer.setEnabled(enableAll);
    if (m_site.hasSecureServer()) {
        m_fieldSecureServer.setValue(m_site.getSecureUrl());
    }
    if (m_site.getErrorPage() != null) {
        m_fieldErrorPage.setValue(m_site.getErrorPage());
    }
    m_fieldWebServer.setValue(new Boolean(m_site.isWebserver()));
    m_fieldWebServer.setEnabled(enableAll);
    m_fieldExclusiveURL.setValue(new Boolean(m_site.isExclusiveUrl()));
    m_fieldExclusiveURL.setEnabled(enableAll);
    m_fieldExclusiveError.setValue(new Boolean(m_site.isExclusiveError()));
    m_fieldExclusiveError.setEnabled(enableAll);
    Map<String, String> siteParameters = m_site.getParameters();
    for (Entry<String, String> parameter : siteParameters.entrySet()) {
        addParameter(getParameterString(parameter));
    }
    List<CmsSiteMatcher> siteAliases = m_site.getAliases();
    for (CmsSiteMatcher siteMatcher : siteAliases) {
        if (enableAll) {
            m_aliasGroup.addRow(createAliasComponent(siteMatcher.getUrl(), siteMatcher.getRedirectMode()));
        } else {
            Component c = createAliasComponent(siteMatcher.getUrl(), siteMatcher.getRedirectMode());
            c.setEnabled(false);
            m_aliases.addComponent(c);
        }
    }
    setTemplateField();
    setUpComboBoxPosition();
    if (!m_fieldSecureServer.isEmpty()) {
        m_fieldExclusiveURL.setEnabled(true && enableAll);
        m_fieldExclusiveError.setEnabled(true && enableAll);
    }
    setFaviconIfExist();
    checkOnOfflineSiteRoot();
    m_fieldUploadFavIcon.setVisible(false);
    m_simpleFieldEncryption.setContainerDataSource(getSSLModeContainer("caption", true, m_site.getSSLMode()));
    m_simpleFieldEncryption.select(m_site.getSSLMode());
    m_simpleFieldEncryption.setEnabled(enableAll);
    m_fieldErrorPage.setEnabled(enableAll);
    m_addParameter.setVisible(enableAll);
    m_fieldPosition.setEnabled(enableAll);
    fillAlternativeSiteRootTab(m_site.getAlternativeSiteRootMapping().orElse(null));
}
Also used : CmsResourceInfo(org.opencms.ui.components.CmsResourceInfo) ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) CmsSiteMatcher(org.opencms.site.CmsSiteMatcher) Component(com.vaadin.ui.Component)

Aggregations

ValueChangeEvent (com.vaadin.v7.data.Property.ValueChangeEvent)20 ValueChangeListener (com.vaadin.v7.data.Property.ValueChangeListener)20 ComboBox (com.vaadin.v7.ui.ComboBox)17 TextField (com.vaadin.v7.ui.TextField)11 Label (com.vaadin.ui.Label)10 CheckBox (com.vaadin.v7.ui.CheckBox)10 DateField (com.vaadin.v7.ui.DateField)9 Disease (de.symeda.sormas.api.Disease)9 FacadeProvider (de.symeda.sormas.api.FacadeProvider)9 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)9 FieldVisibilityCheckers (de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers)9 AbstractEditForm (de.symeda.sormas.ui.utils.AbstractEditForm)9 H3 (de.symeda.sormas.ui.utils.CssStyles.H3)9 VSPACE_3 (de.symeda.sormas.ui.utils.CssStyles.VSPACE_3)9 FieldHelper (de.symeda.sormas.ui.utils.FieldHelper)9 Captions (de.symeda.sormas.api.i18n.Captions)8 Strings (de.symeda.sormas.api.i18n.Strings)8 DistrictReferenceDto (de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto)8 Converter (com.vaadin.v7.data.util.converter.Converter)7 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)7