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);
}
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));
}
Aggregations