diff options
Diffstat (limited to 'src/main/java/org/cristalise/gui/lifecycle/chooser/LDAPEntryChooser.java')
| -rw-r--r-- | src/main/java/org/cristalise/gui/lifecycle/chooser/LDAPEntryChooser.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/org/cristalise/gui/lifecycle/chooser/LDAPEntryChooser.java b/src/main/java/org/cristalise/gui/lifecycle/chooser/LDAPEntryChooser.java new file mode 100644 index 0000000..90c759f --- /dev/null +++ b/src/main/java/org/cristalise/gui/lifecycle/chooser/LDAPEntryChooser.java @@ -0,0 +1,71 @@ +package org.cristalise.gui.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.Iterator;
+
+import javax.swing.JComboBox;
+
+import org.cristalise.gui.MainFrame;
+import org.cristalise.kernel.lookup.DomainPath;
+import org.cristalise.kernel.process.Gateway;
+
+
+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
+ {
+ Iterator<?> children = Gateway.getLookup().search(mDomainPath, "*");
+ while (children.hasNext())
+ {
+ DomainPath domPath = (DomainPath)children.next();
+ allItems.add(domPath.getName());
+ }
+ }
+ catch (Exception ex)
+ {
+ MainFrame.exceptionDialog(ex);
+ }
+
+ Collections.sort(allItems);
+ addItem("");
+ for (String element : allItems) {
+ addItem(element);
+ }
+
+ }
+
+ public void reload()
+ {
+ removeAllItems();
+ initialise();
+ }
+
+ @Override
+ public synchronized Dimension getSize()
+ {
+ if (Gateway.getProperties().getInt("ResizeCombo") > 0)
+ return new Dimension(super.getSize().width<400?400:super.getSize().width,super.getSize().height);
+ return super.getSize();
+ }
+
+}
|
