Package jsky.navigator

Examples of jsky.navigator.Navigator$NavigatorImageLoader


     * @param tableId optional: identifier which may be used to refer to the loaded table in subsequent message
     * @param name    optional: name which may be used to label the loaded table in the application GUI
     * @throws Exception on error
     */
    protected void tableLoadVotable(URL url, String tableId, String name) throws Exception {
        Navigator navigator = _imageFrame.getNavigator();
        if (navigator != null) {
            VoCatalog catalog = new VoCatalog(VoTable.createVoTable(url, tableId, name));
            navigator.setQueryResult(catalog);
            navigator.setOrigURL(url); // XXX is this still needed?
            navigator.registerTable(url, tableId);
        }
    }
View Full Code Here


     * @param url     URL of a table
     * @param row     Row index (zero-based) of the row to highlight.
     * @throws Exception on error
     */
    protected void tableHighlightRow(String tableId, URL url, int row) throws Exception {
        Navigator navigator = _imageFrame.getNavigator();
        if (navigator != null) {
            navigator.selectTableRows(tableId, url, new int[]{row});
        }
    }
View Full Code Here

     * @param url     URL of a table
     * @param rowList indexes (zero-based) of the rows to highlight.
     * @throws Exception on error
     */
    protected void tableSelectRowList(String tableId, URL url, List<String> rowList) throws Exception {
        Navigator navigator = _imageFrame.getNavigator();
        if (navigator != null) {
            int[] rows = new int[rowList.size()];
            for (int i = 0; i < rows.length; i++) {
                rows[i] = Integer.parseInt(rowList.get(i));
            }
            navigator.selectTableRows(tableId, url, rows);
        }
    }
View Full Code Here

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

        // Add the Send Table to ... menu item
        final Navigator navigator = _imageFrame.getNavigator();

        final TableSendActionManager man = new TableSendActionManager(navigator, _connector, url, format, ucdMap);
        menu.add(man.createSendMenu());

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

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

     * @param rowList list of selected row indexes in the currently displayed table
     *
     * @return a map of parameter names to values for the "table.select.rowList" message
     */
    private Map _makeTransmitSelectedRowsMessage(List<Integer> rowList) {
        Navigator navigator = _imageFrame.getNavigator();
        QueryResult queryResult = navigator.getQueryResult();
        if (queryResult instanceof TableQueryResult) {
            TableQueryResult table = (TableQueryResult) queryResult;
            String tableId = table.getId();
            String sampId = TableSendActionManager.getSampId(tableId);
            if (sampId != null) {
                // Must be a table we sent, so use the samp table id we sent it with
                tableId = sampId;
            }
            URL url = navigator.getOrigURL();
            String urlStr = url != null ? url.toString() : null;
            Message msg = new Message("table.select.rowList");
            if (tableId != null) {
                msg.addParam("table-id", tableId);
            }
View Full Code Here

        else if (MessageId.VOT_SHOWOBJECTS.equals(message) &&
                args.size() >= 2 &&
                args.get(1) instanceof List) {
            String tableId = args.get(0).toString();
            List rowList = (List) args.get(1);
            Navigator navigator = _imageFrame.getNavigator();
            if (navigator != null) {
                int[] rows = new int[rowList.size()];
                for (int i = 0; i < rows.length; i++) {
                    // should actually be a number
                    rows[i] = Integer.parseInt(rowList.get(i).toString());
                }
                navigator.selectTableRows(tableId, null, rows);
            }
            return Boolean.TRUE;
        }

        /* Highlight a single row. */
        else if (MessageId.VOT_HIGHLIGHTOBJECT.equals(message) &&
                args.size() >= 2 &&
                args.get(1) instanceof Number) {
            String tableId = args.get(0).toString();
            int irow = ((Number) args.get(1)).intValue();
            Navigator navigator = _imageFrame.getNavigator();
            if (navigator != null) {
                navigator.selectTableRows(tableId, null, new int[]{irow});
            }
            return Boolean.TRUE;
        }

        /* Get the icon for this application. */
 
View Full Code Here

     * @param id identifies the sent VOTable for later use
     * @throws java.io.IOException on error
     */
    private void votableLoad(URI sender, String votText, String id)
            throws IOException {
        Navigator navigator = _imageFrame.getNavigator();
        if (navigator != null) {
            final byte[] votBytes = votText.getBytes("UTF-8");
            DataSource datsrc = new DataSource() {
                public InputStream getRawInputStream() {
                    return new ByteArrayInputStream(votBytes);
                }
            };
            String name = sender.toString() + "-" + id;
            VoCatalog catalog = new VoCatalog(VoTable.createVoTable(datsrc, id, name));
            navigator.setQueryResult(catalog);
            navigator.registerTable(null, id);
        }
    }
View Full Code Here

     * @param id identifier for loaded table
     * @throws java.io.IOException on error
     */
    private void votableLoadFromURL(URI sender, String urlStr, String id)
            throws IOException {
        Navigator navigator = _imageFrame.getNavigator();
        if (navigator != null) {
            String name = sender.toString() + "-" + id;
            URL url = new URL(urlStr);
            VoCatalog catalog = new VoCatalog(VoTable.createVoTable(url, id, name));
            navigator.setQueryResult(catalog);
            navigator.registerTable(url, id);
        }
    }
View Full Code Here

     * @param url the URL of the table or spectrum, or null to use the displayed table
     * @param format the expected format/mime type
     * @param ucdMap maps UCD to column value for the current table row (may be empty)
     */
    private void _initTableMenu(JComponent menu, final URL url, final String format, final Map ucdMap) {
        final Navigator navigator = _imageFrame.getNavigator();
        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();
        }

        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 {
View Full Code Here

    private void transmitTable(final PlasticHubListener hub,
                               final URI plasticId, final URI[] recipients,
                               URL url, final String format, final Map ucdMap) throws IOException {

        // Write the data as a VOTable to a temporary file preparatory to broadcast.
        final Navigator navigator = _imageFrame.getNavigator();
        final String urlStr;
        final String name;
        final File tmpfile;
        if (url == null) {
            tmpfile = File.createTempFile("plastic", ".vot");
            urlStr = URLUtils.makeFileURL(tmpfile).toString();
            tmpfile.deleteOnExit();
            OutputStream ostrm = new BufferedOutputStream(new FileOutputStream(tmpfile));
            final StarTable starTable = navigator.getStarTable();
            name = starTable.getName();
            try {
                new VOTableWriter(DataFormat.TABLEDATA, true).writeStarTable(starTable, ostrm);
            }
            catch (IOException e) {
                //noinspection ResultOfMethodCallIgnored
                tmpfile.delete();
                throw e;
            }
            finally {
                ostrm.close();
            }
        } else {
            urlStr = url.toString();
            name = plasticId.toString();
            tmpfile = null;
        }

        // Store a record of the table that was broadcast
        navigator.registerTable(new URL(urlStr), name);

        // Do the broadcast, synchronously so that we don't delete the
        // temporary file too early, but in another thread so that we
        // don't block the GUI.
        new Thread("PLASTIC table broadcast") {
View Full Code Here

TOP

Related Classes of jsky.navigator.Navigator$NavigatorImageLoader

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.