List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow show
public void show(final IPartialPageRequestHandler target)
From source file:com.doculibre.constellio.wicket.panels.results.tagging.SearchResultTaggingPanel.java
License:Open Source License
public SearchResultTaggingPanel(String id, final SolrDocument doc, final IDataProvider dataProviderParam) { super(id);/*from w w w .ja va 2 s . com*/ RecordCollectionServices collectionServices = ConstellioSpringUtils.getRecordCollectionServices(); final SimpleSearch simpleSearch; if (dataProviderParam instanceof FacetsDataProvider) { FacetsDataProvider dataProvider = (FacetsDataProvider) dataProviderParam; simpleSearch = dataProvider.getSimpleSearch(); } else { SearchResultsDataProvider dataProvider = (SearchResultsDataProvider) dataProviderParam; simpleSearch = dataProvider.getSimpleSearch(); } String collectionName = simpleSearch.getCollectionName(); RecordCollection collection = collectionServices.get(collectionName); if (!collection.isOpenSearch()) { RecordServices recordServices = ConstellioSpringUtils.getRecordServices(); Record record = recordServices.get(doc); recordModel = new RecordModel(record); final ModalWindow taggingModal = new ModalWindow("taggingModal"); taggingModal.setTitle(new StringResourceModel("tags", this, null)); taggingModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY); taggingModal.setInitialWidth(800); taggingModal.setInitialHeight(450); taggingModal.setCloseButtonCallback(new CloseButtonCallback() { @Override public boolean onCloseButtonClicked(AjaxRequestTarget target) { target.addComponent(SearchResultTaggingPanel.this); return true; } }); add(taggingModal); IModel thesaurusListModel = new LoadableDetachableModel() { @Override protected Object load() { List<Thesaurus> thesaurusList = new ArrayList<Thesaurus>(); RecordCollectionServices collectionServices = ConstellioSpringUtils .getRecordCollectionServices(); String collectionName = simpleSearch.getCollectionName(); RecordCollection collection = collectionServices.get(collectionName); thesaurusList.add(null);// free text tags if (collection.getThesaurus() != null) { thesaurusList.add(collection.getThesaurus()); } return thesaurusList; } }; add(new ListView("taggingLinks", thesaurusListModel) { @Override protected void populateItem(ListItem item) { Thesaurus thesaurus = (Thesaurus) item.getModelObject(); final ReloadableEntityModel<Thesaurus> thesaurusModel = new ReloadableEntityModel<Thesaurus>( thesaurus); final String thesaurusName; if (thesaurus == null) { thesaurusName = getLocalizer().getString("tags", this); } else { thesaurusName = getLocalizer().getString("thesaurus", this); } AjaxLink link = new AjaxLink("taggingLink") { @Override public void onClick(AjaxRequestTarget target) { Thesaurus thesaurus = thesaurusModel.getObject(); SearchResultEditTaggingPanel editTaggingPanel = new SearchResultEditTaggingPanel( taggingModal.getContentId(), doc, dataProviderParam, thesaurus); taggingModal.setContent(editTaggingPanel); taggingModal.show(target); } @Override public boolean isEnabled() { boolean enabled = super.isEnabled(); if (enabled) { Record record = recordModel.getObject(); if (record != null) { ConstellioUser user = ConstellioSession.get().getUser(); if (user != null) { RecordCollection collection = record.getConnectorInstance() .getRecordCollection(); enabled = user.hasCollaborationPermission(collection); } else { enabled = false; } } else { enabled = false; } } return enabled; } @Override public void detachModels() { thesaurusModel.detach(); super.detachModels(); } }; item.add(link); link.add(new Label("thesaurusName", thesaurusName)); final IModel tagsModel = new LoadableDetachableModel() { @Override protected Object load() { Record record = recordModel.getObject(); Thesaurus thesaurus = thesaurusModel.getObject(); return new ArrayList<RecordTag>(record.getIncludedRecordTags(thesaurus)); } }; item.add(new ListView("tags", tagsModel) { @SuppressWarnings("unchecked") @Override protected void populateItem(ListItem item) { RecordTag recordTag = (RecordTag) item.getModelObject(); final RecordTagModel recordTagModel = new RecordTagModel(recordTag); Link addTagLink = new Link("addTagLink") { @Override public void onClick() { RecordTag recordTag = recordTagModel.getObject(); SimpleSearch clone = simpleSearch.clone(); clone.getTags().add(recordTag.getName(getLocale())); PageFactoryPlugin pageFactoryPlugin = PluginFactory .getPlugin(PageFactoryPlugin.class); if (StringUtils.isNotBlank(clone.getLuceneQuery())) { // ConstellioSession.get().addSearchHistory(clone); setResponsePage(pageFactoryPlugin.getSearchResultsPage(), SearchResultsPage.getParameters(clone)); } else { SimpleSearch newSearch = new SimpleSearch(); newSearch.setCollectionName(simpleSearch.getCollectionName()); newSearch.setSingleSearchLocale(simpleSearch.getSingleSearchLocale()); setResponsePage(pageFactoryPlugin.getSearchFormPage(), SearchFormPage.getParameters(newSearch)); } } @Override public void detachModels() { recordTagModel.detach(); super.detachModels(); } }; item.add(addTagLink); List<RecordTag> recordTags = (List<RecordTag>) tagsModel.getObject(); String tag = recordTag.getName(getLocale()); if (item.getIndex() < recordTags.size() - 1) { tag += ";"; } addTagLink.add(new Label("tag", tag)); addTagLink.setEnabled(false); } }); item.add(new WebMarkupContainer("noTags") { @SuppressWarnings("unchecked") @Override public boolean isVisible() { List<RecordTag> recordTags = (List<RecordTag>) tagsModel.getObject(); return super.isVisible() && recordTags.isEmpty(); } }); } }); } else { setVisible(false); } }
From source file:com.evolveum.midpoint.web.component.assignment.AssignmentTablePanel.java
License:Apache License
private void showModalWindow(String id, AjaxRequestTarget target) { ModalWindow window = (ModalWindow) get(id); window.show(target); }
From source file:com.evolveum.midpoint.web.component.assignment.AutzActionsTablePanel.java
License:Apache License
private void showAuthorizationPopupPerformed(AjaxRequestTarget target) { ModalWindow mod = (ModalWindow) get(ID_MODAL_DELETE_AUTHORIZATION); mod.show(target); }
From source file:com.evolveum.midpoint.web.component.form.multivalue.MultiValueChoosePanel.java
License:Apache License
protected void editValuePerformed(AjaxRequestTarget target) { ModalWindow window = (ModalWindow) get(MODAL_ID_CHOOSE_PANEL); ChooseTypeDialog dialog = (ChooseTypeDialog) window; dialog.updateTablePerformed(target, createChooseQuery()); window.show(target); }
From source file:com.evolveum.midpoint.web.component.MultiValueChoosePanel.java
License:Apache License
protected void editValuePerformed(AjaxRequestTarget target, ListItem<T> item) { ModalWindow window = (ModalWindow) get(MODAL_ID_CHOOSE_PANEL); ChooseTypeDialog dialog = (ChooseTypeDialog) window; dialog.updateTablePerformed(target, createChooseQuery()); window.show(target); }
From source file:com.evolveum.midpoint.web.page.admin.BaseFocusPanel.java
License:Apache License
private void showModalWindow(String id, AjaxRequestTarget target) { ModalWindow window = (ModalWindow) get(id); window.show(target); target.add(getFeedbackPanel());/*from www.j av a 2s. c o m*/ }
From source file:com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypePanel.java
License:Apache License
private void changeOptionPerformed(AjaxRequestTarget target) { ModalWindow window = (ModalWindow) get(MODAL_ID_SHOW_CHOOSE_OPTIONS); window.show(target); }
From source file:com.evolveum.midpoint.web.page.admin.configuration.PageDebugList.java
License:Apache License
private void deleteAllType(AjaxRequestTarget target) { DebugSearchDto searchDto = searchModel.getObject(); DebugConfDialogDto dto = new DebugConfDialogDto(DebugConfDialogDto.Operation.DELETE_ALL_TYPE, null, searchDto.getType().getClassDefinition()); confDialogModel.setObject(dto);/* w w w .ja v a2s. c om*/ ModalWindow dialog = (ModalWindow) get(ID_CONFIRM_DELETE_POPUP); dialog.show(target); }
From source file:com.evolveum.midpoint.web.page.admin.configuration.PageDebugList.java
License:Apache License
private void deleteSelected(AjaxRequestTarget target, DebugObjectItem item) { List<DebugObjectItem> selected = getSelectedData(target, item); if (selected.isEmpty()) { return;//from ww w . j ava 2 s . c o m } DebugSearchDto searchDto = searchModel.getObject(); DebugConfDialogDto dto = new DebugConfDialogDto(DebugConfDialogDto.Operation.DELETE_SELECTED, selected, searchDto.getType().getClassDefinition()); confDialogModel.setObject(dto); ModalWindow dialog = (ModalWindow) get(ID_CONFIRM_DELETE_POPUP); dialog.show(target); }
From source file:com.evolveum.midpoint.web.page.admin.configuration.PageDebugList.java
License:Apache License
private void deleteAllIdentities(AjaxRequestTarget target) { DebugConfDialogDto dto = new DebugConfDialogDto(DebugConfDialogDto.Operation.DELETE_ALL_IDENTITIES, null, null);/* w w w . j ava 2s . c o m*/ confDialogModel.setObject(dto); ModalWindow dialog = (ModalWindow) get(ID_CONFIRM_DELETE_POPUP); dialog.show(target); }