Change the interface of ProgressDialog to be able to specify separately the frame of the dialog and the component that must be used as a reference to display the dialog.
In some cases the frame that is going to display the progress dialog is hidden just after the progress dialog is displayed (this is the case for most of the cases in the control panel). Depending on the OS, hiding the parent frame implies to hide the progress dialog. The result is that the progress dialog is also hidden with the parent frame. However in other cases it is interesting to pass the frame that displays the progress dialog (for instance when we want to have a modal progress dialog this is required).
| | |
| | | if (errors.size() == 0) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.getParentDialog(this), getProgressDialogTitle(), getInfo()); |
| | | Utilities.createFrame(), Utilities.getParentDialog(this), |
| | | getProgressDialogTitle(), getInfo()); |
| | | try |
| | | { |
| | | NewEntryTask newTask = |
| | |
| | | if (errors.size() == 0) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_ADD_TO_GROUP_TITLE.get(), getInfo()); |
| | | LinkedHashSet<DN> groupDns = new LinkedHashSet<DN>(); |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.getParentDialog(BackupPanel.this), getTitle(), |
| | | getInfo()); |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(BackupPanel.this), |
| | | getTitle(), getInfo()); |
| | | BackupTask newTask = new BackupTask(getInfo(), progressDialog); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | if ((paths != null) && (paths.length > 0)) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_DELETE_SELECTED_ENTRIES_TITLE.get(), getInfo()); |
| | | DeleteEntryTask newTask = new DeleteEntryTask(getInfo(), dlg, paths, |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_DELETE_INDEXES_TITLE.get(), getInfo()); |
| | | DeleteIndexTask newTask = new DeleteIndexTask(getInfo(), dlg, |
| | |
| | | title = INFO_CTRL_PANEL_DELETE_OBJECTCLASSES_AND_ATTRIBUTES_TITLE.get(); |
| | | } |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), title, getInfo()); |
| | | DeleteSchemaElementsTask newTask = |
| | | new DeleteSchemaElementsTask(getInfo(), dlg, orderedObjectClasses, |
| | |
| | | { |
| | | ArrayList<Message> errors = new ArrayList<Message>(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_DELETE_ATTRIBUTE_TITLE.get(), getInfo()); |
| | | ArrayList<ObjectClass> ocsToDelete = new ArrayList<ObjectClass>(); |
| | |
| | | { |
| | | ArrayList<Message> errors = new ArrayList<Message>(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_DELETE_OBJECTCLASS_TITLE.get(), getInfo()); |
| | | ArrayList<ObjectClass> ocsToDelete = new ArrayList<ObjectClass>(); |
| | |
| | | { |
| | | final LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Object[] backends = list.getSelectedValues(); |
| | | ArrayList<BackendDescriptor> backendsToDelete = |
| | |
| | | { |
| | | final LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Object[] dns = list.getSelectedValues(); |
| | | ArrayList<BaseDNDescriptor> baseDNsToDelete = |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | ExportTask newTask = new ExportTask(getInfo(), progressDialog); |
| | | for (Task task : getInfo().getTasks()) |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | ImportTask newTask = new ImportTask(getInfo(), progressDialog); |
| | | for (Task task : getInfo().getTasks()) |
| | |
| | | { |
| | | ArrayList<Message> errors = new ArrayList<Message>(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_DELETE_INDEX_TITLE.get(), getInfo()); |
| | | ArrayList<AbstractIndexDescriptor> indexesToDelete = |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.getParentDialog(this), |
| | | Utilities.getFrame(this), |
| | | Utilities.getFrame(this), |
| | | INFO_CTRL_PANEL_MODIFYING_INDEX_TITLE.get(), getInfo()); |
| | | dlg.setModal(modal); |
| | | newModifyTask = new ModifyIndexTask(getInfo(), dlg); |
| | |
| | | { |
| | | ArrayList<Message> errors = new ArrayList<Message>(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_JAVA_PROPERTIES_TITLE.get(), |
| | | getInfo()); |
| | | INFO_CTRL_PANEL_JAVA_PROPERTIES_TITLE.get(), getInfo()); |
| | | JavaPropertiesTask newTask = new JavaPropertiesTask(getInfo(), dlg); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | try |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.getParentDialog(this), |
| | | Utilities.getFrame(this), |
| | | Utilities.getFrame(this), |
| | | INFO_CTRL_PANEL_MODIFYING_ENTRY_CHANGES_TITLE.get(), getInfo()); |
| | | dlg.setModal(modal); |
| | | Entry entry = displayedEntryPanel.getEntry(); |
| | |
| | | Message title = isLeaf ? INFO_CTRL_PANEL_DELETING_ENTRY_TITLE.get() : |
| | | INFO_CTRL_PANEL_DELETING_SUBTREE_TITLE.get(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.getParentDialog(this), |
| | | title, getInfo()); |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), title, getInfo()); |
| | | DeleteEntryTask newTask = new DeleteEntryTask(getInfo(), dlg, |
| | | new TreePath[]{treePath}, controller); |
| | | for (Task task : getInfo().getTasks()) |
| | |
| | | { |
| | | ArrayList<Message> errors = new ArrayList<Message>(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_CANCEL_TASK_TITLE.get(), getInfo()); |
| | | List<TaskEntry> tasks = getSelectedTasks(true); |
| | |
| | | } |
| | | |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_NEW_ATTRIBUTE_PANEL_TITLE.get(), getInfo()); |
| | | NewAttributeTask newTask = null; |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Utilities.createFrame(), Utilities.getParentDialog(this), getTitle(), |
| | | getInfo()); |
| | | NewBaseDNTask newTask = new NewBaseDNTask(getInfo(), progressDialog); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | setPrimaryInvalid(lType); |
| | | } |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_NEW_INDEX_TITLE.get(), getInfo()); |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), INFO_CTRL_PANEL_NEW_INDEX_TITLE.get(), |
| | | getInfo()); |
| | | NewIndexTask newTask = new NewIndexTask(getInfo(), dlg); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | } |
| | | |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_NEW_OBJECTCLASS_PANEL_TITLE.get(), getInfo()); |
| | | NewObjectClassTask newTask = null; |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_NEW_VLV_INDEX_TITLE.get(), getInfo()); |
| | | NewVLVIndexTask newTask = new NewVLVIndexTask(getInfo(), dlg); |
| | |
| | | import javax.swing.JButton; |
| | | import javax.swing.JCheckBox; |
| | | import javax.swing.JEditorPane; |
| | | import javax.swing.JFrame; |
| | | import javax.swing.JPanel; |
| | | import javax.swing.JProgressBar; |
| | | import javax.swing.JScrollPane; |
| | |
| | | |
| | | /** |
| | | * Constructor of the dialog. |
| | | * @param parentDialog the parent dialog. |
| | | * @param parentFrame the parent frame. |
| | | * @param relativeTo the component to use as reference to set the position |
| | | * of this dialog. |
| | | * @param title the title of the dialog. |
| | | * @param info the control panel information. |
| | | */ |
| | | public ProgressDialog(Component parentDialog, Message title, |
| | | ControlPanelInfo info) |
| | | public ProgressDialog(JFrame parentFrame, Component relativeTo, |
| | | Message title, ControlPanelInfo info) |
| | | { |
| | | super(Utilities.getFrame(parentDialog), getPanel(info)); |
| | | Utilities.centerGoldenMean(this, parentDialog); |
| | | super(parentFrame, getPanel(info)); |
| | | Utilities.centerGoldenMean(this, relativeTo); |
| | | setTitle(title.toString()); |
| | | progressPanel = (ProgressPanel)panel; |
| | | getRootPane().setDefaultButton(progressPanel.closeButton); |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Utilities.createFrame(), Utilities.getParentDialog(this), getTitle(), |
| | | getInfo()); |
| | | HashSet<String> baseDNs = new HashSet<String>(); |
| | | baseDNs.add(getSelectedBaseDN()); |
| | | RebuildIndexTask newTask = new RebuildIndexTask(getInfo(), progressDialog, |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | if (errors.size() == 0) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_RESET_USER_PASSWORD_TITLE.get(), |
| | | getInfo()); |
| | | INFO_CTRL_PANEL_RESET_USER_PASSWORD_TITLE.get(), getInfo()); |
| | | ResetUserPasswordTask newTask = |
| | | new ResetUserPasswordTask(getInfo(), dlg, node, controller, |
| | | password.getPassword()); |
| | |
| | | LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | // Launch the task in another progress dialog. |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_VERIFY_BACKUP_TITLE.get(), |
| | | getInfo()); |
| | | INFO_CTRL_PANEL_VERIFY_BACKUP_TITLE.get(), getInfo()); |
| | | RestoreTask newTask = new RestoreTask(getInfo(), dlg, true); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Utilities.createFrame(), Utilities.getParentDialog(this), getTitle(), |
| | | getInfo()); |
| | | RestoreTask newTask = new RestoreTask(getInfo(), progressDialog, false); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | { |
| | | LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_START_SERVER_PROGRESS_DLG_TITLE.get(), getInfo()); |
| | | StartServerTask newTask = new StartServerTask(getInfo(), progressDialog); |
| | |
| | | { |
| | | LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_STOP_SERVER_PROGRESS_DLG_TITLE.get(), getInfo()); |
| | | StopServerTask newTask = new StopServerTask(getInfo(), progressDialog); |
| | |
| | | { |
| | | LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_RESTART_SERVER_PROGRESS_DLG_TITLE.get(), getInfo()); |
| | | RestartServerTask newTask = new RestartServerTask(getInfo(), |
| | |
| | | { |
| | | ArrayList<Message> errors = new ArrayList<Message>(); |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_DELETE_VLV_INDEX_TITLE.get(), getInfo()); |
| | | ArrayList<AbstractIndexDescriptor> indexesToDelete = |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.getParentDialog(this), |
| | | Utilities.getFrame(this), |
| | | Utilities.getFrame(this), |
| | | INFO_CTRL_PANEL_MODIFYING_INDEX_TITLE.get(), getInfo()); |
| | | dlg.setModal(modal); |
| | | newModifyTask = new ModifyVLVIndexTask(getInfo(), dlg); |
| | |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Utilities.createFrame(), Utilities.getParentDialog(this), getTitle(), |
| | | getInfo()); |
| | | VerifyIndexTask newTask = new VerifyIndexTask(getInfo(), progressDialog); |
| | | for (Task task : getInfo().getTasks()) |
| | | { |
| | |
| | | { |
| | | LinkedHashSet<Message> errors = new LinkedHashSet<Message>(); |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | Utilities.createFrame(), Utilities.getParentDialog(this), getTitle(), |
| | | getInfo()); |
| | | WindowsServiceTask newTask = new WindowsServiceTask(getInfo(), |
| | | progressDialog, !isWindowsServiceEnabled); |
| | | for (Task task : getInfo().getTasks()) |