|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
wt.clients.beans.PrincipalSelectionBrowser
public class PrincipalSelectionBrowser
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
| 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.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PrincipalSelectionBrowser()
| Method Detail |
|---|
public void setLayout(LayoutManager lm)
setLayout in class Containerlm - The LayoutManager the component will
have set.LayoutManagerpublic void setSelectedLabel(String title)
title - the String label of the selected list.public LayoutManager getLayout()
getLayout in class ContainerLayoutManager the component is
currently utilizing.LayoutManagerpublic void setMultipleSelection(boolean b)
b - The boolean flag that determines whether
or not multiple participants can be selected.public boolean isMultipleSelection()
boolean state of the
multipleSelection flag.public void setDeletedPrincipalsVisible(boolean b)
b - The boolean flag that determines whether
deleted principals will be displayed.public boolean isDeletedPrincipalsVisible()
boolean state of the
deletedPrincipalsVisible flag.public void setGroupSelectionTabVisible(boolean b)
b - The boolean flag for the visibility of
this tab.public boolean isGroupSelectionTabVisible()
boolean value of the tab's visibility
flag.public void setUserSelectionTabVisible(boolean b)
b - The boolean flag for the visibility of
this tab.public boolean isUserSelectionTabVisible()
boolean value of the tab's visibility
flag.public void setOrgSelectionTabVisible(boolean b)
b - The boolean flag for the visibility of
this tab.public boolean isOrgSelectionTabVisible()
boolean value of the tab's visibility
flag.public void setActorSelectionTabVisible(boolean b)
b - The boolean flag for the visibility of
this tab.public boolean isActorSelectionTabVisible()
boolean value of the tab's visibility
flag.public void setRoleSelectionTabVisible(boolean b)
b - The boolean flag for the visibility of
this tab.public boolean isRoleSelectionTabVisible()
boolean value of the tab's visibility
flag.
public void setContainerRef(WTContainerRef containerRef)
throws WTException
containerRef - The container reference
WTExceptionWTContainerRefpublic WTContainerRef getContainerRef()
WTContainerRefpublic Vector getSelectedParticipants()
Vector of the selected
participants/participant.Vectorpublic HelpSystem getHelpSystem()
HelpSystem for the beanHelpSystempublic HelpContext getHelpContext()
HelpContext for the bean.HelpContextpublic void addHelpListener(PropertyChangeListener pcl)
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.
pcl - The PropertyChangeListener to be notified of
PropertyChangeEvents generated by the help system.removeHelpListener(java.beans.PropertyChangeListener),
HelpSystem,
HelpContext,
PropertyChangeListenerpublic void removeHelpListener(PropertyChangeListener pcl)
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.
pcl - the PropertyChangeListener to be removed as a
listener of events generated by the help system of this panel.addHelpListener(java.beans.PropertyChangeListener),
PropertyChangeListenerpublic void addPropertyChangeListener(PropertyChangeListener pcl)
addPropertyChangeListener in class Containerpcl - The PropertyChangeListenerPropertyChangeListener,
PropertyChangeEventpublic void removePropertyChangeListener(PropertyChangeListener pcl)
removePropertyChangeListener in class Componentpcl - The PropertyChangeListenerPropertyChangeListener,
PropertyChangeEvent
public void setSelectedParticipant(String key,
Object value)
key and
value.
key - the String to be displayedvalue - the selected Objectpublic void setSelectedParticipant(Object value)
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().
value - the selected Objectpublic void clearSelectedParticipants()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||