Defining Panel for an Element
Each element in the configuration file is associated to a panel for editing the attributes for that element. The mapping of the element to panel is done in the element_panels.properties file that can be found in the resources sub-directory. The key is the name of the element and the value is the fully qualified name of the panel.
Properties Example
accurev=net.sourceforge.cruisecontrol.gui.panels.AccurevPanel
Element panels are in the net.sourceforge.cruisecontrol.ui.panels package.The easiest way to create a panel is to subclass net.sourceforge.cruisecontrol.gui.panels.common.BaseElementPanel. Then override the addComponents() method, add a field using the addFieldFor() method for each attribute of the element.
Panel Example
package net.sourceforge.cruisecontrol.gui.panels; import net.sourceforge.cruisecontrol.gui.panels.common.BaseElementPanel; /** * @author alwick */ public class AccurevPanel extends BaseElementPanel implements EditorPanel { public void addComponents() { super.addComponents(); addFieldFor( "stream", "Accurev Stream", TEXT_FIELD_TYPE ); addFieldFor( "verbose", "Verbose", CHECKBOX_FIELD_TYPE ); } public String getTitle() { return "Accurev Element"; } }
Compound Panels
Compound panels are used for elements that have sub-elements. These panels may also include other element panels as well as list of sub-elements.