1 /**
2 * Copyright 2014-2024 Bloomreach B.V. (<a href="http://www.bloomreach.com">http://www.bloomreach.com</a>)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.onehippo.forge.exdocpicker.impl.field.tree;
17
18 import java.io.Serializable;
19
20 import org.apache.wicket.model.Model;
21 import org.hippoecm.frontend.dialog.AbstractDialog;
22 import org.hippoecm.frontend.plugin.IPluginContext;
23 import org.hippoecm.frontend.plugin.config.IPluginConfig;
24 import org.onehippo.forge.exdocpicker.api.ExternalDocumentCollection;
25 import org.onehippo.forge.exdocpicker.impl.field.ExternalDocumentFieldSelectorPlugin;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 /**
30 * External document(s) selector field plugin for tree item data from external data backend.
31 * This class simply exstends {@link ExternalDocumentFieldSelectorPlugin} to show a different implementation of
32 * the dialog when user clicks on the browse button.
33 */
34 public class ExternalTreeItemFieldSelectorPlugin extends ExternalDocumentFieldSelectorPlugin {
35
36 private static final long serialVersionUID = 1L;
37
38 private static final Logger log = LoggerFactory.getLogger(ExternalTreeItemFieldSelectorPlugin.class);
39
40 /**
41 * Constructs tree-viewable external document(s) selector field plugin.
42 * @param context plugin context
43 * @param config plugin config
44 */
45 public ExternalTreeItemFieldSelectorPlugin(final IPluginContext context, IPluginConfig config) {
46 super(context, config);
47 }
48
49 /**
50 * {@inheritDoc}
51 */
52 @Override
53 protected AbstractDialog<ExternalDocumentCollection<Serializable>> createDialogInstance() {
54 return new ExternalTreeItemFieldBrowserDialog(
55 getCaptionModel(),
56 getExternalDocumentServiceContext(),
57 getExternalDocumentServiceFacade(),
58 new Model<>(getCurrentExternalDocumentCollection()));
59 }
60
61 }