|
|||||||||||
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
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 | |
(package private) class |
PrincipalSelectionPanel.SymAction
|
(package private) class |
PrincipalSelectionPanel.SymFocus
|
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 |
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 | |
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. |
private void |
browseButton_ActionPerformed(ActionEvent event)
|
private void |
firePropertyChangeEvent(String command,
Object oldValue,
Object newValue)
|
String |
getBrowseButtonLabel()
This method returns the current value for the component's browse button label. |
Dimension |
getComponentPreferredGridSize()
|
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. |
Dimension |
getMinimumSize()
|
private Frame |
getParentFrame(Component c)
|
Dimension |
getPreferredSize()
|
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. |
private String[] |
getServices()
|
private void |
initHelpSystem()
|
private void |
initializeHelp()
|
private boolean |
isGroupSelectionTabVisible()
|
private boolean |
isOrgSelectionTabVisible()
|
private boolean |
isUserSelectionTabVisible()
|
private void |
localize()
|
static void |
main(String[] args)
The main method used for testing purposes. |
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 |
selectionTextField_FocusLost(FocusEvent event)
|
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. |
private void |
setGroupSelectionTabVisible(boolean b)
|
void |
setLabelMode(int mode)
This method sets the component's label mode. |
void |
setLayout(LayoutManager lm)
This method sets the layout for the PrincipalSelectionPanel. |
private void |
setOrgSelectionTabVisible(boolean b)
|
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. |
private void |
setUserSelectionTabVisible(boolean b)
|
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
public static final int DISPLAY_SELECTION_MODE
public static final int DISPLAY_VIEW_ONLY_MODE
private int displayMode
public static final int LABEL_VISIBLE_MODE
public static final int LABEL_INVISIBLE_MODE
private int labelMode
public static final int USER_MODE
public static final int GROUP_MODE
public static final int ORGANIZATION_MODE
public static final int PRINCIPAL_MODE
private int principalMode
private boolean groupSelectionTabVisible
private boolean userSelectionTabVisible
private boolean orgSelectionTabVisible
private WTPrincipal selectedParticipant
private WTPrincipal previousSelectedParticipant
private WTPrincipalReference selectedParticipantRef
private WTPrincipalReference previousSelectedParticipantRef
private boolean verifyParticipant
public static String noPrincipalSelectedString
private String principalLabel
private String browseButtonLabel
private LayoutManager layout
private boolean layoutInitialized
private boolean principalSelected
private WTContainerRef containerRef
private ThreadGroup contextGroup
private Frame parentFrame
private PrincipalSelectionBrowseDialog browseDialog
private static final String SELECTION_CARD
private static final String VIEW_ONLY_CARD
private Vector propertyChangeListeners
private String principalString
HelpSystem helpSystem
HelpContext helpContext
boolean debug
private String[] servicesList
Panel mainPanel
Panel viewOnlyPanel
Label viewOnlyLabel
Label viewOnlyTextValue
Panel selectionPanel
Button browseButton
TextField selectionTextField
Label selectionLabel
Constructor Detail |
public PrincipalSelectionPanel()
Method Detail |
public void setLayout(LayoutManager lm)
lm
- The LayoutManager
the component will
have set.LayoutManager
public LayoutManager getLayout()
LayoutManager
the component is
currently utilizing.LayoutManager
public 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 referenceWTContainerRef
public WTContainerRef getContainerRef()
WTContainerRef
public void setBrowseButtonLabel(String newLabel)
String
public String getBrowseButtonLabel()
String
value of the current browse
button label.String
public void setPrincipalLabel(String newLabel)
String
public String getPrincipalLabel()
String
value of the current principal
label.String
private String[] getServices()
public WTPrincipal getSelectedParticipant()
WTPrincipal
that was selected.WTPrincipal
public void setSelectedParticipant(WTPrincipal p)
p
- The principal selected.WTPrincipal
public void addPropertyChangeListener(PropertyChangeListener pcl)
pcl
- The PropertyChangeListener
PropertyChangeListener
,
PropertyChangeEvent
public void removePropertyChangeListener(PropertyChangeListener pcl)
pcl
- The PropertyChangeListener
PropertyChangeListener
,
PropertyChangeEvent
public void setEnabled(boolean b)
b
- The boolean
value that enables or
disables the components on the panel.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 Dimension getComponentPreferredGridSize()
public Dimension getPreferredSize()
public Dimension getMinimumSize()
private void setGroupSelectionTabVisible(boolean b)
private boolean isGroupSelectionTabVisible()
private void setOrgSelectionTabVisible(boolean b)
private boolean isOrgSelectionTabVisible()
private void setUserSelectionTabVisible(boolean b)
private boolean isUserSelectionTabVisible()
private Frame getParentFrame(Component c)
private void browseButton_ActionPerformed(ActionEvent event)
private void localize()
private void firePropertyChangeEvent(String command, Object oldValue, Object newValue)
private void selectionTextField_FocusLost(FocusEvent event)
private void initializeHelp()
private void initHelpSystem()
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |