001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2009 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.quicksetup.installer.ui;
018
019import static org.opends.messages.QuickSetupMessages.*;
020
021import java.awt.Component;
022import java.awt.GridBagConstraints;
023import java.awt.GridBagLayout;
024import java.awt.event.ActionEvent;
025import java.awt.event.ActionListener;
026import java.awt.event.FocusEvent;
027import java.awt.event.FocusListener;
028import java.util.HashMap;
029import java.util.List;
030
031import javax.swing.Box;
032import javax.swing.ButtonGroup;
033import javax.swing.JButton;
034import javax.swing.JComboBox;
035import javax.swing.JLabel;
036import javax.swing.JPanel;
037import javax.swing.JRadioButton;
038import javax.swing.event.DocumentEvent;
039import javax.swing.event.DocumentListener;
040import javax.swing.text.JTextComponent;
041
042import org.forgerock.i18n.LocalizableMessage;
043import org.opends.quicksetup.UserData;
044import org.opends.quicksetup.event.BrowseActionListener;
045import org.opends.quicksetup.installer.NewSuffixOptions;
046import org.opends.quicksetup.ui.FieldName;
047import org.opends.quicksetup.ui.GuiApplication;
048import org.opends.quicksetup.ui.LabelFieldDescriptor;
049import org.opends.quicksetup.ui.QuickSetupStepPanel;
050import org.opends.quicksetup.ui.UIFactory;
051import org.opends.quicksetup.ui.Utilities;
052import org.opends.server.tools.BackendTypeHelper;
053import org.opends.server.tools.BackendTypeHelper.BackendTypeUIAdapter;
054
055/**
056 * This is the panel that contains the Data Options: the suffix dn, whether to
057 * import data to the suffix or not, etc.
058 */
059public class DataOptionsPanel extends QuickSetupStepPanel
060{
061  private static final long serialVersionUID = 1815782841921928118L;
062
063  private Component lastFocusComponent;
064  private UserData defaultUserData;
065
066  private HashMap<FieldName, JLabel> hmLabels = new HashMap<>();
067  private HashMap<FieldName, JTextComponent> hmFields = new HashMap<>();
068  private HashMap<NewSuffixOptions.Type, JRadioButton> hmRadioButtons = new HashMap<>();
069
070  private JButton ldifBrowseButton;
071  private JComboBox<BackendTypeUIAdapter> backendTypeComboBox;
072
073  /**
074   * Constructor of the panel.
075   *
076   * @param application
077   *          Application represented by this panel the fields of the panel.
078   */
079  public DataOptionsPanel(GuiApplication application)
080  {
081    super(application);
082    this.defaultUserData = application.getUserData();
083    populateComponentMaps();
084    createBackendTypeComboBox();
085    addDocumentListeners();
086    addFocusListeners();
087    addActionListeners();
088  }
089
090  @Override
091  public Object getFieldValue(FieldName fieldName)
092  {
093    if (fieldName == FieldName.DATA_OPTIONS)
094    {
095      for (NewSuffixOptions.Type type : hmRadioButtons.keySet())
096      {
097        if (hmRadioButtons.get(type).isSelected())
098        {
099          return type;
100        }
101      }
102    }
103    else if (FieldName.BACKEND_TYPE == fieldName)
104    {
105      return ((BackendTypeUIAdapter) backendTypeComboBox.getSelectedItem()).getBackend();
106    }
107    else
108    {
109      final JTextComponent field = getField(fieldName);
110      if (field != null)
111      {
112        return field.getText();
113      }
114    }
115
116    return null;
117  }
118
119  @Override
120  public void displayFieldInvalid(final FieldName fieldName, final boolean invalid)
121  {
122    final JLabel label = getLabel(fieldName);
123    if (label != null)
124    {
125      final UIFactory.TextStyle style;
126
127      if (fieldName != FieldName.DIRECTORY_BASE_DN)
128      {
129        style = invalid ? UIFactory.TextStyle.SECONDARY_FIELD_INVALID : UIFactory.TextStyle.SECONDARY_FIELD_VALID;
130      }
131      else
132      {
133        style = invalid ? UIFactory.TextStyle.PRIMARY_FIELD_INVALID : UIFactory.TextStyle.PRIMARY_FIELD_VALID;
134      }
135
136      UIFactory.setTextStyle(label, style);
137    }
138  }
139
140  @Override
141  protected Component createInputPanel()
142  {
143    JPanel panel = new JPanel(new GridBagLayout());
144    panel.setOpaque(false);
145
146    GridBagConstraints gbc = new GridBagConstraints();
147    // Add the server location widgets
148    addBackendTypeSection(panel, gbc);
149    addBaseDNSection(panel, gbc);
150
151    int h1 = getLabel(FieldName.DATA_OPTIONS).getPreferredSize().height;
152    int h2 = getRadioButton(NewSuffixOptions.Type.CREATE_BASE_ENTRY).getPreferredSize().height;
153    int additionalInset = Math.abs(h2 - h1) / 2;
154    gbc.gridwidth = GridBagConstraints.RELATIVE;
155    gbc.weightx = 0.0;
156    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD + additionalInset;
157    gbc.insets.left = 0;
158    gbc.anchor = GridBagConstraints.NORTHWEST;
159    panel.add(getLabel(FieldName.DATA_OPTIONS), gbc);
160
161    gbc.weightx = 1.0;
162    gbc.fill = GridBagConstraints.HORIZONTAL;
163    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
164    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
165    gbc.gridwidth = GridBagConstraints.REMAINDER;
166    panel.add(createRadioButtonPanel(), gbc);
167
168    addVerticalGlue(panel);
169
170    return panel;
171  }
172
173  private void addBackendTypeSection(final JPanel panel, final GridBagConstraints gbc)
174  {
175    gbc.gridwidth = GridBagConstraints.RELATIVE;
176    gbc.weightx = 0.0;
177    gbc.insets.top = 0;
178    gbc.insets.left = 0;
179    gbc.anchor = GridBagConstraints.WEST;
180    panel.add(getLabel(FieldName.BACKEND_TYPE), gbc);
181
182    JPanel auxPanel = new JPanel(new GridBagLayout());
183    auxPanel.setOpaque(false);
184    gbc.gridwidth = GridBagConstraints.RELATIVE;
185    gbc.insets = UIFactory.getEmptyInsets();
186    gbc.fill = GridBagConstraints.HORIZONTAL;
187    gbc.weightx = 0.0;
188    auxPanel.add(backendTypeComboBox, gbc);
189
190    gbc.gridwidth = GridBagConstraints.REMAINDER;
191    gbc.insets.left = UIFactory.LEFT_INSET_BROWSE;
192    gbc.weightx = 1.0;
193    gbc.fill = GridBagConstraints.HORIZONTAL;
194    auxPanel.add(Box.createHorizontalGlue(), gbc);
195
196    gbc.weightx = 1.0;
197    gbc.fill = GridBagConstraints.HORIZONTAL;
198    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
199    gbc.gridwidth = GridBagConstraints.REMAINDER;
200    panel.add(auxPanel, gbc);
201  }
202
203  private void addBaseDNSection(final JPanel panel, final GridBagConstraints gbc)
204  {
205    gbc.gridwidth = GridBagConstraints.RELATIVE;
206    gbc.weightx = 0.0;
207    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
208    gbc.insets.left = 0;
209    gbc.anchor = GridBagConstraints.WEST;
210    panel.add(getLabel(FieldName.DIRECTORY_BASE_DN), gbc);
211
212    final JPanel auxPanel = new JPanel(new GridBagLayout());
213    auxPanel.setOpaque(false);
214    gbc.weightx = 1.0;
215    gbc.fill = GridBagConstraints.HORIZONTAL;
216    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
217    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
218    gbc.gridwidth = GridBagConstraints.REMAINDER;
219    panel.add(auxPanel, gbc);
220
221    gbc.gridwidth = GridBagConstraints.RELATIVE;
222    gbc.insets = UIFactory.getEmptyInsets();
223    gbc.weightx = 0.0;
224    auxPanel.add(getField(FieldName.DIRECTORY_BASE_DN), gbc);
225
226    gbc.gridwidth = GridBagConstraints.REMAINDER;
227    gbc.weightx = 1.0;
228    gbc.fill = GridBagConstraints.HORIZONTAL;
229    auxPanel.add(Box.createHorizontalGlue(), gbc);
230
231    gbc.gridwidth = GridBagConstraints.RELATIVE;
232    gbc.weightx = 0.0;
233    gbc.insets.top = 0;
234    gbc.insets.left = 0;
235    gbc.anchor = GridBagConstraints.WEST;
236    panel.add(Box.createHorizontalGlue(), gbc);
237
238    gbc.insets.top = 3;
239    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
240    gbc.gridwidth = GridBagConstraints.REMAINDER;
241    final JLabel noBaseDNLabel = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, INFO_NO_BASE_DN_INLINE_HELP.get(),
242                                                      UIFactory.TextStyle.INLINE_HELP);
243    panel.add(noBaseDNLabel, gbc);
244  }
245
246  /**
247   * Returns and creates the radio buttons panel.
248   *
249   * @return the radio buttons panel.
250   */
251  private JPanel createRadioButtonPanel()
252  {
253    JPanel panel = new JPanel(new GridBagLayout());
254    GridBagConstraints gbc = new GridBagConstraints();
255    panel.setOpaque(false);
256
257    gbc.gridwidth = GridBagConstraints.REMAINDER;
258    gbc.insets = UIFactory.getEmptyInsets();
259    gbc.weightx = 1.0;
260    gbc.fill = GridBagConstraints.HORIZONTAL;
261    panel.add(getRadioButton(NewSuffixOptions.Type.LEAVE_DATABASE_EMPTY), gbc);
262    gbc.insets.top = UIFactory.TOP_INSET_RADIOBUTTON;
263    panel.add(getRadioButton(NewSuffixOptions.Type.CREATE_BASE_ENTRY), gbc);
264    panel.add(getRadioButton(NewSuffixOptions.Type.IMPORT_FROM_LDIF_FILE), gbc);
265
266    JPanel auxPanel = createBrowseButtonPanel(FieldName.LDIF_PATH, getLDIFBrowseButton());
267
268    gbc.insets = UIFactory.getEmptyInsets();
269    gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
270    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
271    panel.add(auxPanel, gbc);
272
273    gbc.insets.left = 0;
274    panel.add(getRadioButton(NewSuffixOptions.Type.IMPORT_AUTOMATICALLY_GENERATED_DATA), gbc);
275
276    auxPanel = createNumberEntriesPanel();
277
278    gbc.insets = UIFactory.getEmptyInsets();
279    gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
280    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
281    panel.add(auxPanel, gbc);
282
283    return panel;
284  }
285
286  /**
287   * Returns the number entries panel.
288   *
289   * @return the number entries panel.
290   */
291  private JPanel createNumberEntriesPanel()
292  {
293    JPanel panel;
294
295    GridBagConstraints gbc = new GridBagConstraints();
296
297    panel = new JPanel(new GridBagLayout());
298    panel.setOpaque(false);
299    gbc.gridwidth = 3;
300    gbc.insets = UIFactory.getEmptyInsets();
301    gbc.weightx = 0.0;
302    panel.add(getLabel(FieldName.NUMBER_ENTRIES), gbc);
303
304    gbc.gridwidth--;
305    gbc.weightx = 0.1;
306    gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
307    panel.add(getField(FieldName.NUMBER_ENTRIES), gbc);
308
309    gbc.gridwidth = GridBagConstraints.REMAINDER;
310    gbc.weightx = 1.0;
311    gbc.fill = GridBagConstraints.HORIZONTAL;
312    panel.add(Box.createHorizontalGlue(), gbc);
313
314    return panel;
315  }
316
317  /**
318   * Creates a panel with a field and a browse button.
319   *
320   * @param fieldName
321   *          the field name of the field.
322   * @param browseButton
323   *          the browse button.
324   * @return the created panel.
325   */
326  private JPanel createBrowseButtonPanel(FieldName fieldName, JButton browseButton)
327  {
328    return Utilities.createBrowseButtonPanel(getLabel(fieldName), getField(fieldName), browseButton);
329  }
330
331  @Override
332  protected LocalizableMessage getInstructions()
333  {
334    return INFO_DATA_OPTIONS_PANEL_INSTRUCTIONS.get();
335  }
336
337  @Override
338  protected LocalizableMessage getTitle()
339  {
340    return INFO_DATA_OPTIONS_PANEL_TITLE.get();
341  }
342
343  @Override
344  public void endDisplay()
345  {
346    if (lastFocusComponent != null)
347    {
348      lastFocusComponent.requestFocusInWindow();
349    }
350  }
351
352  /**
353   * Returns the default value for the provided field Name.
354   *
355   * @param fieldName
356   *          the field name for which we want to get the default value.
357   * @return the default value for the provided field Name.
358   */
359  private String getDefaultValue(FieldName fieldName)
360  {
361    final NewSuffixOptions suffixOptions = defaultUserData.getNewSuffixOptions();
362    switch (fieldName)
363    {
364    case DIRECTORY_BASE_DN:
365      return firstElementOrNull(suffixOptions.getBaseDns());
366
367    case LDIF_PATH:
368      return firstElementOrNull(suffixOptions.getLDIFPaths());
369
370    default:
371      throw new IllegalArgumentException("Unknown field name: " + fieldName);
372    }
373  }
374
375  private String firstElementOrNull(final List<String> list)
376  {
377    if (list != null && !list.isEmpty())
378    {
379      return list.get(0);
380    }
381
382    return null;
383  }
384
385  /** Creates the components and populates the Maps with them. */
386  private void populateComponentMaps()
387  {
388    final HashMap<FieldName, LabelFieldDescriptor> hm = new HashMap<>();
389
390    final LabelFieldDescriptor baseDNLabelDescriptor = new LabelFieldDescriptor(
391        INFO_BASE_DN_LABEL.get(), INFO_BASE_DN_TOOLTIP.get(), LabelFieldDescriptor.FieldType.TEXTFIELD,
392        LabelFieldDescriptor.LabelType.PRIMARY, UIFactory.DN_FIELD_SIZE);
393    hm.put(FieldName.DIRECTORY_BASE_DN, baseDNLabelDescriptor);
394
395    final LabelFieldDescriptor importPathLabelDescriptor = new LabelFieldDescriptor(
396        INFO_IMPORT_PATH_LABEL.get(), INFO_IMPORT_PATH_TOOLTIP.get(), LabelFieldDescriptor.FieldType.TEXTFIELD,
397        LabelFieldDescriptor.LabelType.SECONDARY, UIFactory.PATH_FIELD_SIZE);
398    hm.put(FieldName.LDIF_PATH, importPathLabelDescriptor);
399
400    final LabelFieldDescriptor entryNumberLabelDescriptor = new LabelFieldDescriptor(
401        INFO_NUMBER_ENTRIES_LABEL.get(), INFO_NUMBER_ENTRIES_TOOLTIP.get(), LabelFieldDescriptor.FieldType.TEXTFIELD,
402        LabelFieldDescriptor.LabelType.SECONDARY, UIFactory.NUMBER_ENTRIES_FIELD_SIZE);
403    hm.put(FieldName.NUMBER_ENTRIES, entryNumberLabelDescriptor);
404
405    for (final FieldName fieldName : hm.keySet())
406    {
407      final LabelFieldDescriptor desc = hm.get(fieldName);
408      final String defaultValue = fieldName == FieldName.NUMBER_ENTRIES ?
409                                            Integer.toString(defaultUserData.getNewSuffixOptions().getNumberEntries())
410                                          : getDefaultValue(fieldName);
411      final JTextComponent field = UIFactory.makeJTextComponent(desc, defaultValue);
412      final JLabel label = UIFactory.makeJLabel(desc);
413      label.setLabelFor(field);
414      hmFields.put(fieldName, field);
415      hmLabels.put(fieldName, label);
416    }
417
418    final JLabel dataLabel = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, INFO_DIRECTORY_DATA_LABEL.get(),
419                                                  UIFactory.TextStyle.PRIMARY_FIELD_VALID);
420    hmLabels.put(FieldName.DATA_OPTIONS, dataLabel);
421
422    final JLabel backendTypeLabel = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, INFO_BACKEND_TYPE_LABEL.get(),
423                                                         UIFactory.TextStyle.PRIMARY_FIELD_VALID);
424    hmLabels.put(FieldName.BACKEND_TYPE, backendTypeLabel);
425    createDirectoryDataChoiceRadioButton(dataLabel);
426    checkEnablingState();
427  }
428
429  private void createBackendTypeComboBox()
430  {
431    final BackendTypeHelper backendTypeHelper = new BackendTypeHelper();
432    backendTypeComboBox = new JComboBox<>(backendTypeHelper.getBackendTypeUIAdaptors());
433  }
434
435  private void createDirectoryDataChoiceRadioButton(final JLabel dataLabel)
436  {
437    final JRadioButton createBaseEntryRB = UIFactory.makeJRadioButton(
438        INFO_CREATE_BASE_ENTRY_LABEL.get(getDefaultValue(FieldName.DIRECTORY_BASE_DN)),
439        INFO_CREATE_BASE_ENTRY_TOOLTIP.get(),
440        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
441    hmRadioButtons.put(NewSuffixOptions.Type.CREATE_BASE_ENTRY, createBaseEntryRB);
442
443    final JRadioButton leaveDataBaseEmptyRB = UIFactory.makeJRadioButton(
444        INFO_LEAVE_DATABASE_EMPTY_LABEL.get(),
445        INFO_LEAVE_DATABASE_EMPTY_TOOLTIP.get(),
446        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
447    hmRadioButtons.put(NewSuffixOptions.Type.LEAVE_DATABASE_EMPTY, leaveDataBaseEmptyRB);
448    dataLabel.setLabelFor(leaveDataBaseEmptyRB);
449
450    final JRadioButton importFileDataRB = UIFactory.makeJRadioButton(
451        INFO_IMPORT_DATA_FROM_LDIF_LABEL.get(),
452        INFO_IMPORT_DATA_FROM_LDIF_TOOLTIP.get(),
453        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
454    hmRadioButtons.put(NewSuffixOptions.Type.IMPORT_FROM_LDIF_FILE, importFileDataRB);
455
456    final JRadioButton importGeneratedDataRB = UIFactory.makeJRadioButton(
457        INFO_IMPORT_AUTOMATICALLY_GENERATED_LABEL.get(),
458        INFO_IMPORT_AUTOMATICALLY_GENERATED_TOOLTIP.get(),
459        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
460    hmRadioButtons.put(NewSuffixOptions.Type.IMPORT_AUTOMATICALLY_GENERATED_DATA, importGeneratedDataRB);
461
462    final NewSuffixOptions.Type defaultType = defaultUserData.getNewSuffixOptions().getType();
463    final ButtonGroup buttonGroup = new ButtonGroup();
464    for (NewSuffixOptions.Type type : hmRadioButtons.keySet())
465    {
466      final JRadioButton radioButton = hmRadioButtons.get(type);
467      radioButton.setSelected(type == defaultType);
468      buttonGroup.add(radioButton);
469    }
470  }
471
472  private JButton getLDIFBrowseButton()
473  {
474    if (ldifBrowseButton == null)
475    {
476      ldifBrowseButton = UIFactory.makeJButton(INFO_BROWSE_BUTTON_LABEL.get(), INFO_BROWSE_BUTTON_TOOLTIP.get());
477
478      final BrowseActionListener listener = new BrowseActionListener(
479          getField(FieldName.LDIF_PATH), BrowseActionListener.BrowseType.OPEN_LDIF_FILE, getMainWindow());
480      ldifBrowseButton.addActionListener(listener);
481    }
482
483    return ldifBrowseButton;
484  }
485
486  /** Adds all the required document listeners to the fields. */
487  private void addDocumentListeners()
488  {
489    final DocumentListener docListener = new DocumentListener()
490    {
491      @Override
492      public void changedUpdate(DocumentEvent ev)
493      {
494        final LocalizableMessage newLabel =
495            INFO_CREATE_BASE_ENTRY_LABEL.get(getFieldValue(FieldName.DIRECTORY_BASE_DN));
496        getRadioButton(NewSuffixOptions.Type.CREATE_BASE_ENTRY).setText(newLabel.toString());
497      }
498
499      @Override
500      public void insertUpdate(DocumentEvent ev)
501      {
502        changedUpdate(ev);
503      }
504
505      @Override
506      public void removeUpdate(DocumentEvent ev)
507      {
508        changedUpdate(ev);
509      }
510    };
511
512    getField(FieldName.DIRECTORY_BASE_DN).getDocument().addDocumentListener(docListener);
513  }
514
515  /** Adds the required focus listeners to the fields. */
516  private void addFocusListeners()
517  {
518    final FocusListener focusListener = new FocusListener()
519    {
520      @Override
521      public void focusGained(FocusEvent e)
522      {
523        lastFocusComponent = e.getComponent();
524        if (lastFocusComponent == getField(FieldName.LDIF_PATH))
525        {
526          getRadioButton(NewSuffixOptions.Type.IMPORT_FROM_LDIF_FILE).setSelected(true);
527        }
528        else if (lastFocusComponent == getField(FieldName.NUMBER_ENTRIES))
529        {
530          getRadioButton(NewSuffixOptions.Type.IMPORT_AUTOMATICALLY_GENERATED_DATA).setSelected(true);
531        }
532      }
533
534      @Override
535      public void focusLost(FocusEvent e)
536      {
537      }
538    };
539
540    for (JTextComponent tf : hmFields.values())
541    {
542      tf.addFocusListener(focusListener);
543    }
544    for (JRadioButton rb : hmRadioButtons.values())
545    {
546      rb.addFocusListener(focusListener);
547    }
548    getLDIFBrowseButton().addFocusListener(focusListener);
549
550    lastFocusComponent = getField(FieldName.DIRECTORY_BASE_DN);
551  }
552
553  /** Adds the required focus listeners to the fields. */
554  private void addActionListeners()
555  {
556    final ActionListener l = new ActionListener()
557    {
558      @Override
559      public void actionPerformed(ActionEvent e)
560      {
561        checkEnablingState();
562      }
563    };
564
565    for (final JRadioButton radioButton : hmRadioButtons.values())
566    {
567      radioButton.addActionListener(l);
568    }
569  }
570
571  /** Enables/disables the fields. */
572  private void checkEnablingState()
573  {
574    boolean importLDIF = getRadioButton(NewSuffixOptions.Type.IMPORT_FROM_LDIF_FILE).isSelected();
575    boolean automaticData = getRadioButton(NewSuffixOptions.Type.IMPORT_AUTOMATICALLY_GENERATED_DATA).isSelected();
576
577    getField(FieldName.LDIF_PATH).setEnabled(importLDIF);
578    getLDIFBrowseButton().setEnabled(importLDIF);
579    getField(FieldName.NUMBER_ENTRIES).setEnabled(automaticData);
580
581    getLabel(FieldName.LDIF_PATH).setEnabled(importLDIF);
582    getLabel(FieldName.NUMBER_ENTRIES).setEnabled(automaticData);
583  }
584
585  private JLabel getLabel(FieldName fieldName)
586  {
587    return hmLabels.get(fieldName);
588  }
589
590  private JTextComponent getField(FieldName fieldName)
591  {
592    return hmFields.get(fieldName);
593  }
594
595  private JRadioButton getRadioButton(NewSuffixOptions.Type type)
596  {
597    return hmRadioButtons.get(type);
598  }
599}