001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.ui.dialogs.permissions;
029
030import org.opencms.file.CmsGroup;
031import org.opencms.file.CmsObject;
032import org.opencms.file.CmsUser;
033import org.opencms.main.CmsException;
034import org.opencms.main.CmsLog;
035import org.opencms.main.OpenCms;
036import org.opencms.security.CmsAccessControlEntry;
037import org.opencms.security.CmsRole;
038import org.opencms.security.CmsRoleAsPrincipal;
039import org.opencms.security.I_CmsPrincipal;
040import org.opencms.ui.A_CmsUI;
041import org.opencms.ui.CmsCssIcon;
042import org.opencms.ui.CmsVaadinUtils;
043import org.opencms.ui.FontOpenCms;
044import org.opencms.ui.apps.Messages;
045import org.opencms.ui.components.CmsBasicDialog;
046import org.opencms.ui.components.OpenCmsTheme;
047import org.opencms.ui.dialogs.CmsEmbeddedDialogContext;
048import org.opencms.ui.dialogs.permissions.CmsPrincipalSelect.I_PrincipalSelectHandler;
049import org.opencms.ui.dialogs.permissions.CmsPrincipalSelect.PrincipalType;
050import org.opencms.ui.dialogs.permissions.CmsPrincipalSelect.WidgetType;
051
052import java.util.ArrayList;
053import java.util.List;
054import java.util.Map;
055import java.util.stream.Collectors;
056
057import org.apache.commons.logging.Log;
058
059import com.vaadin.server.FontIcon;
060import com.vaadin.ui.Button;
061import com.vaadin.ui.Button.ClickEvent;
062import com.vaadin.ui.Button.ClickListener;
063import com.vaadin.ui.UI;
064import com.vaadin.ui.Window;
065import com.vaadin.ui.themes.ValoTheme;
066import com.vaadin.v7.data.Item;
067import com.vaadin.v7.data.Property.ValueChangeEvent;
068import com.vaadin.v7.data.Property.ValueChangeListener;
069import com.vaadin.v7.data.util.IndexedContainer;
070import com.vaadin.v7.event.FieldEvents.TextChangeEvent;
071import com.vaadin.v7.event.FieldEvents.TextChangeListener;
072import com.vaadin.v7.ui.ComboBox;
073import com.vaadin.v7.ui.HorizontalLayout;
074import com.vaadin.v7.ui.Label;
075import com.vaadin.v7.ui.TextField;
076import com.vaadin.v7.ui.VerticalLayout;
077
078/**
079 * Class for the dialog to show the principal table.<p>
080 */
081public class CmsPrincipalSelectDialog extends CmsBasicDialog {
082
083    /** Parameter key OU. */
084    public static final String PARAM_OU = "ou";
085
086    /** Parameter key widget type. */
087    public static final String PARAM_TYPE = "type";
088
089    /** Parameter key start view type. */
090    public static final String PARAM_START_TYPE = "starttype";
091
092    /** Parameter key real groups only. */
093    public static final String PARAM_REAL_ONLY = "realonly";
094
095    /** The dialog id. */
096    public static final String DIALOG_ID = "principalselect";
097
098    /**vaadin serial id.*/
099    private static final long serialVersionUID = 4650407086145654695L;
100
101    /** The log object for this class. */
102    private static final Log LOG = CmsLog.getLog(CmsPrincipalSelectDialog.class);
103
104    /**Icon property. */
105    private static String ID_ICON = "icon";
106
107    /**Caption property. */
108    private static String ID_CAPTION = "caption";
109
110    /**Descrpition property. */
111    private static String ID_DESC = "desc";
112
113    /**Organizational unit property. */
114    private static String ID_OU = "ou";
115
116    /**CmsObject.*/
117    CmsObject m_cms;
118
119    /**Calling vaadin component.*/
120    I_CmsPrincipalSelect m_selectField;
121
122    /**Vaadin component.*/
123    private Button m_closeButton;
124
125    /**Vaadin component.*/
126    ComboBox m_typeCombo;
127
128    /**Vaadin component.*/
129    private TextField m_tableFilter;
130
131    /**Vaadin component.*/
132    CmsPrincipalTable m_table;
133
134    /**Ou name. */
135    private String m_ou;
136
137    /**Type to display. */
138    WidgetType m_type;
139
140    /**Only show real principals? */
141    private boolean m_realOnly;
142
143    /**Vaadin component.*/
144    private ComboBox m_ouCombo;
145
146    /** The principal select handler. */
147    private I_PrincipalSelectHandler m_selectHandler;
148
149    /**
150     * public constructor.<p>
151     *
152     * @param cmsPrincipalSelect calling vaadin component
153     * @param ou the current OU
154     * @param window window to be closed after finishing
155     * @param widgetType type of principal to be shown
156     * @param realOnly true, only show real principals
157     * @param defaultView default mode to open
158     */
159    public CmsPrincipalSelectDialog(
160        I_CmsPrincipalSelect cmsPrincipalSelect,
161        String ou,
162        final Window window,
163        WidgetType widgetType,
164        boolean realOnly,
165        CmsPrincipalSelect.PrincipalType defaultView) {
166
167        this(cmsPrincipalSelect, ou, window, widgetType, realOnly, defaultView, true, false);
168
169    }
170
171    /**
172     * public constructor.<p>
173     *
174     * @param cmsPrincipalSelect calling vaadin component
175     * @param ou the current OU
176     * @param window window to be closed after finishing
177     * @param widgetType type of principal to be shown
178     * @param realOnly true, only show real principals
179     * @param defaultView default mode to open
180     * @param includeWebOus if web OUs should be included
181     * @param roleSelectionAllowed if true, selecting roles should be allowed (if the widget type allows for roles)
182     */
183    public CmsPrincipalSelectDialog(
184        I_CmsPrincipalSelect cmsPrincipalSelect,
185        String ou,
186        final Window window,
187        WidgetType widgetType,
188        boolean realOnly,
189        CmsPrincipalSelect.PrincipalType defaultView,
190        boolean includeWebOus,
191        boolean roleSelectionAllowed) {
192
193        m_ou = ou;
194        m_type = widgetType;
195        m_realOnly = realOnly;
196        try {
197            m_cms = A_CmsUI.getCmsObject();
198
199            m_selectField = cmsPrincipalSelect;
200
201            m_ouCombo = CmsVaadinUtils.getOUComboBox(m_cms, m_cms.getRequestContext().getOuFqn(), null, includeWebOus);
202            m_ouCombo.select(m_ou);
203
204            IndexedContainer data;
205
206            data = getContainerForType(defaultView, m_realOnly, (String)m_ouCombo.getValue());
207            m_table = new CmsPrincipalTable(this, data, ID_ICON, ID_CAPTION, ID_DESC, ID_OU);
208            m_table.setColumnHeader(
209                ID_CAPTION,
210                CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GROUP_NAME_0));
211            m_table.setColumnHeader(
212                ID_DESC,
213                CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GROUP_DESCRIPTION_0));
214            m_table.setColumnHeader(ID_OU, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GROUP_OU_0));
215
216            m_tableFilter = new TextField();
217            m_tableFilter.setIcon(FontOpenCms.FILTER);
218            m_tableFilter.setInputPrompt(
219                Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0));
220            m_tableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
221            m_tableFilter.setWidth("200px");
222            m_tableFilter.addTextChangeListener(new TextChangeListener() {
223
224                private static final long serialVersionUID = 1L;
225
226                public void textChange(TextChangeEvent event) {
227
228                    m_table.filterTable(event.getText());
229                }
230            });
231            VerticalLayout vl = new VerticalLayout();
232            vl.setSpacing(true);
233            HorizontalLayout hl = new HorizontalLayout();
234            hl.setSpacing(true);
235            hl.setWidth("100%");
236            m_typeCombo = new ComboBox();
237            Label space = new Label();
238
239            hl.addComponent(m_typeCombo);
240            hl.addComponent(m_ouCombo);
241            hl.addComponent(space);
242            hl.addComponent(m_tableFilter);
243            hl.setExpandRatio(space, 1);
244            hl.setComponentAlignment(m_ouCombo, com.vaadin.ui.Alignment.MIDDLE_CENTER);
245            vl.addComponent(hl);
246            vl.addComponent(m_table);
247
248            if (!OpenCms.getRoleManager().hasRole(m_cms, CmsRole.ACCOUNT_MANAGER)) {
249                m_ouCombo.setValue(m_cms.getRequestContext().getOuFqn());
250                m_ouCombo.setEnabled(false);
251                m_typeCombo.setValue(WidgetType.groupwidget);
252                m_typeCombo.setEnabled(false);
253            }
254
255            setContent(vl);
256        } catch (CmsException e) {
257            LOG.error("Can't read principals", e);
258        }
259        m_closeButton = new Button(CmsVaadinUtils.messageClose());
260        addButton(m_closeButton);
261
262        m_closeButton.addClickListener(new ClickListener() {
263
264            private static final long serialVersionUID = -3702402223196220788L;
265
266            public void buttonClick(ClickEvent event) {
267
268                window.close();
269
270            }
271        });
272        m_ouCombo.addValueChangeListener(new ValueChangeListener() {
273
274            private static final long serialVersionUID = -5035831853626955191L;
275
276            public void valueChange(ValueChangeEvent event) {
277
278                initTable((CmsPrincipalSelect.PrincipalType)m_typeCombo.getValue());
279
280            }
281        });
282        m_typeCombo.addValueChangeListener(new ValueChangeListener() {
283
284            private static final long serialVersionUID = 645817336220889132L;
285
286            public void valueChange(ValueChangeEvent event) {
287
288                CmsPrincipalSelect.PrincipalType principalType = (CmsPrincipalSelect.PrincipalType)m_typeCombo.getValue();
289                initTable(principalType);
290                m_ouCombo.setVisible(principalType != PrincipalType.role);
291            }
292
293        });
294        initTypeCombo(defaultView, roleSelectionAllowed);
295    }
296
297    /**
298     * Opens the principal select dialog within an embedded dialog context.<p>
299     *
300     * @param dialogContext the dialog context
301     * @param params the request parameters
302     */
303    public static void openEmbeddedDialog(final CmsEmbeddedDialogContext dialogContext, Map<String, String[]> params) {
304
305        openEmbeddedDialog(dialogContext, params, true);
306    }
307
308    /**
309     * Opens the principal select dialog within an embedded dialog context.<p>
310     *
311     * @param dialogContext the dialog context
312     * @param params the request parameters
313     * @param includeWebOus include WebOu?
314     */
315    public static void openEmbeddedDialog(
316        final CmsEmbeddedDialogContext dialogContext,
317        Map<String, String[]> params,
318        boolean includeWebOus) {
319
320        String[] param = params.get(PARAM_OU);
321        String ou;
322        if ((param != null) && (param.length >= 1)) {
323            ou = param[0];
324        } else {
325            ou = dialogContext.getCms().getRequestContext().getCurrentUser().getOuFqn();
326        }
327        boolean realOnly;
328        param = params.get(PARAM_REAL_ONLY);
329        if ((param != null) && (param.length >= 1)) {
330            realOnly = Boolean.parseBoolean(param[0]);
331        } else {
332            realOnly = true;
333        }
334        WidgetType type = WidgetType.groupwidget;
335        param = params.get(PARAM_TYPE);
336        if ((param != null) && (param.length >= 1)) {
337            try {
338                type = WidgetType.valueOf(param[0]);
339            } catch (Exception e) {
340                // ignore
341            }
342        }
343        CmsPrincipalSelect.PrincipalType startType = null;
344        param = params.get(PARAM_START_TYPE);
345        if ((param != null) && (param.length >= 1)) {
346            try {
347                startType = CmsPrincipalSelect.PrincipalType.valueOf(param[0]);
348            } catch (Exception e) {
349                // ignore
350            }
351        }
352        if (startType == null) {
353            if ((type == WidgetType.principalwidget) || (type == WidgetType.groupwidget)) {
354                startType = CmsPrincipalSelect.PrincipalType.group;
355            } else if (type == WidgetType.userwidget) {
356                startType = CmsPrincipalSelect.PrincipalType.user;
357            }
358        }
359        Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
360        dialogContext.setWindow(window);
361        CmsPrincipalSelectDialog dialog = new CmsPrincipalSelectDialog(
362            null,
363            ou,
364            window,
365            type,
366            realOnly,
367            startType,
368            includeWebOus,
369            false);
370        dialog.setSelectHandler(new I_PrincipalSelectHandler() {
371
372            public void onPrincipalSelect(String principalType, String principalName) {
373
374                dialogContext.selectString(principalName);
375            }
376        });
377        window.setCaption(
378            CmsVaadinUtils.getMessageText(
379                org.opencms.workplace.commons.Messages.GUI_PRINCIPALSELECTION_LIST_ACTION_SELECT_NAME_0));
380        window.setContent(dialog);
381        A_CmsUI.get().addWindow(window);
382    }
383
384    /**
385     * Opens the principal select dialog within an embedded dialog context.<p>
386     *
387     * @param dialogContext the dialog context
388     * @param params the request parameters
389     * @param includeWebOus include WebOu?
390     */
391    public static void openEmbeddedDialogV2(
392        final CmsEmbeddedDialogContext dialogContext,
393        Map<String, String> params,
394        boolean includeWebOus) {
395
396        String ou = params.get(PARAM_OU);
397        if (ou == null) {
398            ou = dialogContext.getCms().getRequestContext().getCurrentUser().getOuFqn();
399        }
400        boolean realOnly;
401        String param = params.get(PARAM_REAL_ONLY);
402        if (param != null) {
403            realOnly = Boolean.parseBoolean(param);
404        } else {
405            realOnly = true;
406        }
407        WidgetType type = WidgetType.groupwidget;
408        param = params.get(PARAM_TYPE);
409        if (param != null) {
410            try {
411                type = WidgetType.valueOf(param);
412            } catch (Exception e) {
413                // ignore
414            }
415        }
416        CmsPrincipalSelect.PrincipalType startType = null;
417        param = params.get(PARAM_START_TYPE);
418        if (param != null) {
419            try {
420                startType = CmsPrincipalSelect.PrincipalType.valueOf(param);
421            } catch (Exception e) {
422                // ignore
423            }
424        }
425        if (startType == null) {
426            if ((type == WidgetType.principalwidget) || (type == WidgetType.groupwidget)) {
427                startType = CmsPrincipalSelect.PrincipalType.group;
428            } else if (type == WidgetType.userwidget) {
429                startType = CmsPrincipalSelect.PrincipalType.user;
430            }
431        }
432        Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
433        dialogContext.setWindow(window);
434        CmsPrincipalSelectDialog dialog = new CmsPrincipalSelectDialog(
435            null,
436            ou,
437            window,
438            type,
439            realOnly,
440            startType,
441            includeWebOus,
442            false);
443        dialog.setSelectHandler(new I_PrincipalSelectHandler() {
444
445            public void onPrincipalSelect(String principalType, String principalName) {
446
447                dialogContext.selectString(principalName);
448            }
449        });
450        window.setCaption(
451            CmsVaadinUtils.getMessageText(
452                org.opencms.workplace.commons.Messages.GUI_PRINCIPALSELECTION_LIST_ACTION_SELECT_NAME_0));
453        window.setContent(dialog);
454        A_CmsUI.get().addWindow(window);
455    }
456
457    /**
458     * Selects a principal and closes the dialog.<p>
459     *
460     * @param value the principal which was clicked
461     */
462    public void select(I_CmsPrincipal value) {
463
464        if (m_selectField != null) {
465            m_selectField.handlePrincipal(value);
466        }
467        if (m_selectHandler != null) {
468            m_selectHandler.onPrincipalSelect(
469                value.isGroup() ? I_CmsPrincipal.PRINCIPAL_GROUP : I_CmsPrincipal.PRINCIPAL_USER,
470                value.getName());
471        }
472        m_closeButton.click();
473    }
474
475    /**
476     * En/Disables the ou combo box.<p>
477     *
478     * @param enabled enabled boolean
479     */
480    public void setOuComboBoxEnabled(boolean enabled) {
481
482        m_ouCombo.setEnabled(enabled);
483    }
484
485    /**
486     * Sets the principal select handler.<p>
487     *
488     * @param selectHandler the principal select handler
489     */
490    public void setSelectHandler(I_PrincipalSelectHandler selectHandler) {
491
492        m_selectHandler = selectHandler;
493    }
494
495    /**
496     * Init table.<p>
497     * @param type WidgetType to initialize
498     */
499    void initTable(CmsPrincipalSelect.PrincipalType type) {
500
501        IndexedContainer data;
502        try {
503            data = getContainerForType(type, m_realOnly, (String)m_ouCombo.getValue());
504            m_table.updateContainer(data);
505            m_tableFilter.setValue("");
506        } catch (CmsException e) {
507            LOG.error("Can't read principals", e);
508        }
509    }
510
511    /**
512     * Returns the container for the currently selected Principal group.<p>
513     *
514     * @param type to be shown
515     * @param realOnly true->get only real principals
516     * @param ou ou
517     * @return indexed container
518     * @throws CmsException exception
519     */
520    private IndexedContainer getContainerForType(CmsPrincipalSelect.PrincipalType type, boolean realOnly, String ou)
521    throws CmsException {
522
523        IndexedContainer res = null;
524        List<FontIcon> icons = new ArrayList<FontIcon>();
525
526        if (type == PrincipalType.group) {
527            List<CmsGroup> groups = OpenCms.getRoleManager().getManageableGroups(m_cms, ou, false);
528            if (!realOnly) {
529                groups.add(
530                    0,
531                    new CmsGroup(
532                        CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID,
533                        null,
534                        CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_ALLOTHERS_0),
535                        CmsVaadinUtils.getMessageText(
536                            org.opencms.workplace.commons.Messages.GUI_DESCRIPTION_ALLOTHERS_0),
537                        0));
538                icons.add(new CmsCssIcon(OpenCmsTheme.ICON_PRINCIPAL_ALL));
539                if (OpenCms.getRoleManager().hasRole(m_cms, CmsRole.VFS_MANAGER)) {
540                    groups.add(
541                        0,
542                        new CmsGroup(
543                            CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID,
544                            null,
545                            CmsVaadinUtils.getMessageText(
546                                org.opencms.workplace.commons.Messages.GUI_LABEL_OVERWRITEALL_0),
547                            CmsVaadinUtils.getMessageText(
548                                org.opencms.workplace.commons.Messages.GUI_DESCRIPTION_OVERWRITEALL_0),
549                            0));
550                    icons.add(0, new CmsCssIcon(OpenCmsTheme.ICON_PRINCIPAL_OVERWRITE));
551                }
552            }
553
554            res = CmsVaadinUtils.getPrincipalContainer(
555                A_CmsUI.getCmsObject(),
556                groups,
557                ID_CAPTION,
558                ID_DESC,
559                ID_ICON,
560                ID_OU,
561                OpenCmsTheme.ICON_GROUP,
562                icons);
563        }
564        if (type == PrincipalType.user) {
565            List<CmsUser> users = OpenCms.getRoleManager().getManageableUsers(m_cms, ou, false, true);
566            if (!realOnly) {
567                CmsUser user = new CmsUser(
568                    CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID,
569                    CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_ALLOTHERS_0),
570                    "",
571                    "",
572                    "",
573                    "",
574                    0,
575                    0,
576                    0,
577                    null);
578                user.setDescription(
579                    CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_DESCRIPTION_ALLOTHERS_0));
580                users.add(0, user);
581                icons.add(new CmsCssIcon(OpenCmsTheme.ICON_PRINCIPAL_ALL));
582                if (OpenCms.getRoleManager().hasRole(m_cms, CmsRole.VFS_MANAGER)) {
583                    user = new CmsUser(
584                        CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID,
585                        CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_OVERWRITEALL_0),
586                        "",
587                        "",
588                        "",
589                        "",
590                        0,
591                        0,
592                        0,
593                        null);
594                    user.setDescription(
595                        CmsVaadinUtils.getMessageText(
596                            org.opencms.workplace.commons.Messages.GUI_DESCRIPTION_OVERWRITEALL_0));
597                    users.add(0, user);
598                    icons.add(0, new CmsCssIcon(OpenCmsTheme.ICON_PRINCIPAL_OVERWRITE));
599                }
600            }
601            res = CmsVaadinUtils.getPrincipalContainer(
602                A_CmsUI.getCmsObject(),
603                users,
604                ID_CAPTION,
605                ID_DESC,
606                ID_ICON,
607                ID_OU,
608                OpenCmsTheme.ICON_USER,
609                icons);
610        }
611
612        if (type == PrincipalType.role) {
613
614            List<CmsRole> roles = CmsRole.getSystemRoles();
615            List<CmsRoleAsPrincipal> roleWrappers = roles.stream().map(role -> new CmsRoleAsPrincipal(role)).collect(
616                Collectors.toList());
617            res = CmsVaadinUtils.getPrincipalContainer(
618                A_CmsUI.getCmsObject(),
619                roleWrappers,
620                ID_CAPTION,
621                ID_DESC,
622                ID_ICON,
623                ID_OU,
624                OpenCmsTheme.ICON_ROLE,
625                icons);
626        }
627
628        return res;
629    }
630
631    /**
632     * Init ComboBox for choosing type of principal.<p>
633     * @param defaultType Default mode to open
634     */
635    private void initTypeCombo(CmsPrincipalSelect.PrincipalType defaultType, boolean roleSelectionAllowed) {
636
637        IndexedContainer container = new IndexedContainer();
638
639        container.addContainerProperty("caption", String.class, "");
640
641        Item item = container.addItem(CmsPrincipalSelect.PrincipalType.group);
642        item.getItemProperty("caption").setValue(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GROUP_0));
643
644        item = container.addItem(CmsPrincipalSelect.PrincipalType.user);
645        item.getItemProperty("caption").setValue(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_0));
646        if (roleSelectionAllowed) {
647            if ((m_type == null) || m_type.getPrincipalTypes().contains(CmsPrincipalSelect.PrincipalType.role)) {
648                item = container.addItem(CmsPrincipalSelect.PrincipalType.role);
649                String message = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ROLE_0);
650                item.getItemProperty("caption").setValue(message);
651            }
652        }
653
654        m_typeCombo.setContainerDataSource(container);
655        m_typeCombo.select(defaultType);
656        m_typeCombo.setEnabled((m_type == null) || (m_type.getPrincipalTypes().size() > 1));
657        m_typeCombo.setItemCaptionPropertyId("caption");
658        m_typeCombo.setNullSelectionAllowed(false);
659        m_typeCombo.setNewItemsAllowed(false);
660
661    }
662
663}