View on GitHub

EMU-guide

Guide to EMU, a Micro-Manager plugin to load easily reconfigurable user interfaces.

ConfigurablePanel

It is important to plan some aspects of a ConfigurablePanel before starting building it. Here are few points worth considering:

ConfigurablePanel methods

A ConfigurablePanel must implements few methods, which are shown empty in the following example:

import de.embl.rieslab.emu.ui.ConfigurablePanel;

public class MyPanel extends ConfigurablePanel {

	//////////////////////// Constructor 
	public MyPanel(String label) {
		super(label);
		
		// Add JComponents here 
        // (see Swing tutorials online or use drag and drop software) 
 	}

	//////////////////////// UIProperties 

	@Override
	protected void initializeProperties() {
        // Add the UIProperties here
	}

	@Override
	protected void propertyhasChanged(String propertyName, String newvalue) {
        // What happens when the UIProperty propertyName change?
	}
	
	@Override
	protected void addComponentListeners() {
        // Here add the JComponent listeners to react to user interactions
	}
	
	//////////////////////// InternalProperties 
	
	@Override
	protected void initializeInternalProperties() {
        // Add the InternalProperties here
	}

	@Override
	public void internalpropertyhasChanged(String propertyName) {
        // What happens when the InternalProperty propertyName change?
	}
	
	//////////////////////// UIParameters 

	@Override
	protected void initializeParameters() {
        // Add the UIParameters here
	}

	@Override
	protected void parameterhasChanged(String parameterName) {
        // What happens when the UIParameter parameterName change?
	}

	//////////////////////// Others 
	
	@Override
	public String getDescription() {
        // Change the description to something informative about the panel
		return "Description";
	}

	@Override
	public void shutDown() {
        // Here stops running threads created within the panel
	}
}

All components (JComponents) should be declared and added in the constructor. Then, the methods are called in a particular order:

  1. super-constructor()
  2. initializeProperties()
  3. initializeParameters()
  4. initializeInternalProperties()
  5. rest of the constructor() (instantiation of the JComponents)

Finally, upon configuration (at the start-up of EMU):

  1. propertyhasChanged(…) looped call on all UIProperties
  2. parameterhasChanged(…) looped call on all UIParameters
  3. addComponentListeners(…), which allows using the UIParameter’s values

The following sections dive into the different objects declared by a ConfigurablePanel:

  1. UIProperty
  2. SwingUIListeners
  3. UIParameter
  4. InternalProperty

In particular, you will find examples on how to implement the different methods of a ConfigurablePanel.

Roadmap

Example

Back to the programming guide

Back to the main menu