tell me more icon Writing Methods

The first method you will write is a getter method for returning a List of javax.faces.model.SelectItem instances. This is for populating a listbox component, which you will add in the next card. To write the method, first declare a property of type List<SelectItem>, then use a set of add(new SelectItem("some value", "some label")) statements to create the list.

The second method you will write is a drop event listener method. A drop event listener method takes a DropEvent event as a parameter and returns For example:

public DnDAction handleDrop(DropEvent dropEvent) {
  // handle drop event here

The drop event listener method must determine whether the drop event is accepted or rejected, and return an appropriate DndAction. If accepted, valid values must be one or more NMTOKENS from the set of COPY, MOVE, LINK (in any order). If rejected, DndAction.NONE should be returned.

In the drop method logic, retrieve the dropped value and use the dropped value as the value and label for a new select item to add to the SelectItem list. See the Javadoc for and for details about retrieving data from a transferable object from a drop event.

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,