Difference: DpHipeComponents (10 vs. 11)

Revision 112010-01-11 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Adding Components to existing Views

Line: 38 to 38
 

Whenever the user selects a session variable in the VariablesView, a SelectionEvent is sent around.

Changed:
<
<
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.
>
>
The OutlineView is listening to such event and it tries to find the appropriate component that can show the outline information of that variable.
  The contract for outline components is:
Line: 48 to 48
 The recommended way of implementing OutlineComponent is by extending ObjectOutline, which provides a table with basic information about the variable.
Methods getExtraTableInfo() and getExtraComponent() may be overriden as needed for providing extra information about your type.
Changed:
<
<
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.

>
>
For example, suppose you want to create an outline for FineTime variables to show their contents in the outline view whenever a session variable of that type is selected by the user.
 

Component Implementation

Line: 71 to 69
 

Component Registry

Changed:
<
<
The following snippet, could then go into your __init__.py:
>
>
The following snippet would go into your __init__.py:
 
# Register to the variable outline factory

Line: 88 to 86
 

Source Code of Basic implementations

Changed:
<
<
The ia_gui_apps contains some basic implementations for OutlineComponents:
>
>
Module ia_dataset_gui 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.

 
Changed:
<
<
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.
>
>

FITS Preview Outline

A special kind of outline is devoted to show previews of FITS files (for images, cubes, spectra...).

This is managed by FitsFileOutline, which reads the product contained in the FITS file in the background, and shows an image preview for it when done.

For this to work properly, any type that is meaningful to produce a preview should:

1. Extend herschel.ia.gui.kernel.PreviewMaker. For example, for images (herschel.ia.gui.image.Image):

import herschel.ia.gui.image.Image;

public class ImagePreviewMaker extends PreviewMaker<Image> {

    // PreviewFactory needs that every preview maker provides a default public constructor
    public ImagePreviewMaker() {
	super(Image.class);
    }

    // Either override this method
    @Override public java.awt.Image makeImage(Object o) {
	if (!(o instanceof Image)) return null;
	Image image = (Image)o;
        // create a Java image from the dataset image object
    }

    // or this one, by returning a visible component that will be used for drawing the image
    @Override protected java.awt.Component makeComponent(Image image) {
        // create a Java component from the dataset image
    }
}
2. Register the preview maker in the corresponding __init__.py:
from herschel.ia.gui.kernel import ExtensionRegistry, Extension, PreviewFactory

REGISTRY.register(PreviewFactory.ID, Extension(
                  "Image preview maker",
                  "herschel.ia.gui.image.ImagePreviewMaker",
                  None,   # unused
                  "herschel.ia.dataset.image.Image"))
 
 
This site is powered by the TWiki collaboration platform Powered by Perl