Examples of MainImageDisplay


Examples of jsky.image.gui.MainImageDisplay

            m.add(getWindowAction());
            m.addSeparator();
        }

        // Add the Send Table to ... menu item
        final MainImageDisplay imageDisplay = _imageFrame.getImageDisplayControl().getImageDisplay();
        final ImageSendActionManager man = new ImageSendActionManager(imageDisplay, _connector, url);

        menu.add(man.createSendMenu());

        final JMenuItem broadCastItem = new JMenuItem("Broadcast Image");
        broadCastItem.setIcon(Resources.getIcon("broadcast.gif"));
        broadCastItem.addActionListener(man.getBroadcastAction());
        menu.add(broadCastItem);

        if (url == null) {
            broadCastItem.setEnabled(false);
            man.setEnabled(false);
            imageDisplay.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    ImageChangeEvent e = (ImageChangeEvent) changeEvent;
                    if (e.isNewImage() && !e.isBefore()) {
                        boolean enabled = (imageDisplay.getURL() != null || imageDisplay.getFilename() != null);
                        man.setEnabled(enabled);
                        broadCastItem.setEnabled(enabled);
                    }
                }
            });
View Full Code Here

Examples of jsky.image.gui.MainImageDisplay

     *
     * @param menu the menu (JMenu or JPopupMenu) to add items to
     * @param url the URL of the image to send
     */
    private void _initImageMenu(JComponent menu, final URL url) {
        final MainImageDisplay imageDisplay = _imageFrame.getImageDisplayControl().getImageDisplay();
        if (menu instanceof JMenu) {
            // only include these in the main menu
            JMenu jMenu = (JMenu) menu;
            jMenu.add(getRegisterAction(true));
            jMenu.add(getRegisterAction(false));
            jMenu.add(new HubWatchAction(_imageFrame, this));
            jMenu.add(getHubStartAction(true));
            jMenu.add(getHubStartAction(false));
            jMenu.addSeparator();
        }

        final PlasticTransmitter trans = new PlasticTransmitter(this, MessageId.FITS_LOADIMAGE, "image") {
            @Override
            protected void transmit(PlasticHubListener hub, URI clientId, ApplicationItem app) throws IOException {
                URI[] recipients = app == null
                        ? null
                        : new URI[]{app.getId()};
                transmitImage(hub, clientId, recipients, url);
            }
        };

        JMenu sendMenu = trans.createSendMenu();
        sendMenu.setIcon(Resources.getIcon("phone2.gif"));
        menu.add(sendMenu);

        final JMenuItem broadCastItem = new JMenuItem("Broadcast Image");
        broadCastItem.setIcon(Resources.getIcon("broadcast.gif"));
        broadCastItem.addActionListener(trans.getBroadcastAction());
        menu.add(broadCastItem);

        if (url == null) {
            broadCastItem.setEnabled(false);
            trans.setEnabled(false);
            imageDisplay.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    ImageChangeEvent e = (ImageChangeEvent) changeEvent;
                    if (e.isNewImage() && !e.isBefore()) {
                        boolean enabled = (imageDisplay.getURL() != null || imageDisplay.getFilename() != null);
                        trans.setEnabled(enabled);
                        broadCastItem.setEnabled(enabled);
                    }
                }
            });
View Full Code Here

Examples of jsky.image.gui.MainImageDisplay

    private void transmitImage(final PlasticHubListener hub,
                               final URI plasticId, final URI[] recipients,
                               URL url)
            throws IOException {

        final MainImageDisplay imageDisplay = _imageFrame.getImageDisplayControl().getImageDisplay();
        URL imageUrl = url;
        if (imageUrl == null) {
            String fileName = imageDisplay.getFilename();
            imageUrl = imageDisplay.getURL();
            if (fileName != null) {
                imageUrl = new File(fileName).toURI().toURL();
            }
        }
        if (imageUrl == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.