cds.aladin
Class AladinPlugin
java.lang.Object
cds.aladin.AladinPlugin
- All Implemented Interfaces:
- java.lang.Runnable
public abstract class AladinPlugin
- extends java.lang.Object
- implements java.lang.Runnable
An Aladin plugin mechanism allows you to extend Aladin for you own purpose.
See
http://aladin.u-strasbg.fr/java/nph-aladin.pl?frame=plugins page for examples.
How create your Aladin plugin:
- Write your plugin by extending this abstract class. Notice that you can use your
own java package (instead of cds.aladin package), or no package definition at all.
REQUIRED : you must implement these 2 methods:
- String menu() => return your menu label
- void exec() => will be called by Aladin for executing your plugin
OPTIONAL : you can extend these methods:
- String author() => return the author list
- String version() => return the version number and/or version date
- String category() => return the plugin category (Image, Catalog, Overlays...)
- String url() => return an URL to a web site providing the source code, the new releases...
- String description() => return a short paragraph describing your plugin
- String scriptCommand() => return the command word for allowing script usage of your plugin
- String scriptHelp() => return the script help of your plugin (syntax specific)
-
- boolean inSeparatedThread() => return true if your plugin has to be executed in a separated thread (false by default)
- boolean isRunning() => => return true when the plugin is activated (see javadoc)
- void cleanup() => call by Aladin before it shuts down
- String execScriptCommand(String []param) => will be called by Aladin for executing
your plugin by script. By default calls process() without
parameter
- Put the corresponding YourPlugin.class file into the Aladin plugin directory
=> $HOME/.aladin/Plugins
- Restart Aladin and find your plugin into the Plugins menu.
Material for plugins:
- An Aladin plugin has a reference to the instance of Aladin session: called "aladin"
- An Aladin plugin can access directly to the Aladin stack data via a dedicated
class called AladinData (see the corresponding class javadoc)
These objects must be created by one of these 4 aladin methods
- aladin.getAladinData("planeLabel") => provides an AladinData associated to the specified plane
- aladin.getAladinData() => same for the first selected stack plane
- aladin.getAladinImage() => same for the background image
- aladin.createAladinData("planeLabel")=> create a new stack plane and return the associated AladinData
example:
AladinData ad = aladin.getAladinData("PlaneLabel");
double [] pixels = ad.getPixels();
....
- An Aladin plugin can know the Aladin stack plane labels via the dedicated
aladin method :
String [] labels = aladin.getAladinStack();
- An Aladin plugin can control Aladin via the VOApp interface implemented by Aladin
=> see documentation at http://aladin.u-strasbg.fr/java/FAQ.htx#VOApp
example:
aladin.execCommand("get Vizier(GSC1.2) m1");
aladin.execCommand("copy DSS2 CopyOfDSS2");
aladin.putVOTable(InputStream in,"label");
...
- An Aladin plugin can be registered itself as a VOObserver listener to be
called by Aladin when the user click somewhere
=> see documentation at http://aladin.u-strasbg.fr/java/FAQ.htx#VOObserver
ex: aladin.addVOObserver(this)
WARNING: Presently, the Aladin.createAladinData(String) can create Image plane only.
For creating Catalog or Graphical plane you can use VOapp interface
by passing a VOTable stream or executing some script commands.
- Version:
- 1.1 jan 2007 - creation
- Author:
- Pierre Fernique
Field Summary |
Aladin |
aladin
Aladin reference : automatically set when the plugin is loaded |
Method Summary |
java.lang.String |
author()
OPTIONAL: return the author list with or without their affiliations... |
java.lang.String |
category()
OPTIONAL: return the plugin category as a path (see examples). |
void |
cleanup()
OPTIONAL: Method called by Aladin when shutting down and when the user is stopping
manually the plugin
Override this method if you have to dispose a JFrame when your plugin is stopping. |
java.lang.String |
description()
OPTIONAL: return a short paragraph describing the plugin... |
abstract void |
exec()
Method called by Aladin when the user launchs the plugin |
java.lang.String |
execScriptCommand(java.lang.String[] param)
Optional: Method called by Aladin to execute the Plugin by script |
boolean |
inSeparatedThread()
Optional: return true if the plugin must be executed in a separated thread |
boolean |
isRunning()
Use by Aladin to know the plugin state. |
abstract java.lang.String |
menu()
Return the string identifying this plugin in the Aladin menu. |
void |
run()
Thread processing
DO NOT OVERIDE IT |
java.lang.String |
scriptCommand()
OPTIONAL: return the script command (1 word) for allowing the usage
of the plugin via script |
java.lang.String |
scriptHelp()
OPTIONAL: return the script help associated to the script plugin command
The syntax has to follow the Aladin help script syntax. |
void |
setAladin(Aladin aladin)
Use by Aladin to pass the reference to itself
DO NOT OVERIDE IT |
java.lang.String |
url()
OPTIONAL: return an URL allowing to access to the original site. |
java.lang.String |
version()
OPTIONAL: return the version number and/or version date... |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
aladin
public Aladin aladin
- Aladin reference : automatically set when the plugin is loaded
AladinPlugin
public AladinPlugin()
menu
public abstract java.lang.String menu()
- Return the string identifying this plugin in the Aladin menu.
This string will be used as the plugin identifier. So it has to be unique
If you want to insert this plugin in a sub-menu, use the category() method
exec
public abstract void exec()
throws AladinException
- Method called by Aladin when the user launchs the plugin
- Throws:
AladinException
author
public java.lang.String author()
- OPTIONAL: return the author list with or without their affiliations...
Ex : P.Fernique [CDS], T. Boch [CDS]
version
public java.lang.String version()
- OPTIONAL: return the version number and/or version date...
And the Aladin minimal version number
Example: v1.0 - 9 dec 2006 - Aladin v5.426
description
public java.lang.String description()
- OPTIONAL: return a short paragraph describing the plugin...
scriptCommand
public java.lang.String scriptCommand()
- OPTIONAL: return the script command (1 word) for allowing the usage
of the plugin via script
scriptHelp
public java.lang.String scriptHelp()
- OPTIONAL: return the script help associated to the script plugin command
The syntax has to follow the Aladin help script syntax. See the example below.
"#X:" : Field descriptor - "@cmd" : hyper-link to another command - not folded lines
Example: #n:rot - Image rotation <= name + short description
#s:rot [planeLabel] [angle] <= synopsys
#d:Image rotation using... <= full description
#e:rot Image1 35 <= example
#t:90 and 180° rotations are faster <= tip
#g:@create,@mview <= see also
category
public java.lang.String category()
- OPTIONAL: return the plugin category as a path (see examples). Used by Aladin
to build the menu and sub-menu according to this path.
Prefer the 1 level category.
1 level examples : Image , Catalog, Cube, Overlay, ...
2 level examples : Image/Astrometry, Catalog/Source extraction, ...
url
public java.lang.String url()
- OPTIONAL: return an URL allowing to access to the original site.
Generally used to download the source code and/or the new versions
Ex: http://aladin.u-strasbg.fr/java/Plugins/RotationImage.java
Ex: http://my.beautiful.site/myplugins/index.html
inSeparatedThread
public boolean inSeparatedThread()
- Optional: return true if the plugin must be executed in a separated thread
execScriptCommand
public java.lang.String execScriptCommand(java.lang.String[] param)
- Optional: Method called by Aladin to execute the Plugin by script
- Parameters:
param
- list of params
- Returns:
- "" if ok, otherwise an error message.
cleanup
public void cleanup()
- OPTIONAL: Method called by Aladin when shutting down and when the user is stopping
manually the plugin
Override this method if you have to dispose a JFrame when your plugin is stopping.
Override this method if your plugin needs to do some clean-up before Aladin shuts down,
eg disconnect from a PLASTIC hub
isRunning
public boolean isRunning()
- Use by Aladin to know the plugin state. Can be overided for plugins
not running in a separated thread (notably if they use their own window..)
- Returns:
- true if the plugin is active (or running for separated thread); false otherwise
setAladin
public void setAladin(Aladin aladin)
- Use by Aladin to pass the reference to itself
DO NOT OVERIDE IT
run
public void run()
- Thread processing
DO NOT OVERIDE IT
- Specified by:
run
in interface java.lang.Runnable
Copyright © 2009 UDS/CNRS