Search in sources :

Example 6 with EnableEscKeyCloseDialog

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

the class FilterApplicationsAndIpDialog method initialize.

/**
 * Initializes the dialog.
 */
private void initialize() {
    PacketAnalyzerResult currentTraceResult = ((MainFrame) parent).getController().getTheModel().getAnalyzerResult();
    PacketAnalyzerResult initialTraceResult = ((MainFrame) parent).getController().getCurrentTraceInitialAnalyzerResult();
    if (currentTraceResult == null) {
        LOGGER.error("Trace result error! ");
        MessageDialogFactory.getInstance().showErrorDialog(FilterApplicationsAndIpDialog.this, "wrong..");
    } else {
        setCurrentPktAnalyzerResult(currentTraceResult);
        setInitialPktAnalyzerResult(initialTraceResult);
        // Save a copy of the filter before user makes any changes to the selection
        cloneFilter();
        this.jIpAddressesTableModel = new FilterIpAddressesTableModel(currentTraceResult.getFilter());
        this.jApplicationsTableModel = new FilterApplicationsTableModel(currentTraceResult.getFilter());
        this.jApplicationsTableModel.addTableModelListener(new TableModelListener() {

            @Override
            public void tableChanged(TableModelEvent e) {
                if (e.getColumn() == FilterApplicationsTableModel.SELECT_COL || e.getColumn() == FilterApplicationsTableModel.COLOR_COL) {
                    for (int row = e.getFirstRow(); row <= e.getLastRow(); ++row) {
                        if (row >= 0 && row < jApplicationsTableModel.getRowCount()) {
                            ApplicationSelection as = jApplicationsTableModel.getValueAt(row);
                            String appName = as.getAppName();
                            for (FilterIpAddressesTableModel.AppIPAddressSelection is : jIpAddressesTableModel.getData()) {
                                if (appName == is.getAppName() || (appName != null && appName.equals(is.getAppName()))) {
                                    if ((as.isSelected() || !is.getIpSelection().isSelected()) && e.getColumn() == FilterApplicationsTableModel.COLOR_COL) {
                                        is.getIpSelection().setColor(as.getColor());
                                    }
                                    if (e.getColumn() == FilterApplicationsTableModel.SELECT_COL) {
                                        is.getIpSelection().setSelected(as.isSelected());
                                    }
                                }
                            }
                        }
                    }
                    jIpAddressesTableModel.fireTableDataChanged();
                }
            }
        });
        this.jIpAddressesTableModel.addTableModelListener(new TableModelListener() {

            @Override
            public void tableChanged(TableModelEvent e) {
                if (e.getColumn() == FilterIpAddressesTableModel.SELECT_COL) {
                    for (int row = e.getFirstRow(); row <= e.getLastRow(); ++row) {
                        if (row >= 0 && row < jIpAddressesTableModel.getRowCount()) {
                            FilterIpAddressesTableModel.AppIPAddressSelection ipSel = jIpAddressesTableModel.getValueAt(row);
                            String appName = ipSel.getAppName();
                            boolean b = ipSel.getIpSelection().isSelected();
                            if (b) {
                                for (FilterIpAddressesTableModel.AppIPAddressSelection is : jIpAddressesTableModel.getData()) {
                                    if (appName == is.getAppName() || (appName != null && appName.equals(is.getAppName()))) {
                                        b &= is.getIpSelection().isSelected();
                                    }
                                }
                            }
                            for (ApplicationSelection as : jApplicationsTableModel.getData()) {
                                if (appName != null && appName.equals(as.getAppName())) {
                                    as.setSelected(b);
                                    break;
                                }
                            }
                            jApplicationsTableModel.fireTableDataChanged();
                        }
                    }
                }
            }
        });
    }
    this.setSize(600, 420);
    this.setModal(true);
    this.setTitle(ResourceBundleHelper.getMessageString(DialogItem.filter_title));
    this.setLayout(new BorderLayout());
    this.add(getMainPanel(), BorderLayout.CENTER);
    this.setLocationRelativeTo(getOwner());
    new EnableEscKeyCloseDialog(getRootPane(), this);
}
Also used : BorderLayout(java.awt.BorderLayout) EnableEscKeyCloseDialog(com.att.aro.ui.commonui.EnableEscKeyCloseDialog) TableModelEvent(javax.swing.event.TableModelEvent) TableModelListener(javax.swing.event.TableModelListener) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) MainFrame(com.att.aro.ui.view.MainFrame)

Example 7 with EnableEscKeyCloseDialog

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

the class ChartPlotOptionsDialog method initialize.

/**
 * Initializes the dialog.
 */
private void initialize() {
    this.setTitle(ResourceBundleHelper.getMessageString(DialogItem.chart_options_dialog_title));
    this.setContentPane(getJContentPane());
    this.setModalityType(Dialog.DEFAULT_MODALITY_TYPE);
    if (isUserPrefsSelected(ChartPlotOptions.DEFAULT_VIEW)) {
        enableOptions(false);
    }
    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    enableEscKeyCloseDialog = new EnableEscKeyCloseDialog(getRootPane(), this, false);
    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowDeactivated(WindowEvent event) {
            if (enableEscKeyCloseDialog.consumeEscPressed()) {
                executeCancelButton();
            }
        }
    });
    pack();
    setLocationRelativeTo(parent.getFrame());
    getRootPane().setDefaultButton(okButton);
}
Also used : EnableEscKeyCloseDialog(com.att.aro.ui.commonui.EnableEscKeyCloseDialog) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter)

Example 8 with EnableEscKeyCloseDialog

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

the class FilterProcessesDialog method initialize.

/**
 * Initializes the dialog.
 */
private void initialize() {
    this.setTitle(ResourceBundleHelper.getMessageString(DialogItem.processes_dialog_title));
    this.setContentPane(getJContentPane());
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.pack();
    this.setModalityType(Dialog.DEFAULT_MODALITY_TYPE);
    this.setLocationRelativeTo(super.getOwner());
    getRootPane().setDefaultButton(okButton);
    enableEscKeyCloseDialog = new EnableEscKeyCloseDialog(getRootPane(), this);
    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowDeactivated(WindowEvent event) {
            if (enableEscKeyCloseDialog.consumeEscPressed()) {
                cancelButtonAction();
            }
        }
    });
}
Also used : EnableEscKeyCloseDialog(com.att.aro.ui.commonui.EnableEscKeyCloseDialog) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter)

Example 9 with EnableEscKeyCloseDialog

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

the class ConfigurationFrame method initialize.

/**
 * Initializes the table which shows the profile details on the dialog.
 */
private void initialize(Profile profile) {
    // ApplicationContext context = new AnnotationConfigApplicationContext(AROConfig.class);
    factory = ContextAware.getAROConfigContext().getBean(IProfileFactory.class);
    setModal(true);
    setPreferredSize(new Dimension(475, 600));
    setLocationRelativeTo(getOwner());
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    // Create and set up the content pane.
    networkAttributesTable = new JTable(tableModel.getNetworkAttributesTableModel());
    networkAttributesTable.getTableHeader().setReorderingAllowed(false);
    networkAttributesTable.setCellSelectionEnabled(true);
    networkAttributesTable.setColumnSelectionAllowed(true);
    networkAttributesTable.setRowSelectionAllowed(true);
    networkAttributesTable.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
    // Set up column sizes.
    networkAttributesTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    // Create and set up the content pane.
    deviceAttributesTable = new JTable(tableModel.getDeviceAttributesTableModel());
    deviceAttributesTable.getTableHeader().setReorderingAllowed(false);
    deviceAttributesTable.setCellSelectionEnabled(true);
    deviceAttributesTable.setColumnSelectionAllowed(true);
    deviceAttributesTable.setRowSelectionAllowed(true);
    deviceAttributesTable.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
    // Set up column sizes.
    deviceAttributesTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    setProfile(profile);
    setJMenuBar(getConfigMenuBar());
    // Create the scroll pane and add the table to it.
    JScrollPane networkAttributesScrollPane = new JScrollPane(networkAttributesTable);
    JScrollPane deviceAttributesScrollPane = new JScrollPane(deviceAttributesTable);
    // Add the scroll pane to this panel.
    setLayout(new GridLayout(2, 1));
    add(networkAttributesScrollPane);
    add(deviceAttributesScrollPane);
    // Display the window.
    pack();
    this.setLocationRelativeTo(super.getOwner());
    new EnableEscKeyCloseDialog(getRootPane(), this);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridLayout(java.awt.GridLayout) EnableEscKeyCloseDialog(com.att.aro.ui.commonui.EnableEscKeyCloseDialog) JTable(javax.swing.JTable) Dimension(java.awt.Dimension) IProfileFactory(com.att.aro.core.configuration.IProfileFactory)

Aggregations

EnableEscKeyCloseDialog (com.att.aro.ui.commonui.EnableEscKeyCloseDialog)9 WindowAdapter (java.awt.event.WindowAdapter)6 WindowEvent (java.awt.event.WindowEvent)6 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)2 MainFrame (com.att.aro.ui.view.MainFrame)2 IProfileFactory (com.att.aro.core.configuration.IProfileFactory)1 ApplicationSelection (com.att.aro.core.packetanalysis.pojo.ApplicationSelection)1 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 GridLayout (java.awt.GridLayout)1 JScrollPane (javax.swing.JScrollPane)1 JTable (javax.swing.JTable)1 TableModelEvent (javax.swing.event.TableModelEvent)1 TableModelListener (javax.swing.event.TableModelListener)1