Package slash.navigation.common

Examples of slash.navigation.common.DegreeFormat


*/

public class DegreeFormatListCellRenderer extends DefaultListCellRenderer {
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        DegreeFormat degreeFormat = DegreeFormat.class.cast(value);
        String text = RouteConverter.getBundle().getString("degreeformat-" + degreeFormat.name().toLowerCase());
        label.setText(text);
        return label;
    }
View Full Code Here


    }

    public static String formatLongitude(Double longitude) {
        if (longitude == null)
            return "";
        DegreeFormat degreeFormat = RouteConverter.getInstance().getUnitSystemModel().getDegreeFormat();
        return degreeFormat.longitudeToDegrees(longitude);
    }
View Full Code Here

    }

    public static String formatLatitude(Double latitude) {
        if (latitude == null)
            return "";
        DegreeFormat degreeFormat = RouteConverter.getInstance().getUnitSystemModel().getDegreeFormat();
        return degreeFormat.latitudeToDegrees(latitude);
    }
View Full Code Here

    private Double parseLongitude(Object objectValue, String stringValue) {
        if (objectValue == null || objectValue instanceof Double)
            return (Double) objectValue;

        DegreeFormat degreeFormat = RouteConverter.getInstance().getUnitSystemModel().getDegreeFormat();
        switch (degreeFormat) {
            case Degrees:
                return parseDouble(stringValue);
            case Degrees_Minutes:
                return ddmm2longitude(stringValue);
View Full Code Here

    private Double parseLatitude(Object objectValue, String stringValue) {
        if (objectValue == null || objectValue instanceof Double)
            return (Double) objectValue;

        DegreeFormat degreeFormat = RouteConverter.getInstance().getUnitSystemModel().getDegreeFormat();
        switch (degreeFormat) {
            case Degrees:
                return parseDouble(stringValue);
            case Degrees_Minutes:
                return ddmm2latitude(stringValue);
View Full Code Here

        comboBoxDegreeFormat.setRenderer(new DegreeFormatListCellRenderer());
        comboBoxDegreeFormat.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() != SELECTED)
                    return;
                DegreeFormat degreeFormat = DegreeFormat.class.cast(e.getItem());
                r.getUnitSystemModel().setDegreeFormat(degreeFormat);
            }
        });

        ComboBoxModel<String> timeZoneModel = new DefaultComboBoxModel<>(getTimeZoneIds());
View Full Code Here

TOP

Related Classes of slash.navigation.common.DegreeFormat

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.