Package org.hortonmachine.gui.utils
Class DefaultGuiBridgeImpl
- java.lang.Object
-
- org.hortonmachine.gui.utils.DefaultGuiBridgeImpl
-
- All Implemented Interfaces:
GuiBridgeHandler
public class DefaultGuiBridgeImpl extends Object implements GuiBridgeHandler
JGT implementation of theGuiBridgeHandler.- Author:
- Andrea Antonello (www.hydrologis.com)
-
-
Field Summary
-
Fields inherited from interface org.hortonmachine.gui.utils.GuiBridgeHandler
DEBUG_KEY, GEOPAPARAZZI_PREFERENCES_KEY, HEAP_KEY, LAST_GP_PROJECTS_PATH, SPATIAL_TOOLBOX_PREFERENCES_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultGuiBridgeImpl()DefaultGuiBridgeImpl(Component rootComponent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intconfirmDialog(String message, String title, int optionType, int messageType)HashMap<String,String>getGeopaparazziProjectViewerPreferencesMap()Get the map of user preferences.FilegetLibsFolder()Get the folder inside which the libraries to browse are contained.protected ComponentgetRootComponent()HashMap<String,String>getSpatialToolboxPreferencesMap()Get the map of user preferences.Point2DgetWorldPoint(int x, int y)Get the worldPoint2Dfrom and screen pixel x/y (ex.StringinputDialog(String message, String title)StringinputDialog(String message, String title, int messageType, String initialValue)voidmessageDialog(String message, String[] messageArgs, String title, int messageType)voidmessageDialog(String message, String title, int messageType)StringpromptForCrs()Open a dialog to prompt for a CRS.voidsetGeopaparazziProjectViewerPreferencesMap(HashMap<String,String> prefsMap)Save SpatialToolbox preferences map.voidsetLibsFolder(File libsFolder)voidsetSpatialToolboxPreferencesMap(HashMap<String,String> prefsMap)Save SpatialToolbox preferences map.File[]showChooserDialog(String title, int type, int selectionMode, boolean multiselection, File initialPath, FileFilter filter, boolean fileHidingEnabled)File[]showOpenDirectoryDialog(String title, File initialPath)Open a directory selection dialog.File[]showOpenFileDialog(String title, File initialPath, FileFilter filter)Open an open file dialog.File[]showSaveFileDialog(String title, File initialPath, FileFilter filter)Open a save file dialog.JFrameshowWindow(JComponent component, String windowTitle)Show aJComponentinside a window.booleansupportsMapContext()A check to see if this handler supports a map context.
-
-
-
Constructor Detail
-
DefaultGuiBridgeImpl
public DefaultGuiBridgeImpl()
-
DefaultGuiBridgeImpl
public DefaultGuiBridgeImpl(Component rootComponent)
-
-
Method Detail
-
getRootComponent
protected Component getRootComponent()
-
confirmDialog
public int confirmDialog(String message, String title, int optionType, int messageType)
-
inputDialog
public String inputDialog(String message, String title, int messageType, String initialValue)
-
messageDialog
public void messageDialog(String message, String title, int messageType)
- Specified by:
messageDialogin interfaceGuiBridgeHandler
-
messageDialog
public void messageDialog(String message, String[] messageArgs, String title, int messageType)
- Specified by:
messageDialogin interfaceGuiBridgeHandler
-
showChooserDialog
public File[] showChooserDialog(String title, int type, int selectionMode, boolean multiselection, File initialPath, FileFilter filter, boolean fileHidingEnabled)
-
showOpenDirectoryDialog
public File[] showOpenDirectoryDialog(String title, File initialPath)
Description copied from interface:GuiBridgeHandlerOpen a directory selection dialog.- Specified by:
showOpenDirectoryDialogin interfaceGuiBridgeHandler- Returns:
-
showOpenFileDialog
public File[] showOpenFileDialog(String title, File initialPath, FileFilter filter)
Description copied from interface:GuiBridgeHandlerOpen an open file dialog.- Specified by:
showOpenFileDialogin interfaceGuiBridgeHandler- Returns:
-
showSaveFileDialog
public File[] showSaveFileDialog(String title, File initialPath, FileFilter filter)
Description copied from interface:GuiBridgeHandlerOpen a save file dialog.- Specified by:
showSaveFileDialogin interfaceGuiBridgeHandler- Returns:
-
getWorldPoint
public Point2D getWorldPoint(int x, int y)
Description copied from interface:GuiBridgeHandlerGet the worldPoint2Dfrom and screen pixel x/y (ex. coming from a mouse event).- Specified by:
getWorldPointin interfaceGuiBridgeHandler- Parameters:
x- the screen X.y- the screen Y.- Returns:
- the world position or
null.
-
promptForCrs
public String promptForCrs()
Description copied from interface:GuiBridgeHandlerOpen a dialog to prompt for a CRS.- Specified by:
promptForCrsin interfaceGuiBridgeHandler- Returns:
- the selected epsg code or
null.
-
supportsMapContext
public boolean supportsMapContext()
Description copied from interface:GuiBridgeHandlerA check to see if this handler supports a map context.This also defines if conversion between screen and world coordinates and prompting for a crs are supported.
- Specified by:
supportsMapContextin interfaceGuiBridgeHandler- Returns:
trueif a mapcontext is supported.
-
getSpatialToolboxPreferencesMap
public HashMap<String,String> getSpatialToolboxPreferencesMap()
Description copied from interface:GuiBridgeHandlerGet the map of user preferences.- Specified by:
getSpatialToolboxPreferencesMapin interfaceGuiBridgeHandler- Returns:
- the
HashMapof preferences.
-
setSpatialToolboxPreferencesMap
public void setSpatialToolboxPreferencesMap(HashMap<String,String> prefsMap)
Description copied from interface:GuiBridgeHandlerSave SpatialToolbox preferences map.- Specified by:
setSpatialToolboxPreferencesMapin interfaceGuiBridgeHandler
-
getGeopaparazziProjectViewerPreferencesMap
public HashMap<String,String> getGeopaparazziProjectViewerPreferencesMap()
Description copied from interface:GuiBridgeHandlerGet the map of user preferences.- Specified by:
getGeopaparazziProjectViewerPreferencesMapin interfaceGuiBridgeHandler- Returns:
- the
HashMapof preferences.
-
setGeopaparazziProjectViewerPreferencesMap
public void setGeopaparazziProjectViewerPreferencesMap(HashMap<String,String> prefsMap)
Description copied from interface:GuiBridgeHandlerSave SpatialToolbox preferences map.- Specified by:
setGeopaparazziProjectViewerPreferencesMapin interfaceGuiBridgeHandler
-
setLibsFolder
public void setLibsFolder(File libsFolder)
- Specified by:
setLibsFolderin interfaceGuiBridgeHandler
-
getLibsFolder
public File getLibsFolder()
Description copied from interface:GuiBridgeHandlerGet the folder inside which the libraries to browse are contained.- Specified by:
getLibsFolderin interfaceGuiBridgeHandler- Returns:
- the file to the libraries folder.
-
showWindow
public JFrame showWindow(JComponent component, String windowTitle)
Description copied from interface:GuiBridgeHandlerShow aJComponentinside a window.- Specified by:
showWindowin interfaceGuiBridgeHandler- Parameters:
component- the component to show.
-
-