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