Example usage for javax.swing.event InternalFrameEvent getInternalFrame

List of usage examples for javax.swing.event InternalFrameEvent getInternalFrame

Introduction

In this page you can find the example usage for javax.swing.event InternalFrameEvent getInternalFrame.

Prototype


public JInternalFrame getInternalFrame() 

Source Link

Document

Returns the originator of the event.

Usage

From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java

@Override
public void internalFrameActivated(InternalFrameEvent e) {
    LOG.debug("activated: " + e.getInternalFrame().getTitle());
    this.tslTool.setActiveTslInternalFrame(this);
}

From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java

@Override
public void internalFrameDeactivated(InternalFrameEvent e) {
    LOG.debug("deactivated: " + e.getInternalFrame().getTitle());
    this.tslTool.setActiveTslInternalFrame(null);
}

From source file:org.eumetsat.metop.visat.IasiInfoView.java

@Override
protected JComponent createControl() {
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("Sounder Info", createInfoComponent());
    tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent());
    tabbedPane.add("Radiance Analysis", createRadianceAnalysisComponent());
    tabbedPane.add("Sounder Layer", createSounderLayerComponent());

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }//from  w  w w  . ja v a  2  s. co m

    InternalFrameListener internalFrameListener = new InternalFrameAdapter() {

        @Override
        public void internalFrameActivated(InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final IasiLayer layer = getIasiLayer();
                if (layer != null) {
                    modelChanged(layer);
                } else {
                    final LayerListener layerListener = new AbstractLayerListener() {
                        @Override
                        public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) {
                            final IasiLayer layer = getIasiLayer();
                            if (layer != null) {
                                modelChanged(layer);
                                view.getRootLayer().removeListener(this);
                            }
                        }
                    };
                    view.getRootLayer().addListener(layerListener);
                }
            }
        }

        @Override
        public void internalFrameDeactivated(InternalFrameEvent e) {
            if (currentOverlay != null) {
                currentOverlay.removeListener(overlayListener);
            }
            updateUI(null);
            editor.setModel(null);
        }
    };

    VisatApp.getApp().addInternalFrameListener(internalFrameListener);
    if (MetopSounderVPI.isValidAvhrrProductSceneViewSelected()) {
        final IasiLayer layer = getIasiLayer();
        if (layer != null) {
            modelChanged(layer);
        }
    }

    final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"),
            false);
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }

    final JPanel containerPanel = new JPanel(new BorderLayout());
    containerPanel.add(tabbedPane, BorderLayout.CENTER);
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.add(helpButton, BorderLayout.EAST);
    containerPanel.add(buttonPanel, BorderLayout.SOUTH);

    return containerPanel;
}

From source file:org.eumetsat.metop.visat.SounderInfoView.java

@Override
protected JComponent createControl() {
    overlayListener = new SounderOverlayListener() {
        @Override/*from www  . j  av  a 2  s.  c  om*/
        public void selectionChanged(SounderOverlay overlay) {
            updateUI(overlay);
        }

        @Override
        public void dataChanged(SounderOverlay overlay) {
            updateUI(overlay);
        }
    };
    internalFrameListener = new InternalFrameAdapter() {
        @Override
        public void internalFrameActivated(final InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final SounderLayer layer = getSounderLayer(view);

                if (layer != null) {
                    layerChanged(layer);
                } else {
                    final LayerListener layerListener = new AbstractLayerListener() {
                        @Override
                        public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) {
                            final SounderLayer layer = getSounderLayer(view);
                            if (layer != null) {
                                layerChanged(layer);
                                view.getRootLayer().removeListener(this);
                            }
                        }
                    };
                    view.getRootLayer().addListener(layerListener);
                }
            }
        }

        @Override
        public void internalFrameDeactivated(final InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final SounderLayer layer = getSounderLayer(view);
                if (layer != null) {
                    layer.getOverlay().removeListener(overlayListener);
                }
            }
        }

        @Override
        public void internalFrameClosed(InternalFrameEvent e) {
            if (getSounderLayer() == null) {
                clearUI();
                editor.setModel(null);
            }
        }
    };
    VisatApp.getApp().addInternalFrameListener(internalFrameListener);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("Sounder Info", createInfoComponent());
    tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent());
    tabbedPane.add("Sounder Layer", createSounderLayerComponent());

    final SounderLayer layer = getSounderLayer();
    if (layer != null) {
        layerChanged(layer);
    }

    final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"),
            false);
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }

    final JPanel containerPanel = new JPanel(new BorderLayout());
    containerPanel.add(tabbedPane, BorderLayout.CENTER);
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.add(helpButton, BorderLayout.EAST);
    containerPanel.add(buttonPanel, BorderLayout.SOUTH);

    return containerPanel;
}

From source file:com.g2inc.scap.editor.gui.windows.EditorMainWindow.java

@Override
public void internalFrameClosed(InternalFrameEvent e) {
    decrementOpenDocuments();//from   ww w  . j  av  a  2  s .  c  o m

    JInternalFrame internalFrame = (JInternalFrame) e.getInternalFrame();

    /* if (internalFrame instanceof WizardModeWindow) {
    setWizMode(false);
     }
    */
    InternalFrameListener[] frameListeners = internalFrame.getInternalFrameListeners();

    if (frameListeners != null) {
        for (int x = 0; x < frameListeners.length; x++) {
            internalFrame.removeInternalFrameListener(frameListeners[x]);
        }

        frameListeners = null;
    }

    decrementOpenDocuments();

    desktopPane.remove(internalFrame);

    if (internalFrame instanceof OvalEditorForm) {
        ((OvalEditorForm) internalFrame).cleanUp();
    } else if (internalFrame instanceof CPEDictionaryEditorForm) {
        ((CPEDictionaryEditorForm) internalFrame).cleanUp();
    }

    internalFrame.dispose();
    //       navPanel.clearButtons();
}