Search in sources :

Example 1 with ValueChangeEvent

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

the class CmsDbExportView method setupComboBoxSite.

/**
 * Sets up the combo box for the site choice.<p>
 */
private void setupComboBoxSite() {
    IndexedContainer container = CmsVaadinUtils.getAvailableSitesContainer(A_CmsUI.getCmsObject(), "title");
    m_site.setContainerDataSource(container);
    m_site.setItemCaptionMode(ItemCaptionMode.PROPERTY);
    m_site.setItemCaptionPropertyId("title");
    m_site.setFilteringMode(FilteringMode.CONTAINS);
    m_site.setNullSelectionAllowed(false);
    m_site.setValue(A_CmsUI.getCmsObject().getRequestContext().getSiteRoot());
    m_site.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = -1019243885633462477L;

        public void valueChange(ValueChangeEvent event) {
            changeSite();
            removeUnvalidPathFields();
        }
    });
    m_project.setContainerDataSource(CmsVaadinUtils.getProjectsContainer(A_CmsUI.getCmsObject(), "caption"));
    m_project.setItemCaptionPropertyId("caption");
    m_project.select(A_CmsUI.getCmsObject().getRequestContext().getCurrentProject().getUuid());
    m_project.setNewItemsAllowed(false);
    m_project.setNullSelectionAllowed(false);
    m_project.setTextInputAllowed(false);
}
Also used : ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) IndexedContainer(com.vaadin.v7.data.util.IndexedContainer)

Example 2 with ValueChangeEvent

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

the class CmsUpdateStep01LicenseDialog method init.

/**
 * @see org.opencms.setup.updater.dialogs.A_CmsUpdateDialog#init(org.opencms.setup.CmsUpdateUI)
 */
@Override
public boolean init(CmsUpdateUI ui) {
    CmsVaadinUtils.readAndLocalizeDesign(this, null, null);
    super.init(ui, false, true);
    setCaption("OpenCms Update-Wizard - License Agreement");
    Label label = htmlLabel(readSnippet("license.html"));
    label.setWidth("100%");
    m_licenseContainer.addComponent(label);
    m_accept.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            enableOK(m_accept.getValue().booleanValue());
        }
    });
    enableOK(false);
    return true;
}
Also used : ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) Label(com.vaadin.ui.Label)

Example 3 with ValueChangeEvent

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

the class CmsUserEditDialog method init.

/**
 * A initialization method.<p>
 *
 * @param window to be closed
 * @param app opening this dialog
 * @param settings user settings, null if new user
 * @param enabled enable edit
 */
private void init(final Window window, final CmsAccountsApp app, final CmsUserSettings settings, boolean enabled) {
    m_userdata.initFields(m_user, enabled ? EditLevel.all : EditLevel.none);
    if (m_user != null) {
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_user.getFirstname()) | CmsStringUtil.isEmptyOrWhitespaceOnly(m_user.getLastname()) | CmsStringUtil.isEmptyOrWhitespaceOnly(m_user.getEmail())) {
            m_name_was_empty = true;
        }
    }
    iniLanguage(settings);
    iniProject(settings);
    iniSite(settings);
    iniStartView(settings);
    m_site.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 5111762655156037899L;

        public void valueChange(ValueChangeEvent event) {
            setupStartFolder(null);
        }
    });
    m_ok.addClickListener(new ClickListener() {

        private static final long serialVersionUID = -2579639520410382246L;

        public void buttonClick(ClickEvent event) {
            setupValidators();
            if (isValid()) {
                save();
                window.close();
                app.reload();
            }
        }
    });
    m_next.addClickListener(new ClickListener() {

        private static final long serialVersionUID = -8584899970290349959L;

        public void buttonClick(ClickEvent event) {
            setupValidators();
            switchTab();
        }
    });
    m_cancel.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 5803825104722705175L;

        public void buttonClick(ClickEvent event) {
            window.close();
        }
    });
    if (m_user == null) {
        m_role.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 5697126133686172725L;

            public void valueChange(ValueChangeEvent event) {
                iniSite(settings);
                iniStartView(settings);
            }
        });
        m_group.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1512940002751242094L;

            public void valueChange(ValueChangeEvent event) {
                iniStartView(settings);
                iniSite(settings);
            }
        });
    }
    m_site.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = -169973382455098800L;

        public void valueChange(ValueChangeEvent event) {
            m_startfolder.setCmsObject(getCmsObjectWithSite((String) m_site.getValue()));
        }
    });
    m_generateButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 4128513094772586752L;

        public void buttonClick(ClickEvent event) {
            final Window windowDialog = CmsBasicDialog.prepareWindow(CmsBasicDialog.DialogWidth.content);
            windowDialog.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GEN_PASSWORD_CAPTION_0));
            CmsGeneratePasswordDialog dialog = new CmsGeneratePasswordDialog(CmsUserEditDialog.this, new Runnable() {

                public void run() {
                    windowDialog.close();
                }
            });
            windowDialog.setContent(dialog);
            A_CmsUI.get().addWindow(windowDialog);
        }
    });
}
Also used : Window(com.vaadin.ui.Window) ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 4 with ValueChangeEvent

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

the class CmsSourceSearchForm method initFields.

/**
 * Initializes the form fields.<p>
 */
private void initFields() {
    CmsObject cms = A_CmsUI.getCmsObject();
    boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();
    if (m_searchPattern.getValue().isEmpty()) {
        m_searchPattern.setValue(REGEX_ALL);
    }
    m_resourceSearch.setUseRootPaths(true);
    m_replaceResource.setUseRootPaths(true);
    m_resourceSearch.requireFile();
    m_replaceResource.requireFile();
    CmsObject rootCms;
    try {
        rootCms = OpenCms.initCmsObject(cms);
        rootCms.getRequestContext().setSiteRoot("");
        m_resourceSearch.setCmsObject(rootCms);
        m_resourceSearch.setDefaultPath(cms.getRequestContext().getSiteRoot());
        m_replaceResource.setCmsObject(rootCms);
        m_replaceResource.setDefaultPath(cms.getRequestContext().getSiteRoot());
    } catch (CmsException e1) {
    // 
    }
    m_siteSelect.setContainerDataSource(CmsVaadinUtils.getAvailableSitesContainer(cms, CmsVaadinUtils.PROPERTY_LABEL));
    m_siteSelect.setItemCaptionPropertyId(CmsVaadinUtils.PROPERTY_LABEL);
    m_siteSelect.setTextInputAllowed(true);
    m_siteSelect.setNullSelectionAllowed(false);
    m_siteSelect.setFilteringMode(FilteringMode.CONTAINS);
    m_siteSelect.setValue(cms.getRequestContext().getSiteRoot());
    try {
        for (CmsPropertyDefinition prop : A_CmsUI.getCmsObject().readAllPropertyDefinitions()) {
            m_property.addItem(prop);
            m_property.setItemCaption(prop, prop.getName());
        }
    } catch (CmsException e) {
    // 
    }
    m_siteSelect.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = -1079794209679015125L;

        public void valueChange(ValueChangeEvent event) {
            try {
                updateSearchRoot();
            } catch (CmsException e) {
                LOG.error("Unable to initialize CmsObject", e);
            }
        }
    });
    m_property.setNullSelectionAllowed(false);
    m_property.select(m_property.getItemIds().iterator().next());
    m_property.setFilteringMode(FilteringMode.CONTAINS);
    m_searchType.setFilteringMode(FilteringMode.OFF);
    m_searchType.setNullSelectionAllowed(false);
    m_searchType.addItem(SearchType.fullText);
    m_searchType.setItemCaption(SearchType.fullText, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_FULLTEXT_0));
    m_searchType.addItem(SearchType.contentValues);
    m_searchType.setItemCaption(SearchType.contentValues, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_XMLCONTENT_0));
    m_searchType.addItem(SearchType.properties);
    m_searchType.setItemCaption(SearchType.properties, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_PROPERTY_SEARCH_0));
    m_searchType.addItem(SearchType.resourcetype);
    m_searchType.setItemCaption(SearchType.resourcetype, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_RESOURCE_SEARCH_0));
    m_searchType.addItem(SearchType.renameContainer);
    m_searchType.setItemCaption(SearchType.renameContainer, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_RENAME_CONTAINER_SEARCH_0));
    if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) {
        m_searchIndex.setFilteringMode(FilteringMode.OFF);
        m_searchIndex.setNullSelectionAllowed(false);
        String selectIndex = null;
        for (CmsSearchIndex index : OpenCms.getSearchManager().getAllSolrIndexes()) {
            boolean offlineMode = I_CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode());
            // in case the current project is offline, show offline indexes, otherwise show online indexes
            if ((!online && offlineMode) || (online && !offlineMode)) {
                m_searchIndex.addItem(index.getName());
                if (selectIndex == null) {
                    selectIndex = index.getName();
                }
            }
        }
        if (selectIndex != null) {
            m_searchIndex.setValue(selectIndex);
            // only add the solr search types if there is an index available
            m_searchType.addItem(SearchType.solr);
            m_searchType.setItemCaption(SearchType.solr, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_SOLR_0));
            m_searchType.addItem(SearchType.solrContentValues);
            m_searchType.setItemCaption(SearchType.solrContentValues, CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_SOLR_CONTENT_VALUES_0));
        }
    }
    m_searchType.setValue(SearchType.fullText);
    m_searchRoot.setValue("/");
    m_searchRoot.disableSiteSwitch();
    m_searchRoot.setResourceFilter(CmsResourceFilter.DEFAULT_FOLDERS);
    m_searchRoot.requireFolder();
    m_locale.setFilteringMode(FilteringMode.OFF);
    for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
        m_locale.addItem(locale);
    }
    m_resourceType.setNullSelectionAllowed(true);
    IndexedContainer resTypes = CmsVaadinUtils.getResourceTypesContainer();
    resTypes.addContainerFilter(CmsVaadinUtils.FILTER_NO_FOLDERS);
    m_resourceType.setContainerDataSource(resTypes);
    m_resourceType.setItemCaptionPropertyId(PropertyId.caption);
    m_resourceType.setItemIconPropertyId(PropertyId.icon);
    m_resourceType.setFilteringMode(FilteringMode.CONTAINS);
    m_workProject.setNullSelectionAllowed(false);
    IndexedContainer projects = CmsVaadinUtils.getProjectsContainer(A_CmsUI.getCmsObject(), "caption");
    projects.removeItem(CmsProject.ONLINE_PROJECT_ID);
    m_workProject.setContainerDataSource(projects);
    m_workProject.setItemCaptionPropertyId("caption");
    if (online) {
        m_replace.setEnabled(false);
    } else {
        m_workProject.setValue(cms.getRequestContext().getCurrentProject().getUuid());
    }
}
Also used : Locale(java.util.Locale) ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) CmsObject(org.opencms.file.CmsObject) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) IndexedContainer(com.vaadin.v7.data.util.IndexedContainer) CmsException(org.opencms.main.CmsException) CmsPropertyDefinition(org.opencms.file.CmsPropertyDefinition) I_CmsSearchIndex(org.opencms.search.I_CmsSearchIndex) CmsSearchIndex(org.opencms.search.CmsSearchIndex)

Example 5 with ValueChangeEvent

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

the class CmsAccountsApp method iniButtons.

/**
 * Initializes the toolbar buttons.<p>
 */
private void iniButtons() {
    m_newButton = CmsToolBar.createButton(FontOpenCms.WAND, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_ELEMENT_0));
    m_newButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            openNewDialog();
        }
    });
    m_infoButton = new CmsInfoButton();
    Button csvButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_EXPORT_ONLY_USER_0));
    csvButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 5472430305539438757L;

        public void buttonClick(ClickEvent event) {
            boolean includeTechnicalFields = false;
            try {
                OpenCms.getRoleManager().checkRole(m_cms, CmsRole.ADMINISTRATOR);
                includeTechnicalFields = true;
            } catch (CmsRoleViolationException e) {
            // ok
            }
            Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
            CmsUserCsvExportDialog dialog = new CmsUserCsvExportDialog(getFullUser(getVisibleUser()), m_stateBean.getPath(), m_stateBean.getType(), getElementName(m_stateBean), CmsVaadinUtils.isButtonPressed(getToggleButton(m_stateBean)), window, includeTechnicalFields);
            window.setContent(dialog);
            A_CmsUI.get().addWindow(window);
        }
    });
    m_infoButton.setAdditionalButton(csvButton);
    m_addElementButton = CmsToolBar.createButton(FontAwesome.PLUS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_USER_TO_GROUP_0));
    m_addElementButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1859694635385726953L;

        public void buttonClick(ClickEvent event) {
            openAddUserDialog();
        }
    });
    m_toggleButtonRole = CmsToolBar.createButton(FontOpenCms.USERS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ROLES_TOGGLE_0));
    m_toggleButtonRole.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 8265075332953321274L;

        public void buttonClick(ClickEvent event) {
            toggleTable(m_toggleButtonRole);
        }
    });
    m_toggleButtonUser = CmsToolBar.createButton(FontOpenCms.USERS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_TOGGLE_0));
    m_toggleButtonUser.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 8265075332953321274L;

        public void buttonClick(ClickEvent event) {
            toggleTable(m_toggleButtonUser);
        }
    });
    m_toggleButtonGroups = CmsToolBar.createButton(FontOpenCms.USERS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GROUPS_TOGGLE_0));
    m_toggleButtonGroups.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 8265075332953321274L;

        public void buttonClick(ClickEvent event) {
            toggleTable(m_toggleButtonGroups);
        }
    });
    m_uiContext.addToolbarButton(m_newButton);
    m_uiContext.addToolbarButton(m_addElementButton);
    m_uiContext.addToolbarButton(m_infoButton);
    m_uiContext.addToolbarButton(m_toggleButtonRole);
    m_uiContext.addToolbarButton(m_toggleButtonUser);
    m_uiContext.addToolbarButton(m_toggleButtonGroups);
    for (Button button : getAdditionalButtons()) {
        m_uiContext.addToolbarButton(button);
    }
    m_filter = CmsVaadinUtils.getOUComboBox(m_cms, m_baseOU, LOG);
    m_filter.setWidth("379px");
    m_infoLayout.addComponent(m_filter, 0);
    m_filterTable = new TextField();
    m_filterTable.setIcon(FontOpenCms.FILTER);
    m_filterTable.setInputPrompt(Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0));
    m_filterTable.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    // m_filterTable.setWidth("200px");
    m_filterTable.addTextChangeListener(new TextChangeListener() {

        private static final long serialVersionUID = 1L;

        public void textChange(TextChangeEvent event) {
            filterTable(event.getText());
        }
    });
    m_filterTable.setWidth("200px");
    m_infoLayout.addComponent(m_filterTable);
    m_infoLayout.addStyleName("o-many-elements");
    m_filter.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            if ((m_stateBean.getType() != null) & !m_doNotChange) {
                update((String) event.getProperty().getValue(), CmsOuTreeType.OU, null);
            } else {
            // 
            }
        }
    });
    if (!m_ouHandler.isOUManagable(m_stateBean.getPath())) {
        boolean change = m_doNotChange;
        m_doNotChange = false;
        m_filter.select(m_filter.getItemIds().iterator().next());
        m_doNotChange = change;
    }
}
Also used : Window(com.vaadin.ui.Window) ClickEvent(com.vaadin.ui.Button.ClickEvent) ValueChangeEvent(com.vaadin.v7.data.Property.ValueChangeEvent) CmsRoleViolationException(org.opencms.security.CmsRoleViolationException) ValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener) Button(com.vaadin.ui.Button) CmsInfoButton(org.opencms.ui.components.CmsInfoButton) TextChangeEvent(com.vaadin.v7.event.FieldEvents.TextChangeEvent) TextField(com.vaadin.v7.ui.TextField) TextChangeListener(com.vaadin.v7.event.FieldEvents.TextChangeListener) ClickListener(com.vaadin.ui.Button.ClickListener) CmsInfoButton(org.opencms.ui.components.CmsInfoButton)

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