If you would like your trace processor or seismic generator to utilize the property sheet within the Seismic Workbench there are a couple of small modifications that you must make to your processor or generator.
The first step is a fairly simple step. We need to create an array of objects and return it. This array of objects is what is searched by NetBeans when we do a lookup. The following is a simple example taken from the Random Volume seismic generator:
protected Object[] getLookupObjects() {
ArrayList<Object> list = new ArrayList<Object>();
IMemento memento = this.getLookupMemento();
list.add(memento);
return list.toArray();
}
This method creates a List of Objects, fills the array with the IMemento object that contains our properties, and then returns the list as an array. The creation and filling of the IMemento object is discussed in the next section.
The first step is to create the IMemento object. This is accomplished by the following two lines of code:
Collection<? extends IMementoFactory> factories = Lookup.getDefault().lookupAll(IMementoFactory.class);
IMemento processorMemento = factories.iterator().next().createMemento("SeismicGenerator");
You are free to change the name SeismicGenerator to whatever you wish, this is only a placeholder.
The next step is to fill the IMemento object with all of the values that your generator or processor requires. This is accomplished by creating a child for each property that your class needs input for.
IMemento nameOfProperty = processorMemento.createChild("IntegerProperty");
IntegerProperty is the type of property that this child is referring to. The following are the valid property types for the Seismic Workbench:
These names replace IntegerProperty in the child creation line depending on what type of property you require. They must be placed as the name of the child exactly as they are spelled above.
All of these properties require a set of four different arguments.
Additionally, ComboProperties require a list of items that will be the drop down list displayed to the user. These are done by adding a child to the ComboProperty called ListElement. ListElements have two different arguments.
The following code is an example on how to build your IMemento from INTViewer's AGC trace processor.
private IMemento getLookupMemento() {
Collection<? extends IMementoFactory> factories = Lookup.getDefault().lookupAll(IMementoFactory.class);
IMemento processorMemento = factories.iterator().next().createMemento("Properties");
IMemento measurementMemento = processorMemento.createChild("ComboProperty");
measurementMemento.putString("name", "Measurement Unit");
measurementMemento.putString("mementoName", "measurementUnit");
measurementMemento.putString("required", "true");
measurementMemento.putString("default", Integer.toString(SeismicProperties.AGC_SAMPLE));
IMemento sampleMemento = measurementMemento.createChild("ListElement");
sampleMemento.putString("text", "Samples");
sampleMemento.putString("value", Integer.toString(SeismicProperties.AGC_SAMPLE));
IMemento timeMemento = measurementMemento.createChild("ListElement");
timeMemento.putString("text", "Seconds");
timeMemento.putString("value", Integer.toString(SeismicProperties.AGC_TIME));
IMemento windowMemento = processorMemento.createChild("FloatProperty");
windowMemento.putString("name", "Window Length");
windowMemento.putString("mementoName", "windowLength");
windowMemento.putString("required", "true");
windowMemento.putString("default", Float.toString(250));
return processorMemento;
}