Search in sources :

Example 31 with ValueChangeListener

use of com.vaadin.v7.data.Property.ValueChangeListener 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 32 with ValueChangeListener

use of com.vaadin.v7.data.Property.ValueChangeListener 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

ValueChangeListener (com.vaadin.v7.data.Property.ValueChangeListener)21 ValueChangeEvent (com.vaadin.v7.data.Property.ValueChangeEvent)20 ComboBox (com.vaadin.v7.ui.ComboBox)17 TextField (com.vaadin.v7.ui.TextField)11 Label (com.vaadin.ui.Label)10 DateField (com.vaadin.v7.ui.DateField)8 FacadeProvider (de.symeda.sormas.api.FacadeProvider)8 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)8 FieldVisibilityCheckers (de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers)8 AbstractEditForm (de.symeda.sormas.ui.utils.AbstractEditForm)8 FieldHelper (de.symeda.sormas.ui.utils.FieldHelper)8 List (java.util.List)8 Converter (com.vaadin.v7.data.util.converter.Converter)7 Captions (de.symeda.sormas.api.i18n.Captions)7 Strings (de.symeda.sormas.api.i18n.Strings)7 DistrictReferenceDto (de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto)7 CheckBox (com.vaadin.v7.ui.CheckBox)6 Field (com.vaadin.v7.ui.Field)6 Disease (de.symeda.sormas.api.Disease)6 FacilityDto (de.symeda.sormas.api.infrastructure.facility.FacilityDto)6