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;  *Beta API*
    public final static String SELECT_NEXT_ITEM;  *Beta API*
    public final static String SELECT_PREVIOUS_ITEM;  *Beta API*

    /* 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(); *Beta API*
    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(); *Beta API*
    public boolean isEnabled(); *Beta API*
    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); *Beta API*
    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); *Beta API*
    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

setPrototypeItem

  public void setPrototypeItem(ListItem item)
Sets the prototype ListItem used by the Popup's ListView.

prototypeItem

  public ListItem prototypeItem()
Returns the prototype ListItem used by the Popup's ListView.
See Also:
setPrototypeItem

removeAllItems

  public void removeAllItems()
Removes all ListItems from the Popup.

addItem

  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

removeItem

  public void removeItem(String title)
Removes the ListItem with title title from the Popup.

removeItemAt

  public void removeItemAt(int index) *Beta API* 
Removes the ListItem at index.

selectedIndex

  public int selectedIndex()
Returns the index of the Popup's selected row.

selectedItem

  public ListItem selectedItem()
Returns the Popup's selected ListItem.

selectItem

  public void selectItem(ListItem item)
Selects a particular Popup item. When inactive, the Popup displays the currently selected ListItem.

selectItemAt

  public void selectItemAt(int index)
Calls selectItem() using the ListItem at the given row.

count

  public int count()
Returns the number of ListItems the Popup contains.

itemAt

  public ListItem itemAt(int index)
Returns the ListItem at the given row index.

setBorder

  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.

border

  public Border border()
Returns the Popup's border.
See Also:
setBorder

setPopupList

  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.

popupList

  public ListView popupList()
Returns the Popup's ListView.
See Also:
setPopupList

setPopupWindow

  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.

popupWindow

  public Window popupWindow()
Returns the active Popup's Window.
See Also:
setPopupWindow

setPopupImage

  public void setPopupImage(Image anImage)
Sets the Image displayed by the selected ListItem.

popupImage

  public Image popupImage()
Returns the Image displayed by the selected ListItem.
See Also:
setPopupImage

layoutPopupWindow

  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.

showPopupWindow

  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.

mouseDown

  public boolean mouseDown(MouseEvent event)
Catches mouse events on the Popup's inactive "button". Calls layoutPopupWindow() followed by showPopupWindow().
Overrides:
mouseDown in class View

setEnabled

  public void setEnabled(boolean flag) *Beta API* 
Enables or disables the Popup.

isEnabled

  public boolean isEnabled() *Beta API* 
Returns true if the Popup is enabled, false otherwise.

isTransparent

  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

drawView

  public void drawView(Graphics g)
Draws the inactive Popup.
Overrides:
drawView in class View

setTarget

  public void setTarget(Target newTarget)
Sets the Popup's Target. The Popup sends its command to its Target when the currently selected ListItem changes.

target

  public Target target()
Returns the Popup's Target.
See Also:
setTarget

setCommand

  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.

command

  public String command()
Returns the Popup's command.
See Also:
setCommand

sendCommand

  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).

performCommand

  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.

minSize

  public Size minSize()
Returns the View's minimum size.
Overrides:
minSize in class View

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the Popup class' information.
Overrides:
describeClassInfo in class View
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Archives the Popup instance.
Overrides:
encode in class View
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Unarchives the Popup instance.
Overrides:
decode in class View
See Also:
decode

canBecomeSelectedView

  public boolean canBecomeSelectedView() *Beta API* 
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

ancestorWillRemoveFromViewHierarchy

  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

formElementText

  public String formElementText() *Beta API* 
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 Apr 1997