Class Popup
All Packages Class Hierarchy This Package Previous Next Index
Class Popup
public class netscape.application.Popup
extends netscape.application.View
implements netscape.application.Target,
netscape.application.FormElement
{
/* Fields
*/
public final static String POPUP;
public final static String SELECT_NEXT_ITEM;
public final static String SELECT_PREVIOUS_ITEM;
/* Constructors
*/
public Popup();
public Popup(Rect);
public Popup(int, int, int, int);
/* Methods
*/
public ListItem addItem(String, String);
protected void ancestorWillRemoveFromViewHierarchy(View);
public Border border();
public boolean canBecomeSelectedView();
public String command();
public int count();
public void decode(Decoder);
public void describeClassInfo(ClassInfo);
public void drawView(Graphics);
public void encode(Encoder);
public String formElementText();
public boolean isEnabled();
public boolean isTransparent();
public ListItem itemAt(int);
protected void layoutPopupWindow();
public Size minSize();
public boolean mouseDown(MouseEvent);
public void performCommand(String, Object);
public Image popupImage();
public ListView popupList();
public Window popupWindow();
public ListItem prototypeItem();
public void removeAllItems();
public void removeItem(String);
public void removeItemAt(int);
public void selectItem(ListItem);
public void selectItemAt(int);
public int selectedIndex();
public ListItem selectedItem();
public void sendCommand();
public void setBorder(Border);
public void setCommand(String);
public void setEnabled(boolean);
public void setPopupImage(Image);
public void setPopupList(ListView);
public void setPopupWindow(Window);
public void setPrototypeItem(ListItem);
public void setTarget(Target);
protected void showPopupWindow(MouseEvent);
public Target target();
}
View subclass that, when clicked, pops up a window containing a ListView
of PopupItems. When the user selects a PopupItem, the Popup sends the
PopupItem's command to the Popup's target. By default, the Popup creates
and displays PopupItems, but you can create and use your own ListItem
subclass.
- See Also:
- PopupItem, ListView
Fields
SELECT_NEXT_ITEM
public final static String SELECT_NEXT_ITEM
- Cause the popup to select the next available item.
SELECT_PREVIOUS_ITEM
public final static String SELECT_PREVIOUS_ITEM
- Cause the popup to select the previous available item.
POPUP
public final static String POPUP
- Cause the popup to popup, displaying all the available choices.
Constructors
.Popup
public Popup()
- Constructs an empty Popup.
.Popup
public Popup(Rect rect)
- Constructs an empty Popup with bounds rect. This Rect
defines the bounds of the inactive (not popped-up) Popup. When active,
the Popup grows vertically to fully display its items.
.Popup
public Popup(int x,
int y,
int width,
int height)
- Constructs an empty Popup with the given bounds. This rectangle
defines the bounds of the inactive (not popped-up) Popup. When active,
the Popup grows vertically to fully display its items.
Methods
public void setPrototypeItem(ListItem item)
- Sets the prototype ListItem used by the Popup's ListView.
public ListItem prototypeItem()
- Returns the prototype ListItem used by the Popup's ListView.
- See Also:
- setPrototypeItem
public void removeAllItems()
- Removes all ListItems from the Popup.
public ListItem addItem(String title,
String command)
- Adds a ListItem with the given title and command to the Popup. Calls
addItem() on the Popup's ListView.
- See Also:
- addItem
public void removeItem(String title)
- Removes the ListItem with title title from the Popup.
public void removeItemAt(int index)
- Removes the ListItem at index.
public int selectedIndex()
- Returns the index of the Popup's selected row.
public ListItem selectedItem()
- Returns the Popup's selected ListItem.
public void selectItem(ListItem item)
- Selects a particular Popup item. When inactive, the Popup displays
the currently selected ListItem.
public void selectItemAt(int index)
- Calls selectItem() using the ListItem at the given row.
public int count()
- Returns the number of ListItems the Popup contains.
public ListItem itemAt(int index)
- Returns the ListItem at the given row index.
public void setBorder(Border aBorder)
- Sets the Popup's Border. The Popup draws this Border around its
smaller inactive state and around its window when active. You can
customize a Popup's look by setting a different Border.
public Border border()
- Returns the Popup's border.
- See Also:
- setBorder
public void setPopupList(ListView list)
- Sets the ListView the Popup should use to maintain its ListItems.
You can customize a Popup's look by providing a custom ListView.
public ListView popupList()
- Returns the Popup's ListView.
- See Also:
- setPopupList
public void setPopupWindow(Window window)
- Sets the Window used to contain the active Popup. You can change the
active Popup's appearance by providing a custom Window.
public Window popupWindow()
- Returns the active Popup's Window.
- See Also:
- setPopupWindow
public void setPopupImage(Image anImage)
- Sets the Image displayed by the selected ListItem.
public Image popupImage()
- Returns the Image displayed by the selected ListItem.
- See Also:
- setPopupImage
protected void layoutPopupWindow()
- Sizes and positions the Popup's Window to accomodate its ListItems, and
positions the Popup's ListView within its Window. Popup calls this
method before bringing its Window onscreen.
protected void showPopupWindow(MouseEvent event)
- Brings the Popup's Window onscreen. Popup calls this method after
calling layoutPopupWindow(), in response to a mouse down event
on the Popup's inactive state. This method actually pops up the Popup.
public boolean mouseDown(MouseEvent event)
- Catches mouse events on the Popup's inactive "button". Calls
layoutPopupWindow() followed by showPopupWindow().
- Overrides:
- mouseDown in class View
public void setEnabled(boolean flag)
- Enables or disables the Popup.
public boolean isEnabled()
- Returns true if the Popup is enabled, false otherwise.
public boolean isTransparent()
- Returns true if the Popup is transparent. A Popup is
transparent if its ListView is transparent.
- Overrides:
- isTransparent in class View
- See Also:
- popupList
public void drawView(Graphics g)
- Draws the inactive Popup.
- Overrides:
- drawView in class View
public void setTarget(Target newTarget)
- Sets the Popup's Target. The Popup sends its command to its Target when
the currently selected ListItem changes.
public Target target()
- Returns the Popup's Target.
- See Also:
- setTarget
public void setCommand(String newCommand)
- Sets the Popup's command. The Popup sends this command to its Target
if the selected ListItem does not have a command.
public String command()
- Returns the Popup's command.
- See Also:
- setCommand
public void sendCommand()
- Sends a command to the Popup's Target. This command is either the
selected ListItem's command, or the Popup's command (if the ListItem
has no command).
public void performCommand(String command,
Object data)
- Responds to a message from its ListView that the user has selected a
different ListItem. Calls sendCommand() and hides the
Popup Window.
public Size minSize()
- Returns the View's minimum size.
- Overrides:
- minSize in class View
public void describeClassInfo(ClassInfo info)
- Describes the Popup class' information.
- Overrides:
- describeClassInfo in class View
- See Also:
- describeClassInfo
public void encode(Encoder encoder) throws CodingException
- Archives the Popup instance.
- Overrides:
- encode in class View
- See Also:
- encode
public void decode(Decoder decoder) throws CodingException
- Unarchives the Popup instance.
- Overrides:
- decode in class View
- See Also:
- decode
public boolean canBecomeSelectedView()
- Return whether this view can become the selected view
when the user is moving from view to views with the keyboard
Popup's implementation returns true
- Overrides:
- canBecomeSelectedView in class View
protected void ancestorWillRemoveFromViewHierarchy(View view)
- Called when the View or one of its ancestors has been removed from
the Application's View hierarchy.
- Overrides:
- ancestorWillRemoveFromViewHierarchy in class View
public String formElementText()
- Implementation of the FormElement interface
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997