blob: c2cdb0ca5a424471f37769acf4355081af4862ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package com.c2kernel.lifecycle.chooser;
/**
* @version $Revision: 1.2 $ $Date: 2005/12/01 14:23:15 $
* @author $Author: abranson $
*/
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import javax.swing.JComboBox;
import com.c2kernel.lookup.DomainPath;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
public class LDAPEntryChooser extends JComboBox
{
DomainPath mDomainPath = null;
ArrayList<String> allItems = new ArrayList<String>();
public LDAPEntryChooser(DomainPath domPath, boolean editable)
{
super();
setEditable(editable);
mDomainPath = domPath;
initialise();
}
private void initialise()
{
try
{
Enumeration children = Gateway.getLDAPLookup().searchAliases(mDomainPath);
while (children.hasMoreElements())
{
DomainPath domPath = (DomainPath)children.nextElement();
allItems.add(domPath.getName());
}
}
catch (Exception ex)
{
Logger.exceptionDialog(ex);
}
Collections.sort(allItems);
addItem("");
for (String element : allItems) {
addItem(element);
}
}
public void reload()
{
removeAllItems();
initialise();
}
public synchronized Dimension getSize()
{
if ("1".equals(Gateway.getProperty("ResizeCombo")))
return new Dimension(super.getSize().width<400?400:super.getSize().width,super.getSize().height);
return super.getSize();
}
}
|