es.unex.sextante.gui.core
Class SextanteGUI

java.lang.Object
  extended by es.unex.sextante.gui.core.SextanteGUI
All Implemented Interfaces:
SettingsConstants

public class SextanteGUI
extends java.lang.Object
implements SettingsConstants

This class centralizes most actions related to the SextanteGUI, containing methods to show dialogs and retrieve basic values used by GUI elements


Field Summary
static int COMMANDLINE
           
static int HISTORY
           
 
Fields inherited from interface es.unex.sextante.gui.core.SettingsConstants
DEFAULT_NO_DATA_VALUE, GRASS_3D_V_MODE, GRASS_FOLDER, GRASS_IN_POLYLINES, GRASS_LAT_LON_MODE, GRASS_MAPSET_FOLDER, GRASS_USE_TEMP_MAPSET, GRASS_WIN_SHELL, MODELS_FOLDER, MODIFY_NAMES, RESULTS_FOLDER, SHOW_ONLY_ACTIVE, USE_INTERNAL_NAMES, WPS_ACTIVATED, WPS_URL
 
Constructor Summary
SextanteGUI()
           
 
Method Summary
static void addCustomParametersPanel(java.lang.Class<?> alg, java.lang.Class<?> panel, java.lang.Class<?> modelerPanel)
           
static void checkGrassMapsetFolder(java.lang.String grassMapsetFolder)
          Checks whether the GRASS mapset folder is valid.
static java.lang.String getConfigPath()
          Returns the config folder
static java.lang.Double getDefaultNoDataValue()
          Returns the default value to represent "No Data" (null) raster cells.
static java.lang.String getGrassFolder()
          Returns the path where grass is installed
static java.lang.String getGrassMapsetFolder()
          Returns the grass mapset folder as set by the user.
static java.lang.String getGrassUserMapsetFolder()
          Returns the grass mapset folder as set by the user (which may be empty).
static java.lang.String getGrassWinShell()
          Gets the path to the shell that handles GRASS scripts on Windows.
static IGUIFactory getGUIFactory()
          Returns the current GUIFactory
static java.lang.String getHelpPath()
          Returns the path to help files
static IInputFactory getInputFactory()
          Returns the current input factory
static int getLastCommandOrigin()
          Returns the type of the last element from which a command-line command was executed
static javax.swing.JDialog getLastCommandOriginParentDialog()
          Gets the dialog from which the last command--line command was executed.
static java.awt.Frame getMainFrame()
          Returns the current main frame
static java.lang.Class getModelerParametersPanel(java.lang.Class alg)
           
static java.lang.String getModelsFolder()
          Returns the models folder.
static boolean getModifyResultsNames()
          Returns true if names of output layers should be modified to avoid conflictive characters (), [], - .. etc
static OutputFactory getOutputFactory()
          Returns the current OutputFactory
static java.lang.String getOutputFolder()
          Returns the default folder for output data.
static java.lang.Class getParametersPanel(java.lang.Class alg)
           
static java.lang.Runnable getPostProcessTask(GeoAlgorithm alg)
          Returns the task to post-process the algorithm outputs, usually to add them to the GUI of the GIS app.
static boolean getShowOnlyActiveAlgorithms()
          Returns true if only active algorithms (those that can be executed with the current data objects) should be shown in the toolbox
static boolean getUseInternalNames()
          Returns whether output names should be substituted by internal output names, instead of using output descriptions
static java.util.ArrayList<java.lang.String> getWpsURLs()
          Returns a list of URLs with WPS processes
static void initialize()
          Initializes the GUI parameters and resources.
static void initialize(java.lang.String sFolder)
          Initializes the GUI parameters and resources.
static void initialize(java.net.URL[] jars)
          Initializes the GUI parameters and resources.
static boolean isGrass3DVMode()
          returns true if GRASS processes all vector input as 3D
static boolean isGrassInPolylines()
          returns true if GRASS (v.in.ogr) will import polygons as polylines.
static boolean isGrassLatLonMode()
          returns true if GRASS processes data in lat/lon mode
static boolean isGrassTempMapset()
          returns true if GRASS uses a temporary mapset for processing
static boolean isWPSActivated()
          returns true is the WPS client is enabled
static java.lang.String modifyResultName(java.lang.String sName)
          Modifies the passed string, so it can be used as a safe data object name (without special characters)
static void saveSettings()
          Saves current settings to the config file
static void setDefaultNoDataValue(java.lang.Double dDefaultNoDataValue)
          Sets the default value to represent "No Data" (null) raster cells.
static void setGrassFolder(java.lang.String grassFolder)
          Sets the path where GRASS is installed.
static void setGrassMapsetFolder(java.lang.String grassMapsetFolder)
          Sets the path path to the GRASS mapset where GRASS data processing will take place.
static int setGrassWinShell(java.lang.String grassWinShell)
          Sets the path to the shell that handles GRASS scripts on Windows.
static void setGUIFactory(IGUIFactory guiFactory)
          sets a new GUI factory
static void setHelpPath(java.lang.String sPath)
          Sets the current path to help files
static void setInputFactory(IInputFactory inputFactory)
          Sets a new input factory as the current one
static void setIsGrass3DVMode(boolean isGrass3DVMode)
          Sets whether GRASS processes all vector input as 3D
static void setIsGrassInPolylines(boolean isGrassInPolylines)
          Sets whether GRASS (v.in.ogr) will import polygons as polylines.
static void setIsGrassLatLonMode(boolean isGrassLatLonMode)
          Sets whether GRASS processes data in lat/lon mode
static void setIsGrassTempMapset(boolean isGrassTempMapset)
          Sets whether GRASS should use a temporary mapset for processing
static void setIsWPSActivated(boolean isWPSActivated)
          Sets whether the WPS client is enabled or not
static void setLastCommandOrigin(int iLast)
          Sets the type of the last element from which a command-line command was executed.
static void setLastCommandOriginParentDialog(javax.swing.JDialog parent)
          Sets the dialog (if any) that contains the element from which the last command--line command was executed
static void setMainFrame(java.awt.Frame frame)
          Sets a new main frame.
static void setModelsFolder(java.lang.String sModelsFolder)
          Sets the models folder
static void setModifyResultsNames(boolean bModify)
          Sets whether names of output layers should be modified to avoid conflictive characters
static void setOutputFactory(OutputFactory outputFactory)
          sets a new output factory
static void setOutputFolder(java.lang.String sOutputFolder)
          Sets the default folder for output data.
static void setPostProcessTaskFactory(IPostProcessTaskFactory factory)
          Sets the current post process task factory
static void setSettings(java.util.Map values)
          Sets the whole set of settings.
static void setShowOnlyActiveAlgorithms(boolean showOnlyActiveAlgorithms)
          Sets whether only active algorithms (those that can be executed with the current data objects) should be shown in the toolbox
static java.util.ArrayList<java.lang.String> setWpsURLs(java.util.ArrayList<java.lang.String> list)
          Sets a new list of WPS URLs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTORY

public static final int HISTORY
See Also:
Constant Field Values

COMMANDLINE

public static final int COMMANDLINE
See Also:
Constant Field Values
Constructor Detail

SextanteGUI

public SextanteGUI()
Method Detail

setMainFrame

public static void setMainFrame(java.awt.Frame frame)
Sets a new main frame. This will be used as the parent frame by SEXTANTE GUI elements

Parameters:
frame - The main frame

getMainFrame

public static java.awt.Frame getMainFrame()
Returns the current main frame

Returns:
the current main frame

getInputFactory

public static IInputFactory getInputFactory()
Returns the current input factory

Returns:
the current input factory
See Also:
IInputFactory.

setInputFactory

public static void setInputFactory(IInputFactory inputFactory)
Sets a new input factory as the current one

Parameters:
inputFactory - the new input factory

getOutputFactory

public static OutputFactory getOutputFactory()
Returns the current OutputFactory

Returns:
the current OutputFactory

setOutputFactory

public static void setOutputFactory(OutputFactory outputFactory)
sets a new output factory

Parameters:
outputFactory - the new output factory

getGUIFactory

public static IGUIFactory getGUIFactory()
Returns the current GUIFactory

Returns:
the current GUIFactory

setGUIFactory

public static void setGUIFactory(IGUIFactory guiFactory)
sets a new GUI factory

Parameters:
guiFactory - the new GUI factory

getPostProcessTask

public static java.lang.Runnable getPostProcessTask(GeoAlgorithm alg)
Returns the task to post-process the algorithm outputs, usually to add them to the GUI of the GIS app.

Parameters:
alg - the algorithm to postprocess. Since this task will mainly deal with output results, the algorithm should have been previously executed, so it contains non-null output values
Returns:
a task to postprocess the given algorithm

setPostProcessTaskFactory

public static void setPostProcessTaskFactory(IPostProcessTaskFactory factory)
Sets the current post process task factory

Parameters:
factory - the new post-process task factory

initialize

public static void initialize()
Initializes the GUI parameters and resources. It takes GUI resources (custom panels, etc.) from classpath jars


initialize

public static void initialize(java.lang.String sFolder)
Initializes the GUI parameters and resources. It takes GUI resources (custom panels, etc.) from the specified folder

Parameters:
sFolder - the folder with jars with custom GUI resources

initialize

public static void initialize(java.net.URL[] jars)
Initializes the GUI parameters and resources. It takes GUI resources (custom panels, etc.) from the specified urls

Parameters:
jars - the urls of the jar files with custom GUI resources

getHelpPath

public static java.lang.String getHelpPath()
Returns the path to help files

Returns:
the path to help files

setHelpPath

public static void setHelpPath(java.lang.String sPath)
Sets the current path to help files

Parameters:
sPath - the path to help files

setOutputFolder

public static void setOutputFolder(java.lang.String sOutputFolder)
Sets the default folder for output data.

Parameters:
sOutputFolder - the default folder for output data.

getOutputFolder

public static java.lang.String getOutputFolder()
Returns the default folder for output data.

Returns:
the default folder for output data.

setDefaultNoDataValue

public static void setDefaultNoDataValue(java.lang.Double dDefaultNoDataValue)
Sets the default value to represent "No Data" (null) raster cells.

Parameters:
the - new "No Data" value.

getDefaultNoDataValue

public static java.lang.Double getDefaultNoDataValue()
Returns the default value to represent "No Data" (null) raster cells.

Returns:
the current "No Data" value.

getModelsFolder

public static java.lang.String getModelsFolder()
Returns the models folder. If not set, returns the default models folder, which is the help folder containing example models.

Returns:
the models folder

setModelsFolder

public static void setModelsFolder(java.lang.String sModelsFolder)
Sets the models folder

Parameters:
sModelsFolder - the new model folder

setWpsURLs

public static java.util.ArrayList<java.lang.String> setWpsURLs(java.util.ArrayList<java.lang.String> list)
Sets a new list of WPS URLs

Parameters:
list - the list of WPS URLs
Returns:
a list of URLs that could not be used from the passed one (are not correct or not available)

getWpsURLs

public static java.util.ArrayList<java.lang.String> getWpsURLs()
Returns a list of URLs with WPS processes

Returns:
a list of URLs with WPS Processes

saveSettings

public static void saveSettings()
Saves current settings to the config file


getConfigPath

public static java.lang.String getConfigPath()
Returns the config folder

Returns:
the config folder

getLastCommandOrigin

public static int getLastCommandOrigin()
Returns the type of the last element from which a command-line command was executed

Returns:
the type of the element from which a command-line command was executed. SextanteGUI.HISTORY if the last component was the history panel; SextanteGUI.COMMANDLINE if it was the regular SEXTANTE console

setLastCommandOrigin

public static void setLastCommandOrigin(int iLast)
Sets the type of the last element from which a command-line command was executed. This has to be called from any component that allows execution of command

Parameters:
iLast - one of the following constants: SextanteGUI.HISTORY if the last component was the history panel; SextanteGUI.COMMANDLINE if it was the regular SEXTANTE console

getLastCommandOriginParentDialog

public static javax.swing.JDialog getLastCommandOriginParentDialog()
Gets the dialog from which the last command--line command was executed. This will be used as the parent dialog for task monitors or message dialogs generated by the execution of that command.

Returns:
the dialog from which the last command--line command was executed

setLastCommandOriginParentDialog

public static void setLastCommandOriginParentDialog(javax.swing.JDialog parent)
Sets the dialog (if any) that contains the element from which the last command--line command was executed

Parameters:
parent - the dialog (if any) that contains the element from which the last command--line command was executed

isWPSActivated

public static boolean isWPSActivated()
returns true is the WPS client is enabled

Returns:
true if the WPS client is enabled

setIsWPSActivated

public static void setIsWPSActivated(boolean isWPSActivated)
Sets whether the WPS client is enabled or not

Parameters:
isWPSActivated - true if the WPS client is enabled

getShowOnlyActiveAlgorithms

public static boolean getShowOnlyActiveAlgorithms()
Returns true if only active algorithms (those that can be executed with the current data objects) should be shown in the toolbox

Returns:
true if only active algorithms (those that can be executed with the current data objects) should be shown in the toolbox

setShowOnlyActiveAlgorithms

public static void setShowOnlyActiveAlgorithms(boolean showOnlyActiveAlgorithms)
Sets whether only active algorithms (those that can be executed with the current data objects) should be shown in the toolbox

Parameters:
showOnlyActiveAlgorithms - must be true if only active algorithms (those that can be executed with the current data objects) should be shown in the toolbox

getModifyResultsNames

public static boolean getModifyResultsNames()
Returns true if names of output layers should be modified to avoid conflictive characters (), [], - .. etc

Returns:
Whether names of output layers should be modified to avoid conflictive characters

setModifyResultsNames

public static void setModifyResultsNames(boolean bModify)
Sets whether names of output layers should be modified to avoid conflictive characters

Parameters:
bModify - true if names of output layers should be modified to avoid conflictive characters

isGrass3DVMode

public static boolean isGrass3DVMode()
returns true if GRASS processes all vector input as 3D

Returns:
true if GRASS processes all vector input as 3D

setIsGrass3DVMode

public static void setIsGrass3DVMode(boolean isGrass3DVMode)
Sets whether GRASS processes all vector input as 3D

Parameters:
isGrass3DVMode - true if the WPS client is enabled

isGrassInPolylines

public static boolean isGrassInPolylines()
returns true if GRASS (v.in.ogr) will import polygons as polylines.

Returns:
true if GRASS (v.in.ogr) will import polygons as polylines.

setIsGrassInPolylines

public static void setIsGrassInPolylines(boolean isGrassInPolylines)
Sets whether GRASS (v.in.ogr) will import polygons as polylines.

Parameters:
isGrassInPolylines - true if GRASS (v.in.ogr) will import polygons as polylines.

isGrassLatLonMode

public static boolean isGrassLatLonMode()
returns true if GRASS processes data in lat/lon mode

Returns:
true if GRASS processes data in lat/lon mode

setIsGrassLatLonMode

public static void setIsGrassLatLonMode(boolean isGrassLatLonMode)
Sets whether GRASS processes data in lat/lon mode

Parameters:
isGrassLatLonMode - true if GRASS processes data in lat/lon mode

isGrassTempMapset

public static boolean isGrassTempMapset()
returns true if GRASS uses a temporary mapset for processing

Returns:
true if GRASS uses a temporary mapset for processing

setIsGrassTempMapset

public static void setIsGrassTempMapset(boolean isGrassTempMapset)
Sets whether GRASS should use a temporary mapset for processing

Parameters:
setIsGrassTempMapset - true if GRASS should use a temporary mapset for processing

setSettings

public static void setSettings(java.util.Map values)
Sets the whole set of settings. They are passed in a map, using the constants defined in SettingsConstants as keys.

Parameters:
values - the map with settings values.

modifyResultName

public static java.lang.String modifyResultName(java.lang.String sName)
Modifies the passed string, so it can be used as a safe data object name (without special characters)

Parameters:
sName - the name to modify
Returns:
the modified safe name (with no special characters)

getGrassFolder

public static java.lang.String getGrassFolder()
Returns the path where grass is installed

Returns:
the path where grass is installed

setGrassFolder

public static void setGrassFolder(java.lang.String grassFolder)
                           throws WrongGrassFolderException
Sets the path where GRASS is installed. Also checks for validity of GRASS binaries path specification.

Parameters:
grassFolder - the path where grass is installed
Throws:
WrongGrassFolderException

setGrassMapsetFolder

public static void setGrassMapsetFolder(java.lang.String grassMapsetFolder)
Sets the path path to the GRASS mapset where GRASS data processing will take place.

Parameters:
grassMapsetFolder - the path to the GRASS mapset (folder)

checkGrassMapsetFolder

public static void checkGrassMapsetFolder(java.lang.String grassMapsetFolder)
                                   throws WrongGrassMapsetFolderException
Checks whether the GRASS mapset folder is valid.

Parameters:
grassMapsetFolder - the path to the GRASS mapset (folder)
Throws:
WrongGrassMapsetFolderException

setGrassWinShell

public static int setGrassWinShell(java.lang.String grassWinShell)
                            throws WrongGrassWinShellException
Sets the path to the shell that handles GRASS scripts on Windows.

Parameters:
grassWinShell - the path including the shell .exe file.
Throws:
WrongGrassWinShellException

getGrassWinShell

public static java.lang.String getGrassWinShell()
Gets the path to the shell that handles GRASS scripts on Windows.


getGrassMapsetFolder

public static java.lang.String getGrassMapsetFolder()
Returns the grass mapset folder as set by the user. Returns a path to a folder in the system's temporary files location if user is working with temporary GRASS mapset.

Returns:
the current grass mapset folder

getGrassUserMapsetFolder

public static java.lang.String getGrassUserMapsetFolder()
Returns the grass mapset folder as set by the user (which may be empty). Never returns the name of the temporary mapset.

Returns:
the grass mapset folder set by the user.)

getUseInternalNames

public static boolean getUseInternalNames()
Returns whether output names should be substituted by internal output names, instead of using output descriptions

Returns:
whether output names should be substituted by internal output names

addCustomParametersPanel

public static void addCustomParametersPanel(java.lang.Class<?> alg,
                                            java.lang.Class<?> panel,
                                            java.lang.Class<?> modelerPanel)

getModelerParametersPanel

public static java.lang.Class getModelerParametersPanel(java.lang.Class alg)

getParametersPanel

public static java.lang.Class getParametersPanel(java.lang.Class alg)