Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow CSS_CLASS_GRAY

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow CSS_CLASS_GRAY

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow CSS_CLASS_GRAY.

Prototype

String CSS_CLASS_GRAY

To view the source code for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow CSS_CLASS_GRAY.

Click Source Link

Document

CSS class for window with gray border.

Usage

From source file:com.cubeia.backoffice.web.user.UserList.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters//from w w  w .ja  v  a 2 s .  co  m
*            Page parameters
*/
public UserList(final PageParameters parameters) {
    final Form<?> searchForm = new Form<UserList>("searchForm", new CompoundPropertyModel<UserList>(this));
    final TextField<String> idField = new TextField<String>("userId");
    searchForm.add(idField);
    final TextField<String> userNameField = new TextField<String>("name");
    searchForm.add(userNameField);
    searchForm.add(new Button("clearForm") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            super.onSubmit();
            idField.clearInput();
            userNameField.clearInput();
        }
    });
    add(searchForm);
    add(new FeedbackPanel("feedback"));

    final UsersDataProvider dataProvider = new UsersDataProvider();
    List<IColumn<User, String>> columns = new ArrayList<IColumn<User, String>>();

    columns.add(new AbstractColumn<User, String>(Model.of("User Id")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<User>> item, String componentId, IModel<User> model) {
            Long userId = model.getObject().getUserId();
            LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class,
                    params(UserSummary.PARAM_USER_ID, userId));
            item.add(panel);
        }

        @Override
        public boolean isSortable() {
            return true;
        }

        @Override
        public String getSortProperty() {
            return UserOrder.ID.name();
        }
    });
    columns.add(new PropertyColumn<User, String>(Model.of("XId"), "externalUserId"));
    columns.add(
            new PropertyColumn<User, String>(Model.of("User name"), UserOrder.USER_NAME.name(), "userName"));
    columns.add(new PropertyColumn<User, String>(Model.of("Status"), UserOrder.STATUS.name(), "status"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("First name"), "userInformation.firstName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Last name"), "userInformation.lastName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Country"), UserOrder.COUNTRY.name(), "userInformation.country"));
    columns.add(new PropertyColumn<User, String>(Model.of("Ext. Username"), "attributes.externalUsername"));
    columns.add(new PropertyColumn<User, String>(Model.of("Screename"), "attributes.screenname"));

    AjaxFallbackDefaultDataTable<User, String> userTable = new AjaxFallbackDefaultDataTable<User, String>(
            "userTable", columns, dataProvider, 20);
    add(userTable);

    final ModalWindow modal = new ModalWindow("modal");
    modal.setContent(new UserReportPanel(modal.getContentId(), modal));
    modal.setTitle("Generate report");
    modal.setCookieName("modal");
    modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    modal.setInitialWidth(265);
    modal.setInitialHeight(200);

    add(modal);
    add(new AjaxLink<Void>("showReportPanel") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<User> users = getUserList(getUserId(), getName(), 0, Integer.MAX_VALUE,
                    dataProvider.getSort().getProperty(), dataProvider.getSort().isAscending()).getUsers();
            HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
            request.getSession().setAttribute(ReportServlet.REPORTS_COLLECTION_DATA_SOURCE, users);
            modal.show(target);
        }
    });
}

From source file:com.cubeia.games.poker.admin.wicket.pages.user.UserList.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters/*from  w ww  .jav a  2s .  c  o m*/
*            Page parameters
*/
public UserList(final PageParameters parameters) {
    super(parameters);
    final Form<?> searchForm = new Form<UserList>("searchForm", new CompoundPropertyModel<UserList>(this));
    final TextField<String> idField = new TextField<String>("userId");
    searchForm.add(idField);
    final TextField<String> userNameField = new TextField<String>("name");
    searchForm.add(userNameField);
    searchForm.add(new Button("clearForm") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            super.onSubmit();
            idField.clearInput();
            userNameField.clearInput();
        }
    });
    add(searchForm);
    add(new FeedbackPanel("feedback"));

    final UsersDataProvider dataProvider = new UsersDataProvider();
    List<IColumn<User, String>> columns = new ArrayList<IColumn<User, String>>();

    columns.add(new AbstractColumn<User, String>(Model.of("User Id")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<User>> item, String componentId, IModel<User> model) {
            Long userId = model.getObject().getUserId();
            LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class,
                    params(UserSummary.PARAM_USER_ID, userId));
            item.add(panel);
        }

        @Override
        public boolean isSortable() {
            return true;
        }

        @Override
        public String getSortProperty() {
            return UserOrder.ID.name();
        }
    });
    columns.add(new PropertyColumn<User, String>(Model.of("XId"), "externalUserId"));
    columns.add(
            new PropertyColumn<User, String>(Model.of("User name"), UserOrder.USER_NAME.name(), "userName"));
    columns.add(new PropertyColumn<User, String>(Model.of("Status"), UserOrder.STATUS.name(), "status"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("First name"), "userInformation.firstName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Last name"), "userInformation.lastName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Country"), UserOrder.COUNTRY.name(), "userInformation.country"));
    columns.add(new PropertyColumn<User, String>(Model.of("Ext. Username"), "attributes.externalUsername"));
    columns.add(new PropertyColumn<User, String>(Model.of("Screename"), "attributes.screenname"));

    AjaxFallbackDefaultDataTable<User, String> userTable = new AjaxFallbackDefaultDataTable<User, String>(
            "userTable", columns, dataProvider, 20);
    add(userTable);

    final ModalWindow modal = new ModalWindow("modal");
    modal.setContent(new UserReportPanel(modal.getContentId(), modal));
    modal.setTitle("Generate report");
    modal.setCookieName("modal");
    modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    modal.setInitialWidth(265);
    modal.setInitialHeight(200);

    add(modal);
    add(new AjaxLink<Void>("showReportPanel") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<User> users = getUserList(getUserId(), getName(), 0, Integer.MAX_VALUE,
                    dataProvider.getSort().getProperty(), dataProvider.getSort().isAscending()).getUsers();
            HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
            request.getSession().setAttribute(ReportServlet.REPORTS_COLLECTION_DATA_SOURCE, users);
            modal.show(target);
        }
    });
}

From source file:com.doculibre.constellio.wicket.components.holders.ModalLinkHolder.java

License:Open Source License

private void initComponents(IModel labelModel) {
    link = newLink(LINK_ID);/*from  w ww.j ava2 s .c om*/
    label = newLabel(LABEL_ID, labelModel);

    add(link);
    link.add(label);

    IModel titleModel = getTitleModel();
    if (titleModel != null) {
        link.add(new AttributeModifier("title", true, titleModel));
    }

    modalWindow = new ModalWindow("modal");
    modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    add(modalWindow);
}

From source file:com.doculibre.constellio.wicket.components.tinymce.TinyMCEModalWindow.java

License:Open Source License

public TinyMCEModalWindow(String id) {
    super(id);
    setCssClassName(ModalWindow.CSS_CLASS_GRAY);
}

From source file:com.doculibre.constellio.wicket.panels.admin.analyzer.AddEditAnalyzerFieldPanel.java

License:Open Source License

public AddEditAnalyzerFieldPanel(String id, IModel analyzerModel) {
    super(id, new CompoundPropertyModel(analyzerModel));

    Analyzer analyzer = (Analyzer) analyzerModel.getObject();
    filtersModel.getObject().addAll(analyzer.getFilters());

    final ModalWindow analyzerClassModal = new ModalWindow("analyzerClassModal");
    add(analyzerClassModal);/*from w  ww . j  a  v  a  2 s  .  c  o m*/
    analyzerClassModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

    IModel analyzerClassesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            AnalyzerClassServices analyzerClassServices = ConstellioSpringUtils.getAnalyzerClassServices();
            return analyzerClassServices.list();
        }
    };

    IChoiceRenderer analyzerClassRenderer = new ChoiceRenderer("className");

    final DropDownChoice analyzerClassField = new DropDownChoice("analyzerClass", analyzerClassesModel,
            analyzerClassRenderer);
    add(analyzerClassField);
    analyzerClassField.setOutputMarkupId(true);

    AjaxLink addAnalyzerClassLink = new AjaxLink("addAnalyzerClassLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddEditAnalyzerClassPanel addEditAnalyzerClassPanel = new AddEditAnalyzerClassPanel(
                    analyzerClassModal.getContentId(), new AnalyzerClass(), analyzerClassField);
            analyzerClassModal.setContent(addEditAnalyzerClassPanel);
            analyzerClassModal.show(target);
        }
    };
    add(addAnalyzerClassLink);

    final ModalWindow tokenizerClassModal = new ModalWindow("tokenizerClassModal");
    add(tokenizerClassModal);
    tokenizerClassModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

    IModel tokenizerClassesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            TokenizerClassServices tokenizerClassServices = ConstellioSpringUtils.getTokenizerClassServices();
            return tokenizerClassServices.list();
        }
    };

    IChoiceRenderer tokenizerClassRenderer = new ChoiceRenderer("className");

    final DropDownChoice tokenizerClassField = new DropDownChoice("tokenizerClass", tokenizerClassesModel,
            tokenizerClassRenderer);
    add(tokenizerClassField);
    tokenizerClassField.setOutputMarkupId(true);

    AjaxLink addTokenizerClassLink = new AjaxLink("addTokenizerClassLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddEditTokenizerClassPanel addEditTokenizerClassPanel = new AddEditTokenizerClassPanel(
                    tokenizerClassModal.getContentId(), new TokenizerClass(), tokenizerClassField);
            tokenizerClassModal.setContent(addEditTokenizerClassPanel);
            tokenizerClassModal.show(target);
        }
    };
    add(addTokenizerClassLink);

    add(new FilterListPanel("filtersPanel"));
}

From source file:com.doculibre.constellio.wicket.panels.admin.analyzer.filter.AddEditFilterPanel.java

License:Open Source License

public AddEditFilterPanel(String id, AnalyzerFilter filter, int index) {
    super(id, true);
    this.entityModel = new ReloadableEntityModel<AnalyzerFilter>(filter);
    // Ne pas utiliser filter.getID() pour dterminer si c'est en cration.
    // Car cela empche de modifier un filtre tout juste cr
    this.index = index;

    Form form = getForm();/*w ww  .  ja v  a  2  s .c  o m*/
    form.setModel(new CompoundPropertyModel(entityModel));

    final ModalWindow filterClassModal = new ModalWindow("filterClassModal");
    form.add(filterClassModal);
    filterClassModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

    IModel filterClassesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            FilterClassServices filterClassServices = ConstellioSpringUtils.getFilterClassServices();
            return filterClassServices.list();
        }
    };

    IChoiceRenderer filterClassRenderer = new ChoiceRenderer("className");

    final DropDownChoice filterClassField = new DropDownChoice("filterClass", filterClassesModel,
            filterClassRenderer);
    form.add(filterClassField);
    filterClassField.setOutputMarkupId(true);

    AjaxLink addFilterClassLink = new AjaxLink("addFilterClassLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddEditFilterClassPanel addEditAnalyzerClassPanel = new AddEditFilterClassPanel(
                    filterClassModal.getContentId(), new FilterClass(), filterClassField);
            filterClassModal.setContent(addEditAnalyzerClassPanel);
            filterClassModal.show(target);
        }
    };
    form.add(addFilterClassLink);

    form.add(new CheckBox("ignoreCase"));
    form.add(new CheckBox("expand"));
    form.add(new CheckBox("enablePositionIncrements"));
    form.add(new CheckBox("inject"));
    form.add(new TextField("language"));
    form.add(new TextArea("wordsText"));
    form.add(new TextArea("synonymsText"));
    form.add(new TextArea("protectedText"));
    form.add(new TextField("generateWordParts", Integer.class));
    form.add(new TextField("generateNumberParts", Integer.class));
    form.add(new TextField("catenateWords", Integer.class));
    form.add(new TextField("catenateNumbers", Integer.class));
    form.add(new TextField("catenateAll", Integer.class));
    form.add(new TextField("splitOnCaseChange", Integer.class));
    form.add(new TextField("delimiter"));
    form.add(new TextField("encoder"));
    form.add(new TextField("pattern"));
    form.add(new TextField("replacement"));
    form.add(new TextField("replace"));
}

From source file:com.doculibre.constellio.wicket.panels.admin.connectorTypeMeta.AddEditConnectorTypeMetaMappingPanel.java

License:Open Source License

public AddEditConnectorTypeMetaMappingPanel(String id, ConnectorTypeMetaMapping metaMapping) {
    super(id, true);
    this.metaMappingModel = new ReloadableEntityModel<ConnectorTypeMetaMapping>(metaMapping);

    Form form = getForm();//ww w .  j a va2  s . c o  m
    form.setModel(new CompoundPropertyModel(metaMappingModel));

    TextField metaNameField = new RequiredTextField("metaName");
    metaNameField.add(new StringValidator.MaximumLengthValidator(255));
    form.add(metaNameField);

    TextField indexFieldNameField = new RequiredTextField("indexFieldName");
    indexFieldNameField.add(new StringValidator.MaximumLengthValidator(255));
    form.add(indexFieldNameField);

    final CheckBox indexedCheckbox = new CheckBox("indexed");
    form.add(indexedCheckbox);

    //        final CheckBox storedCheckbox = new CheckBox("stored");
    //        form.add(storedCheckbox);

    final CheckBox multiValuedCheckbox = new CheckBox("multiValued");
    form.add(multiValuedCheckbox);

    final ModalWindow fieldTypeModal = new ModalWindow("fieldTypeModal");
    form.add(fieldTypeModal);
    fieldTypeModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

    IModel fieldTypesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            FieldTypeServices fieldTypeServices = ConstellioSpringUtils.getFieldTypeServices();
            return fieldTypeServices.list();
        }
    };

    IChoiceRenderer fieldTypeRenderer = new ChoiceRenderer("name");

    final DropDownChoice fieldTypeField = new DropDownChoice("fieldType", fieldTypesModel, fieldTypeRenderer);
    form.add(fieldTypeField);
    fieldTypeField.setOutputMarkupId(true);

    AjaxLink addFieldTypeLink = new AjaxLink("addFieldTypeLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddEditFieldTypePanel addEditFieldTypePanel = new AddEditFieldTypePanel(
                    fieldTypeModal.getContentId(), new FieldType(), fieldTypeField);
            fieldTypeModal.setContent(addEditFieldTypePanel);
            fieldTypeModal.show(target);
        }
    };
    form.add(addFieldTypeLink);
}

From source file:com.doculibre.constellio.wicket.panels.admin.elevate.ElevateQueryListPanel.java

License:Open Source License

public ElevateQueryListPanel(String id) {
    super(id);//from  ww w  . j a  va2 s. c o  m

    add(new DocIdsPanel("excludedDocIdsPanel", null, false));

    IModel elevateQueriesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            AdminCollectionPanel collectionAdminPanel = (AdminCollectionPanel) findParent(
                    AdminCollectionPanel.class);
            RecordCollection collection = collectionAdminPanel.getCollection();
            String solrCoreName = collection.getName();

            ElevateServices elevateServices = ConstellioSpringUtils.getElevateServices();
            return elevateServices.getQueries(solrCoreName);
        }
    };

    add(new ListView("queries", elevateQueriesModel) {
        @Override
        protected void populateItem(ListItem item) {
            final String queryText = (String) item.getModelObject();
            ElevateServices elevateServices = ConstellioSpringUtils.getElevateServices();
            final SimpleSearch querySimpleSearch = elevateServices.toSimpleSearch(queryText);

            int nbDocs = elevateServices.getElevatedDocIds(querySimpleSearch).size();
            item.add(new Label("nbDocs", "" + nbDocs));

            final ModalWindow detailsModal = new ModalWindow("detailsModal");
            item.add(detailsModal);
            detailsModal.setInitialHeight(SingleColumnCRUDPanel.MODAL_HEIGHT);
            detailsModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

            WebMarkupContainer detailsLink = new AjaxLink("detailsLink") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    detailsModal
                            .setContent(new ElevateQueryDocIdsPanel(detailsModal.getContentId(), queryText));
                    //                  detailsModal.setTitle(queryText);
                    detailsModal.setWindowClosedCallback(new WindowClosedCallback() {
                        @Override
                        public void onClose(AjaxRequestTarget target) {
                            target.addComponent(ElevateQueryListPanel.this);
                        }
                    });
                    detailsModal.show(target);
                }
            };
            item.add(detailsLink);
            detailsLink.add(new SimpleSearchQueryPanel("queryText", querySimpleSearch));

            WebMarkupContainer deleteLink = new AjaxLink("deleteLink") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    ElevateServices elevateServices = ConstellioSpringUtils.getElevateServices();
                    elevateServices.deleteQuery(querySimpleSearch);
                    target.addComponent(ElevateQueryListPanel.this);
                }

                @Override
                protected IAjaxCallDecorator getAjaxCallDecorator() {
                    return new AjaxCallDecorator() {
                        @Override
                        public CharSequence decorateScript(CharSequence script) {
                            String confirmMsg = getLocalizer().getString("confirmDelete",
                                    ElevateQueryListPanel.this);
                            return "if (confirm('" + confirmMsg + "')) {" + script + "} else { return false; }";
                        }
                    };
                }
            };
            item.add(deleteLink);
        }
    });
}

From source file:com.doculibre.constellio.wicket.panels.admin.fieldType.AddEditFieldTypePanel.java

License:Open Source License

public AddEditFieldTypePanel(String id, FieldType fieldType, Component refreshComponentP) {
    super(id, true);
    this.fieldTypeModel = new ReloadableEntityModel<FieldType>(fieldType);
    this.refreshComponent = refreshComponentP;

    Form form = getForm();/* w  w w. j a va2 s  .  c o  m*/
    form.setModel(new CompoundPropertyModel(fieldTypeModel));

    TextField nameField = new RequiredTextField("name");
    nameField.add(new StringValidator.MaximumLengthValidator(255));
    form.add(nameField);

    final ModalWindow fieldTypeClassModal = new ModalWindow("fieldTypeClassModal");
    form.add(fieldTypeClassModal);
    fieldTypeClassModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

    IModel fieldTypeClassesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            FieldTypeClassServices fieldTypeClassServices = ConstellioSpringUtils.getFieldTypeClassServices();
            return fieldTypeClassServices.list();
        }
    };

    IChoiceRenderer fieldTypeClassRenderer = new ChoiceRenderer("className");

    final DropDownChoice fieldTypeClassField = new DropDownChoice("fieldTypeClass", fieldTypeClassesModel,
            fieldTypeClassRenderer);
    form.add(fieldTypeClassField);
    fieldTypeClassField.setOutputMarkupId(true);

    AjaxLink addFieldTypeClassLink = new AjaxLink("addFieldTypeClassLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddEditFieldTypeClassPanel addEditFieldTypeClassPanel = new AddEditFieldTypeClassPanel(
                    fieldTypeClassModal.getContentId(), new FieldTypeClass(), fieldTypeClassField);
            fieldTypeClassModal.setContent(addEditFieldTypeClassPanel);
            fieldTypeClassModal.show(target);
        }
    };
    form.add(addFieldTypeClassLink);

    analyzerPanel = new AddEditAnalyzerFieldPanel("analyzerPanel", new LoadableDetachableModel() {
        @Override
        protected Object load() {
            FieldType fieldType = fieldTypeModel.getObject();
            return fieldType.getAnalyzer() != null ? fieldType.getAnalyzer() : new Analyzer();
        }
    });
    form.add(analyzerPanel);

    queryAnalyzerPanel = new AddEditAnalyzerFieldPanel("queryAnalyzerPanel", new LoadableDetachableModel() {
        @Override
        protected Object load() {
            FieldType fieldType = fieldTypeModel.getObject();
            return fieldType.getQueryAnalyzer() != null ? fieldType.getQueryAnalyzer() : new Analyzer();
        }
    });
    form.add(queryAnalyzerPanel);

    TextField precisionStepField = new TextField("precisionStep", Integer.class);
    form.add(precisionStepField);

    TextField positionIncrementGapField = new TextField("positionIncrementGap", Integer.class);
    form.add(positionIncrementGapField);

    final CheckBox sortMissingLastCheckbox = new CheckBox("sortMissingLast");
    form.add(sortMissingLastCheckbox);

    final CheckBox omitNormsCheckbox = new CheckBox("omitNorms");
    form.add(omitNormsCheckbox);

    final CheckBox multiValuedCheckbox = new CheckBox("multiValued");
    form.add(multiValuedCheckbox);

}

From source file:com.doculibre.constellio.wicket.panels.admin.indexField.AddEditIndexFieldPanel.java

License:Open Source License

public AddEditIndexFieldPanel(String id, IndexField indexField) {
    super(id);/* www  . j  a  v a 2  s  .c om*/
    this.indexFieldModel = new ReloadableEntityModel<IndexField>(indexField);
    for (CopyField copyFieldDest : indexField.getCopyFieldsDest()) {
        copyFieldsDest.add(new CopyFieldDTO(copyFieldDest));
    }
    for (CopyField copyFieldSource : indexField.getCopyFieldsDest()) {
        copyFieldsSource.add(new CopyFieldDTO(copyFieldSource));
    }
    for (ConnectorInstanceMeta meta : indexField.getConnectorInstanceMetas()) {
        metas.add(new ConnectorInstanceMetaDTO(meta));
    }

    add(new FeedbackPanel("feedback"));

    Form form = new Form("form", new CompoundPropertyModel(indexFieldModel));
    add(form);
    form.add(new SetFocusBehavior(form));

    String titleKey = indexField.getId() == null ? "add" : "edit";
    IModel titleModel = new StringResourceModel(titleKey, this, null);
    form.add(new Label("title", titleModel));

    TextField nameField = new RequiredTextField("name");
    nameField.add(new StringValidator.MaximumLengthValidator(255));
    nameField.setEnabled(!indexField.isInternalField());
    form.add(nameField);

    final CheckBox indexedCheckbox = new CheckBox("indexed");
    indexedCheckbox.setEnabled(!indexField.isInternalField());
    form.add(indexedCheckbox);

    //      final CheckBox storedCheckbox = new CheckBox("stored");
    //      storedCheckbox.setEnabled(!indexField.isInternalField());
    //      form.add(storedCheckbox);

    final CheckBox dynamicFieldCheckbox = new CheckBox("dynamicField");
    dynamicFieldCheckbox.setEnabled(!indexField.isInternalField());
    form.add(dynamicFieldCheckbox);

    final CheckBox multiValuedCheckbox = new CheckBox("multiValued");
    multiValuedCheckbox.setEnabled(!indexField.isInternalField());
    form.add(multiValuedCheckbox);

    final CheckBox sortableCheckbox = new CheckBox("sortable");
    form.add(sortableCheckbox);

    final CheckBox highlightedCheckbox = new CheckBox("highlighted");
    form.add(highlightedCheckbox);

    final ModalWindow fieldTypeModal = new ModalWindow("fieldTypeModal");
    form.add(fieldTypeModal);
    fieldTypeModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);

    IModel fieldTypesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            FieldTypeServices fieldTypeServices = ConstellioSpringUtils.getFieldTypeServices();
            return fieldTypeServices.list();
        }
    };

    IChoiceRenderer fieldTypeRenderer = new ChoiceRenderer("name");

    final DropDownChoice fieldTypeField = new DropDownChoice("fieldType", fieldTypesModel, fieldTypeRenderer);
    form.add(fieldTypeField);
    fieldTypeField.setOutputMarkupId(true);
    fieldTypeField.setEnabled(indexField.isAnalyzingCustomizable());

    AjaxLink addFieldTypeLink = new AjaxLink("addFieldTypeLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddEditFieldTypePanel addEditFieldTypePanel = new AddEditFieldTypePanel(
                    fieldTypeModal.getContentId(), new FieldType(), fieldTypeField);
            fieldTypeModal.setContent(addEditFieldTypePanel);
            fieldTypeModal.show(target);
        }
    };
    form.add(addFieldTypeLink);
    addFieldTypeLink.setVisible(indexField.isAnalyzingCustomizable());

    form.add(new MetaListPanel("metas").setVisible(indexField.isAnalyzingCustomizable()));
    form.add(new CopyFieldListPanel("copyFieldsDest", true).setVisible(indexField.isAnalyzingCustomizable()));

    IModel localesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            AdminCollectionPanel collectionAdminPanel = (AdminCollectionPanel) findParent(
                    AdminCollectionPanel.class);
            RecordCollection collection = collectionAdminPanel.getCollection();
            return collection.getLocales();
        }
    };
    MultiLocaleComponentHolder nameHolder = new MultiLocaleComponentHolder("label", indexFieldModel,
            localesModel) {
        @Override
        protected void onPopulateItem(ListItem item, IModel componentModel, Locale locale) {
            TextField nameField = new TextField("nameLocale", componentModel);
            item.add(nameField);
            item.add(new LocaleNameLabel("localeName", locale, true) {
                @Override
                public boolean isVisible() {
                    AdminCollectionPanel collectionAdminPanel = (AdminCollectionPanel) findParent(
                            AdminCollectionPanel.class);
                    RecordCollection collection = collectionAdminPanel.getCollection();
                    return collection.getLocales().size() > 1;
                }
            });
        }
    };
    form.add(nameHolder);

    Button submitButton = new AjaxButton("submitButton") {
        @Override
        public void onSubmit(AjaxRequestTarget target, Form form) {
            IndexField indexField = indexFieldModel.getObject();

            EntityManager entityManager = ConstellioPersistenceContext.getCurrentEntityManager();
            if (!entityManager.getTransaction().isActive()) {
                entityManager.getTransaction().begin();
            }

            List<ConnectorInstanceMeta> existingMetas = new ArrayList<ConnectorInstanceMeta>(
                    indexField.getConnectorInstanceMetas());
            // Remove deleted metas
            List<ConnectorInstanceMeta> formMetas = new ArrayList<ConnectorInstanceMeta>();
            for (ConnectorInstanceMetaDTO metaDTO : getMetas()) {
                formMetas.add(metaDTO.toConnectorInstanceMeta());
            }
            for (Iterator<ConnectorInstanceMeta> it = existingMetas.iterator(); it.hasNext();) {
                ConnectorInstanceMeta meta = it.next();
                meta = entityManager.merge(meta);
                if (!hasMeta(meta, formMetas)) {
                    indexField.removeConnectorInstanceMeta(meta);
                }
            }
            // Add new
            for (ConnectorInstanceMetaDTO metaDTO : getMetas()) {
                ConnectorInstanceMeta meta = metaDTO.toConnectorInstanceMeta();
                if (!hasMeta(meta, existingMetas)) {
                    meta = entityManager.merge(meta);
                    indexField.addConnectorInstanceMeta(meta);
                }
            }

            Set<CopyField> existingCopyFieldsSource = indexField.getCopyFieldsSource();
            // Remove deleted copy fields
            for (Iterator<CopyField> it = existingCopyFieldsSource.iterator(); it.hasNext();) {
                CopyField copyField = it.next();
                if (!getCopyFieldsSource().contains(new CopyFieldDTO(copyField))) {
                    it.remove();
                }
            }
            // Add new or update set
            for (CopyFieldDTO copyFieldDTO : getCopyFieldsSource()) {
                CopyField copyField = copyFieldDTO.toCopyField();
                copyField.setIndexFieldSource(indexField);
                if (copyField.getId() != null) {
                    entityManager.merge(copyField);
                } else {
                    existingCopyFieldsSource.add(copyField);
                }
            }

            Set<CopyField> existingCopyFieldsDest = indexField.getCopyFieldsDest();
            // Remove deleted copy fields
            for (Iterator<CopyField> it = existingCopyFieldsDest.iterator(); it.hasNext();) {
                CopyField copyField = it.next();
                if (!getCopyFieldsDest().contains(new CopyFieldDTO(copyField))) {
                    it.remove();
                }
            }
            // Add new or update set
            for (CopyFieldDTO copyFieldDTO : getCopyFieldsDest()) {
                CopyField copyField = copyFieldDTO.toCopyField();
                copyField.setIndexFieldDest(indexField);
                if (copyField.getId() != null) {
                    entityManager.merge(copyField);
                } else {
                    existingCopyFieldsDest.add(copyField);
                }
            }

            AdminCollectionPanel collectionAdminPanel = (AdminCollectionPanel) findParent(
                    AdminCollectionPanel.class);
            RecordCollection collection = collectionAdminPanel.getCollection();
            indexField.setRecordCollection(collection);

            IndexFieldServices indexFieldServices = ConstellioSpringUtils.getIndexFieldServices();
            FederationServices federationServices = ConstellioSpringUtils.getFederationServices();

            if (indexField.isSortable()) {
                if (indexFieldServices.getSortFieldOf(indexField) == null) {
                    indexFieldServices.newSortFieldFor(indexField);
                }
            }

            AutocompleteServices autocompleteServices = ConstellioSpringUtils.getAutocompleteServices();
            if (indexField.isAutocompleted()) {
                autocompleteServices.setAutoCompleteToField(indexField);
            } else {
                autocompleteServices.removeAutoCompleteFromField(indexField);
            }

            if (collection.isIncludedInFederation()) {
                List<String> conflicts = new ArrayList<String>();
                List<IndexField> newFederationFields = new ArrayList<IndexField>();
                List<RecordCollection> ownerCollections = federationServices.listOwnerCollections(collection);
                for (RecordCollection ownerCollection : ownerCollections) {
                    String indexFieldName = indexField.getName();
                    IndexField ownerIndexField = ownerCollection.getIndexField(indexFieldName);
                    if (ownerIndexField == null) {
                        IndexField copy = federationServices.copy(indexField, ownerCollection);
                        newFederationFields.add(copy);
                    }
                    if (federationServices.isConflict(indexFieldName, ownerCollection, collection)) {
                        Locale displayLocale = ownerCollection.getDisplayLocale(getLocale());
                        conflicts.add(ownerCollection.getTitle(displayLocale));
                    }
                }
                if (conflicts.isEmpty()) {
                    indexFieldServices.makePersistent(indexField);
                    for (IndexField newFederationField : newFederationFields) {
                        indexFieldServices.makePersistent(newFederationField);
                    }
                } else {
                    for (String collectionTitle : conflicts) {
                        error(getLocalizer().getString("conflict", this) + " : " + collectionTitle);
                    }
                }
            } else {
                indexFieldServices.makePersistent(indexField);
            }

            entityManager.getTransaction().commit();

            ModalWindow modalWindow = (ModalWindow) findParent(ModalWindow.class);
            modalWindow.close(target);

            target.addComponent(modalWindow.findParent(AdminIndexFieldsPanel.class));
        }
    };
    form.add(submitButton);

    Button cancelButton = new AjaxButton("cancelButton") {
        @Override
        public void onSubmit(AjaxRequestTarget target, Form form) {
            ModalWindow modalWindow = (ModalWindow) findParent(ModalWindow.class);
            modalWindow.close(target);
        }
    }.setDefaultFormProcessing(false);
    form.add(cancelButton);
}