|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CommandItemProvider
Provides a field's command items. Command items are provided in a Vector
of CommandItem
elements in order of importance.
Invoke Field.setCommandItemProvider()
to configure a field as a
CommandItemProvider
.
In the following code sample, the command item only provides a single command.
This command item provider would be associated with a field by invoking Field.setCommandItemProvider()
.
See DefaultContextMenuProvider
for an example of this.
See the Command Framework API
for more information about commands and how you can use the framework to
register commands across applications.
class ItemProvider implements CommandItemProvider { public Object getContext(Field field) { return field; } public Vector getItems(Field field) { Vector items = new Vector(); CommandItem defaultCmd = new CommandItem(new StringProvider("My Menu Item"), null, new Command(new DialogCommandHandler())); items.addElement(defaultCmd); return items; } } class DialogCommandHandler extends CommandHandler { public void execute(ReadOnlyCommandMetadata metadata, Object context) { Dialog.alert("Executing command for " + context.toString()); } }
Method Summary | ||
---|---|---|
Object |
getContext(Field field)
Provides a context. |
|
Vector |
getItems(Field field)
Provides command items. |
Method Detail |
---|
Object getContext(Field field)
field
- The field providing the context.
Vector getItems(Field field)
field
- The field providing the command items.
CommandItem
s in order of importance. The most important item becomes the default in the pop-up menu.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.