当前位置: 首页>>代码示例>>Java>>正文


Java ConfirmDialog类代码示例

本文整理汇总了Java中com.rapidminer.gui.tools.dialogs.ConfirmDialog的典型用法代码示例。如果您正苦于以下问题:Java ConfirmDialog类的具体用法?Java ConfirmDialog怎么用?Java ConfirmDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfirmDialog类属于com.rapidminer.gui.tools.dialogs包,在下文中一共展示了ConfirmDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: overwriteProcess

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
private void overwriteProcess(final ProcessEntry processEntry) {
	if (SwingTools.showConfirmDialog("overwrite", ConfirmDialog.YES_NO_OPTION, processEntry.getLocation()) == ConfirmDialog.YES_OPTION) {
		ProgressThread storeProgressThread = new ProgressThread("store_process") {

			@Override
			public void run() {
				getProgressListener().setTotal(100);
				getProgressListener().setCompleted(10);
				try {
					Process process = RapidMinerGUI.getMainFrame().getProcess();
					process.setProcessLocation(new RepositoryProcessLocation(processEntry.getLocation()));
					processEntry.storeXML(process.getRootOperator().getXML(false));
					RapidMinerGUI.addToRecentFiles(process.getProcessLocation());
					RapidMinerGUI.getMainFrame().processHasBeenSaved();
				} catch (Exception e) {
					SwingTools.showSimpleErrorMessage("cannot_store_process_in_repository", e, processEntry.getName());
				} finally {
					getProgressListener().setCompleted(100);
					getProgressListener().complete();
				}
			}
		};
		storeProgressThread.start();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:StoreProcessAction.java

示例2: actionPerformed

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	boolean res = false;
	String itemString = (isDirectory() ? "directory" : "file") + " " + getItemName();
	int resInt = SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_CANCEL_OPTION, itemString);
	if (resInt == ConfirmDialog.YES_OPTION) {
		try {
			res = delete();
		} catch (Exception exp) {
			// do nothing
		}
		if (!res) {
			SwingTools.showVerySimpleErrorMessage("file_chooser.delete.error", itemString);
		} else {
			getParentPane().getFilePane().rescanDirectory();
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:Item.java

示例3: loggedActionPerformed

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public void loggedActionPerformed(ActionEvent e) {
	boolean res = false;
	String itemString = (isDirectory() ? "directory" : "file") + " " + getItemName();
	int resInt = SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_CANCEL_OPTION, itemString);
	if (resInt == ConfirmDialog.YES_OPTION) {
		try {
			res = delete();
		} catch (Exception exp) {
			// do nothing
		}
		if (!res) {
			SwingTools.showVerySimpleErrorMessage("file_chooser.delete.error", itemString);
		} else {
			getParentPane().getFilePane().rescanDirectory();
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:19,代码来源:Item.java

示例4: checkUnsavedChanges

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/** Checks if the user changed any values or have an unsaved Item opened and asks him to save those changes before closing the dialog.
 * Returns true if the dialog can be closed, false otherwise. 
 * @throws ConfigurationException **/
protected boolean checkUnsavedChanges() throws ConfigurationException {
	//T inputFieldEntry = getConfigurableFromInputFields();
	if (hasUnsavedChanges()) {
		// If the user has changed any values / new unsaved entry
		int saveBeforeOpen = SwingTools.showConfirmDialog("configuration.dialog.savecurrent", ConfirmDialog.YES_NO_CANCEL_OPTION, getConfigurableFromInputFields().getName());
		if (saveBeforeOpen == ConfirmDialog.YES_OPTION) {
			// YES: Speichere alles
			entrySaved = false;
			SAVE_ENTRY_ACTION.actionPerformed(null);
			if (entrySaved) {
				return true;
			} else {
				return false;
			}
		} else if (saveBeforeOpen == ConfirmDialog.NO_OPTION) {
			// NO: Verwerfe alles
			return true;
		} else if (saveBeforeOpen == ConfirmDialog.CANCEL_OPTION) {
			return false;
		}
	}
	return true;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:27,代码来源:ConfigurationDialog.java

示例5: promptForPdfLocation

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/**
 * Prompts the user for the location of the .pdf file.
 * Will append .pdf if file does not end with it.
 * 
 * @return
 */
private File promptForPdfLocation() {
	// prompt user for pdf location
	File file = SwingTools.chooseFile(RapidMinerGUI.getMainFrame(), "export_pdf", null, false, false, new String[] { "pdf" }, new String[] { "PDF" }, false);
	if (file == null) {
		return null;
	}
	if (!file.getName().endsWith(".pdf")) {
		file = new File(file.getAbsolutePath() + ".pdf");
	}
	// prompt for overwrite confirmation
	if (file.exists()) {
		int returnVal = SwingTools.showConfirmDialog("export_pdf", ConfirmDialog.YES_NO_OPTION, file.getName());
		if (returnVal == ConfirmDialog.NO_OPTION) {
			return null;
		}
	}
	return file;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:25,代码来源:ExportPdfAction.java

示例6: newProcess

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/** Creates a new process. */
public void newProcess() {
	// ask for confirmation before stopping the currently running process and opening a new one!
	if (getProcessState() == Process.PROCESS_STATE_RUNNING || getProcessState() == Process.PROCESS_STATE_PAUSED) {
		if (SwingTools.showConfirmDialog("close_running_process", ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
			return;
		}
	}
	if (close(false)) {
		// process changed -> clear undo history
		resetUndo();

		stopProcess();
		changed = false;
		setProcess(new Process(), true);
		addToUndoList();
		if (!"false".equals(ParameterService.getParameterValue(PROPERTY_RAPIDMINER_GUI_SAVE_ON_PROCESS_CREATION))) {
			SaveAction.save(getProcess());
		}
		SAVE_ACTION.setEnabled(false);
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:23,代码来源:MainFrame.java

示例7: windowClosing

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public void windowClosing(WindowEvent event) {
	if (backgroundJob != null) {
		if (SwingTools.invokeAndWaitWithResult(confirmResultRunnable) != ConfirmDialog.YES_OPTION) {
			closeDialog = false;
		} else {
			closeDialog = true;
		}
		confirmDialog = null;
		if (closeDialog && backgroundJob != null) {
			stopButton.doClick();
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:AbstractToRepositoryStep.java

示例8: actionPerformed

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {

	List<Entry> entries = tree.getSelectedEntries();

	// Deletion of elements
	if (e.getActionCommand().equals(DeleteRepositoryEntryAction.I18N_KEY)
			|| e.getActionCommand().equals(CutCopyPasteDeleteAction.DELETE_ACTION_COMMAND_KEY)) {
		if (entries.size() == 1) {
			if (SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_OPTION, entries.get(0)
					.getName()) != ConfirmDialog.YES_OPTION) {
				return;
			}
		} else {
			if (SwingTools
					.showConfirmDialog("file_chooser.delete_multiple", ConfirmDialog.YES_NO_OPTION, entries.size()) != ConfirmDialog.YES_OPTION) {
				return;
			}
		}
	}

	// Do not treat entries, whose are already included in selected folders
	entries = removeIntersectedEntries(tree.getSelectedEntries());

	for (Entry entry : entries) {
		actionPerformed(requiredSelectionType.cast(entry));
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:AbstractRepositoryAction.java

示例9: noMoreHits

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
private void noMoreHits() {
	String restartAt = backwardRadioButton.isSelected() ? "end" : "beginning";
	switch (SwingTools.showConfirmDialog("editor.search_replace.no_more_hits", ConfirmDialog.YES_NO_OPTION, restartAt)) {
		case ConfirmDialog.YES_OPTION:
			textComponent.setCaretPosition(
					backwardRadioButton.isSelected() ? textComponent.getText().replaceAll("\r", "").length() : 0);
			search();
			break;
		case ConfirmDialog.NO_OPTION:
		default:
			return;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:SearchDialog.java

示例10: newProcess

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/**
 * Creates a new process. Depending on the given parameter, the user will or will not be asked
 * to save unsaved changes.
 *
 * @param checkforUnsavedWork
 *            Iff {@code true} the user is asked to save their unsaved work (if any), otherwise
 *            unsaved work is discarded without warning.
 */
public void newProcess(final boolean checkforUnsavedWork) {
	// ask for confirmation before stopping the currently running process and opening a new one!
	if (getProcessState() == Process.PROCESS_STATE_RUNNING || getProcessState() == Process.PROCESS_STATE_PAUSED) {
		if (SwingTools.showConfirmDialog("close_running_process",
				ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
			return;
		}
	}

	ProgressThread newProcessThread = new ProgressThread("new_process") {

		@Override
		public void run() {
			// Invoking close() will ask the user to save their work if there are unsaved
			// changes. This method can be skipped if it is already clear that changes should be
			// discarded.
			boolean resetProcess = checkforUnsavedWork ? close(false) : true;
			if (resetProcess) {
				// process changed -> clear undo history
				resetUndo();

				stopProcess();
				changed = false;
				setProcess(new Process(), true);
				addToUndoList();
				if (!"false"
						.equals(ParameterService.getParameterValue(PROPERTY_RAPIDMINER_GUI_SAVE_ON_PROCESS_CREATION))) {
					SaveAction.saveAsync(getProcess());
				}
				// always have save action enabled. If process is not yet associated with
				// location SaveAs will be used
				SAVE_ACTION.setEnabled(true);
			}
		}
	};
	newProcessThread.setIndeterminate(true);
	newProcessThread.setCancelable(false);
	newProcessThread.start();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:48,代码来源:MainFrame.java

示例11: promptForFileLocation

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/**
 * Prompt a file chooser dialog where the user selects a file location and returns a
 * {@link File} at this location.
 *
 * @param i18nKey
 *            the i18n key for the dialog to be shown. The provided i18nKey must be contained in
 *            the GUI properties file (gui.dialog.i18nKey.[title|message|icon]).
 * @param fileExtensions
 *            a list of explicit file extension like "pdf" or "png".
 * @param extensionDescriptions
 *            a list of descriptions of the given format for this file extension
 * @return the new File in the an object can be stored
 * @throws IOException
 */
static public File promptForFileLocation(String i18nKey, String[] fileExtensions, String[] extensionDescriptions)
		throws IOException {

	// check parameters
	for (int i = 0; i < fileExtensions.length; ++i) {
		if ("".equals(fileExtensions[i]) || "".equals(extensionDescriptions[i])) {
			throw new IllegalArgumentException("Empty file extension or exntension description are not allowed!");
		}
		if (fileExtensions[i].startsWith(".")) {
			fileExtensions[i] = fileExtensions[i].substring(1);
		}
	}

	// prompt user for file location
	File file = SwingTools.chooseFile(RapidMinerGUI.getMainFrame(), i18nKey, null, false, false, fileExtensions,
			extensionDescriptions, false);
	if (file == null) {
		return null;
	}

	// do not overwrite directories
	if (file.isDirectory()) {
		throw new IOException(I18N.getMessage(I18N.getErrorBundle(), "error.io.file_is_directory", file.getPath()));
	}

	// prompt for overwrite confirmation
	if (file.exists()) {
		int returnVal = SwingTools.showConfirmDialog("export_image", ConfirmDialog.YES_NO_OPTION, file.getName());
		if (returnVal == ConfirmDialog.NO_OPTION) {
			return null;
		}
	}
	return file;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:49,代码来源:PrintingTools.java

示例12: cancel

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/**
 * If the thread is currently active, calls {@link #executionCancelled()} to notify children. If
 * not active, removes the thread from the queue so it won't become active.
 */
public final void cancel() {
	boolean dependentThreads = false;
	synchronized (LOCK) {
		dependentThreads = checkQueuedThreadDependOnCurrentThread();
	}
	if (dependentThreads) {
		if (ConfirmDialog.OK_OPTION != SwingTools.showConfirmDialog("cancel_pg_with_dependencies",
				ConfirmDialog.OK_CANCEL_OPTION)) {
			return;
		} else {
			synchronized (LOCK) {
				removeQueuedThreadsWithDependency(getID());
			}
		}
	}
	synchronized (LOCK) {
		cancelled = true;
		if (started) {
			executionCancelled();
			currentThreads.remove(this);
		} else {
			// cancel and not started? Can only be in queue
			queuedThreads.remove(this);
		}
	}
	taskCancelled(this);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:ProgressThread.java

示例13: addCallback

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
/**
 * Build a midas client, then bind session file
 * and callbacks.
 *
 * @param client a midas client need to be constructed,
 *               could be a normal client and a sharable
 *               client;
 */
private void addCallback(MidasClient client) {
    final RemoteResultDisplay display = RapidMinerGUI.getMainFrame().getRemoteResultDisplay();
    // add callbacks
    Function1<JobStatus, BoxedUnit> fn = new AbstractFunction1<JobStatus, BoxedUnit>() {
        @Override
        public BoxedUnit apply(JobStatus v1) {
            final RemoteResultOverview overview = display.getOverview();
            final JobStatus status = v1;
            boolean msg = overview.updateStatus(status);
            if (msg) {

                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        // Scroll to the bottom when job finished.
                        Rectangle visibleRect = overview.getVisibleRect();
                        visibleRect.y = overview.getHeight() - visibleRect.height;
                        overview.scrollRectToVisible(visibleRect);

                        if (!OperatorService.isRapidGUITestMode()) {
                            // User should be toggled to result page when click `ok` in finish panel.
                            switch(SwingTools.showConfirmDialog("job_finished",
                                    ConfirmDialog.OK_CANCEL_OPTION, status.session().id(), status.id())) {

                                case ConfirmDialog.OK_OPTION:
                                    overview.showStatusResult(status);
                                    break;
                            }
                        }
                    }
                });
            }
            return BoxedUnit.UNIT;
        }
    };
    client.addCompleteCallback(fn);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:47,代码来源:StartupSessionListener.java

示例14: getCloseAction

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
public Runnable getCloseAction() {
    return new Runnable() {
        public void run() {
            int answer = ConfirmDialog.showConfirmDialogWithOptionalCheckbox(ApplicationFrame.getApplicationFrame(), "free_edition", 0, (String)null, 0, false, new Object[0]);
            if(answer == 0) {
                EmailVerificationCard.this.verificationTimer.cancel();
                EmailVerificationCard.this.getContainer().dispose();
            }

        }
    };
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:13,代码来源:EmailVerificationCard.java

示例15: run

import com.rapidminer.gui.tools.dialogs.ConfirmDialog; //导入依赖的package包/类
public void run() {
    if(AbstractCard.this.isAtLeastCommunityEdition()) {
        AbstractCard.this.getContainer().dispose();
    } else {
        int answer = ConfirmDialog.showConfirmDialogWithOptionalCheckbox(ApplicationFrame.getApplicationFrame(), "free_edition", 0, (String)null, 0, false, new Object[0]);
        if(answer == 0) {
            AbstractCard.this.getContainer().dispose();
        }
    }

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:AbstractCard.java


注:本文中的com.rapidminer.gui.tools.dialogs.ConfirmDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。