TWiki> Public Web>DpHipe>DpHipeComponents (revision 7)EditAttach

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 VariablesView, a SelectionEvent is sent around. The OutlineView is listening to such an event and it tries to find the appropriate component that can show the outline information of that variable.

An example:

Suppose you would like to create an outline for FineTime variables 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.

Source Code of Basic implementations

The ia_gui_apps contains some basic implementations for OutlineComponents:

Tip, idea If you have a sub-class of e.g. a product, you can also create a dedicated OutlineComponent for that sub-class, which will be picked up instead of the default ProductOutline.

Editor Area

The above showed an example of extending the outline view by adding a OutlineComponent. Similarly, you can contribute by developing a specific EditorComponent.

Editor components are editors (optionally read-only) of data contents of a specific variable that is selected within in the HIPE session.

Simple Example Code

/**
 * Editor component for MyType.
 */
public class MyTypeComponent extends AbstractVariableEditorComponent {

    public Icon getComponentIcon() {
	return ...;
    }

    @Override
    protected Class getVariableType() {
	return MyType.class;
    }

    @Override
    protected boolean makeEditorContent() {
        ...
    }
}

Source Code of Basic implementations

The ia_gui_apps contains some basic implementations for EditorComponents:

Your Explorer Implementation

You may have created an implementation of the former Explorer interface which is used by the dataset inspector (and is registered within that inspector).

If you do not expect that your explorer needs to talk to other parts within the HIPE application, you can simply extend the AbstractExplorerComponent class:

public class ArrayDataComponent extends AbstractExplorerComponent {
    private static final Icon ICON = ...

    public ArrayDataComponent() {
	super(ICON);
    }   
}

Edit | Attach | Watch | Print version | History: r23 | r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r7 - 2008-08-13 - JaimeSaiz
 
This site is powered by the TWiki collaboration platform Powered by Perl