Search in sources :

Example 6 with MessageDialogFactory

use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.

the class DataDump method startBackgroundWorker.

/**
 * Initialize and start background worker thread to create datadump file
 * @param traceFolders
 */
private void startBackgroundWorker(final List<File> traceFolders) {
    SwingWorker<File, Object> datadumpWorker = new SwingWorker<File, Object>() {

        @Override
        protected File doInBackground() throws IOException, ProfileException {
            Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
            startDataDump(traceFolders);
            return fileToSave;
        }

        @Override
        protected void done() {
            try {
                if (get().getName().contains(EXTENSION_FILTER)) {
                    if (singleTrace) {
                        LOG.info(ResourceBundleHelper.getMessageString(MessageItem.table_export_success));
                    } else {
                        if (new MessageDialogFactory().showExportConfirmDialog(MSG_WINDOW) == JOptionPane.YES_OPTION) {
                            Desktop desktop = Desktop.getDesktop();
                            desktop.open(get());
                        }
                    }
                }
                this.cancel(true);
            } catch (IOException e) {
                LOG.error("Unexpected IOException analyzing trace", e);
                new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
            } catch (UnsupportedOperationException unsupportedException) {
                MessageDialogFactory.showMessageDialog(MSG_WINDOW, ResourceBundleHelper.getMessageString(MessageItem.Error_unableToOpen));
            } catch (InterruptedException e) {
                LOG.error("Unexpected exception analyzing trace", e);
                new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
            } catch (ExecutionException e) {
                LOG.error("Unexpected execution exception analyzing trace", e);
                if (e.getCause() instanceof OutOfMemoryError) {
                    new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString(MessageItem.Error_outOfMemory));
                } else {
                    new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
                }
            }
        }
    };
    datadumpWorker.execute();
}
Also used : Desktop(java.awt.Desktop) CrashHandler(com.att.aro.core.util.CrashHandler) SwingWorker(javax.swing.SwingWorker) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) File(java.io.File)

Example 7 with MessageDialogFactory

use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.

the class ConfigurationFrame method saveConfigurationData.

/**
 * Implements the functionality of Save menu item.
 */
private boolean saveConfigurationData() {
    synchronized (tableModel) {
        try {
            Profile profile = tableModel.getProfile();
            if (profile.getName() != null) {
                // Make sure current editor is closed
                TableCellEditor networkAttrEditor = networkAttributesTable.getCellEditor();
                TableCellEditor deviceAttrEditor = deviceAttributesTable.getCellEditor();
                if (networkAttrEditor != null) {
                    networkAttrEditor.stopCellEditing();
                }
                if (deviceAttrEditor != null) {
                    deviceAttrEditor.stopCellEditing();
                }
                saveProfile(null, profile);
                setProfile(profile);
                return true;
            }
        } catch (ProfileException e) {
            handleProfileException(e);
        } catch (IOException e) {
            LOG.error("IOException saving profile", e);
            MessageDialogFactory dialog = new MessageDialogFactory();
            dialog.showUnexpectedExceptionDialog(ConfigurationFrame.this, e);
        }
        return false;
    }
}
Also used : MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) TableCellEditor(javax.swing.table.TableCellEditor) IOException(java.io.IOException) Profile(com.att.aro.core.configuration.pojo.Profile)

Example 8 with MessageDialogFactory

use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.

the class ConfigurationFrame method saveAsConfigurationData.

/**
 * Implements the functionality of Save As menu item.
 */
private boolean saveAsConfigurationData() {
    synchronized (tableModel) {
        JFileChooser fileChooser = new JFileChooser(UserPreferencesFactory.getInstance().create().getLastProfileDirectory());
        fileChooser.setDialogTitle(DEFAULTBUNDLE.getString("configuration.savefile"));
        fileChooser.setMultiSelectionEnabled(false);
        int returnVal = fileChooser.showSaveDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            try {
                File file = fileChooser.getSelectedFile();
                if (file.exists() && MessageDialogFactory.showConfirmDialog(this, DEFAULTBUNDLE.getString("configuration.fileExists"), DEFAULTBUNDLE.getString("configuration.confirm"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
                    return false;
                }
                // Make sure current editor is closed
                TableCellEditor networkAttrEditor = networkAttributesTable.getCellEditor();
                TableCellEditor deviceAttrEditor = deviceAttributesTable.getCellEditor();
                if (networkAttrEditor != null) {
                    networkAttrEditor.stopCellEditing();
                }
                if (deviceAttrEditor != null) {
                    deviceAttrEditor.stopCellEditing();
                }
                Profile profile = tableModel.getProfile();
                saveProfile(file, profile);
                setProfile(profile);
                return true;
            } catch (IOException ioException) {
                MessageDialogFactory dialog = new MessageDialogFactory();
                dialog.showUnexpectedExceptionDialog(ConfigurationFrame.this, ioException);
            } catch (ProfileException profileException) {
                handleProfileException(profileException);
            }
        }
        return false;
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) TableCellEditor(javax.swing.table.TableCellEditor) IOException(java.io.IOException) File(java.io.File) Profile(com.att.aro.core.configuration.pojo.Profile)

Example 9 with MessageDialogFactory

use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.

the class ConfigurationFrame method handleProfileException.

private void handleProfileException(ProfileException profileException) {
    MessageDialogFactory dialog = new MessageDialogFactory();
    dialog.showErrorDialog(this, MessageFormat.format(ResourceBundleHelper.getMessageString("configuration.parseerror"), profileException.getMessage()));
}
Also used : MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory)

Example 10 with MessageDialogFactory

use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.

the class SegmentTablePanel method launchStartUpDelayDialog.

public void launchStartUpDelayDialog() {
    GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendViews("StartupDelayDialog");
    IVideoPlayer player = aroView.getVideoPlayer();
    double maxDuration = player.getDuration();
    List<UserEvent> userEventList = analyzerResult.getAnalyzerResult().getTraceresult().getUserEvents();
    if (maxDuration >= 0) {
        selectVideoStreamWithRefresh(videoStream);
        try {
            dialog = new StartupDelayDialog(aroView.getGraphPanel(), maxDuration, videoStream, userEventList, this, viewIndex);
            dialog.pack();
            dialog.setSize(dialog.getPreferredSize());
            dialog.validate();
            dialog.setModalityType(ModalityType.APPLICATION_MODAL);
            dialog.setVisible(true);
        } catch (Exception e) {
            LOG.error("Exception in StartupDelayDialog:", e);
            new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString("startupdelay.error.message"));
        }
    }
}
Also used : IVideoPlayer(com.att.aro.ui.view.video.IVideoPlayer) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) StartupDelayDialog(com.att.aro.ui.view.diagnostictab.StartupDelayDialog) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent)

Aggregations

MessageDialogFactory (com.att.aro.ui.commonui.MessageDialogFactory)18 IOException (java.io.IOException)10 File (java.io.File)9 Profile (com.att.aro.core.configuration.pojo.Profile)3 CrashHandler (com.att.aro.core.util.CrashHandler)3 AROUIIllegalStateException (com.att.aro.ui.exception.AROUIIllegalStateException)3 JFileChooser (javax.swing.JFileChooser)3 AROPrintablePanel (com.att.aro.ui.commonui.AROPrintablePanel)2 IAROPrintable (com.att.aro.ui.commonui.IAROPrintable)2 DataTablePopupMenu (com.att.aro.ui.model.DataTablePopupMenu)2 MainFrame (com.att.aro.ui.view.MainFrame)2 TimeRangeEditorDialog (com.att.aro.ui.view.menu.file.TimeRangeEditorDialog)2 PrinterException (java.awt.print.PrinterException)2 FileNameExtensionFilter (javax.swing.filechooser.FileNameExtensionFilter)2 TableCellEditor (javax.swing.table.TableCellEditor)2 SpringContextUtil (com.att.aro.core.SpringContextUtil)1 IExternalProcessRunner (com.att.aro.core.commandline.IExternalProcessRunner)1 ExternalProcessRunnerImpl (com.att.aro.core.commandline.impl.ExternalProcessRunnerImpl)1 IDataCollector (com.att.aro.core.datacollector.IDataCollector)1 IFileManager (com.att.aro.core.fileio.IFileManager)1