@Override public void loadValueFromXML(Element xmlElement) { PeakList[] currentDataPeakLists = MZmineCore.getProjectManager().getCurrentProject().getPeakLists(); PeakListsSelectionType selectionType; final String attrValue = xmlElement.getAttribute("type"); if (Strings.isNullOrEmpty(attrValue)) selectionType = PeakListsSelectionType.GUI_SELECTED_PEAKLISTS; else selectionType = PeakListsSelectionType.valueOf(xmlElement.getAttribute("type")); ArrayList<Object> newValues = new ArrayList<Object>(); NodeList items = xmlElement.getElementsByTagName("specific_peak_list"); for (int i = 0; i < items.getLength(); i++) { String itemString = items.item(i).getTextContent(); for (PeakList df : currentDataPeakLists) { if (df.getName().equals(itemString)) newValues.add(df); } } PeakList specificPeakLists[] = newValues.toArray(new PeakList[0]); String namePattern = null; items = xmlElement.getElementsByTagName("name_pattern"); for (int i = 0; i < items.getLength(); i++) { namePattern = items.item(i).getTextContent(); } this.value = new PeakListsSelection(); this.value.setSelectionType(selectionType); this.value.setSpecificPeakLists(specificPeakLists); this.value.setNamePattern(namePattern); }
/** Reloads peak lists from the project to the selector combo box */ void rebuildPeakListSelector() { logger.finest("Rebuilding the peak list selector"); PeakList selectedPeakList = (PeakList) peakListSelector.getSelectedItem(); PeakList currentPeakLists[] = MZmineCore.getProjectManager().getCurrentProject().getPeakLists(dataFile); peakListSelector.removeAllItems(); for (int i = currentPeakLists.length - 1; i >= 0; i--) { peakListSelector.addItem(currentPeakLists[i]); } if (selectedPeakList != null) peakListSelector.setSelectedItem(selectedPeakList); }