Sets the dialog, which contains the view pager.

@param dialog
The dialog, which should be set, as an instance of the type {@link MaterialDialog}.
The dialog may not be null
961652
public final void setDialog(@NonNull final MaterialDialog dialog) {
        Condition.INSTANCE.ensureNotNull(dialog, "The dialog may not be null");
        this.dialog = dialog;
    }
343760
protected void addDialogComponents() {
		JComponent dialogContentPane = createDialogContentPane();
		GuiStandardUtils.attachDialogBorder(dialogContentPane);
		if (getPreferredSize() != null) {
			dialogContentPane.setPreferredSize(getPreferredSize());
		}
		getDialogContentPane().add(dialogContentPane);
		getDialogContentPane().add(createButtonBar(), BorderLayout.SOUTH);
	}
51307
public void setActivePage(DialogPage activePage) {
		DialogPage oldPage = this.activePage;

		Assert.isTrue(activePage == null || pages.contains(activePage));
		if (oldPage == activePage) {
			return;
		}
		this.activePage = activePage;

		updateMessage();
		if (oldPage != null) {
			updatePageLabels(oldPage);
		}
		if (activePage != null) {
			updatePageLabels(activePage);
		}
	}
869236
public synchronized void onDialogsChanged(boolean isEmpty) {
        if (isDialogsEmpty.get() != isEmpty) {
            context.getPreferences().putBool("app.dialogs.empty", isEmpty);
            isDialogsEmpty.change(isEmpty);
        }
        if (!isEmpty) {
            if (isAppEmpty.get()) {
                context.getPreferences().putBool("app.empty", false);
                isAppEmpty.change(false);
            }
        }
    }
329100
public void updateDialogMsg(final int resId) {
        if (dialog != null) {
            this.dialog.setMessage(dialog.getContext().getText(resId));
        }
    }
1276828
public void enableScrollInViewPager(ViewPager pager) {
        viewPager = pager;
        //noinspection all - ViewPager is not clickable, it is safe to set touch listener
        pager.setOnTouchListener(PAGER_TOUCH_LISTENER);

        // Disabling motion event splitting
        pager.setMotionEventSplittingEnabled(false);
    }
782810
protected void prepareDialogPage(DialogPage page) {
		page.addPropertyChangeListener(childChangeHandler);
		JComponent c = page.getControl();
		GuiStandardUtils.attachDialogBorder(c);
		Dimension size = c.getPreferredSize();
		if (size.width > largestPageWidth) {
			largestPageWidth = size.width;
		}
		if (size.height > largestPageHeight) {
			largestPageHeight = size.height;
		}
	}
443780
public static void invalidateDialog (Component any)
    {
        JInternalDialog dialog = getInternalDialog(any);
        if (dialog == null) {
            return;
        }

        SwingUtil.applyToHierarchy(dialog, new SwingUtil.ComponentOp() {
            public void apply (Component comp) {
                comp.invalidate();
            }
        });

        dialog.setSize(dialog.getPreferredSize());
    }
628612
public final void setOrientation(int orientation) {
        mOrientation = orientation;
        mOrientationState = getOrientationStateFromParam(mOrientation);
        invalidate();
        if (mOuterAdapter != null) {
            mOuterAdapter.setOrientation(mOrientation);
        }

    }
858094
public void setPageCount(int pageN) {
        this.pageN = pageN;
        DocListener listener;
		for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
            listener = (DocListener) iterator.next();
            listener.setPageCount(pageN);
        }
    }
1144502
public Document marshall(Dialog dialog) {

        DMRMarshallRoutine marshaller = new DMRMarshallRoutine(dialog);
        dialog.getInterfaceModel().accept(marshaller);
        return marshaller.getResult();
    }
570002
public static void centerDialog(JDialog dialog) {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = dialog.getSize();
    dialog.setLocation(screenSize.width / 2 - frameSize.width / 2,
            screenSize.height / 2 - frameSize.height / 2);
    dialog.setLocationByPlatform(true);
  }
275454
public int showDialog(Component parent) {
        dialogResultValue = ERROR_OPTION;
        JDialog dialog = createDialog(parent);
        dialog.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                dialogResultValue = CANCEL_OPTION;
            }
        });

        dialog.setVisible(true);
        dialog.dispose();
        dialog = null;

        return dialogResultValue;
    }
1272868
public FastAdapterDialog<Item> withOnClickListener(com.mikepenz.fastadapter.listeners.OnClickListener<Item> onClickListener) {
        this.mFastAdapter.withOnClickListener(onClickListener);
        return this;
    }
281287
private void initDialogObject() {

        Object o = getDialogObject();
        if (o != null) {
            m_dialogSettings = (CmsLanguageCopyFolderAndLanguageSelectDialogSettings)o;
        } else {
            m_dialogSettings = new CmsLanguageCopyFolderAndLanguageSelectDialogSettings();
            setDialogObject(m_dialogSettings);
        }
    }
1068907
public void setDialogMode(int mode) {
        if (!(mode == OK_CANCEL_DIALOG || mode == CLOSE_DIALOG)) {
            throw new IllegalArgumentException("invalid dialog mode");
        }

        if (okButton != null) {
            buttonPane.remove(okButton);
            okButton = null;
        }
        if (cancelOrCloseButton != null) {
            buttonPane.remove(cancelOrCloseButton);
            cancelOrCloseButton = null;
        }

        switch (mode) {
            case OK_CANCEL_DIALOG:
                okButton
                        = new JButton(ResourceManager.all(BaseDialog.class).getString("ok"));
                okButton.addActionListener(okAction);
                buttonPane.add(okButton);
                cancelOrCloseButton
                        = new JButton(
                                ResourceManager.all(BaseDialog.class).getString("cancel"));
                cancelOrCloseButton.addActionListener(cancelOrCloseAction);
                buttonPane.add(cancelOrCloseButton);
                getRootPane().setDefaultButton(okButton);
                break;
            case CLOSE_DIALOG:
                cancelOrCloseButton
                        = new JButton(ResourceManager.all(BaseDialog.class).getString("close"));
                cancelOrCloseButton.addActionListener(cancelOrCloseAction);
                buttonPane.add(cancelOrCloseButton);
                break;
        }

        this.mode = mode;
    }
360766
public final void setDialogBackground(@DrawableRes final int resourceId) {
        this.dialogBackground = ContextCompat.getDrawable(getContext(), resourceId);
        this.dialogBackgroundBitmap = null;
        this.dialogBackgroundId = resourceId;
        this.dialogBackgroundColor = -1;
    }