Package jsky.catalog

Examples of jsky.catalog.FieldDesc


                    c++;
                } else if (urlStr.startsWith("m1", c)) { // min magnitude
                    if (sc != null && sc.length > 0) {
                        String m1 = "0"; // default value
                        for (SearchCondition aSc : sc) {
                            FieldDesc p = aSc.getFieldDesc();
                            if (p.isMin()) {
                                String id = p.getId();
                                // field name is "mag" by convention
                                if (id != null && id.equalsIgnoreCase("mag")) {
                                    m1 = aSc.getValueAsString();
                                    break;
                                }
                            }
                        }
                        buf.append(m1);
                    }
                    c += 2;
                } else if (urlStr.startsWith("m2", c)) { // max magnitude
                    if (sc != null && sc.length > 0) {
                        String m2 = "0"; // default value
                        for (SearchCondition aSc : sc) {
                            FieldDesc p = aSc.getFieldDesc();
                            if (p.isMax()) {
                                String id = p.getId();
                                // field name is "mag" by convention
                                if (id != null && id.equalsIgnoreCase("mag")) {
                                    m2 = aSc.getValueAsString();
                                    break;
                                }
View Full Code Here


        int n = _catalog.getNumParams();
        _labels = new JLabel[n];
        _components = new JComponent[n];

        for (int i = 0; i < n; i++) {
            FieldDesc p = _catalog.getParamDesc(i);
            if (p == null || "hidden".equals(p.getType())) {
                _labels[i] = null;
                _components[i] = null;
            } else {
                // add a label and component
                String s = p.getDisplayName();
                if (s == null) {
                    s = "Field" + (i + 1);
                }
                String tip = p.getDescription();
                if (tip != null && tip.length() != 0) {
                    tip = "<html>" + tip.replace(". ", ".<br>") + "</html>";
                }
                _labels[i] = makeLabel(s, tip);
                _components[i] = makeComponent(p, tip);
View Full Code Here

     * Set the value in the named component.
     */
    protected void setValue(String label, Object value) {
        int n = _catalog.getNumParams();
        for (int i = 0; i < n; i++) {
            FieldDesc param = _catalog.getParamDesc(i);
            if (param != null) {
                String name = param.getName();
                String id = param.getId();
                if ((id != null && id.equalsIgnoreCase(label)) || (name != null && name.equalsIgnoreCase(label))) {
                    setValue(i, value);
                    return;
                }
            }
View Full Code Here

        int numCols = table.getColumnCount();
        Vector<Object> v = stats.getRow();
        Vector<Object> rowVec = new Vector<Object>(numCols);

        for (int col = 0; col < numCols; col++) {
            FieldDesc field = table.getColumnDesc(col);
            String name = field.getName();
            if (field.isId()) {
                rowVec.add(v.get(PickObjectStatistics.ID));
            } else if (field.isRaMain()) {
                rowVec.add(stats.getCenterPos().getRA().toString());
            } else if (field.isDecMain()) {
                rowVec.add(stats.getCenterPos().getDec().toString());
            } else {
                Object o = null;
                for (int i = 0; i < PickObjectStatistics.NUM_FIELDS; i++) {
                    if (name.equals(PickObjectStatistics.FIELD_NAMES[i])) {
View Full Code Here

        SlapCatalog cat = new SlapCatalog("Splatalogue Simple Line Access Service",
                new URL("http://phobos.jb.man.ac.uk:8000/slap.py"));
        assertEquals("Splatalogue Simple Line Access Service", cat.getName());
        assertEquals(4, cat.getNumParams());

        FieldDesc fd = cat.getParamDesc(0);
        assertEquals("Linelist", fd.getName());
        assertEquals("Specify the original linelist from which this information is derived", fd.getDescription());

        fd = cat.getParamDesc(1);
        assertEquals("Species", fd.getName());
        assertEquals("Specify the species name.", fd.getDescription());

        fd = cat.getParamDesc(2);
        assertEquals("Final", fd.getName());
        assertEquals("Specify the final energy of the species originating the transition. To be specified in J.", fd.getDescription());

        fd = cat.getParamDesc(3);
        assertEquals("Wavelength", fd.getName());
        assertEquals("Specify the wavelength spectral range. To be specified in meters. This wavelength will be interpreted as the wavelength in the vacuum of the transition originating the line", fd.getDescription());
    }
View Full Code Here

    }

    // Returns teh tooltip for the given table clumn, or null if not known
    private String getColumnToolTip(int i) {
        if (_tableQueryResult != null) {
            FieldDesc fd = _tableQueryResult.getColumnDesc(i);
            String tip = fd.getDescription();
            String units = fd.getUnits();
            if (units != null) {
                units = units.trim();
                if (fd.isRA()) {
                    units += " (displayed as hours:minutes:seconds)"; // We reformat deg to h:m:s...
                }
            }
            if (tip == null || tip.length() == 0) {
                if (units != null && units.length() != 0) {
                    tip = fd.getName() + " in " + units;
                }
            } else if (units != null && units.length() != 0) {
                tip += ", Units: " + units;
            }
            return tip;
View Full Code Here

     * default text item, or if a value needs special formatting.
     */
    protected void setColumnRenderers() {
        int numCols = _tableQueryResult.getColumnCount();
        for (int col = 0; col < numCols; col++) {
            FieldDesc field = _tableQueryResult.getColumnDesc(col);
            TableColumn column = _table.getColumn(_tableQueryResult.getColumnName(col));

            // linked fields are displayed as buttons that download and display the item behind the link
            if (field.hasLink()) {
                // Add SAMP/PLASTIC features to download
                column.setCellRenderer(new UrlTableCellRenderer(field, _tableQueryResult, _queryResultDisplay));
                column.setCellEditor(new UrlTableCellRenderer(field, _tableQueryResult, _queryResultDisplay));
            } else if (field.isRA()) {
                // RA,DEC coordinates are displayed in sexagesimal (hh:mm:ss.sss) notation
                column.setCellRenderer(new SexagesimalTableCellRenderer(true));
                column.setCellEditor(new SexagesimalTableCellEditor(true));
            } else if (field.isDec()) {
                column.setCellRenderer(new SexagesimalTableCellRenderer(false));
                column.setCellEditor(new SexagesimalTableCellEditor(false));
            } else {
                Class c = _tableQueryResult.getColumnClass(col);
                // Use the StarJava renderer for better numeric display (also handles strings, etc.)
View Full Code Here

     */
    protected void reorderColumns() {
        if (_tableQueryResult != null) {
            int columnCount = _tableQueryResult.getColumnCount();
            for(int col = 0; col < columnCount; col++) {
                FieldDesc fd = _tableQueryResult.getColumnDesc(col);
                if (fd.hasLink()) {
                    _table.moveColumn(col, 0);
                } else if ("format".equalsIgnoreCase(_tableQueryResult.getColumnName(col))
                        || new UcdSupport(fd.getUCD()).isFormat()) {
                    _table.moveColumn(col, 1);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of jsky.catalog.FieldDesc

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.