JavaTM Look and Feel Design Guidelines: Advanced Topics > Part I: General Topics > 4: Behavior > Filtering and Searching a Set of Objects   PreviousNextContents/Index/Search


Filtering and Searching a Set of Objects

When working with a large set of objects, users sometimes want to view only objects with particular properties. For example, a user of an email application might want to see only message headers representing unread messages. Searching and filtering are application features that let a user specify which objects a window should display, based on the user's criteria. A user's criteria are called a filter (in filtering) or a query (in searching).

Providing filtering and searching can improve an application's scalability.


NOTE ¯ Sorting a set of objects can be an easier way to provide most of the benefits of filtering the set. For information on sorting, see "Row Sorting" on page 86. In addition, see Chapter 12 of Java Look and Feel Design Guidelines, 2d ed.

You can provide two kinds of filtering and searching in your application:

Complex Filtering and Searching

When providing complex filtering or complex searching, follow these guidelines:

Provide a filter or query for a set of objects if users cannot view the entire set without scrolling it.

Unless your application takes less than 4 seconds to start displaying the complete results of a filter or search, display the results a portion at a time.

Provide an easy way for users to execute a query or filter again after new data becomes available.

Enable users to name, save, reuse, and modify custom filters and queries.

Enable users to construct a single request from multiple filter terms or multiple query terms.

If the data displayed in a window is the result of a filter or query, indicate that fact above the data. If possible, indicate which filter or query was used to obtain the data.

Simple Filtering and Searching

If users will use certain filters or queries repeatedly, provide quick access to those filters or queries through visible controls. Filters and queries accessible in this way are called simple filters and simple queries.

To enable users to choose simple filters, you can place menu items on the View menu or in a combo box, as in Figure 40.

Figure 40   Simple Filters

In Figure 40, the combo box includes the following items:

Filters can be more complex than the one in Figure 40. Figure 41 shows a more complex filter.

Figure 41   Complex Filter

A task analysis can help you determine both:

For references on task analysis, see "Related Books" on page 4.

Provide simple filters or simple queries if users need to refer to subsets of information repeatedly.

Stopping Searches and Filter Operations

Users sometimes need to stop a search or filter operation before it is complete--typically, because the operation is taking too long. Users should be able stop a search or filter operation at any time by clicking a command button that, typically, is labeled Stop, Stop Search, or Stop Filtering.

If a user stops a search or filter, your application should display a message stating that any displayed search results are incomplete.

Indicate a stopped search or filter by placing a message outside the results but near where they are described--for example, in the title area of a table. Figure 42 shows a stopped search indicated by a message ("Stopped by User") displayed above the results. (For more information, see "Letting Users Stop Commands in Progress" on page 111.)

Figure 42   Stopped Search (Indicated by Text Above the Results)  


Java Look and Feel Design Guidelines: Advanced Topics.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.
PreviousNextContents/Index/Search