Example usage for javax.swing DefaultListModel addElement

List of usage examples for javax.swing DefaultListModel addElement

Introduction

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

Prototype

public void addElement(E element) 

Source Link

Document

Adds the specified component to the end of this list.

Usage

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

public void loadMaterialFlowList(String producerID) throws Exception {
    LOG.debug("loadMaterialFlowList, start");
    DefaultListModel model;
    if (theMaterialFlowList.getModel() instanceof DefaultListModel) {
        model = (DefaultListModel) theMaterialFlowList.getModel();
        model.clear();//from w  w w  .j  a  v  a2s .c  om
    } 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.ManualDepositPresenter.java

public void filterProducerList(String theFilter) {
    if (producers == null || producers.isEmpty())
        return;/*from   www  .j av  a 2s . com*/
    DefaultListModel model = (DefaultListModel) theProducerList.getModel();
    //      Producer selectedProducer = null;
    //      if (theProducerList.getSelectedValue() != null) {
    //         selectedProducer = (Producer) theProducerList.getSelectedValue();
    //      }
    model.clear();
    for (Producer data : producers) {
        if (data.getDescription().toLowerCase().contains(theFilter.toLowerCase())) {
            model.addElement(data);
        }
    }
    //      if (selectedProducer != null) {
    //         theProducerList.setSelectedValue(selectedProducer, true);
    //      }
    //      
    //      theProducerList.setSelectedIndex(-1);
}

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

private void loadTranslations() {
    DefaultListModel translationModel = (DefaultListModel) theLstCharacterTranslations.getModel();
    translationModel.clear();//w  w  w. j  a va 2s. co  m
    if (userGroupData != null) {
        for (UserGroupData.CharacterTranslations translation : userGroupData.getCharacterTranslations()) {
            translationModel.addElement(translation);
        }
    }
    theTxtTranslateFrom.setText("");
    theTxtTranslateTo.setText("");
    theCmbCharacterPosition.setSelectedIndex(0);
}

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 .  j  a v a 2s. c  o m
    // 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);
    }/*from  www.  ja v a  2  s. c  o m*/
    theDataList.setModel(model);
    configuratorFrame.checkButtons();
}

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

private void loadSipData() throws Exception {
    if (theSipList == null) {
        return;//from w ww .ja va 2  s . c  o  m
    }
    sipStatusCollection = SIPStatusCollection.create(sipStatusConfigFile.getAbsolutePath());
    DefaultListModel model = (DefaultListModel) theSipList.getModel();
    model.clear();
    for (SIPStatus sipStatus : sipStatusCollection) {
        model.addElement(sipStatus);
    }
}

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

public void addSipStatus() {
    if (theSipList == null) {
        return;/*ww  w  . j ava2 s.c  o m*/
    }
    DefaultListModel model = (DefaultListModel) theSipList.getModel();
    SIPStatus status = SIPStatus.create("New SIP Status", "", false, false, false);
    model.addElement(status);
    theSipList.setSelectedIndex(model.getSize() - 1);
    if (sipStatusCollection == null) {
        sipStatusCollection = SIPStatusCollection.create();
    }
    sipStatusCollection.add(status);
    configuratorFrame.showSipStatus(status);
}

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

public void addUser() throws Exception {
    if (theUserList == null) {
        return;//from   w  w w . j a  v  a  2s.  co m
    }
    DefaultListModel model = (DefaultListModel) theUserList.getModel();
    IndigoUser user = IndigoUser.create("New User", "");
    model.addElement(user);
    theUserList.setSelectedIndex(model.getSize() - 1);
    if (userData == null) {
        userData = UserData.create("");
    }
    userData.addUser(user);
    configuratorFrame.showUser(user);
}

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

private void loadUsers() throws Exception {
    if (theUserList == null) {
        return;/* www . jav  a  2  s  .  c o m*/
    }
    userData = UserData.create(userConfigFile.getAbsolutePath(), false);
    DefaultListModel model = (DefaultListModel) theUserList.getModel();
    model.clear();
    for (IndigoUser user : userData) {
        model.addElement(user);
    }
}

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);
    }/* ww w.  ja  v  a  2s.  c om*/
    theDnxTypeList.setModel(model);
}