Example usage for javax.swing DefaultListModel DefaultListModel

List of usage examples for javax.swing DefaultListModel DefaultListModel

Introduction

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

Prototype

DefaultListModel

Source Link

Usage

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

public void loadMaterialFlowList(String producerID) throws Exception {
    LOG.debug("loadMaterialFlowList, start");
    DefaultListModel model;/*  w  ww .  j a v a  2 s  .c om*/
    if (theMaterialFlowList.getModel() instanceof DefaultListModel) {
        model = (DefaultListModel) theMaterialFlowList.getModel();
        model.clear();
    } else {
        model = new DefaultListModel();
    }
    LOG.debug("loadMaterialFlowList, Before create deposit");
    IDeposit deposit = applicationProperties.getApplicationData().getDeposit();
    LOG.debug("loadMaterialFlowList, After create deposit, before get list");
    ArrayList<MaterialFlow> flows = deposit.getMaterialFlows(producerID);
    LOG.debug("loadProducersList, After get list");
    for (MaterialFlow data : flows) {
        model.addElement(data);
    }
    theMaterialFlowList.setModel(model);
    LOG.debug("loadMaterialFlowList, start");
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

public void addUserHandlers(JList userList) {
    theUserList = userList;/*from   w w  w  .j a  va2  s  .c om*/
    DefaultListModel model = new DefaultListModel();
    theUserList.setModel(model);
    theUserList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
        public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            lstUsersValueChanged(evt);
        }
    });
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

public void addUserGroupHandlers(JLabel lblCleanupDirectory, JLabel lblDelay, JTextField txtCleanupDelay,
        JComboBox cmbCleanupType, JList lstCharacterTranslations, JComboBox cmbCharacterPosition,
        JTextField txtTranslateFrom, JTextField txtTranslateTo, JComboBox cmbUserGroupDesc) {
    theLblCleanupDirectory = lblCleanupDirectory;
    theLblDelay = lblDelay;//from   ww w . java  2s  .  c o  m
    theTxtCleanupDelay = txtCleanupDelay;
    theCmbCleanupType = cmbCleanupType;
    theLstCharacterTranslations = lstCharacterTranslations;
    theCmbCharacterPosition = cmbCharacterPosition;
    theTxtTranslateFrom = txtTranslateFrom;
    theTxtTranslateTo = txtTranslateTo;
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (UserGroupData.ECleanupType cleanupType : UserGroupData.ECleanupType.values()) {
        model.addElement(cleanupType);
    }
    theCmbCleanupType.setModel(model);
    theCmbCleanupType.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cmbCleanupTypeActionPerformed(evt);
        }
    });
    theCmbUserGroupDesc = cmbUserGroupDesc;
    model = new DefaultComboBoxModel();
    for (UserGroupData.UserGroupDesc userGroupDesc : UserGroupData.UserGroupDesc.values()) {
        model.addElement(userGroupDesc);
    }
    theCmbUserGroupDesc.setModel(model);
    theCmbCharacterPosition = cmbCharacterPosition;
    model = new DefaultComboBoxModel();
    for (UserGroupData.ECharacterPosition charPosition : UserGroupData.ECharacterPosition.values()) {
        model.addElement(charPosition);
    }
    theCmbCharacterPosition.setModel(model);
    DefaultListModel translationModel = new DefaultListModel();
    theLstCharacterTranslations.setModel(translationModel);
    loadTranslations();
    theLstCharacterTranslations.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            characterTranslationValueChanged(evt);
        }
    });
    theTxtTranslateFrom.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            userGroupCaretUpdate(evt);
        }
    });
    theTxtTranslateTo.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            userGroupCaretUpdate(evt);
        }
    });
    checkCleanupItems();
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

public void addSipStatusHandlers(JList sipList) {
    theSipList = sipList;/*w  w  w .java 2  s  .c  o  m*/
    DefaultListModel model = new DefaultListModel();
    theSipList.setModel(model);
    theSipList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            sipListValueChanged(evt);
        }
    });
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

public void addMetaDataHandlers(JList dataList, JComboBox dataTypeCombo, JPanel dataLookupFrame,
        JList dataTypeListItems, JList cmsMappingsList, JComboBox cmsFieldCombo, JList dnxTypeList,
        JList dnxDetailList, JList dcTypeList, JList dcXsiList, JList dcTermsTypeList, JTabbedPane dnxDcPane) {
    theDataList = dataList;/*  www .  jav a2  s .c o  m*/
    theDataList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dataListValueChanged(evt);
        }
    });
    theCmbDataType = dataTypeCombo;
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (EDataType dataType : EDataType.values()) {
        model.addElement(dataType);
    }
    theCmbDataType.setModel(model);
    theCmbDataType.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            cmbDataTypeActionPerformed(evt);
        }
    });
    theDataLookupFrame = dataLookupFrame;
    theDataLookupList = dataTypeListItems;
    DefaultListModel listModel = new DefaultListModel();
    theDataLookupList.setModel(listModel);
    theDataLookupList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dataLookupListValueChanged(evt);
        }
    });
    theCmsMappingsList = cmsMappingsList;
    listModel = new DefaultListModel();
    theCmsMappingsList.setModel(listModel);
    theCmsMappingsList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            cmsMappingListValueChanged(evt);
        }
    });
    theDnxTypeList = dnxTypeList;
    theDnxTypeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dnxTypeListValueChanged(evt);
        }
    });
    theCmsFieldCombo = cmsFieldCombo;
    tehDnxDetailList = dnxDetailList;
    tehDnxDetailList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dnxDetailListValueChanged(evt);
        }
    });
    theDcTypeList = dcTypeList;
    theDcTypeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dcTypeListValueChanged(evt);
        }
    });
    theDcXsiList = dcXsiList;
    theDcXsiList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dcXsiListValueChanged(evt);
        }
    });
    theDcTermsTypeList = dcTermsTypeList;
    theDcTermsTypeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dcTermsTypeListValueChanged(evt);
        }
    });
    theDnxDcPane = dnxDcPane;
    theDnxDcPane.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            tabDnxDcStateChanged(evt);
        }
    });
    try {
        loadDNXValues();
    } catch (Exception ex) {
        configuratorFrame.showError("Error loading DNX values", ex.getMessage());
    }
    loadDCValues();
    loadDCXsiValues();
    loadDCTermsValues();
    loadCMSFields();
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

private void cmbDataTypeActionPerformed(ActionEvent evt) {
    // I'm going to make an assumption that the controls have been set up
    // correctly/*from   ww w . ja va2  s . com*/
    // If they haven't then you're going to get an error.
    EDataType dataType = (EDataType) theCmbDataType.getSelectedItem();
    MetaDataTypeImpl data = (MetaDataTypeImpl) theDataList.getSelectedValue();
    data.setDataType(dataType);
    if (dataType.equals(EDataType.MultiSelect)) {
        MetaDataTypeImpl meta = (MetaDataTypeImpl) theDataList.getSelectedValue();
        DefaultListModel model = new DefaultListModel();
        if (meta.getListItems() != null) {
            for (MetaDataListValues value : meta.getListItems()) {
                model.addElement(value);
            }
        }
        theDataLookupList.setModel(model);
        theDataLookupFrame.setVisible(true);
    } else {
        theDataLookupFrame.setVisible(false);
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

private void loadMetaData() {
    DefaultListModel model = new DefaultListModel();
    for (IMetaDataTypeExtended meta : metaData) {
        model.addElement(meta);/*  w  w w .  ja va 2s .  c  o  m*/
    }
    theDataList.setModel(model);
    configuratorFrame.checkButtons();
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

private void loadDNXValues() throws Exception {
    DefaultListModel model = new DefaultListModel();
    ArrayList<String> parents = theAppProperties.getApplicationData().getDeposit(false).getDNXValues(null);
    for (String parent : parents) {
        model.addElement(parent);//from   w  w w.  j  a va2s.  c  om
    }
    theDnxTypeList.setModel(model);
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

private void loadDNXDetailValues() throws Exception {
    DefaultListModel model = new DefaultListModel();
    if (theDnxTypeList.getSelectedValue() != null) {
        MetaDataTypeImpl data = (MetaDataTypeImpl) theDataList.getSelectedValue();
        data.setDnxType((String) theDnxTypeList.getSelectedValue());
        String selectedValue = (String) theDnxTypeList.getSelectedValue();
        ArrayList<String> children = theAppProperties.getApplicationData().getDeposit(false)
                .getDNXValues(selectedValue);
        for (String child : children) {
            model.addElement(child);//from w  ww . j  av a2 s  .  co m
        }
    }
    tehDnxDetailList.setModel(model);
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

private void loadDCValues() {
    DefaultListModel model = new DefaultListModel();
    model.addElement("title");
    model.addElement("creator");
    model.addElement("subject");
    model.addElement("description");
    model.addElement("publisher");
    model.addElement("contributor");
    model.addElement("date");
    model.addElement("type");
    model.addElement("format");
    model.addElement("identifier");
    model.addElement("source");
    model.addElement("language");
    model.addElement("relation");
    model.addElement("coverage");
    model.addElement("rights");
    theDcTypeList.setModel(model);//from w  w w . ja  v a2 s  .  c  o m
}