Starting with Protege 3.2 beta (build 301 and higher), you can programmatically add your own configuration tab to the project configuration panel. (527)
The left picture shows the default project configuration panel. The right picture shows a user-defined tab added to the project configuration panel. (528)
To create your own configuration tab, you need to do the following steps: (52C)
- Create your own Java class by extending the edu.stanford.smi.protege.util.AbstractValidatableComponent. This class is JComponent and holds the tab that will be added to the project configuration panel. In the example from above, it is the "RegisteredConfigTab". (52D)
- Implement at least one of the default constructor or a constructor that takes a edu.stanford.smi.protege.model.Project as argument (52E)
- Implement the methods (52F)
public void saveContents() and the public boolean validateContents() (52J)
When the user presses the OK button of the configuration panel, the validateContents() method is called. If it returns true, then the saveContents() method is called and the dialog is closed. The dialog only closes if validateContents() returns true. (52K)
- If you want your tab to be added to the configuration panel, call the following method: (52T)
edu.stanford.smi.protege.ui.ConfigureProjectPanel.registerConfigureTab(String tabTitle, String clsName) (52U)
The arguments of the static method are: the tabTitle (in the example, "RegisteredConfigTab") and the name of the class extending the AbstractValidatableComponent and that holds your tab (for example, "config.MyConfigTab"). (52V)
To remove the tab from the project configuration panel, call: (52W)
ConfigureProjectPanel.unregisterConfigureTab(String tabName) (52X)
that has as argument the name of the tab you added before (for example, "RegisteredConfigTab"). (52Y)
Java Example (52Z)
This example is a project plugin that adds a menu "Config_Test" from which you can add or remove a user defined tab to the project configuration panel. See picture below. (530)
Download the example source code: http://protege.cim3.net/file/pub/files/PrjConfigTab/ProjectConfigTest_src.zip (533)
Download the example binaries (compiled for Protege 3.2 beta 301 and above): http://protege.cim3.net/file/pub/files/PrjConfigTab/ProjectConfigTest_bin.zip (531)