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.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  ww w  .  ja  v a2  s . com*/
    }
    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 ww . j a  v  a2 s . c  om*/
}

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

private void loadDCXsiValues() {
    DefaultListModel model = new DefaultListModel();
    model.addElement("dcterms:URI");
    model.addElement("dcterms:ISBN");
    model.addElement("dcterms:ISMN");
    model.addElement("dcterms:ISSN");
    theDcXsiList.setModel(model);// w ww  .  j a va 2s. co  m
}

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

private void loadDCTermsValues() {
    DefaultListModel model = new DefaultListModel();
    model.addElement("bibliographicCitation");
    model.addElement("issued");
    model.addElement("available");
    model.addElement("isbn");
    model.addElement("issn");
    model.addElement("ismn");
    model.addElement("url");
    model.addElement("accrualPeriodicity");
    model.addElement("created");
    model.addElement("alternative");
    theDcTermsTypeList.setModel(model);/*ww w  .  j a  va  2s . c  om*/
}

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

public void addDataLookupItem(String value, String display) {
    int sortOrder = maxDataLookupSortOrder();
    MetaDataListValues newValue = MetaDataListValues.create(value, display, sortOrder);
    DefaultListModel model = (DefaultListModel) theDataLookupList.getModel();
    model.addElement(newValue);
    updateDataLookupValues();/*from  w w  w. java2  s.  c  o  m*/
}

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

public void addCmsMappingItem(String value) {
    if (theDataLookupList.getSelectedValue() == null) {
        configuratorFrame.showError(errorHeader, "No meta data selected");
        return;/*w w w  .  j  av  a2s  . co m*/
    }
    MetaDataListValues currentValue = (MetaDataListValues) theDataLookupList.getSelectedValue();
    currentValue.addCmsMapping(value);
    DefaultListModel model = (DefaultListModel) theCmsMappingsList.getModel();
    model.addElement(value);
}

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

public void loadCmsMappingData() {
    MetaDataListValues currentValue = (MetaDataListValues) theDataLookupList.getSelectedValue();
    DefaultListModel model = (DefaultListModel) theCmsMappingsList.getModel();
    model.clear();//  www.  ja  va2 s  . c  om
    if (currentValue != null) {
        for (String cmsMap : currentValue.getCmsMappings()) {
            model.addElement(cmsMap);
        }
    }
}

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

public void addCMSValueItem(String value) {
    DefaultListModel model = (DefaultListModel) theCmsMappingsList.getModel();
    model.addElement(value);
}

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

public void addNewItem() {
    MetaDataTypeImpl data = new MetaDataTypeImpl();
    data.setDataType(EDataType.Text);
    data.setDataFieldName("New item");
    data.setIsVisible(true);/*from w  ww.  j  a va  2  s.co m*/
    metaData.addMetaData(data);
    DefaultListModel model = (DefaultListModel) theDataList.getModel();
    model.addElement(data);
    theDataList.setSelectedIndex(model.size() - 1);
    setDirty(true);
}

From source file:ome.formats.importer.gui.HistoryDB.java

public DefaultListModel getBaseTableDataByDate(Date start, Date end) {
    ResultSet rs;/*from   w w w.ja va 2  s.  c  om*/
    try {
        rs = getQueryResults("SELECT * FROM import_table" + " WHERE date BETWEEN '" + sqlDateFormat.format(end)
                + "' AND '" + sqlDateFormat.format(start) + "'");

        String icon;
        DefaultListModel list = new DefaultListModel();
        for (; rs.next();) {
            if (rs.getString("status").equals("complete"))
                icon = "gfx/import_done_16.png";
            else
                icon = "gfx/warning_msg16.png";
            String dayString = day.format(rs.getObject("date"));
            String hourString = hour.format(rs.getObject("date"));

            if (day.format(new Date()).equals(dayString))
                dayString = "Today";

            if (day.format(getYesterday()).equals(dayString)) {
                dayString = "Yesterday";
            }

            ImportEntry entry = new ImportEntry(dayString + " " + hourString, icon, rs.getInt("uID"));
            list.addElement(entry);
        }
        return list;
    } catch (SQLException e) {
        String s = String.format("Error retrieving import list from %s to %s.", start.toString(),
                end.toString());
        log.error(s, e);
    }
    return null;
}