|
|||||||||||
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
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 | |
(package private) class |
PrincipalSelectionBrowser.SymAction
|
(package private) class |
PrincipalSelectionBrowser.SymItem
|
(package private) class |
PrincipalSelectionBrowser.SymPropertyChange
|
Nested classes inherited from class java.awt.Panel |
Panel.AccessibleAWTPanel |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
(package private) List |
actorList
|
(package private) symantec.itools.awt.BorderPanel |
actorSelectionTab
|
private String |
actorSelectionTabLabel
|
private boolean |
actorSelectionTabVisible
|
private static int |
actorTabIndex
|
(package private) symantec.itools.awt.LabelButton |
addAllButton
|
(package private) symantec.itools.awt.LabelButton |
addButton
|
private boolean |
allowRemoveAll
|
(package private) Panel |
buttonsPanel
|
private WTContainerRef |
containerRef
|
private ThreadGroup |
contextGroup
|
private Font |
crossLocaleFont
|
private boolean |
deletedPrincipalsVisible
|
(package private) FindGroupPanel |
findGroupPanel
|
(package private) FindOrgPanel |
findOrgPanel
|
(package private) FindUserPanel |
findUserPanel
|
(package private) symantec.itools.awt.BorderPanel |
groupSelectionTab
|
private String |
groupSelectionTabLabel
|
private boolean |
groupSelectionTabVisible
|
private static int |
groupTabIndex
|
(package private) HelpContext |
helpContext
|
(package private) HelpSystem |
helpSystem
|
private LayoutManager |
layout
|
private boolean |
layoutInitialized
|
private boolean |
listsPopulated
|
private boolean |
multipleSelection
|
private Hashtable |
objectHolder
|
(package private) symantec.itools.awt.BorderPanel |
orgSelectionTab
|
private String |
orgSelectionTabLabel
|
private boolean |
orgSelectionTabVisible
|
private static int |
orgTabIndex
|
(package private) symantec.itools.awt.TabPanel |
principalSelectionTabPanel
|
private Vector |
propertyChangeListeners
|
private ReferenceDelegateFactory |
referenceDelegateFactory
|
(package private) symantec.itools.awt.LabelButton |
removeAllButton
|
(package private) symantec.itools.awt.LabelButton |
removeButton
|
private static String |
RESOURCE_BUNDLE
|
private boolean |
returnPrincipalReferences
|
(package private) List |
roleList
|
(package private) symantec.itools.awt.BorderPanel |
roleSelectionTab
|
private String |
roleSelectionTabLabel
|
private boolean |
roleSelectionTabVisible
|
private static int |
roleTabIndex
|
private String |
securedInfoKey
|
(package private) WTMultiList |
selectedParticipantsList
|
(package private) symantec.itools.awt.BorderPanel |
selectedParticipantsPanel
|
private boolean |
showSelectedParticipants
|
(package private) symantec.itools.awt.BorderPanel |
userSelectionTab
|
private String |
userSelectionTabLabel
|
private boolean |
userSelectionTabVisible
|
private static int |
userTabIndex
|
Fields inherited from class java.awt.Panel |
|
Fields inherited from class java.awt.Container |
|
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 | |
private void |
actorList_DblClicked(ActionEvent event)
|
private void |
addAllButton_ActionPerformed(ActionEvent event)
|
private void |
addButton_ActionPerformed(ActionEvent event)
|
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. |
private void |
addToObjectHolder(String key,
Object value)
|
private void |
addToSelectedParticipantsList(String displayName)
|
private void |
addToSelectedParticipantsList(String key,
Object value)
|
private void |
addToSelectedParticipantsList(WTGroup participant_object)
|
private void |
addToSelectedParticipantsList(WTUser participant_object)
|
private boolean |
allowRemove(int row)
|
void |
clearSelectedParticipants()
Remove all entries from the selected Participantlist. |
private void |
findGroupPanel_DblClicked(PropertyChangeEvent event)
|
private void |
findOrgPanel_DblClicked(PropertyChangeEvent event)
|
private void |
findUserPanel_DblClicked(PropertyChangeEvent event)
|
private void |
firePropertyChangeEvent(String command,
Object oldValue,
Object newValue)
|
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. |
private ReferenceDelegateFactory |
getReferenceDelegateFactory()
Returns the ReferenceDelegateFactory Supported API: false |
Vector |
getSelectedParticipants()
This method returns a vector of all the selected participants if multiple selection is enabled. |
private void |
initHelpSystem()
|
private void |
initializeHelp()
|
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. |
private void |
localize()
|
static void |
main(String[] args)
The main method used for testing purposes. |
private void |
populateActorList()
|
private void |
populateLists()
|
private void |
populateRoleList()
|
void |
populateRoles(String[] roles)
This method populates the role list with the strings in the roles array. |
private void |
principalSelectionTabPanel_propertyChange(PropertyChangeEvent event)
|
private void |
removeAllButton_ActionPerformed(ActionEvent event)
|
private void |
removeButton_ActionPerformed(ActionEvent event)
|
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. |
private void |
roleList_DblClicked(ActionEvent event)
|
private void |
selectedParticipantsList_actionPerformed(ActionEvent event)
|
private void |
selectedParticipantsList_itemStateChanged(ItemEvent event)
|
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 |
setFont(Font newFont)
|
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 |
setPrincipalReferences(boolean b)
This method sets the returnPrincipalReferences flag. |
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 |
setShowSelectedParticipants(boolean b)
This method sets the showSelectedParticipants flag. |
void |
setUserSelectionTabVisible(boolean b)
This method sets the visibility flag for the user selection tab. |
void |
setViewMode(boolean mode)
Set the mode to view only by by removing the principal selection tab and buttons pane. |
private void |
updateButtonEnable(int currentTab)
|
private void |
updateTabPanel()
|
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 |
Field Detail |
private static final String RESOURCE_BUNDLE
private String securedInfoKey
private static int groupTabIndex
private static int userTabIndex
private static int orgTabIndex
private static int actorTabIndex
private static int roleTabIndex
private boolean groupSelectionTabVisible
private boolean userSelectionTabVisible
private boolean orgSelectionTabVisible
private boolean actorSelectionTabVisible
private boolean roleSelectionTabVisible
private boolean layoutInitialized
private LayoutManager layout
private boolean multipleSelection
private boolean showSelectedParticipants
private boolean allowRemoveAll
private boolean returnPrincipalReferences
private boolean deletedPrincipalsVisible
private String groupSelectionTabLabel
private String userSelectionTabLabel
private String orgSelectionTabLabel
private String actorSelectionTabLabel
private String roleSelectionTabLabel
private Hashtable objectHolder
private WTContainerRef containerRef
private ThreadGroup contextGroup
private boolean listsPopulated
HelpSystem helpSystem
HelpContext helpContext
private Vector propertyChangeListeners
private ReferenceDelegateFactory referenceDelegateFactory
private Font crossLocaleFont
symantec.itools.awt.TabPanel principalSelectionTabPanel
symantec.itools.awt.BorderPanel groupSelectionTab
FindGroupPanel findGroupPanel
symantec.itools.awt.BorderPanel userSelectionTab
FindUserPanel findUserPanel
symantec.itools.awt.BorderPanel orgSelectionTab
FindOrgPanel findOrgPanel
symantec.itools.awt.BorderPanel actorSelectionTab
List actorList
symantec.itools.awt.BorderPanel roleSelectionTab
List roleList
Panel buttonsPanel
symantec.itools.awt.LabelButton addButton
symantec.itools.awt.LabelButton addAllButton
symantec.itools.awt.LabelButton removeButton
symantec.itools.awt.LabelButton removeAllButton
symantec.itools.awt.BorderPanel selectedParticipantsPanel
WTMultiList selectedParticipantsList
Constructor Detail |
public PrincipalSelectionBrowser()
Method Detail |
public void setLayout(LayoutManager lm)
lm
- The LayoutManager
the component will
have set.LayoutManager
public void setSelectedLabel(String title)
title
- the String
label of the selected list.public LayoutManager getLayout()
LayoutManager
the component is
currently utilizing.LayoutManager
public 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 setPrincipalReferences(boolean b)
b
- The boolean
flag that determines whether
principal particpants are returned as WTPrincipal or
WTPrincipalReference.public void setShowSelectedParticipants(boolean b)
b
- The boolean
flag that determines whether
or not multiple participants can be selected.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
WTException
WTContainerRef
public WTContainerRef getContainerRef()
WTContainerRef
public Vector getSelectedParticipants()
Vector
of the selected
participants/participant.Vector
public HelpSystem getHelpSystem()
HelpSystem
for the beanHelpSystem
public HelpContext getHelpContext()
HelpContext
for the bean.HelpContext
public 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
,
PropertyChangeListener
public 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)
,
PropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener pcl)
pcl
- The PropertyChangeListener
PropertyChangeListener
,
PropertyChangeEvent
public void removePropertyChangeListener(PropertyChangeListener pcl)
pcl
- The PropertyChangeListener
PropertyChangeListener
,
PropertyChangeEvent
public void populateRoles(String[] roles)
getSelectedParticipants method
will return the role strings rather than Role objects.
Supported API: false.
- Parameters:
roles
- The Vector
of Role Strings to populate the role list with.
public void setSelectedParticipant(String key, Object value)
key
and
value
.
key
- the String
to be displayedvalue
- the selected Object
public 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 Object
public void clearSelectedParticipants()
public void setViewMode(boolean mode)
mode
- true for view only, false otherwise.private void updateTabPanel()
public void setFont(Font newFont)
private void localize()
private boolean allowRemove(int row)
private void populateActorList() throws Exception
Exception
private void populateRoleList() throws Exception
Exception
private void addToObjectHolder(String key, Object value)
private void principalSelectionTabPanel_propertyChange(PropertyChangeEvent event)
private void updateButtonEnable(int currentTab)
private void addButton_ActionPerformed(ActionEvent event)
private void addAllButton_ActionPerformed(ActionEvent event)
private ReferenceDelegateFactory getReferenceDelegateFactory() throws WTException
WTException
- if an error occurs in obtaining the
factory.private void addToSelectedParticipantsList(WTGroup participant_object)
private void addToSelectedParticipantsList(WTUser participant_object)
private void addToSelectedParticipantsList(String displayName)
private void addToSelectedParticipantsList(String key, Object value)
private void removeButton_ActionPerformed(ActionEvent event)
private void selectedParticipantsList_itemStateChanged(ItemEvent event)
private void removeAllButton_ActionPerformed(ActionEvent event)
private void populateLists()
private void findUserPanel_DblClicked(PropertyChangeEvent event)
private void findGroupPanel_DblClicked(PropertyChangeEvent event)
private void findOrgPanel_DblClicked(PropertyChangeEvent event)
private void actorList_DblClicked(ActionEvent event)
private void roleList_DblClicked(ActionEvent event)
private void selectedParticipantsList_actionPerformed(ActionEvent event)
private void initializeHelp()
private void initHelpSystem()
private void firePropertyChangeEvent(String command, Object oldValue, Object newValue)
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |