|
|||||||||
| 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.PrincipalSelectionPanel
public class PrincipalSelectionPanel
The PrincipalSelectionPanel bean (wt.clients.beans.PrincipalSelectionPanel) 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
also be edited by using Visual Cafe's Property Editor. At runtime, this class allows you
to select a WTPrincipal (WTUser or WTGroup) by either entering the name of the WTPrincipal
directly or by browsing lists of the available WTGroups or WTUsers. The bean can also
simply display a WTPrincipal. This bean contains a label, a text field, and a browse button
when used for selecting a principal. When the browse button is clicked a dialog is launched
which allows the user to browse a list or lists for a desired principal.
The following is a small example of using the PrincipalSelectionPanel bean:
import java.awt.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import wt.clients.beans.PrincipalSelectionPanel;
import wt.help.*;
import wt.org.WTPrincipal;
import symantec.itools.awt.StatusBar;
public class PSPTestFrame extends Frame
{
public PSPTestFrame()
{
// 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(497,211);
setBackground(new Color(12632256));
psp = new wt.clients.beans.PrincipalSelectionPanel();
psp.setBounds(0,0,495,143);
psp.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,2);
((GridBagLayout)getLayout()).setConstraints(psp, gbc);
add(psp);
testButton = new java.awt.Button();
testButton.setLabel("Test Button");
testButton.setBounds(414,143,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,5,7);
((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(0,171,147,40);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0,0,0,0);
((GridBagLayout)getLayout()).setConstraints(statusBar, gbc);
add(statusBar);
setTitle("PSP Test Frame");
//}}
//{{INIT_MENUS
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
testButton.addActionListener(lSymAction);
//}}
psp.setPrincipalMode(PrincipalSelectionPanel.PRINCIPAL_MODE);
psp.setDisplayMode(PrincipalSelectionPanel.DISPLAY_SELECTION_MODE);
psp.setLabelMode(PrincipalSelectionPanel.LABEL_VISIBLE_MODE);
psp.setBrowseButtonLabel("Custom Browse...");
psp.setPrincipalLabel("Custom Principal:");
HelpListener helpListener = new HelpListener();
psp.addHelpListener(helpListener);
}
public PSPTestFrame(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 PSPTestFrame()).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.PrincipalSelectionPanel psp;
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 == PSPTestFrame.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)
{
WTPrincipal test = psp.getSelectedParticipant();
System.out.println(test);
}
}
| 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 | |
|---|---|
PrincipalSelectionPanel()
This is the no arg constructor that creates the PrincipalSelectionPanel with a two modes, a selection mode and a view only mode. |
|
| 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. |
String |
getBrowseButtonLabel()
This method returns the current value for the component's browse button label. |
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. |
int |
getDisplayMode()
This method returns the currently selected display mode of the component. |
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. |
int |
getLabelMode()
This method returns the currently selected label mode of the component. |
LayoutManager |
getLayout()
This method returns the component's internal LayoutManager. |
String |
getPrincipalLabel()
This method returns the current value for the component's principal label. |
int |
getPrincipalMode()
This method returns the currently selected principal mode of the component. |
WTPrincipal |
getSelectedParticipant()
This method returns the WTPrincipal that was selected. |
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 |
setBrowseButtonLabel(String newLabel)
This method sets the component's browse button label. |
void |
setContainerRef(WTContainerRef containerRef)
This method sets a reference to a container that provides context for queries against users, groups, and organizations. |
void |
setDisplayMode(int mode)
This method sets the component's display mode. |
void |
setEnabled(boolean b)
This method enables both the browse button and the text field if the value of b is true, it disables both the browse button and the text field if the value of b is false. |
void |
setLabelMode(int mode)
This method sets the component's label mode. |
void |
setLayout(LayoutManager lm)
This method sets the layout for the PrincipalSelectionPanel. |
void |
setPrincipalLabel(String newLabel)
This method sets the component's principal label. |
void |
setPrincipalMode(int mode)
This method sets the component's principal mode. |
void |
setSelectedParticipant(WTPrincipal p)
This method sets the selected WTPrincipal. |
| 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 PrincipalSelectionPanel()
| Method Detail |
|---|
public void setLayout(LayoutManager lm)
setLayout in class Containerlm - The LayoutManager the component will
have set.LayoutManagerpublic LayoutManager getLayout()
getLayout in class ContainerLayoutManager the component is
currently utilizing.LayoutManagerpublic void setDisplayMode(int mode)
mode - The int value of the desired new display
mode.public int getDisplayMode()
int value of the currently selected
display mode.public void setLabelMode(int mode)
mode - The int value of the desired new display
mode.public int getLabelMode()
int value of the currently selected
label mode.public void setPrincipalMode(int mode)
mode - The int value of the desired new principal
mode.public int getPrincipalMode()
int value of the currently selected
principal mode.public void setContainerRef(WTContainerRef containerRef)
containerRef - The container referenceWTContainerRefpublic WTContainerRef getContainerRef()
WTContainerRefpublic void setBrowseButtonLabel(String newLabel)
mode - The String value of the desired new label
for the browse button.Stringpublic String getBrowseButtonLabel()
String value of the current browse
button label.Stringpublic void setPrincipalLabel(String newLabel)
mode - The String value of the desired new label
for the principal.Stringpublic String getPrincipalLabel()
String value of the current principal
label.Stringpublic WTPrincipal getSelectedParticipant()
WTPrincipal that was selected.WTPrincipalpublic void setSelectedParticipant(WTPrincipal p)
p - The principal selected.WTPrincipalpublic void addPropertyChangeListener(PropertyChangeListener pcl)
addPropertyChangeListener in class Containerpcl - The PropertyChangeListenerPropertyChangeListener,
PropertyChangeEventpublic void removePropertyChangeListener(PropertyChangeListener pcl)
removePropertyChangeListener in class Componentpcl - The PropertyChangeListenerPropertyChangeListener,
PropertyChangeEventpublic void setEnabled(boolean b)
setEnabled in class Componentb - The boolean value that enables or
disables the components on the panel.public 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),
PropertyChangeListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||