wt.clients.beans
Class PrincipalSelectionBrowser

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by wt.clients.beans.PrincipalSelectionBrowser
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PrincipalSelectionBrowser
extends Panel

The PrincipalSelectionBrowser bean (wt.clients.beans.PrincipalSelectionBrowser) has a dev time component and a runtime component. At dev time, you can drag this component from the component library in Visual Cafe and drop it onto a container. The properties can then be edited by using Visual Cafe's Property Editor. At runtime, this class allows you to select a WTPrincipal (WTUser or WTGroup), an Actor, or a Role. This is done by selecting one of the tabs on the left (Groups, Users, Actors or Roles) and then selecting the desired participant/participants from the list displayed on the selected tab. This bean contains a tab panel containing lists of the available participants, an "Add" button, an "Add All" button, a "Remove" button, a "Remove All" button, and a list to display all the selected participants. The following is a small example of using the PrincipalSelectionBrowser bean:

   import java.awt.*;
   import java.beans.PropertyChangeListener;
   import java.beans.PropertyChangeEvent;
   import java.util.Vector;

   import wt.clients.beans.PrincipalSelectionBrowser;
   import wt.help.*;

   import symantec.itools.awt.StatusBar;

   public class PSBTestFrame extends Frame
   {
     public PSBTestFrame()
     {
        // This code is automatically generated by Visual Cafe when you add
        // components to the visual environment. It instantiates and initializes
        // the components. To modify the code, only use code syntax that matches
        // what Visual Cafe can generate, or Visual Cafe may be unable to back
        // parse your Java file into its visual environment.
        //{{INIT_CONTROLS
        GridBagLayout gridBagLayout;
        gridBagLayout = new GridBagLayout();
        setLayout(gridBagLayout);
        setVisible(false);
        setSize(773,322);
        setBackground(new Color(12632256));
        psb = new wt.clients.beans.PrincipalSelectionBrowser();
        psb.setBounds(0,0,773,259);
        psb.setBackground(new Color(12632256));
        GridBagConstraints gbc;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.insets = new Insets(0,0,0,0);
        ((GridBagLayout)getLayout()).setConstraints(psb, gbc);
        add(psb);
        TestButton = new java.awt.Button();
        TestButton.setLabel("Test Button");
        TestButton.setBounds(687,259,76,23);
        TestButton.setBackground(new Color(12632256));
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.weightx = 1.0;
        gbc.anchor = GridBagConstraints.EAST;
        gbc.fill = GridBagConstraints.NONE;
        gbc.insets = new Insets(0,0,0,10);
        ((GridBagLayout)getLayout()).setConstraints(TestButton, gbc);
        add(TestButton);
        statusBar = new symantec.itools.awt.StatusBar();
        try {
           statusBar.setBevelStyle(symantec.itools.awt.StatusBar.BEVEL_LOWERED);
        }
        catch(java.beans.PropertyVetoException e) { }
        statusBar.setBounds(2,282,769,40);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.weightx = 1.0;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets(0,2,0,2);
        ((GridBagLayout)getLayout()).setConstraints(statusBar, gbc);
        add(statusBar);
        setTitle("PSB Test Frame");
        //}}

        psb.setMultipleSelection(true);
        psb.setGroupSelectionTabVisible(true);
        psb.setUserSelectionTabVisible(true);
        psb.setActorSelectionTabVisible(true);
        psb.setRoleSelectionTabVisible(true);

        HelpListener helpListener = new HelpListener();
        psb.addHelpListener(helpListener);*
        //{{INIT_MENU
        //}}

        //{{REGISTER_LISTENERS
        SymWindow aSymWindow = new SymWindow();
        this.addWindowListener(aSymWindow);
        SymAction lSymAction = new SymAction();
        TestButton.addActionListener(lSymAction);
        //}}
     }

     public PSBTestFrame(String title)
     {
        this();
        setTitle(title);
     }

       public void setVisible(boolean b)
     {
        if(b)
        {
           setLocation(50, 50);
        }
        super.setVisible(b);
     }

     static public void main(String args[])
     {
        (new PSBTestFrame()).setVisible(true);
     }

     public void addNotify()
     {
         Dimension d = getSize();

        super.addNotify();

        if (fComponentsAdjusted)
           return;

        setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
        Component components[] = getComponents();
        for (int i = 0; i < components.length; i++)
        {
           Point p = components[i].getLocation();
           p.translate(insets().left, insets().top);
           components[i].setLocation(p);
        }
        fComponentsAdjusted = true;
     }

     boolean fComponentsAdjusted = false;

     //{{DECLARE_CONTROLS
     wt.clients.beans.PrincipalSelectionBrowser psb;
     java.awt.Button TestButton;
     symantec.itools.awt.StatusBar statusBar;
     //}}

     //{{DECLARE_MENUS
     //}}

     class SymWindow extends java.awt.event.WindowAdapter
     {
        public void windowClosing(java.awt.event.WindowEvent event)
        {
           Object object = event.getSource();
           if (object == PSBTestFrame.this)
              Frame1_WindowClosing(event);
        }
     }

     void Frame1_WindowClosing(java.awt.event.WindowEvent event)
     {
        dispose();          // free the system resources
        System.exit(0);     // close the application
     }

     class HelpListener implements PropertyChangeListener
     {
         public void propertyChange(PropertyChangeEvent pce)
         {
               try
               {
                   if (pce.getPropertyName().equals (HelpContext.TOOL_DESCRIPTION))
                   {
                       try
                       {
                           statusBar.setStatusText((String) pce.getNewValue());
                       }

                       catch (Exception e)
                       {
                           e.printStackTrace();
                       }
                   }
               }

               catch (Exception e) {}
         }
     }

     class SymAction implements java.awt.event.ActionListener
     {
        public void actionPerformed(java.awt.event.ActionEvent event)
        {
           Object object = event.getSource();
           if (object == TestButton)
              TestButton_ActionPerformed(event);
        }
     }

     void TestButton_ActionPerformed(java.awt.event.ActionEvent event)
     {
        Vector v =  new Vector();

        v = psb.getSelectedParticipants();
        System.out.println(v);
     }
   }
 


Supported API: true

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PrincipalSelectionBrowser()
          This is the no arg constructor that creates the PrincipalSelectionBrowser with a TabPanel containing the various selection tabs (Groups, Users, Actors and Roles), an "Add" button, an "Add All" button, a "Remove" button, a "Remove All" button, and a list of the selected participants.
 
Method Summary
 void addHelpListener(PropertyChangeListener pcl)
          Method addHelpListener adds the given listener to be notified of PropertyChangeEvents in the help system.
 void addPropertyChangeListener(PropertyChangeListener pcl)
          This method adds a PropertyChangeListener to the component.
 void clearSelectedParticipants()
          Remove all entries from the selected Participantlist.
 WTContainerRef getContainerRef()
          This method returns the current value for the component's container reference, or null if the component is not currently associated with a container context.
 HelpContext getHelpContext()
          This is the public getter for the HelpContext being used for the online help.
 HelpSystem getHelpSystem()
          This is the public getter for the HelpSystem being used for the online help.
 LayoutManager getLayout()
          This method returns the component's internal LayoutManager.
 Vector getSelectedParticipants()
          This method returns a vector of all the selected participants if multiple selection is enabled.
 boolean isActorSelectionTabVisible()
          This method returns the state of the visiblity flag for this tab.
 boolean isDeletedPrincipalsVisible()
          This method returns the state of the deletedPrincipalsVisible flag.
 boolean isGroupSelectionTabVisible()
          This method returns the state of the visiblity flag for this tab.
 boolean isMultipleSelection()
          This method returns the state of the multipleSelection flag.
 boolean isOrgSelectionTabVisible()
          This method returns the state of the visiblity flag for this tab.
 boolean isRoleSelectionTabVisible()
          This method returns the state of the visiblity flag for this tab.
 boolean isUserSelectionTabVisible()
          This method returns the state of the visiblity flag for this tab.
 void removeHelpListener(PropertyChangeListener pcl)
          Method removeHelpListener removes a listener which was being notified of PropertyChangeEvents in the help system.
 void removePropertyChangeListener(PropertyChangeListener pcl)
          This method removes the desired PropertyChangeListener from the component.
 void setActorSelectionTabVisible(boolean b)
          This method sets the visibility flag for the actor selection tab.
 void setContainerRef(WTContainerRef containerRef)
          This method sets a reference to a container that provides context for queries against users, groups, and organizations.
 void setDeletedPrincipalsVisible(boolean b)
          This method sets the deletedPrincipalsVisible flag.
 void setGroupSelectionTabVisible(boolean b)
          This method sets the visibility flag for the group selection tab.
 void setLayout(LayoutManager lm)
          This method sets the layout for the PrincipalSelectionBrowser.
 void setMultipleSelection(boolean b)
          This method sets the multipleSelection flag.
 void setOrgSelectionTabVisible(boolean b)
          This method sets the visibility flag for the organization selection tab.
 void setRoleSelectionTabVisible(boolean b)
          This method sets the visibility flag for the role selection tab.
 void setSelectedLabel(String title)
          Set the label of the selected participants list

Supported API: true.
 void setSelectedParticipant(Object value)
          Initialize the list of selected items.
 void setSelectedParticipant(String key, Object value)
          Initialize the list of selected items with the key and value.
 void setUserSelectionTabVisible(boolean b)
          This method sets the visibility flag for the user selection tab.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrincipalSelectionBrowser

public PrincipalSelectionBrowser()
This is the no arg constructor that creates the PrincipalSelectionBrowser with a TabPanel containing the various selection tabs (Groups, Users, Actors and Roles), an "Add" button, an "Add All" button, a "Remove" button, a "Remove All" button, and a list of the selected participants.

Supported API: true.

Method Detail

setLayout

public void setLayout(LayoutManager lm)
This method sets the layout for the PrincipalSelectionBrowser. Once the layout has been initialized it cannot be changed. It effectively avoids the component's internal layout from being changed.

Supported API: true.

Overrides:
setLayout in class Container
Parameters:
lm - The LayoutManager the component will have set.
See Also:
LayoutManager

setSelectedLabel

public void setSelectedLabel(String title)
Set the label of the selected participants list

Supported API: true.

Parameters:
title - the String label of the selected list.

getLayout

public LayoutManager getLayout()
This method returns the component's internal LayoutManager.

Supported API: true.

Overrides:
getLayout in class Container
Returns:
The LayoutManager the component is currently utilizing.
See Also:
LayoutManager

setMultipleSelection

public void setMultipleSelection(boolean b)
This method sets the multipleSelection flag. If the flag is set to true the "Add", "Add All", "Remove" and "Remove All" buttons will be displayed. The "Participants" list will also be displayed. The user will be able to select multiple participants from the selection panels. If the flag is set to false, only the selection panels will be displayed, and only a single participant can be selected.

Supported API: true.

Parameters:
b - The boolean flag that determines whether or not multiple participants can be selected.

isMultipleSelection

public boolean isMultipleSelection()
This method returns the state of the multipleSelection flag.

Supported API: true.

Returns:
The boolean state of the multipleSelection flag.

setDeletedPrincipalsVisible

public void setDeletedPrincipalsVisible(boolean b)
This method sets the deletedPrincipalsVisible flag. If the flag is set to true principals that have been previously deleted from the system will still be displayed. If the flag is set to false, previously deleted principals will not be diaplayed.

Supported API: true.

Parameters:
b - The boolean flag that determines whether deleted principals will be displayed.

isDeletedPrincipalsVisible

public boolean isDeletedPrincipalsVisible()
This method returns the state of the deletedPrincipalsVisible flag.

Supported API: true.

Returns:
The boolean state of the deletedPrincipalsVisible flag.

setGroupSelectionTabVisible

public void setGroupSelectionTabVisible(boolean b)
This method sets the visibility flag for the group selection tab.

Supported API: true.

Parameters:
b - The boolean flag for the visibility of this tab.

isGroupSelectionTabVisible

public boolean isGroupSelectionTabVisible()
This method returns the state of the visiblity flag for this tab.

Supported API: true.

Returns:
The boolean value of the tab's visibility flag.

setUserSelectionTabVisible

public void setUserSelectionTabVisible(boolean b)
This method sets the visibility flag for the user selection tab.

Supported API: true.

Parameters:
b - The boolean flag for the visibility of this tab.

isUserSelectionTabVisible

public boolean isUserSelectionTabVisible()
This method returns the state of the visiblity flag for this tab.

Supported API: true.

Returns:
The boolean value of the tab's visibility flag.

setOrgSelectionTabVisible

public void setOrgSelectionTabVisible(boolean b)
This method sets the visibility flag for the organization selection tab.

Supported API: true.

Parameters:
b - The boolean flag for the visibility of this tab.

isOrgSelectionTabVisible

public boolean isOrgSelectionTabVisible()
This method returns the state of the visiblity flag for this tab.

Supported API: true.

Returns:
The boolean value of the tab's visibility flag.

setActorSelectionTabVisible

public void setActorSelectionTabVisible(boolean b)
This method sets the visibility flag for the actor selection tab.

Supported API: true.

Parameters:
b - The boolean flag for the visibility of this tab.

isActorSelectionTabVisible

public boolean isActorSelectionTabVisible()
This method returns the state of the visiblity flag for this tab.

Supported API: true.

Returns:
The boolean value of the tab's visibility flag.

setRoleSelectionTabVisible

public void setRoleSelectionTabVisible(boolean b)
This method sets the visibility flag for the role selection tab.

Supported API: true.

Parameters:
b - The boolean flag for the visibility of this tab.

isRoleSelectionTabVisible

public boolean isRoleSelectionTabVisible()
This method returns the state of the visiblity flag for this tab.

Supported API: true.

Returns:
The boolean value of the tab's visibility flag.

setContainerRef

public void setContainerRef(WTContainerRef containerRef)
                     throws WTException
This method sets a reference to a container that provides context for queries against users, groups, and organizations.

Supported API: true.

Parameters:
containerRef - The container reference
Throws:
WTException
See Also:
WTContainerRef

getContainerRef

public WTContainerRef getContainerRef()
This method returns the current value for the component's container reference, or null if the component is not currently associated with a container context.

Supported API: true.

Returns:
The current container reference
See Also:
WTContainerRef

getSelectedParticipants

public Vector getSelectedParticipants()
This method returns a vector of all the selected participants if multiple selection is enabled. If multiple selection is disabled, the method returns the currently selected participant from the currently selected selection tab.

Supported API: true.

Returns:
A Vector of the selected participants/participant.
See Also:
Vector

getHelpSystem

public HelpSystem getHelpSystem()
This is the public getter for the HelpSystem being used for the online help.

Supported API: true.

Returns:
The HelpSystem for the bean
See Also:
HelpSystem

getHelpContext

public HelpContext getHelpContext()
This is the public getter for the HelpContext being used for the online help.

Supported API: true.

Returns:
The HelpContext for the bean.
See Also:
HelpContext

addHelpListener

public void addHelpListener(PropertyChangeListener pcl)
Method addHelpListener adds the given listener to be notified of PropertyChangeEvents in the help system. Tool description PropertyChangeEvents are generated when the user mouses over the buttons and list of ContentItems in this panel. The given listener will be notified of those events.

Supported API: true.

Parameters:
pcl - The PropertyChangeListener to be notified of PropertyChangeEvents generated by the help system.
See Also:
removeHelpListener(java.beans.PropertyChangeListener), HelpSystem, HelpContext, PropertyChangeListener

removeHelpListener

public void removeHelpListener(PropertyChangeListener pcl)
Method removeHelpListener removes a listener which was being notified of PropertyChangeEvents in the help system. If the given listener is not currently a listener, no changes are made.

Supported API: true.

Parameters:
pcl - the PropertyChangeListener to be removed as a listener of events generated by the help system of this panel.
See Also:
addHelpListener(java.beans.PropertyChangeListener), PropertyChangeListener

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pcl)
This method adds a PropertyChangeListener to the component. The added listener will recieve a PropertyChangeEvent when a principal is selected in non multipleSelection mode.

Supported API: true.

Overrides:
addPropertyChangeListener in class Container
Parameters:
pcl - The PropertyChangeListener
See Also:
PropertyChangeListener, PropertyChangeEvent

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener pcl)
This method removes the desired PropertyChangeListener from the component.

Supported API: true.

Overrides:
removePropertyChangeListener in class Component
Parameters:
pcl - The PropertyChangeListener
See Also:
PropertyChangeListener, PropertyChangeEvent

setSelectedParticipant

public void setSelectedParticipant(String key,
                                   Object value)
Initialize the list of selected items with the key and value.

Supported API: true.

Parameters:
key - the String to be displayed
value - the selected Object

setSelectedParticipant

public void setSelectedParticipant(Object value)
Initialize the list of selected items. If the value is a WTGroup or reference to a WTGroup, the display key will be the name. If the value is a WTUser or a reference to a WTUser, the display key will be the name and full name. If the value is a Role, the display key is the getDisplay() value. Any other object type will display value.toString().

Supported API: true.

Parameters:
value - the selected Object

clearSelectedParticipants

public void clearSelectedParticipants()
Remove all entries from the selected Participantlist.

Supported API: true.