Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.ui.builders
Class ListBuilder<T>

java.lang.Object
  extended by oracle.javatools.ui.builders.BasicBuilder<T>
      extended by oracle.javatools.ui.builders.ListBuilder<T>


public final class ListBuilder<T>
extends BasicBuilder<T>

A class to simply and concisely build a list component which has many more abilities than a standard list.

Tell the builder the features you'd like the list to have, call build(), and the builder will take care of putting one together for you.

The builder takes care of ensuring that it conforms to UI standards, and does the common work of putting together things like creating a reorderable list, adding the scrollpane, and other commonly configured list settings.

T is the type of item in the list.


Nested Class Summary
static class ListBuilder.DefaultAction
          Built in actions that can be used to quickly create toolbar button actions

 

Nested classes/interfaces inherited from class oracle.javatools.ui.builders.BasicBuilder
BasicBuilder.Instructions

 

Field Summary

 

Fields inherited from class oracle.javatools.ui.builders.BasicBuilder
instructions

 

Constructor Summary
ListBuilder()
           

 

Method Summary
 BuiltList<T> build()
          Create and return the final concrete component that can be added to a component hierarchy.
protected  void buildToolbar(oracle.javatools.ui.builders.BuiltBasic builtBasic)
           
protected  BasicBuilder.Instructions createInstructions()
           
 void setActionsDefault(ListBuilder.DefaultAction defaultAction, java.awt.event.ActionListener listener)
          Add one of the DefaultActions to the toolbar and listen to it.
 void setIconFromMethod(java.lang.String methodName)
          Supply the name of a method on the type of element contained in the List, this method will be called to get the icon of the displayed element.
This will only be used if a renderer isn't set directly.
The method must have no parameters, do not include parenthesis.
 void setModel(java.util.List<? extends T> list)
          Set the initial contents of the JList from the contents of the given java.util.List.
 void setModel(T[] array)
          Set the initial contents of the JList from the contents of the given array.
 void setRenderer(javax.swing.ListCellRenderer renderer)
          Set the renderer used by the list.
 void setRenderUsingMethod(java.lang.String methodName)
          Uses reflection to render the items in the list, thus avoiding the need to create a specialized renderer
 void setReorderable(boolean reorderable)
          Allow the contents of the list to be reordered by the user.
 void setSelectionMode(int selectionMode)
          Set the selection mode of the list, by default the mode is single selection
 void setSortable(boolean sortable)
          Initially sort the list by using the natural ordering of the items in the list.
 void setSorter(java.util.Comparator<T> comparator)
          Initially sort the list by using the ordering of the items determined by the given comparator
Note: only DefaultListModels, SimpleListModels, and models supplied as arrays or lists will obey this ability currently.
 void setVisibleRows(int visibleRows)
          Set the preferred number of visible rows

 

Methods inherited from class oracle.javatools.ui.builders.BasicBuilder
setActions, setActionsSecondary, setActionsSecondary, setCheckable, setDoubleClickListener, setEmptyText, setEmptyTextLarge, setLabel, setResizable, setRollover, setSelection, setSelectionEnabledAction, setSelectionEnabledComponent, setTitlebar, setToolbarComponents

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

ListBuilder

public ListBuilder()

Method Detail

createInstructions

protected BasicBuilder.Instructions createInstructions()
Specified by:
createInstructions in class BasicBuilder<T>

setModel

public void setModel(T[] array)
Set the initial contents of the JList from the contents of the given array. The given list is not manipulated except to seed the initial contents. An array whose contents match the onscreen JList can be retrieved from BuiltList.getValues().toArray(T[])
Parameters:
array - the array to display in the list

setModel

public void setModel(java.util.List<? extends T> list)
Set the initial contents of the JList from the contents of the given java.util.List. The given list is not manipulated except to seed the initial contents. A List whose contents match the onscreen JList can be retrieved from BuiltList.getValues()
Parameters:
list - the java.util.List to display in the list

setVisibleRows

public void setVisibleRows(int visibleRows)
Set the preferred number of visible rows
Parameters:
visibleRows - the number of visible rows

setReorderable

public void setReorderable(boolean reorderable)
Allow the contents of the list to be reordered by the user.
If the ListBuilder model is set via a call to model(ListModel) then a call to this method is ignored and the reordering will be determined by whether the list model implements ReorderableListModel
Parameters:
reorderable -

setSorter

public void setSorter(java.util.Comparator<T> comparator)
Initially sort the list by using the ordering of the items determined by the given comparator
Note: only DefaultListModels, SimpleListModels, and models supplied as arrays or lists will obey this ability currently.
Parameters:
comparator - the object used to determine sort order

setSortable

public void setSortable(boolean sortable)
Initially sort the list by using the natural ordering of the items in the list.
Note: only DefaultListModels, SimpleListModels, and models supplied as arrays or lists will obey this ability currently.
Parameters:
sortable -

setRenderer

public void setRenderer(javax.swing.ListCellRenderer renderer)
Set the renderer used by the list.
Parameters:
renderer -

setRenderUsingMethod

public void setRenderUsingMethod(java.lang.String methodName)

Uses reflection to render the items in the list, thus avoiding the need to create a specialized renderer

e.g. If the ListBuilder is building a list of Locale objects, calling this method with 'getDisplayLanguage' will display the Locale items as languages.

This will only be used if a renderer isn't set directly.

The method must have no parameters, do not include parenthesis.

Parameters:
methodName - a method from the type of the ListModel element.

setActionsDefault

public void setActionsDefault(ListBuilder.DefaultAction defaultAction,
                              java.awt.event.ActionListener listener)
Add one of the DefaultActions to the toolbar and listen to it. The listener will receive an action event with its command equal to the appropriate DefaultAction.toString()
Parameters:
defaultAction -
listener - a listener to be called when the action is performed

setIconFromMethod

public void setIconFromMethod(java.lang.String methodName)
Supply the name of a method on the type of element contained in the List, this method will be called to get the icon of the displayed element.
This will only be used if a renderer isn't set directly.
The method must have no parameters, do not include parenthesis.
Parameters:
methodName - a method from the type of the ListModel element.

setSelectionMode

public void setSelectionMode(int selectionMode)
Set the selection mode of the list, by default the mode is single selection
Parameters:
selectionMode - a ListSelectionModel constant

build

public BuiltList<T> build()
Create and return the final concrete component that can be added to a component hierarchy.
Returns:
a BuiltList configured to the specification of previous calls to this builder.

buildToolbar

protected void buildToolbar(oracle.javatools.ui.builders.BuiltBasic builtBasic)
Overrides:
buildToolbar in class BasicBuilder<T>

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


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