1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * ident        "%Z%%M% %I%     %E% SMI"
  24  *
  25  * Copyright (c) 1998-1999 by Sun Microsystems, Inc.
  26  * All rights reserved.
  27  */
  28 package com.sun.dhcpmgr.ui;
  29 
  30 import java.util.Enumeration;
  31 import java.awt.Component;
  32 
  33 /**
  34  * View is the interface implemented by objects which wish to appear as tabs in
  35  * the main window.  Each View is given a tab in the tabbed display managed by
  36  * MainFrame.
  37  * @see MainFrame
  38  */
  39 public interface View {
  40     /**
  41      * Supply the view's display name, which will be the tab's title.
  42      * @return a short name to describe the view
  43      */
  44     public String getName();
  45     /**
  46      * the menus the view wishes to add to the interface.
  47      * @return an enumeration of JMenus
  48      */
  49     public Enumeration menus();
  50     /**
  51      * the menu items to be added to a specific menu
  52      * @return an enumeration of JMenuItems
  53      */
  54     public Enumeration menuItems(int menu);
  55     /**
  56      * the display to be shown for this view.  It will occupy the entire tab.
  57      * @return a component to display
  58      */
  59     public Component getDisplay();
  60     /**
  61      * view is to search for the next occurrence of the supplied string and
  62      * update its display accordingly.
  63      * @param s the string to search for
  64      */
  65     public void find(String s);
  66     /**
  67      * notification to view that it has been activated or deactivated.
  68      * Views may wish to update their display state at this time.
  69      * @param state true if view is now active, false if now inactive
  70      */
  71     public void setActive(boolean state);
  72     /**
  73      * user has selected Edit->Create menu item.  View should provide an
  74      * interface to create an instance of its primary object type.
  75      */
  76     public void handleCreate();
  77     /**
  78      * user has selected Edit->Delete menu item.  View should attempt to delete
  79      * any selected objects, probably with a confirmation notice.
  80      */
  81     public void handleDelete();
  82     /**
  83      * user has selected Edit->Duplicate menu item.  View should provide an
  84      * interface which creates a new object with attributes similar to the
  85      * currently selected object.
  86      */
  87     public void handleDuplicate();
  88     /**
  89      * user has selected Edit->Properties menu item.  View should provide an
  90      * interface to modify the properties of the selected item.
  91      */
  92     public void handleProperties();
  93     /**
  94      * user has selected View->Refresh menu item.  View should make its display
  95      * current.
  96      */
  97     public void handleUpdate();
  98     /**
  99      * add a listener for selection events.
 100      * @param listener a SelectionListener
 101      */
 102     public void addSelectionListener(SelectionListener listener);
 103     /**
 104      * remove a listener for selection events.
 105      * @param listener a SelectionListener
 106      */
 107     public void removeSelectionListener(SelectionListener listener);
 108     /**
 109      * listeners query to ascertain whether selection state is empty.
 110      * @return true if no objects are selected
 111      */
 112     public boolean isSelectionEmpty();
 113     /**
 114      * listeners query to ascertain whether selection state is multiple.
 115      * @return true if multiple objects selected
 116      */
 117     public boolean isSelectionMultiple();
 118 }