Java Code Examples for java.awt.Dialog.ModalityType#DOCUMENT_MODAL

The following examples show how to use java.awt.Dialog.ModalityType#DOCUMENT_MODAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicSetup.java    From meka with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Displays dialog for entering notes in Markdown.
 */
protected void editNotes() {
	MarkdownDialog dialog;

	if (getParentDialog() != null)
		dialog = new MarkdownDialog(getParentDialog(), ModalityType.DOCUMENT_MODAL);
	else
		dialog = new MarkdownDialog(getParentFrame(), true);
	dialog.setTitle("Edit notes");
	dialog.setMarkdown(m_Notes);
	dialog.setSize(600, 400);
	dialog.setLocationRelativeTo(null);
	dialog.setVisible(true);
	if (dialog.getOption() != MarkdownDialog.APPROVE_OPTION)
		return;
	m_Notes = dialog.getMarkdown();
	setModified(true);
	updateButtons();
}
 
Example 2
Source File: ExpertSetup.java    From meka with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Displays dialog for entering notes in Markdown.
 */
protected void editNotes() {
	MarkdownDialog dialog;

	if (getParentDialog() != null)
		dialog = new MarkdownDialog(getParentDialog(), ModalityType.DOCUMENT_MODAL);
	else
		dialog = new MarkdownDialog(getParentFrame(), true);
	dialog.setTitle("Edit notes");
	dialog.setMarkdown(m_Notes);
	dialog.setSize(600, 400);
	dialog.setLocationRelativeTo(null);
	dialog.setVisible(true);
	if (dialog.getOption() != MarkdownDialog.APPROVE_OPTION)
		return;
	m_Notes = dialog.getMarkdown();
	setModified(true);
	updateButtons();
}
 
Example 3
Source File: GetKeyPasswordDialogView.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.DOCUMENT_MODAL);
	ret.setLayout(new BorderLayout());
	ret.setResizable(false);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(Messages.get("action.providePasswordForAKey"));
	ret.add(pnl, BorderLayout.CENTER);
	ret.pack();
	UiUtils.centerWindow(ret, owner);
	return ret;
}
 
Example 4
Source File: DataImportWizardBuilder.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Builds and layouts the configured {@link ImportWizard} dialog.
 *
 * @param owner
 * 		the dialog owner
 * @return the new {@link ImportWizard} instance
 */
public ImportWizard build(Window owner) {
	if (owner == null) {
		owner = ApplicationFrame.getApplicationFrame();
	}
	DataImportWizard wizard = new DataImportWizard(owner, ModalityType.DOCUMENT_MODAL, null);

	// add common steps
	TypeSelectionStep typeSelectionStep = new TypeSelectionStep(wizard);
	wizard.addStep(typeSelectionStep);
	wizard.addStep(new LocationSelectionStep(wizard, factoryI18NKey));
	if (storeData) {
		final StoreToRepositoryStep storeToRepositoryStep = new StoreToRepositoryStep(wizard);
		storeToRepositoryStep.setCallback(callback);
		wizard.addStep(storeToRepositoryStep);
	}
	wizard.addStep(new ConfigureDataStep(wizard, reader, storeData));

	// check whether a local file data source was specified
	if (localFileDataSourceFactory != null) {
		setDataSource(wizard, localFileDataSourceFactory,
				localFileDataSourceFactory.createNew(wizard, filePath, fileDataSourceFactory));
	}

	// Start with type selection
	String startingStep = typeSelectionStep.getI18NKey();

	// unless another starting step ID is specified
	if (startingStepID != null) {
		startingStep = startingStepID;
	}

	wizard.layoutDefault(ButtonDialog.HUGE, startingStep);
	return wizard;
}
 
Example 5
Source File: ProcessBackgroundImageVisualizer.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates a dialog to set the background image of the given process.
 * 
 * @param process
 *            the process for which the background image should be set
 * @param model
 *            the process renderer model instance
 * @return the dialog
 */
private static ButtonDialog createBackgroundImageDialog(final ExecutionUnit process, final ProcessRendererModel model) {
	if (process == null) {
		throw new IllegalArgumentException("process must not be null!");
	}
	if (model == null) {
		throw new IllegalArgumentException("model must not be null!");
	}

	final JPanel mainPanel = new JPanel(new BorderLayout());

	ProcessBackgroundImage prevImg = model.getBackgroundImage(process);
	RepositoryLocation folderLoc = ProcessBackgroundDrawDecorator.getFolderOfExecutionUnit(process);
	final RepositoryLocationChooser chooser = new RepositoryLocationChooser(null, folderLoc,
			prevImg != null ? prevImg.getLocation() : "");
	mainPanel.add(chooser, BorderLayout.CENTER);

	return new ButtonDialog(ApplicationFrame.getApplicationFrame(), "process_background",
			ModalityType.DOCUMENT_MODAL, new Object[] {}) {

		private static final long serialVersionUID = 1L;

		{
			layoutDefault(mainPanel, NORMAL, makeOkButton(), makeCancelButton());
		}

		@Override
		protected void ok() {
			ProcessBackgroundImage img = null;
			try {
				img = new ProcessBackgroundImage(-1, -1, -1, -1, chooser.getRepositoryLocation(), process);
			} catch (MalformedRepositoryLocationException e) {
				// ignore
			}

			if (img != null) {
				model.setBackgroundImage(img);
				model.fireMiscChanged();

				// dirty hack to trigger a process update
				process.getEnclosingOperator().rename(process.getEnclosingOperator().getName());
			}

			super.ok();
		}
	};
}