public void setSwingDataCollection(Collection<ICFSecurityISOCountryObj> value) { final String S_ProcName = "setSwingDataCollection"; swingDataCollection = value; if (swingDataCollection == null) { arrayOfISOCountry = new ICFSecurityISOCountryObj[0]; } else { int len = value.size(); arrayOfISOCountry = new ICFSecurityISOCountryObj[len]; Iterator<ICFSecurityISOCountryObj> iter = swingDataCollection.iterator(); int idx = 0; while (iter.hasNext() && (idx < len)) { arrayOfISOCountry[idx++] = iter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator did not fully populate the array copy"); } if (iter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator had left over items when done populating array copy"); } Arrays.sort(arrayOfISOCountry, compareISOCountryByQualName); } PickerTableModel tblDataModel = getDataModel(); if (tblDataModel != null) { tblDataModel.fireTableDataChanged(); } }
private int[] getElementsRows(final Collection<? extends Module> elements) { final int[] rows = new int[elements.size()]; int index = 0; for (final Module element : elements) { rows[index++] = myTableModel.getElementRow(element); } return rows; }
private int[] getElementsRows(final Collection<? extends T> elements) { final int[] rows = new int[elements.size()]; int index = 0; for (final T element : elements) { rows[index++] = myTable.convertRowIndexToView(myTableModel.getElementRow(element)); } return rows; }
public void selectElements(Collection<? extends Module> elements) { if (elements.size() == 0) { myTable.clearSelection(); return; } final int[] rows = getElementsRows(elements); TableUtil.selectRows(myTable, rows); TableUtil.scrollSelectionToVisible(myTable); myTable.requestFocus(); }
public Object getChild(Object parent, int index) { Collection c = null; if (parent instanceof IProject) { if (activeOnly()) c = CurrentProject.getTaskList().getActiveSubTasks(null, CurrentDate.get()); else c = CurrentProject.getTaskList().getTopLevelTasks(); } else { ITask t = (ITask) parent; if (activeOnly()) c = CurrentProject.getTaskList().getActiveSubTasks(t.getID(), CurrentDate.get()); else c = t.getSubTasks(); } Object array[] = c.toArray(); Arrays.sort(array, comparator); if (opposite) { return array[array.length - index - 1]; } return array[index]; }
protected void loadAirspacesFromPath(String path, Collection<Airspace> airspaces) { File file = ExampleUtil.saveResourceToTempFile(path, ".zip"); if (file == null) return; try { ZipFile zipFile = new ZipFile(file); ZipEntry entry = null; for (Enumeration<? extends ZipEntry> e = zipFile.entries(); e.hasMoreElements(); entry = e.nextElement()) { if (entry == null) continue; String name = WWIO.getFilename(entry.getName()); if (!(name.startsWith("gov.nasa.worldwind.render.airspaces") && name.endsWith(".xml"))) continue; String[] tokens = name.split("-"); try { Class c = Class.forName(tokens[0]); Airspace airspace = (Airspace) c.newInstance(); BufferedReader input = new BufferedReader(new InputStreamReader(zipFile.getInputStream(entry))); String s = input.readLine(); airspace.restoreState(s); airspaces.add(airspace); if (tokens.length >= 2) { airspace.setValue(AVKey.DISPLAY_NAME, tokens[1]); } } catch (Exception ex) { ex.printStackTrace(); } } } catch (IOException e) { e.printStackTrace(); } }