Adding Components to existing Views
the contents of certain views can be extended by developers, such as the
Outline View and the
Editor Area. Both are examples of the system reacting on a data selection made by the user.
Here we explain how you can contribute to the outline view and the editor area.
Outline View
Whenever the user selects a session variable e.g. the Variables View, a SelectionEvent
is sent around. The Outline View is listening to such an event and it tries to find the appropriate component that can show the outline information of that variable.
- Implement the
herschel.ia.gui.views.OutlineComponent
interface by extending a javax.swing.JComponent
- Register your implementation to the
herschel.ia.core.ExtensionRegistry
in the __init__.py
An example:
Suppose you would like to create an outline for herschel.share.fltdyn.time.FineTime
and you would like to show the contents in the outline view whenever a session variable of that type is selected by the user.
Component Implementation
In this example, we simply use a javax.swing.JLabel
and write the contents of the FineTime
object into the text of that label.
public class FineTimeOutline extends JLabel implements OutlineComponent {
public boolean init(Selection selection, OutlineView view) {
VariableSelection var=(VariableSelection)selection;
setText(var.getValue().toString());
return true;
}
}
Component Registry
The following snippet, could then go into your __init__.py
:
# Register to the variable outline factory
REGISTRY.register(COMPONENT,Extension(
"My FineTime Outline",
"resides.in.java.package.FineTimeOutline",
"factory.outline.variable",
"herschel.share.fltdyn.time.FineTime"))
See also the Extension Registry documentation for more details.
Editor Area
The above showed an example of extending the outline view by adding a OutlineComponent
. Similarly, you can contribute by developing a specific editor component.
Editor components are browsers or editors of data contents of a specific variable that is selected in the HIPE session.
- Implement the
herschel.ia.kernel.EditorComponent
interface by extending a javax.swing.JComponent
- Register your implementation to the
herschel.ia.kernel.ExtensionRegistry
in the __init__.py
TODO: Example
public interface EditorComponent {
boolean init(Selection selection, EditorPart editorPart);
boolean aboutToClose();
Icon getComponentIcon();
String getName();
Selection getSelection();
}