|
|
META TOPICPARENT |
name="DpHipe" |
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END --> | | | |
< < | 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 [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.dataset.gui.views.AbstractExplorerComponent][ia.dataset.gui.views.AbstractExplorerComponent]:
public class ArrayDataComponent extends AbstractExplorerComponent<ArrayData> {
private static final Icon ICON = ...
public ArrayDataComponent() {
super(ICON);
}
@Override
protected Class<ArrayData> getVariableType() {
return ArrayData.class;
}
}
That's it. Your explorer would be picked up for showing the values it is registered to manage (see next section).
| | Component Registry
Editor components need to be registered for telling the types they are interested in. This is to be done within your __init__.py : |
|
META TOPICPARENT |
name="DpHipe" |
| |
> > | <-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
<-- END OF ANALYTICS CODE --> | | <--
- Set TOPICTITLE = Adding components to existing views
--> | | <-- END OF COMMENT BOX CODE -->
| |
> > |
META FILEATTACHMENT |
attachment="GoogleAnalytics.txt" attr="h" comment="Script for Google Analytics" date="1350658047" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" stream="GoogleAnalytics.txt" user="Main.DavideRizzo" version="1" |
| |
META TOPICMOVED |
by="DavideRizzo" date="1272527900" from="Hcss.DpHipeComponents" to="Public.DpHipeComponents" |
|
|
META TOPICPARENT |
name="DpHipe" |
| | Outline View
| |
< < | Whenever the user selects a session variable in the [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.inspector.views.VariablesView][VariablesView]], a [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.gui.kernel.event.SelectionEvent][SelectionEvent]] is sent around.
The [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.inspector.views.OutlineView][OutlineView]] is listening to such event and it tries to find the appropriate component that can show the outline information of that variable. | > > | Whenever the user selects a session variable in the VariablesView, a SelectionEvent is sent around.
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: | |
< < |
- Implement the [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.gui.apps.views.outline.OutlineComponent][OutlineComponent]] interface by extending a javax.swing.JComponent
.
| > > | | | | |
< < | The recommended way of implementing [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.gui.apps.views.outline.OutlineComponent][OutlineComponent]] is by extending ObjectOutline, which provides a table with basic information about the variable. | > > | 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.
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. | |
Source Code of Basic implementations
| |
< < | Package herschel.ia.dataset.gui contains some basic implementations for OutlineComponents:
- ArrayDataOutline: a simple outline for any array data
- DatasetOutline: a simple outline for any dataset
- ProductOutline: a simple outline for any product
| > > | Package herschel.ia.dataset.gui contains some basic implementations for OutlineComponent objects: | |
-
__init__.py : how the above get registered
| |
< < | 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 . | > > | 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. | |
| |
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. | > > | 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 ): | > > | 1. Extend herschel.ia.gui.kernel.PreviewMaker. For example, for images (herschel.ia.gui.image.Image): | |
import herschel.ia.gui.image.Image;
| |
Source Code of Basic implementations
| |
< < | The herschel.ia.gui.apps package contains some basic implementations for EditorComponents:
- ListEditorComponent: a simple viewer of lists.
- DefaultFileEditorComponent: a simple viewer of a file.
| > > | The herschel.ia.gui.apps package contains some basic implementations for EditorComponent objects: | |
-
__init__.py : how the above get registered.
| |
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 ia.dataset.gui.views.AbstractExplorerComponent: | > > | If you do not expect that your explorer needs to talk to other parts within the HIPE application, you can simply extend [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.dataset.gui.views.AbstractExplorerComponent][ia.dataset.gui.views.AbstractExplorerComponent]: | |
public class ArrayDataComponent extends AbstractExplorerComponent<ArrayData> {
|
|
META TOPICPARENT |
name="DpHipe" |
| | Outline View
| |
< < | Whenever the user selects a session variable in the VariablesView, a SelectionEvent is sent around.
The OutlineView is listening to such event and it tries to find the appropriate component that can show the outline information of that variable. | > > | Whenever the user selects a session variable in the [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.inspector.views.VariablesView][VariablesView]], a [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.gui.kernel.event.SelectionEvent][SelectionEvent]] is sent around.
The [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.inspector.views.OutlineView][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: | |
< < | | > > |
- Implement the [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.gui.apps.views.outline.OutlineComponent][OutlineComponent]] interface by extending a javax.swing.JComponent
.
| | | |
< < | The recommended way of implementing OutlineComponent is by extending ObjectOutline, which provides a table with basic information about the variable. | > > | The recommended way of implementing [[http://herschel.esac.esa.int/hcss-doc-12.0/index.jsp#hcss_drm:herschel.ia.gui.apps.views.outline.OutlineComponent][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.
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. |
|
META TOPICPARENT |
name="DpHipe" |
|
META TOPICPARENT |
name="DpHipe" |
|
META TOPICPARENT |
name="DpHipe" |
| |
< < | Adding Components to existing Views | > > | <--
- Set TOPICTITLE = Adding components to existing views
-->
Did you spot something wrong or missing on this page? If you have an account on this TWiki, you can fix it yourself by editing the page. If you don't have an account, you can send a message to the Editorial Board to tell us about it. Thank you in advance!
Adding components to existing views | |
<-- summary --> | | | |
< < | <-- JorgoBakker --> | > > | Please add your comments!
| |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | | <-- summary -->
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. | |
< < | Hcss.Here we explain how you can contribute to the outline view and the editor area. | > > | Here we explain how you can contribute to the outline view and the editor area. | |
| | The above showed an example of extending the outline view by adding an 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. | |
< < | They are triggered by double-clicking on a variable, or through the open with menu. Editor components are opened in the editor area . | > > | They are triggered by double-clicking on a variable, or through the open with menu. Editor components are opened in the editor area. | |
The contract for editor components is: |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
| |
Source Code of Basic implementations
| |
< < | Module ia_dataset_gui contains some basic implementations for OutlineComponents: | > > | Package herschel.ia.dataset.gui contains some basic implementations for OutlineComponents:
- ArrayDataOutline: a simple outline for any array data
- DatasetOutline: a simple outline for any dataset
- ProductOutline: a simple outline for any product
- init.py: how the above get registered
| |
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 . | |
The above showed an example of extending the outline view by adding an 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. | > > | Editor components are editors (optionally read-only) of data contents of a specific variable that is selected within in the HIPE session. | | They are triggered by double-clicking on a variable, or through the open with menu. Editor components are opened in the editor area .
The contract for editor components is: | |
Source Code of Basic implementations
| |
< < | The ia_gui_apps contains some basic implementations for EditorComponents: | > > | The herschel.ia.gui.apps package contains some basic implementations for EditorComponents:
- ListEditorComponent: a simple viewer of lists.
- DefaultFileEditorComponent: a simple viewer of a file.
- init.py: how the above get registered.
| | | |
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 AbstractExplorerComponent : | > > | If you do not expect that your explorer needs to talk to other parts within the HIPE application, you can simply extend ia.dataset.gui.views.AbstractExplorerComponent: | |
public class ArrayDataComponent extends AbstractExplorerComponent<ArrayData> {
|
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
<-- JorgoBakker --> | |
> > | <--
--> | |
META TOPICMOVED |
by="DavideRizzo" date="1272527900" from="Hcss.DpHipeComponents" to="Public.DpHipeComponents" |
|
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | | <-- summary -->
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. | > > | Hcss.Here we explain how you can contribute to the outline view and the editor area. | |
| | | |
< < | | > > | | |
| | | |
< < | | > > | | |
--> | |
<-- JorgoBakker --> | |
> > |
META TOPICMOVED |
by="DavideRizzo" date="1272527900" from="Hcss.DpHipeComponents" to="Public.DpHipeComponents" |
|
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
Whenever the user selects a session variable in 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. | > > | 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: | | 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. | |
< < | 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
| |
Component Registry
| |
< < | 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
| |
Source Code of Basic implementations
| |
< < | The ia_gui_apps contains some basic implementations for OutlineComponents: | > > | Module ia_dataset_gui contains some basic implementations for OutlineComponents:
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 . | | | |
< < | 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"))
| |
|
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
| |
> > | | |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | | Some short-cuts | |
< < | | | | | | |
> > | | | | | 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. | > > | Whenever the user selects a session variable in 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. | | | |
< < | <-- If you follow the contract on outline components --> | > > | The contract for outline components is: | | | |
< < | | > > | | | | |
> > | 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. | | 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. | > > | In this example, we simply add an entry to the ObjectOutline with the contents of the FineTime. | |
| |
< < | public class FineTimeOutline extends JLabel implements OutlineComponent {
public boolean init(Selection selection, OutlineView view) {
VariableSelection var=(VariableSelection)selection;
setText(var.getValue().toString()); | > > | public class FineTimeOutline extends ObjectOutline { | | | |
< < | return true; | > > | @Override
protected Object[][] getExtraTableInfo() {
Object time = getSelection().getValue();
return new Object[][] { { "time", time.toString() } }; | | } | |
< < | | | }
| |
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. | > > | The above showed an example of extending the outline view by adding an 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.
They are triggered by double-clicking on a variable, or through the open with menu. Editor components are opened in the editor area . | | | |
< < | Editor components are editors (optionally read-only) of data contents of a specific variable that is selected within in the HIPE session. | > > | The contract for editor components is: | | | | Simple Example Code
| |
> > | import herschel.ia.gui.kernel.parts.AbstractVariableEditorComponent; | | /** | |
< < | * Editor component for MyType. | > > | * Editor component for SomeType. | | */ | |
< < | public class MyTypeComponent extends AbstractVariableEditorComponent { | > > | public class SomeEditorComponent extends AbstractVariableEditorComponent<SomeType> { | |
public Icon getComponentIcon() {
return ...;
}
@Override | |
< < | protected Class getVariableType() {
return MyType.class; | > > | protected Class<SomeType> getVariableType() {
return SomeType.class; | | }
@Override
protected boolean makeEditorContent() { | |
< < | ... | > > | String name = getKey();
SomeType value = getValue();
JComponent content = ...; // build the content with the provided value
add(content);
return true; | | }
}
| | The ia_gui_apps contains some basic implementations for EditorComponents: | |
< < | | > > | | | | |
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: | > > | If you do not expect that your explorer needs to talk to other parts within the HIPE application, you can simply extend AbstractExplorerComponent : | |
| |
< < | public class ArrayDataComponent extends AbstractExplorerComponent { | > > | public class ArrayDataComponent extends AbstractExplorerComponent<ArrayData> { | | private static final Icon ICON = ...
public ArrayDataComponent() {
super(ICON);
} | |
> > |
@Override
protected Class<ArrayData> getVariableType() {
return ArrayData.class;
} | | }
| |
> > |
That's it. Your explorer would be picked up for showing the values it is registered to manage (see next section).
Component Registry
Editor components need to be registered for telling the types they are interested in. This is to be done within your __init__.py :
# Register to the editor component factory
REGISTRY.register(COMPONENT,Extension(
"Some editor",
"herschel.your.module.views.SomeEditorComponent",
"factory.editor.variable",
"herschel.your.module.SomeType"))
| | |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views
<-- summary --> | |
< < | 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. | > > | 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. |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | | | |
> > | | | | |
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
| | Source Code of Basic implementations
The ia_gui_apps contains some basic implementations for EditorComponents: | |
< < | | > > | | |
| |
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 abstract AbstractExplorerComponent class: | > > | 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 {
|
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
| |
> > | <--
Some short-cuts
--> | | | |
> > | | | 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. | > > |
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. | |
<-- If you follow the contract on outline components --> | |
< < |
- 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. | > > | 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. | > > | 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 {
| |
Component Registry
| |
< < | The following snippet, could then go into your __init__.py : | > > | The following snippet, could then go into your __init__.py : | |
# Register to the variable outline factory
| | "herschel.share.fltdyn.time.FineTime"))
| |
< < | See also the Extension Registry documentation for more details. | > > | See also the Extension Registry documentation for more details.
| | | |
> > | Source Code of Basic implementations
The ia_gui_apps contains some basic implementations for OutlineComponents: | | | |
> > | 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 editor component.
Editor components are browsers or editors of data contents of a specific variable that is selected in the HIPE session. | > > | The above showed an example of extending the outline view by adding a OutlineComponent. Similarly, you can contribute by developing a specific EditorComponent. | | | |
< < |
- 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
| > > | Editor components are editors (optionally read-only) of data contents of a specific variable that is selected within in the HIPE session. | | | |
< < | TODO: Example | > > | | | | |
> > | Simple Example Code
| |
| |
< < | public interface EditorComponent { | > > | /**
* Editor component for MyType.
*/
public class MyTypeComponent extends AbstractVariableEditorComponent { | | | |
< < | boolean init(Selection selection, EditorPart editorPart);
boolean aboutToClose(); | > > | public Icon getComponentIcon() {
return ...;
} | | | |
< < | Icon getComponentIcon();
String getName();
Selection getSelection(); | > > | @Override
protected Class getVariableType() {
return MyType.class;
} | | | |
> > | @Override
protected boolean makeEditorContent() {
...
} | | }
\ No newline at end of file | |
> > |
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 abstract AbstractExplorerComponent class:
public class ArrayDataComponent extends AbstractExplorerComponent {
private static final Icon ICON = ...
public ArrayDataComponent() {
super(ICON);
}
}
<-- JorgoBakker --> |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
Editor components are browsers or editors of data contents of a specific variable that is selected in the HIPE session. | |
< < |
- Implement the
herschel.ia.core.EditorComponent interface by extending a javax.swing.JComponent
- Register your implementation to the
herschel.ia.core.ExtensionRegistry in the __init__.py
| > > |
- 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 |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views
<-- summary --> | |
< < | Certain views as well 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 by the user. | > > | 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. | |
| | The following snippet, could then go into your __init__.py :
| |
< < | # convenience short-cuts
from herschel.ia.core import ExtensionRegistry, Extension
FACTORY=ExtensionRegistry.FACTORY
COMPONENT=ExtensionRegistry.COMPONENT
REGISTRY=ExtensionRegistry.getInstance()
# Register to the variable outline factory | > > | # 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")) | |
< < | # clean-up
del(FACTORY,COMPONENT,REGISTRY) | | | |
> > | See also the Extension Registry documentation for more details. | | | |
< < | More information about the extension registry can be found in its Java API (herschel.ia.core.ExtensionRegistry ). | |
|
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
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.
<-- If you follow the contract on outline components --> | | 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.
| |
}
| |
> > | | |
Component Registry | |
> > | | | The following snippet, could then go into your __init__.py :
| |
More information about the extension registry can be found in its Java API (herschel.ia.core.ExtensionRegistry ). | |
> > | | | | |
> > | | |
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. | |
}
| |
> > | | | \ No newline at end of file |
|
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views | |
public class FineTimeOutline extends JLabel implements OutlineComponent {
| |
< < | public boolean setOutline(Selection selection, OutlineView view) { | > > | public boolean init(Selection selection, OutlineView view) { | | VariableSelection var=(VariableSelection)selection;
setText(var.getValue().toString()); | |
- Register your implementation to the
herschel.ia.core.ExtensionRegistry in the __init__.py
TODO: Example | |
> > |
public interface EditorComponent {
boolean init(Selection selection, EditorPart editorPart);
boolean aboutToClose();
Icon getComponentIcon();
String getName();
Selection getSelection();
}
|
|
> > |
META TOPICPARENT |
name="DpHipe" |
Adding Components to existing Views
<-- summary -->
Certain views as well 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 by the user.
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.
<-- If you follow the contract on outline components -->
- 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 setOutline(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 :
# convenience short-cuts
from herschel.ia.core import ExtensionRegistry, Extension
FACTORY=ExtensionRegistry.FACTORY
COMPONENT=ExtensionRegistry.COMPONENT
REGISTRY=ExtensionRegistry.getInstance()
# 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"))
# clean-up
del(FACTORY,COMPONENT,REGISTRY)
More information about the extension registry can be found in its Java API (herschel.ia.core.ExtensionRegistry ).
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.core.EditorComponent interface by extending a javax.swing.JComponent
- Register your implementation to the
herschel.ia.core.ExtensionRegistry in the __init__.py
TODO: Example |
|
|
|
|
|