/*
 * This file is a part of EpnTAPClient.
 * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
 * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
 * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
 *
 * This program is free software: you can
 * redistribute it and/or modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
 * the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */

package eu.omp.irap.vespa.votable.gui;

import eu.omp.irap.vespa.epntapclient.votable.model.VOTABLE;
import eu.omp.irap.vespa.votable.votable.VOTableException;
import eu.omp.irap.vespa.votable.votable.VOTableException.CantGetVOTableException;

/**
 * @author N. Jourdane
 */
public interface AcquireTableInterface {

	/**
	 * Display an error message to the user.
	 *
	 * @param message A short version of the message.
	 * @param error The exception related to the error.
	 */
	void displayError(String message, Exception error);

	/**
	 * Display an informative message to the user.
	 *
	 * @param shortMessage A short version of the message.
	 * @param detailledMessage The full message to display (optional, can be null).
	 */
	void displayInfo(String shortMessage, String detailledMessage);

	/**
	 * If the voTablePath is not present, download the VOTable.
	 *
	 * @throws CantGetVOTableException The VOTable can not be downloaded.
	 */
	void downloadVOTable() throws CantGetVOTableException;

	/**
	 * Fill the table in the view with the parsed table.
	 */
	void displayTable();

	/**
	 * @return The VOTable as a VOTABLE object (corresponding to the XSD).
	 */
	VOTABLE getVOTable();

	/**
	 * @return the path of the XML VOTable file.
	 */
	String getVOTablePath();

	/**
	 * Parse the data inside the VOTable (ie., from the stream) and append the data to voTableData.
	 *
	 * @throws VOTableException The VOTable data can not be parsed.
	 */
	void parseVOTableData() throws VOTableException;

	/**
	 * Parse the XML file of the VOTable to a VOTABLE object (a Java representation of the XML root
	 * element).
	 *
	 * @throws VOTableException The XML file of the VOTable can not be parsed.
	 */
	void parseVOTableXML() throws VOTableException;

	/**
	 * Set the cursor in the VOTable view.
	 *
	 * @param enableWaitMode True to set the Wait cursor, false to set the default cursor.
	 */
	void setWaitMode(boolean enableWaitMode);

	/**
	 * Return if an URL for a query is set.
	 *
	 * @return true if an URL for a query is set, false otherwise.
	 */
	boolean isUrlSet();
}
