Returns a gallery dialog object.<p>

@param popup the parent popup widget

@return gallery dialog
167618
@SuppressWarnings("unused")
    public static CmsGalleryDialog createDialog(final CmsPopup popup) {

        CmsGalleryDialog galleryDialog = new CmsGalleryDialog(new I_CmsGalleryHandler() {

            public boolean filterDnd(CmsResultItemBean resultBean) {

                // TODO: Auto-generated method stub
                return true;
            }

            public Widget getAdditionalTypeTabControl() {

                return null;
            }

            public I_CmsAutoHider getAutoHideParent() {

                return popup;
            }

            public CmsDNDHandler getDndHandler() {

                return null;
            }

            public void processResultItem(CmsResultListItem item) {

                // do nothing
            }

        }, CmsTabbedPanelStyle.buttonTabs);
        try {
            CmsGalleryDataBean data = getGalleryDataFromDict();
            CmsGallerySearchBean search = getSearchBeanFromDict();
            new CmsGalleryController(new CmsGalleryControllerHandler(galleryDialog), data, search);
        } catch (SerializationException e) {
            CmsErrorDialog.handleException(
                new Exception(
                    "Deserialization of gallery data failed. This may be caused by expired java-script resources, please clear your browser cache and try again.",
                    e));
        }

        return galleryDialog;
    }
239226
public static <T extends PopupPanel> T showBelow (T popup, Widget target)
    {
        return show(popup, Position.BELOW, target);
    }
608843
public void showPublishDialog() {

        CmsPublishDialog.showPublishDialog(new HashMap<String, String>(), new CloseHandler<PopupPanel>() {

            /**
             * @see com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google.gwt.event.logical.shared.CloseEvent)
             */
            public void onClose(CloseEvent<PopupPanel> event) {

                deactivateCurrentButton();

            }
        }, new Runnable() {

            public void run() {

                showPublishDialog();
            }

        }, null);
    }
1062767
public static CmsEditExternalLinkDialog showNewLinkDialog(CmsListInfoBean typeInfo, String parentFolderPath) {

        CmsEditExternalLinkDialog dialog = new CmsEditExternalLinkDialog(typeInfo, parentFolderPath);
        dialog.center();
        return dialog;
    }
351426
public Object getDialogObject() {

        if (m_dialogObject == null) {
            m_dialogObject = getDialogObjectMap().get(getClass().getName());
        }
        return m_dialogObject;
    }
58002
public static PopupPanel newPopup (String styleName, Widget contents)
    {
        PopupPanel panel = new PopupPanel();
        panel.setStyleName(styleName);
        panel.setWidget(contents);
        return panel;
    }
231296
protected void openGalleryDialog() {

        if (m_popup == null) {
            m_popup = createPopup();
            m_popup.center();
        } else {
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getCurrentElement())) {
                m_popup.searchElement(getCurrentElement());
            } else {
                m_popup.center();
            }
        }
    }
679805
public static PopupMenuListener popupMenuWillBecomeInvisible(@NonNull Consumer<PopupMenuEvent> consumer) {
      return new PopupMenuListener() {
         @Override
         public void popupMenuCanceled(PopupMenuEvent e) {

         }

         @Override
         public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            consumer.accept(e);
         }

         @Override
         public void popupMenuWillBecomeVisible(PopupMenuEvent e) {

         }
      };
   }
385183
@SuppressWarnings("deprecation")
    private List<CmsResource> getGalleriesByType(int galleryTypeId) {

        List<CmsResource> galleries = new ArrayList<CmsResource>();

        // We swallow errors in this method because we don't  want a failure to read some folders (e.g. because of permission problems) to
        // cause an empty gallery list as a result

        try {
            galleries.addAll(
                getCmsObject().readResources(
                    "/",
                    CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId)));
        } catch (Exception e) {
            LOG.error("Could not read site galleries: " + e.getLocalizedMessage(), e);
        }

        String siteRoot = getCmsObject().getRequestContext().getSiteRoot();
        // if the current site is NOT the root site - add all other galleries from the system path

        try {
            if (!siteRoot.equals("")) {
                List<CmsResource> systemGalleries = null;
                // get the galleries in the /system/ folder
                systemGalleries = getCmsObject().readResources(
                    CmsWorkplace.VFS_PATH_SYSTEM,
                    CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId));
                if (systemGalleries != null) {
                    // add the found system galleries to the result
                    galleries.addAll(systemGalleries);
                }
            }
        } catch (Exception e) {
            LOG.info("Could not read system galleries: " + e.getLocalizedMessage(), e);
        }

        try {
            if (!OpenCms.getSiteManager().isSharedFolder(siteRoot)) {
                String shared = OpenCms.getSiteManager().getSharedFolder();
                List<CmsResource> sharedGalleries = getCmsObject().readResources(
                    shared,
                    CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId));
                if (sharedGalleries != null) {
                    galleries.addAll(sharedGalleries);
                }
            }
        } catch (Exception e) {
            LOG.info("Could not read shared galleries: " + e.getLocalizedMessage(), e);
        }
        return galleries;
    }
537774
private List<CmsGalleryTreeEntry> galleryListToTree(List<CmsGalleryFolderBean> galleries) {

        List<CmsGalleryTreeEntry> result = new ArrayList<CmsGalleryTreeEntry>();
        Collections.sort(galleries, new CmsComparatorPath(true));
        CmsGalleryTreeEntry previous = null;
        for (CmsGalleryFolderBean folderBean : galleries) {
            CmsGalleryTreeEntry current = new CmsGalleryTreeEntry(folderBean);
            CmsGalleryTreeEntry parent = null;
            if (previous != null) {
                parent = lookForParent(previous, current.getPath());
            }
            if (parent != null) {
                parent.addChild(current);
            } else {
                result.add(current);
            }
            previous = current;
        }
        return result;
    }
519671
protected I_CmsGalleryServiceAsync getGalleryService() {

        if (m_gallerySvc == null) {
            m_gallerySvc = GWT.create(I_CmsGalleryService.class);
            String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.galleries.CmsGalleryService.gwt");
            ((ServiceDefTarget)m_gallerySvc).setServiceEntryPoint(serviceUrl);
        }
        return m_gallerySvc;
    }
805897
public static void initGallery(CmsDialog wp) {

        // 1. get "gallerytypename" by reading the folderpath
        String galleryTypeName = null;
        if (wp.useNewStyle()) {
            galleryTypeName = CmsResource.getName(CmsResource.getFolderPath(wp.getAdminTool().getHandler().getLink()));
        } else {
            galleryTypeName = CmsResource.getName(CmsResource.getFolderPath(wp.getJsp().getRequestContext().getUri()));
        }
        if (galleryTypeName.endsWith("/")) {
            galleryTypeName = galleryTypeName.substring(0, galleryTypeName.length() - 1);
        }
        if (!galleryTypeName.equals("commons")) {
            // 2. set in user settings
            wp.getSettings().setGalleryType(galleryTypeName);
        }
    }
1332773
public static CmsPair<String, Map<String, String>> parseEmbeddedGalleryOptions(String configuration) {

        final Map<String, String> galleryOptions = Maps.newHashMap();
        String resultConfig = CmsStringUtil.substitute(
            PATTERN_EMBEDDED_GALLERY_CONFIG,
            configuration,
            new I_CmsRegexSubstitution() {

                public String substituteMatch(String string, Matcher matcher) {

                    String galleryName = string.substring(matcher.start(1), matcher.end(1));
                    String embeddedConfig = string.substring(matcher.start(2), matcher.end(2));
                    galleryOptions.put(galleryName, embeddedConfig);
                    return galleryName;
                }
            });
        return CmsPair.create(resultConfig, galleryOptions);
    }
994531
void openPopup() {

        try {
            if (m_popup == null) {
                m_popup = new CmsPopup(Messages.get().key(Messages.GUI_LOCATION_DIALOG_TITLE_0), hasMap() ? 1020 : 420);
                m_popupContent = new CmsLocationPopupContent(
                    this,
                    new CmsLocationSuggestOracle(this),
                    getModeItems(),
                    getTypeItems(),
                    getZoomItems());
                setFieldVisibility();
                m_popup.setMainContent(m_popupContent);
                m_popup.addDialogClose(null);
            }
            m_popup.center();
            m_popup.show();
            initialize();
            updateForm();
        } catch (Throwable t) {
            CmsErrorDialog.handleException(t);
        }
    }
143843
public String showDialog(Component comp) {
        value = null;
        setLocationRelativeTo(comp);
        setVisible(true);
        return value;
    }
415394
@Override
    public MessageDialogButton showDialog(WindowBasedTextGUI textGUI) {
        result = null;
        super.showDialog(textGUI);
        return result;
    }
435334
protected void openDialog(CmsBasicDialog dialog, String windowCaption) {

        if (m_dialogWindow != null) {
            m_dialogWindow.close();
        }

        m_dialogWindow = CmsBasicDialog.prepareWindow(DialogWidth.wide);
        m_dialogWindow.setContent(dialog);
        m_dialogWindow.setCaption(windowCaption);

        A_CmsUI.get().addWindow(m_dialogWindow);
        m_dialogWindow.center();
    }