本文整理汇总了Java中com.rapidminer.gui.tools.dialogs.ConfirmDialog.NO_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java ConfirmDialog.NO_OPTION属性的具体用法?Java ConfirmDialog.NO_OPTION怎么用?Java ConfirmDialog.NO_OPTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.rapidminer.gui.tools.dialogs.ConfirmDialog
的用法示例。
在下文中一共展示了ConfirmDialog.NO_OPTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkUnsavedChanges
/** 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;
}
示例2: promptForPdfLocation
/**
* 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;
}
示例3: newProcess
/** 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);
}
}
示例4: noMoreHits
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;
}
}
示例5: newProcess
/**
* 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();
}
示例6: promptForFileLocation
/**
* 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;
}
示例7: noMoreHits
private void noMoreHits() {
String restartAt = backwardRadioButton.isSelected() ? "end" : "beginning";
switch (SwingTools.showConfirmDialog(SearchDialog.this, "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;
}
}
示例8: noMoreHits
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;
}
}
示例9: startNext
/**
* Starts the next Tour in the tourList
*/
private void startNext() {
if (!newTours.isEmpty()) {
String currentTourKey = newTours.remove();
String propertyKey = "DontAskAgainTourChoosen";
ParameterService.setParameterValue(propertyKey, "null");
int returnValue = ConfirmDialog.showConfirmDialogWithOptionalCheckbox("new_tour_found", ConfirmDialog.YES_NO_OPTION, propertyKey, ConfirmDialog.NO_OPTION, true, currentTourKey);
// save whether we will ask again
if (!Boolean.parseBoolean(ParameterService.getParameterValue(propertyKey))) {
tourManager.setTourState(currentTourKey, TourState.NEVER_ASK);
}
//handle returnValue
if (returnValue == ConfirmDialog.YES_OPTION) {
IntroductoryTour currentTour = tourManager.get(currentTourKey);
currentTour.addListener(new TourListener() {
@Override
public void tourClosed() {
WelcomeTourAction.this.startNext();
}
});
currentTour.startTour();
}
if (returnValue == ConfirmDialog.NO_OPTION) {
this.startNext();
}
}
}
示例10: exit
public void exit(boolean relaunch) {
if (changed) {
ProcessLocation loc = process.getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(process);
if (changed)
return;
break;
case ConfirmDialog.NO_OPTION:
break;
case ConfirmDialog.CANCEL_OPTION:
default:
return;
}
} else {
if (!relaunch) { // in this case we have already confirmed
// ask for special confirmation before exiting RapidMiner while a process is running!
if (getProcessState() == Process.PROCESS_STATE_RUNNING || getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("exit_despite_running_process", ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
return;
}
} else {
int answer = ConfirmDialog.showConfirmDialog("exit", ConfirmDialog.YES_NO_OPTION, RapidMinerGUI.PROPERTY_CONFIRM_EXIT, ConfirmDialog.YES_OPTION);
if (answer != ConfirmDialog.YES_OPTION) {
return;
}
}
}
}
stopProcess();
dispose();
RapidMinerGUI.quit(relaunch ? RapidMiner.ExitMode.RELAUNCH : RapidMiner.ExitMode.NORMAL);
}
示例11: close
/**
* Closes the current process
*
* @param askForConfirmation
* if <code>true</code>, will prompt the user if he really wants to close the current
* process
* @return
*/
public boolean close(final boolean askForConfirmation) {
if (changed) {
ProcessLocation loc = process.getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(getProcess());
// it may happen that save() does not actually save the process, because the
// user hits cancel in the
// saveAs dialog or an error occurs. In this case the process won't be marked as
// unchanged. Thus,
// we return the process changed status.
return !isChanged();
case ConfirmDialog.NO_OPTION:
// ask for confirmation before stopping the currently running process (if
// askForConfirmation=true)
if (askForConfirmation) {
if (RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_RUNNING
|| RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("close_running_process",
ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
return false;
}
}
}
if (getProcessState() != Process.PROCESS_STATE_STOPPED) {
synchronized (processThread) {
processThread.stopProcess();
}
}
return true;
default: // cancel
return false;
}
} else {
return true;
}
}
示例12: exit
public void exit(final boolean relaunch) {
if (changed) {
ProcessLocation loc = process.getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(process);
if (changed) {
return;
}
break;
case ConfirmDialog.NO_OPTION:
break;
case ConfirmDialog.CANCEL_OPTION:
default:
return;
}
} else {
if (!relaunch) { // in this case we have already confirmed
// ask for special confirmation before exiting RapidMiner while a process is
// running!
if (getProcessState() == Process.PROCESS_STATE_RUNNING
|| getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("exit_despite_running_process",
ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
return;
}
} else {
int answer = ConfirmDialog.showConfirmDialog(ApplicationFrame.getApplicationFrame(), "exit",
ConfirmDialog.YES_NO_OPTION, RapidMinerGUI.PROPERTY_CONFIRM_EXIT, ConfirmDialog.YES_OPTION);
if (answer != ConfirmDialog.YES_OPTION) {
return;
}
}
}
}
stopProcess();
dispose();
RapidMiner.quit(relaunch ? RapidMiner.ExitMode.RELAUNCH : RapidMiner.ExitMode.NORMAL);
}
示例13: close
/**
* Closes the current process
*
* @param askForConfirmation
* if <code>true</code>, will prompt the user if he really wants to close the current
* process
* @return
*/
public boolean close(final boolean askForConfirmation) {
if (!isChanged()) {
return true;
}
ProcessLocation loc = getProcess().getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(getProcess());
// it may happen that save() does not actually save the process, because the
// user hits cancel in the
// saveAs dialog or an error occurs. In this case the process won't be marked as
// unchanged. Thus,
// we return the process changed status.
return !isChanged();
case ConfirmDialog.NO_OPTION:
// ask for confirmation before stopping the currently running process (if
// askForConfirmation=true)
if (askForConfirmation) {
if (RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_RUNNING
|| RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("close_running_process",
ConfirmDialog.YES_NO_OPTION) != ConfirmDialog.YES_OPTION) {
return false;
}
}
}
if (getProcessState() != Process.PROCESS_STATE_STOPPED) {
synchronized (processThread) {
processThread.stopProcess();
}
}
return true;
default: // cancel
return false;
}
}
示例14: exit
public void exit(final boolean relaunch) {
if (isChanged()) {
ProcessLocation loc = getProcess().getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(getProcess());
if (isChanged()) {
return;
}
break;
case ConfirmDialog.NO_OPTION:
break;
case ConfirmDialog.CANCEL_OPTION:
default:
return;
}
} else {
if (!relaunch) { // in this case we have already confirmed
// ask for special confirmation before exiting RapidMiner while a process is
// running!
if (getProcessState() == Process.PROCESS_STATE_RUNNING
|| getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("exit_despite_running_process",
ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
return;
}
} else {
int answer = ConfirmDialog.showConfirmDialog(ApplicationFrame.getApplicationFrame(), "exit",
ConfirmDialog.YES_NO_OPTION, RapidMinerGUI.PROPERTY_CONFIRM_EXIT, ConfirmDialog.YES_OPTION);
if (answer != ConfirmDialog.YES_OPTION) {
return;
}
}
}
}
stopProcess();
dispose();
RapidMiner.quit(relaunch ? RapidMiner.ExitMode.RELAUNCH : RapidMiner.ExitMode.NORMAL);
}
示例15: close
/**
* Closes the current process
* @param askForConfirmation if <code>true</code>, will prompt the user if he really wants to close the current process
* @return
*/
public boolean close(boolean askForConfirmation) {
if (changed) {
ProcessLocation loc = process.getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(getProcess());
// it may happen that save() does not actually save the process, because the user hits cancel in the
// saveAs dialog or an error occurs. In this case the process won't be marked as unchanged. Thus,
// we return the process changed status.
return !isChanged();
case ConfirmDialog.NO_OPTION:
// ask for confirmation before stopping the currently running process (if askForConfirmation=true)
if (askForConfirmation) {
if (RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_RUNNING ||
RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("close_running_process", ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
return false;
}
}
}
if (getProcessState() != Process.PROCESS_STATE_STOPPED) {
synchronized (processThread) {
processThread.stopProcess();
}
}
return true;
default: // cancel
return false;
}
} else {
return true;
}
}