Elastic Path Commerce Development

List Viewer

List Viewer

Overview

This component represents a list of items. It abstracts the usage of the more native Eclipse TableViewer and customizes the UI to look like a native list control. The main problem with the original Eclipse List control is that it cannot have images.

How to use it

It can be created either from IEpLayoutComposite or standalone using the EpControlFactory. The method names to be used are as follows:

IEpListViewer EpControlFactory.createListViewer(Composite parentComposite, String listLabel, boolean multiSelection, EpState epState)

or

IEpLayoutComposite.addListViewer(final String listLabel, final boolean multiSelection, final EpState epState, final IEpLayoutData data)

After creating an instance of the list viewer the content and label providers must be set using the respective setters on the interface. If the list is meant to be editable the org.eclipse.jface.viewers.EditingSupport implementation has to be applied too. Initializing the list viewer control is done by calling IEpListViewer.setInput(Object).

Example

The EP List viewer is mainly used in AbstractEpDualListBoxControl which is a dual list viewer part that has buttons in between the two list boxes. The buttons are used for adding elements from the left list box to the right and removing them vice versa.