Tuesday, November 14, 2006

XML Extension Points ( Context Menus )


To follow up from last week on how to share reports. The same holds true for context menus. The explanation here about how to create the xml to create a menu action is the same. The method to add context menu is the same as reports. Although these menu actions are not (yet) on the exchange, the preferences can still point to any url, so the shared file could reside on a web server.


Also like with the reports there's also an api call to register context menus:


XMLBasedObjectAction.registerContextMenus(URL);


Even though the explaintion is the same and the way to add them is just like reports there are some new things in this area. The first and probably most useful is we have an XML Schema for what these context menus dialogs.xsd. I'll put up the xml schema for the other extension points and I'll be adding annotations to the schema but most of the things in it should be fairly easy to follow.





There are a few areas in this which changed for example now the prompts can be required and have validators for things like checking what the user has entered against the database charset. To make a prompt and have it checked the xml would look something like this:


<prompt required="true" validator="charset">

<label>Table Name</label> </prompt>


These validators must implement a very simple interface which is :




oracle.dbtools.raptor.controls.validators.IValidator

public boolean isValid(String conn,Object o);

public String getMessage();



Then the validator simply need be registered with a call to


ValidatorRegistry.registerValidator(name,class);


Currently the only other one shipping is "numeric" which checks the input to ensure it's a number.

No comments: