All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.gov.nasa.worldwind.layers.rpf.wizard.RPFWizardUtil Maven / Gradle / Ivy

Go to download

World Wind is a collection of components that interactively display 3D geographic information within Java applications or applets.

There is a newer version: 2.0.0-986
Show newest version
/*
 * Copyright (C) 2012 United States Government as represented by the Administrator of the
 * National Aeronautics and Space Administration.
 * All Rights Reserved.
 */
package gov.nasa.worldwind.layers.rpf.wizard;

import gov.nasa.worldwind.util.wizard.WizardProperties;
import gov.nasa.worldwind.util.Logging;
import gov.nasa.worldwind.layers.Layer;

import java.io.File;
import java.util.List;

/**
 * @author dcollins
 * @version $Id: RPFWizardUtil.java 1171 2013-02-11 21:45:02Z dcollins $
 */
public class RPFWizardUtil
{
    public static final String SELECTED_FILE = "selectedFile";
    public static final String FILE_LIST = "fileList";
    public static final String IS_FILE_LIST_CURRENT = "isFileListCurrent";
    public static final String FILE_SET_LIST = "fileSetList";
    public static final String LAYER_LIST = "layerList";

    public static File getSelectedFile(WizardProperties properties)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        File file = null;
        Object value = properties.getProperty(SELECTED_FILE);
        if (value != null && value instanceof File)
            file = (File) value;
        return file;
    }

    public static void setSelectedFile(WizardProperties properties, File file)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        properties.setProperty(SELECTED_FILE, file);
    }

    @SuppressWarnings({"unchecked"})
    public static List getFileList(WizardProperties properties)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        List fileList = null;
        Object value = properties.getProperty(FILE_LIST);
        if (value != null && value instanceof List)
            fileList = (List) value;
        return fileList;
    }

    public static void setFileList(WizardProperties properties, List fileList)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        properties.setProperty(FILE_LIST, fileList);
    }

    public static boolean isFileListCurrent(WizardProperties properties)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        boolean isFileListCurrent = false;
        Boolean value = properties.getBooleanProperty(IS_FILE_LIST_CURRENT);
        if (value != null)
            isFileListCurrent = value;
        return isFileListCurrent;
    }

    public static void setFileListCurrent(WizardProperties properties, boolean current)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        properties.setProperty(IS_FILE_LIST_CURRENT, current);
    }

    @SuppressWarnings({"unchecked"})
    public static List getFileSetList(WizardProperties properties)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        List fileSets = null;
        Object value = properties.getProperty(FILE_SET_LIST);
        if (value != null && value instanceof List)
            fileSets = (List) value;
        return fileSets;
    }

    public static void setFileSetList(WizardProperties properties, List fileSetList)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        properties.setProperty(FILE_SET_LIST, fileSetList);
    }

    @SuppressWarnings({"unchecked"})
    public static List getLayerList(WizardProperties properties)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        List fileSets = null;
        Object value = properties.getProperty(LAYER_LIST);
        if (value != null && value instanceof List)
            fileSets = (List) value;
        return fileSets;
    }

    public static void setLayerList(WizardProperties properties, List layerList)
    {
        if (properties == null)
        {
            String message = "WizardProperties is null";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        properties.setProperty(LAYER_LIST, layerList);
    }

    public static String makeLarger(String text)
    {
        if (text == null)
        {
            String message = Logging.getMessage("nullValue.StringIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        StringBuilder sb = new StringBuilder();
        sb.append("");
        sb.append("");
        sb.append(text);
        sb.append("");
        sb.append("");
        return sb.toString();
    }

    public static String makeSmaller(String text)
    {
        if (text == null)
        {
            String message = Logging.getMessage("nullValue.StringIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        StringBuilder sb = new StringBuilder();
        sb.append("");
        sb.append("");
        sb.append(text);
        sb.append("");
        sb.append("");
        return sb.toString();
    }

    public static String makeBold(String text)
    {
        if (text == null)
        {
            String message = Logging.getMessage("nullValue.StringIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        StringBuilder sb = new StringBuilder();
        sb.append("");
        sb.append("
"); sb.append(""); sb.append(text); sb.append(""); sb.append("
"); sb.append(""); return sb.toString(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy