Package uk.ac.starlink.plastic

Examples of uk.ac.starlink.plastic.PlasticTransmitter


            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);
                    }
                }
            });
        } else {
            trans.setEnabled(true);
        }
    }
View Full Code Here


            jMenu.add(getHubStartAction(false));
            jMenu.addSeparator();
        }

        boolean isSpectrum = format != null && format.startsWith("spectrum/");
        final PlasticTransmitter trans = new PlasticTransmitter(this,
                isSpectrum ? MessageId.SPECTRUM_LOADURL : MessageId.VOT_LOADURL,
                isSpectrum ? "spectrum" : "table") {
            @Override
            protected void transmit(PlasticHubListener hub, URI clientId, ApplicationItem app) throws IOException {
                URI[] recipients = (app == null) ? null : new URI[]{app.getId()};
                transmitTable(hub, clientId, recipients, url, format, ucdMap);
            }
        };

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

        final JMenuItem broadCastItem = new JMenuItem(isSpectrum ? "Broadcast Spectrum" : "Broadcast Table");
        broadCastItem.setIcon(Resources.getIcon("broadcast.gif"));
        broadCastItem.addActionListener(trans.getBroadcastAction());
        menu.add(broadCastItem);

        if (url == null) {
            broadCastItem.setEnabled(false);
            trans.setEnabled(false);
            navigator.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    boolean enabled = navigator.getResultComponent() instanceof TableDisplayTool;
                    trans.setEnabled(enabled);
                    broadCastItem.setEnabled(enabled);
                }
            });
        } else {
            trans.setEnabled(true);
        }
    }
View Full Code Here

TOP

Related Classes of uk.ac.starlink.plastic.PlasticTransmitter

Copyright © 2018 www.massapicom. 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.