1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
package tim.prune.function.browser;
import tim.prune.App;
import tim.prune.GenericFunction;
/**
* Function to show a webservice for the current area or point
*/
public class WebMapFunction extends GenericFunction
{
/** Service to call */
private final UrlGenerator.WebService _service;
/** Key for appearance in menu */
private final String _nameKey;
/**
* Constructor
* @param inApp app object
* @param inService web service to call
* @param inNameKey name key for function
*/
public WebMapFunction(App inApp, UrlGenerator.WebService inService,
String inNameKey)
{
super(inApp);
_service = inService;
_nameKey = inNameKey;
}
@Override
public String getNameKey() {
return _nameKey;
}
/**
* Do the function call
*/
@Override
public void begin()
{
String url = UrlGenerator.generateUrl(_service, _app.getTrackInfo());
if (url != null) {
BrowserLauncher.launchBrowser(url);
}
}
}
|