wiki:ImplementAction

Implement Action

To implement a valid action you must subclass ProteiosAction, implement runMe() and finally(optionally) implement the ContextEnabled interface.

Subclass ProteiosAction

 public class MyAction extends ProteiosAction<MyAction> {...}

This is necessary for proteios to recognize the class as a valid action.

Implement runMe()

This is where you put your block of code that eg. displays a form, calculates something or whatever. Take a look at the example actions to see what you can do and how.

If you want to display something to the user, your action should end with the method call setLayout(layout), there are other ways but we'll not get into that now. Here is how you'd create and set an empty layout.

 RowLayout layout = getLayoutFactory().getRowLayout();
 // Here you would add GuiElements to the layout
 setLayout(layout);

Implement ContextEnabled Interface

If you need your action to be accessible from the gui you have to specify where a link should appear. You do this by implementing the interface ContextEnabled. Currently there are three context classes you can use, MenuContext, TableToolbarContext and FileContext. Here's an example that registers this action to show up as an extension link when browsing files.

 FileContext files = new FileContext("linkId", "Clickable label",
 ImportXFileForm.class);
 contexts.add(files);
 return contexts;
Last modified 13 years ago Last modified on Dec 1, 2008, 9:09:02 AM