Example usage for javax.swing DefaultComboBoxModel removeAllElements

List of usage examples for javax.swing DefaultComboBoxModel removeAllElements

Introduction

In this page you can find the example usage for javax.swing DefaultComboBoxModel removeAllElements.

Prototype

public void removeAllElements() 

Source Link

Document

Empties the list.

Usage

From source file:au.org.ala.delta.editor.ui.ImageDetailsPanel.java

private void updateDisplay() {

    DefaultComboBoxModel model = (DefaultComboBoxModel) soundComboBox.getModel();
    model.removeAllElements();
    if (_selectedImage == null) {
        subjectTextPane.setText("");
        developerNotesTextPane.setText("");
        btnDisplay.setEnabled(false);//  w w  w  .ja va  2s .  c om
        btnDelete.setEnabled(false);
    } else {
        btnDisplay.setEnabled(true);
        btnDelete.setEnabled(true);
        List<ImageOverlay> overlays = _selectedImage.getOverlays();
        for (ImageOverlay overlay : overlays) {

            if (overlay.isType(OverlayType.OLSUBJECT)) {
                subjectTextPane.setText(overlay.overlayText);
            } else if (overlay.isType(OverlayType.OLCOMMENT)) {
                developerNotesTextPane.setText(overlay.overlayText);
            } else if (overlay.isType(OverlayType.OLSOUND)) {
                soundComboBox.addItem(overlay);
            }
        }
    }
    updateSoundActions();
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanel.java

/**
 * @param altView/*w w  w.  j a va2 s  . co  m*/
 */
protected void setDataIntoUI(final AltView altView) {
    ValComboBox cbx = (ValComboBox) formViewObj.getControlByName("defaultMode"); //$NON-NLS-1$
    DefaultComboBoxModel model = (DefaultComboBoxModel) cbx.getModel();
    model.removeAllElements();

    int cnt = 0;
    int inx = 0;
    for (AltViewIFace.CreationMode mode : AltViewIFace.CreationMode.values()) {
        model.addElement(mode);
        if (mode == altView.getMode()) {
            inx = cnt;
        }
        cnt++;
    }
    cbx.getComboBox().setSelectedIndex(inx);
}

From source file:edu.ku.brc.specify.utilapps.sp5utils.Sp5Forms.java

/**
 * /*  www.j  a  v  a2 s .  c  om*/
 */
protected void formSelected() {
    selectedForm = forms.get(formsTable.getSelectedRow());

    // Missing Fields List
    DefaultListModel model = (DefaultListModel) missingFieldsList.getModel();
    model.clear();
    for (FormFieldInfo fi : selectedForm.getFields()) {
        if (fi.getSp6FieldName() == null) {
            model.addElement(fi.getSp5FieldName());
        }
    }

    DefaultComboBoxModel cbxModel = (DefaultComboBoxModel) ((JComboBox) sp6FieldEditor.getComponent())
            .getModel();
    cbxModel.removeAllElements();
    cbxModel.addElement("");

    // Setup Sp6 Fields
    DBTableInfo tblInfo = selectedForm.getTblInfo();
    if (tblInfo != null) {
        for (DBFieldInfo fldInfo : tblInfo.getFields()) {
            if (StringUtils.isNotEmpty(fldInfo.getColumn())) {
                cbxModel.addElement(fldInfo.getColumn());
            }
        }
        for (DBRelationshipInfo relInfo : tblInfo.getRelationships()) {
            if (StringUtils.isNotEmpty(relInfo.getColName())) {
                cbxModel.addElement(relInfo.getColName());
            }
        }
    }

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            fieldsTableModel.setSelectedForm(selectedForm);
            fieldsTableModel.fireTableDataChanged();
        }
    });

}

From source file:edu.ku.brc.specify.datamodel.busrules.BaseTreeBusRules.java

/**
 * @param parentField// ww  w .  j  ava2 s .c o  m
 * @param rankComboBox
 * @param nodeInForm
 */
@SuppressWarnings("unchecked")
protected void adjustRankComboBoxModel(final GetSetValueIFace parentField, final ValComboBox rankComboBox,
        final T nodeInForm) {
    log.debug("Adjusting the model for the 'rank' combo box in a tree node form");
    if (nodeInForm == null) {
        return;
    }
    log.debug("nodeInForm = " + nodeInForm.getName());

    DefaultComboBoxModel<I> model = (DefaultComboBoxModel<I>) rankComboBox.getModel();
    model.removeAllElements();

    // this is the highest rank the edited item can possibly be
    I topItem = null;
    // this is the lowest rank the edited item can possibly be
    I bottomItem = null;

    Object value = parentField.getValue();
    T parent = null;
    if (value instanceof String) {
        // this happens when the combobox is in view mode, which means it's really a textfield
        // in that case, the parent of the node in the form will do, since the user can't change the parents
        parent = nodeInForm.getParent();
    } else {
        parent = (T) parentField.getValue();
    }

    if (parent == null) {
        return;
    }

    // grab all the def items from just below the parent's item all the way to the next enforced level
    // or to the level of the highest ranked child
    topItem = parent.getDefinitionItem().getChild();
    log.debug("highest valid tree level: " + topItem);

    if (topItem == null) {
        // this only happens if a parent was chosen that cannot have children b/c it is at the
        // lowest defined level in the tree
        log.warn("Chosen node cannot be a parent node.  It is at the lowest defined level of the tree.");
        return;
    }

    // find the child with the highest rank and set that child's def item as the bottom of the range
    if (!nodeInForm.getChildren().isEmpty()) {
        for (T child : nodeInForm.getChildren()) {
            if (bottomItem == null || child.getRankId() > bottomItem.getRankId()) {
                bottomItem = child.getDefinitionItem().getParent();
            }
        }
    }

    log.debug("lowest valid tree level:  " + bottomItem);

    I item = topItem;
    boolean done = false;
    while (!done) {
        model.addElement(item);

        if (item.getChild() == null || item.getIsEnforced() == Boolean.TRUE
                || (bottomItem != null && item.getRankId().intValue() == bottomItem.getRankId().intValue())) {
            done = true;
        }
        item = item.getChild();
    }

    if (nodeInForm.getDefinitionItem() != null) {
        I defItem = nodeInForm.getDefinitionItem();
        for (int i = 0; i < model.getSize(); ++i) {
            I modelItem = (I) model.getElementAt(i);
            if (modelItem.getRankId().equals(defItem.getRankId())) {
                log.debug("setting rank selected value to " + modelItem);
                model.setSelectedItem(modelItem);
            }
        }
        //            if (model.getIndexOf(defItem) != -1)
        //            {
        //                model.setSelectedItem(defItem);
        //            }
    } else if (model.getSize() == 1) {
        Object defItem = model.getElementAt(0);
        log.debug("setting rank selected value to the only available option: " + defItem);
        model.setSelectedItem(defItem);
    }
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * @param localeContainer// w  w w .  j  av  a 2  s  .co m
 */
protected void fillWithDate(final SpLocaleContainer localeContainer) {
    formatHash.clear();
    DefaultComboBoxModel cbxModel = (DefaultComboBoxModel) formatCombo.getModel();
    cbxModel.removeAllElements();

    DBFieldInfo precision = tableInfo.getFieldByName(fieldInfo.getName() + "Precision");
    if (precision != null) {
        cbxModel.addElement(getResourceString("SL_PARTIAL_DATE"));
    } else {
        cbxModel.addElement(getResourceString("SL_DATE"));
    }
    formatCombo.setSelectedIndex(0);
    formatCombo.setEnabled(false);
    formatMoreBtn.setEnabled(false);
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * @param webLinkDef// ww  w .ja v  a 2  s. c o  m
 */
protected void setSelectedWebLink(final WebLinkDef webLinkDef) {
    DefaultComboBoxModel model = (DefaultComboBoxModel) webLinkCombo.getModel();
    model.removeAllElements();

    model.addElement(webLinkDefNone);

    int fndInx = 0;
    int index = 0;
    for (WebLinkDef wld : webLinkMgrCache.getWebLinkDefs(null)) {
        model.addElement(wld);
        if (webLinkDef == wld) {
            setHasChanged(true);
            webLinkCombo.setSelectedIndex(index);
            fndInx = index;
            break;
        }
        index++;
    }

    if (fndInx > 0) {
        webLinkCombo.setSelectedItem(webLinkDef);
        setHasChanged(true);
    }
    webLinkCombo.setEnabled(webLinkCombo.getModel().getSize() > 1);
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * Fills the format Combobox with the available formatters.
 *///from ww w  .  j  a  va2 s  .c  o m
protected void fillWebLinkBox() {
    if (webLinkCombo != null) {
        DefaultComboBoxModel wlModel = (DefaultComboBoxModel) webLinkCombo.getModel();
        wlModel.removeAllElements();
        //if (wlModel.getSize() == 0)
        {
            wlModel.addElement(webLinkDefNone);
            for (WebLinkDef wld : webLinkMgrCache.getWebLinkDefs(null)) {
                wlModel.addElement(wld);
            }
        }

        //wbLnkCombo.setEnabled(false);
        webLinkMoreBtn.setEnabled(true);
        //wbLnkCombo.setEnabled(false);

        int selInx = webLinkCombo.getModel().getSize() > 0 ? 0 : -1;
        LocalizableItemIFace fld = getSelectedFieldItem();
        if (fld != null) {
            String webLinkName = fld.getWebLinkName();
            if (StringUtils.isNotEmpty(webLinkName)) {
                DefaultComboBoxModel model = (DefaultComboBoxModel) webLinkCombo.getModel();
                for (int i = 0; i < model.getSize(); i++) {
                    WebLinkDef wld = (WebLinkDef) model.getElementAt(i);
                    if (wld.getName().equals(webLinkName)) {
                        selInx = i;
                        break;
                    }
                }
            }
        }
        webLinkCombo.setSelectedIndex(selInx);
    }
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * @return//www.j  a va 2 s  .  c  om
 */
protected UIFieldFormatterIFace fillWithFieldFormatter(final UIFieldFormatterIFace formatter) {
    formatHash.clear();
    DefaultComboBoxModel cbxModel = (DefaultComboBoxModel) formatCombo.getModel();
    cbxModel.removeAllElements();

    cbxModel.addElement(SL_NONE); // Add None

    if (fieldInfo.getDataClass() == String.class || UIHelper.isClassNumeric(fieldInfo.getDataClass(), true)) {
        formatCombo.setEnabled(true);
        formatMoreBtn.setEnabled(true);
    }

    int selectedInx = 0; // default to 'None'

    UIFieldFormatterIFace selectedFmt = null;
    List<UIFieldFormatterIFace> fList = schemaPanel.getUiFieldFormatterMgrCache()
            .getFormatterList(tableInfo.getClassObj(), fieldInfo.getName());
    // list must be sorted in the same way it's sorted on UIFormatterDlg because selection index is considered equivalent between combo boxes
    Collections.sort(fList, new Comparator<UIFieldFormatterIFace>() {
        public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) {
            return o1.toPattern().compareTo(o2.toPattern());
        }
    });

    if (fList != null && fList.size() > 0) {
        for (UIFieldFormatterIFace fmt : fList) {
            log.debug("[" + (formatter != null ? formatter.getName() : "null") + "][" + fmt.getTitle() + "]");

            cbxModel.addElement(fmt);

            if (formatter != null && formatter.getName().equals(fmt.getName())) {
                selectedInx = cbxModel.getSize() - 1;
                selectedFmt = fmt;
            }
        }
    }

    // I think this should be moved to the AppContext and made generic as possible
    boolean enableFormatter = true;
    if (tableInfo.getTableId() == CollectionObject.getClassTableId()
            && fieldInfo.getName().equals("catalogNumber")) {
        Collection collection = AppContextMgr.getInstance().getClassObject(Collection.class);
        if (collection != null && collection.getNumberingSchemes().size() > 0) {
            enableFormatter = AppPreferences.getLocalPrefs().getBoolean("EDIT_CATNUM", false);
        }
    }

    boolean hasFormat = selectedInx > 0;
    webLinkCombo.setEnabled(hasFormat);

    formatCombo.setSelectedIndex(selectedInx);

    formatSwitcherCombo.setEnabled(enableFormatter && schemaType != SpLocaleContainer.WORKBENCH_SCHEMA);
    formatCombo.setEnabled(enableFormatter && schemaType != SpLocaleContainer.WORKBENCH_SCHEMA);
    formatMoreBtn.setEnabled(enableFormatter && schemaType != SpLocaleContainer.WORKBENCH_SCHEMA);

    return selectedFmt;
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * @param dspName/*from   w  w w .j a  va  2 s  .  c  om*/
 * @param fld
 */
protected void loadPickLists(final String dspName, final LocalizableItemIFace fld) {
    if (disciplineName == null || !dspName.equals(disciplineName)) {
        disciplineName = dspName;

        pickLists.clear();
        List<PickList> plList = localizableIO.getPickLists(null);
        if (plList != null) {
            pickLists.addAll(plList);
        }

        //for (PickList pl : pickLists) System.out.println("0: "+pl.getName());
        if (disciplineName != null) {
            plList = localizableIO.getPickLists(disciplineName);
            if (plList != null) {
                pickLists.addAll(plList);
            }
            //for (PickList pl : localizableIO.getPickLists(disciplineName)) System.out.println("1: "+pl.getName());
        }

        Collections.sort(pickLists);
    }

    if (pickLists != null) {
        DBRelationshipInfo.RelationshipType relType = relInfo != null ? relInfo.getType() : null;

        Class<?> typeCls = fieldInfo != null ? fieldInfo.getDataClass() : null;
        boolean isTypeOK = typeCls != null
                && (typeCls == String.class || UIHelper.isClassNumeric(typeCls, true));

        int selectedIndex = 0;
        DefaultComboBoxModel plCbxModel = (DefaultComboBoxModel) pickListCBX.getModel();

        if (isTypeOK) {
            plCbxModel.removeAllElements();
            plCbxModel.addElement(pickListNone);

            int inx = 1;
            for (PickList pl : pickLists) {
                if (pl.getType() == PickListIFace.PL_WITH_ITEMS
                        || pl.getType() == PickListIFace.PL_TABLE_FIELD) {
                    plCbxModel.addElement(pl);
                    String plName = fld.getPickListName();
                    if (selectedIndex == 0 && StringUtils.isNotEmpty(plName) && plName.equals(pl.getName())) {
                        selectedIndex = inx;
                    }
                    inx++;
                }
            }
        } else if (relType != null && relType == DBRelationshipInfo.RelationshipType.ManyToOne) {
            plCbxModel.removeAllElements();
            plCbxModel.addElement(pickListNone);
            int inx = 1;
            for (PickList pl : pickLists) {
                if (pl.getType() == PickListIFace.PL_WHOLE_TABLE) {
                    DBTableInfo tblInfo = DBTableIdMgr.getInstance().getInfoByTableName(pl.getTableName());
                    if (relInfo.getDataClass() == tblInfo.getClassObj()) {
                        plCbxModel.addElement(pl);
                        String plName = fld.getPickListName();
                        //System.out.println(plName+"  "+pl.getName());
                        if (StringUtils.isNotEmpty(plName) && plName.equals(pl.getName())) {
                            selectedIndex = inx;
                        }
                        inx++;
                    }
                }
            }
        }
        pickListCBX.setEnabled(isTypeOK || relType != null);
        pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? selectedIndex : -1);

    } else {
        pickListCBX.setEnabled(false);
    }
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * //from ww w.j a v a  2  s.c om
 */
public void buildUI() {
    setIgnoreChanges(true);

    fieldsList = createList(fieldsModel);

    fieldsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                getAllDataFromUI();
                fieldSelected();
            }
        }
    });

    fieldsList.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            super.focusLost(e);
            //lastIndex = fieldsList.getSelectedIndex();
        }
    });

    fieldDescText.addKeyListener(new LengthWatcher(255));
    // setting min and pref sizes to some bogus values so that textarea shrinks with dialog
    fieldNameText.addKeyListener(new LengthWatcher(64));

    CellConstraints cc = new CellConstraints();

    int y = 1;

    JScrollPane fldsp = UIHelper.createScrollPane(fieldsList);

    // LocalizableNameDescIFace
    PanelBuilder pb = new PanelBuilder(new FormLayout("max(200px;p),4px,p,2px,p,10px,p,2px,p,f:p:g",
            (includeHiddenUI ? "p,2px," : "") + (isDBSchema ? "p,2px,p,2px," : "")
                    + (includeFormatAndAutoNumUI ? "p,2px,p,2px," : "")
                    + "p,2px,p,2px,p,2px,p,2px,p,2px,p,2px,f:p:g"),
            this);

    pb.add(fldsp, cc.xywh(1, y, 1, 7 + (isDBSchema ? 4 : 0)));
    pb.add(fieldNameLbl = createI18NFormLabel("SL_LABEL", SwingConstants.RIGHT), cc.xy(3, y));
    pb.add(fieldNameText, cc.xywh(5, y, 6, 1));
    y += 2;

    if (includeHiddenUI) {
        pb.add(fieldHideChk, cc.xy(5, y));
        y += 2;
    }

    pb.add(fieldDescLbl = createI18NFormLabel("SL_DESC", SwingConstants.RIGHT), cc.xy(3, y));
    JScrollPane sp = new JScrollPane(fieldDescText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    pb.add(sp, cc.xywh(5, y, 6, 1));
    y += 2;
    fieldDescText.setLineWrap(true);
    fieldDescText.setWrapStyleWord(true);

    if (isDBSchema) {
        fieldTypeTxt = createLabel("");
        fieldLengthTxt = createLabel("");

        pb.add(fieldTypeLbl = createI18NFormLabel("SL_TYPE", SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(fieldTypeTxt, cc.xy(5, y));

        pb.add(fieldReqChk = createCheckBox(getResourceString("SL_REQ")), cc.xy(9, y));
        y += 2;

        pb.add(fieldLengthLbl = createI18NFormLabel("SL_LENGTH", SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(fieldLengthTxt, cc.xy(5, y));
        y += 2;

        fieldTypeTxt.setBackground(Color.WHITE);
        fieldLengthTxt.setBackground(Color.WHITE);
        fieldTypeTxt.setOpaque(true);
        fieldLengthTxt.setOpaque(true);
    }

    if (includeFormatAndAutoNumUI) {
        PanelBuilder inner = new PanelBuilder(new FormLayout("p,2px,p", "p"));

        formatSwitcherCombo = createComboBox();
        fmtCardLayout = new CardLayout();
        formatterPanel = new JPanel(fmtCardLayout);
        pb.add(formatLbl = createI18NFormLabel("SL_FMTTYPE", SwingConstants.RIGHT), cc.xy(3, y));

        inner.add(formatSwitcherCombo, cc.xy(1, 1));
        inner.add(formatterPanel, cc.xy(3, 1));

        pb.add(inner.getPanel(), cc.xywh(5, y, 6, 1));
        y += 2;

        ActionListener switchAL = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String item = (String) formatSwitcherCombo.getSelectedItem();
                if (item != null) {
                    fmtCardLayout.show(formatterPanel, item);
                    webLinkCombo.setEnabled(item.equals(SL_WEBLINK));

                    if (formatSwitcherCombo.getSelectedIndex() == 0) {
                        if (webLinkCombo.getModel().getSize() > 0) {
                            webLinkCombo.setSelectedIndex(0);
                        }
                        if (formatCombo.getModel().getSize() > 0) {
                            formatCombo.setSelectedIndex(0);
                        }
                        if (pickListCBX.getModel().getSize() > 0) {
                            pickListCBX.setSelectedIndex(0);
                        }
                    }
                }
            }
        };
        formatSwitcherCombo.addActionListener(switchAL);

        formatterPanel.add(SL_NONE, new JPanel());

        //--------------------------
        // UIFieldFormatter
        //--------------------------
        inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));

        formatCombo = createComboBox(new DefaultComboBoxModel());
        formatMoreBtn = createButton(ELIPSES);

        inner.add(formatCombo, cc.xy(1, 1));
        inner.add(formatMoreBtn, cc.xy(3, 1));

        formatMoreBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                UIFormatterListEdtDlg dlg = new UIFormatterListEdtDlg((Frame) UIRegistry.getTopWindow(),
                        fieldInfo, true, schemaPanel.getUiFieldFormatterMgrCache());
                dlg.setVisible(true);
                if (!dlg.isCancelled() && dlg.hasChanged()) {
                    //schemaPanel.setHasChanged(true);
                    formHasChanged();

                    //fillFormatBox(dlg.getSelectedFormat());
                    setSelectedFieldFormatter(dlg.getSelectedFormat());
                }
            }
        });

        formatterPanel.add(SL_FORMAT, inner.getPanel());

        ActionListener changed = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                formHasChanged();

                boolean hasFormat = formatCombo.getSelectedIndex() > 0;
                webLinkCombo.setEnabled(!hasFormat);
                if (hasFormat) {
                    webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1);
                    pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1);
                }
            }
        };
        formatCombo.addActionListener(changed);

        //--------------------------
        // WebLinks
        //--------------------------
        webLinkMoreBtn = createButton(ELIPSES);
        webLinkMoreBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                WebLinkDef selectedWL = (WebLinkDef) webLinkCombo.getSelectedItem();
                WebLinkConfigDlg dlg = webLinkMgrCache.editWebLinks(tableInfo, false);
                if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
                    fillWebLinkBox();

                    formHasChanged();

                    if (selectedWL != null && !selectedWL.getName().equals(SL_WEBLINK)) {
                        dlg.setWebLink(selectedWL.getName());
                    }
                    if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
                        setSelectedWebLink(dlg.getSelectedItem());
                    }
                }
            }
        });

        inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));
        webLinkCombo = createComboBox();
        DefaultComboBoxModel model = (DefaultComboBoxModel) webLinkCombo.getModel();
        model.addElement(webLinkDefNone);
        webLinkCombo.setSelectedIndex(0);

        inner.add(webLinkCombo, cc.xy(1, 1));
        inner.add(webLinkMoreBtn, cc.xy(3, 1));

        ActionListener wlchanged = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                formHasChanged();

                boolean hasWL = webLinkCombo.getSelectedIndex() > 0;
                webLinkCombo.setEnabled(hasWL);
                if (hasWL) {
                    formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1);
                    pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1);
                }
            }
        };
        webLinkCombo.addActionListener(wlchanged);

        formatterPanel.add(SL_WEBLINK, inner.getPanel());
    }

    //--------------------------
    // PickList
    //--------------------------

    pickListCBX = createComboBox(new DefaultComboBoxModel());
    pickListCBX.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            formHasChanged();
            if (formatCombo != null && pickListCBX.getSelectedIndex() > 0) {
                formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1);
                webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1);
            }
        }
    });
    pickListMoreBtn = createButton(ELIPSES);
    pickListMoreBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            LocalizableItemIFace currentField = prevField;
            prevField = getSelectedFieldItem();

            PickList selectedItem = (PickList) pickListCBX.getSelectedItem();

            PickListEditorDlg dlg = new PickListEditorDlg(
                    localizableIO.hasUpdatablePickLists() ? null : localizableIO, true, true);
            dlg.setTableInfo(tableInfo);
            dlg.setFieldInfo(fieldInfo);
            dlg.createUI();
            dlg.setSize(400, 500);
            dlg.setVisible(true);
            if (!dlg.isCancelled()) {
                if (dlg.hasChanged()) {
                    hasChanged = true;
                    Vector<PickList> list = dlg.getNewPickLists();
                    DefaultComboBoxModel plCbxModel = (DefaultComboBoxModel) pickListCBX.getModel();
                    for (int i = 0; i < plCbxModel.getSize(); i++) {
                        list.add((PickList) plCbxModel.getElementAt(i));
                    }
                    Collections.sort(list);
                    plCbxModel.removeAllElements();
                    plCbxModel.addElement(pickListNone);
                    int inx = -1;
                    int i = 0;
                    for (PickList pl : list) {
                        plCbxModel.addElement(pl);
                        if (inx == -1 && selectedItem != null
                                && ((selectedItem.getId() != null && pl.getId() != null
                                        && selectedItem.getId().equals(pl.getId()))
                                        || (selectedItem.getName() != null && pl.getName() != null
                                                && selectedItem.getName().equals(pl.getName())))) {
                            inx = i;
                        }
                        i++;
                    }
                    pickListCBX.setSelectedIndex(inx + 1);
                }
            }

            prevField = currentField;
        }
    });

    if (includeFormatAndAutoNumUI) {
        PanelBuilder inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));
        inner.add(pickListCBX, cc.xy(1, 1));
        inner.add(pickListMoreBtn, cc.xy(3, 1));

        formatterPanel.add(SL_PICKLIST, inner.getPanel());

    } else {
        pb.add(pickListLbl = createI18NFormLabel(SL_PICKLIST, SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(pickListCBX, cc.xy(5, y));
        pb.add(pickListMoreBtn, cc.xy(7, y));
        y += 2;
    }

    nxtBtn = createI18NButton("SL_NEXT");
    nxtEmptyBtn = createI18NButton("SL_NEXT_EMPTY");
    fldSpellChkBtn = createI18NButton("SL_SPELL_CHECK");

    //JPanel bbp = ButtonBarFactory.buildCenteredBar(adjustButtonArray(new JButton[] {nxtEmptyBtn, nxtBtn, fldSpellChkBtn}));
    //bbp.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    //pb.add(bbp,   cc.xywh(3, y, 8, 1));

    nxtBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            next();
        }
    });
    nxtEmptyBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            nextEmpty();
        }
    });

    fldSpellChkBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (checker != null) {
                checker.spellCheck(fieldDescText);
                checker.spellCheck(fieldNameText);
            }
        }

    });

    fieldHideChk.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            formHasChanged();
        }

    });

    fieldReqChk.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            formHasChanged();
        }

    });

    DocumentListener dl = new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            formHasChanged();
        }
    };

    fieldNameText.getDocument().addDocumentListener(dl);
    fieldDescText.getDocument().addDocumentListener(dl);
    /*        
            if (formatTxt != null)
            {
    formatTxt.getDocument().addDocumentListener(dl);
            }
    */
    SchemaI18NService.getInstance().checkCurrentLocaleMenu();

    enableUIControls(false);

    setIgnoreChanges(false);
}