diff options
| author | Andrew Branson <andrew@andrewbranson.net> | 2011-06-21 15:46:02 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew@andrewbranson.net> | 2011-06-21 15:46:02 +0200 |
| commit | 254ee6f47eebfc00462c10756a92066e82cc1a96 (patch) | |
| tree | 8273ff95c704e6faa3f92b4711253427b9ba0481 /source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java | |
Initial commit2.2
Diffstat (limited to 'source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java')
| -rwxr-xr-x | source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java b/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java new file mode 100755 index 0000000..c2cdb0c --- /dev/null +++ b/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java @@ -0,0 +1,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();
+ }
+
+}
|
