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(); } }
public int compareTo(Object o) { int row1 = modelIndex; int row2 = ((Row) o).modelIndex; for (Iterator it = sortingColumns.iterator(); it.hasNext(); ) { Directive directive = (Directive) it.next(); int column = directive.column; Object o1 = tableModel.getValueAt(row1, column); Object o2 = tableModel.getValueAt(row2, column); int comparison = 0; // Define null less than everything, except null. if (o1 == null && o2 == null) { comparison = 0; } else if (o1 == null) { comparison = -1; } else if (o2 == null) { comparison = 1; } else { comparison = getComparator(column).compare(o1, o2); } if (comparison != 0) { return directive.direction == DESCENDING ? -comparison : comparison; } } return 0; }
private boolean calculateWithValidValues() { Iterator it = metaProperties.iterator(); while (it.hasNext()) { MetaProperty m = (MetaProperty) it.next(); if (m.hasValidValues()) return true; } return false; }
/** highlight a route (maybe to show it's in use...) */ public void highlightRoute(String src, String dst) { Iterator i = rows.iterator(); while (i.hasNext()) { Map temp = (Map) i.next(); if (temp.get("Address").equals(dst) && temp.get("Pivot").equals(src)) { temp.put("Active", Boolean.TRUE); } } }
/** show the meterpreter routes . :) */ public void setRoutes(Route[] routes) { Iterator i = rows.iterator(); while (i.hasNext()) { Map temp = (Map) i.next(); for (int x = 0; x < routes.length; x++) { Route r = routes[x]; if (r.shouldRoute(temp.get("Address") + "")) temp.put("Pivot", r.getGateway()); } } }
public void actionPerformed(ActionEvent e) { JMenuItem jmi = (JMenuItem) e.getSource(); Iterator marks = mediator.getMarkerModel().getMarkersWithLabel(jmi.getText()); if (marks.hasNext()) { ChronicleMarker marker = (ChronicleMarker) marks.next(); Instant to = marker.getWhen(); Instant from = mediator.getMajorMoment(); viper.api.impl.Util.shiftDescriptors(new Descriptor[] {desc}, from, to); } }
public void actionPerformed(ActionEvent e) { Iterator toInterp = Collections.singleton(desc).iterator(); JMenuItem jmi = (JMenuItem) e.getSource(); Iterator marks = mediator.getMarkerModel().getMarkersWithLabel(jmi.getText()); if (marks.hasNext()) { ChronicleMarker marker = (ChronicleMarker) marks.next(); Instant to = marker.getWhen(); Instant from = mediator.getMajorMoment(); mediator.getPropagator().interpolateDescriptors(toInterp, from, to); } }
/** * Loads the list of enabled and disabled encryption protocols with their priority. * * @param enabledEncryptionProtocols The list of enabled encryption protocol available for this * account. * @param disabledEncryptionProtocols The list of disabled encryption protocol available for this * account. */ private void loadEncryptionProtocols( Map<String, Integer> encryptionProtocols, Map<String, Boolean> encryptionProtocolStatus) { int nbEncryptionProtocols = ENCRYPTION_PROTOCOLS.length; String[] encryptions = new String[nbEncryptionProtocols]; boolean[] selectedEncryptions = new boolean[nbEncryptionProtocols]; // Load stored values. int prefixeLength = ProtocolProviderFactory.ENCRYPTION_PROTOCOL.length() + 1; String encryptionProtocolPropertyName; String name; int index; boolean enabled; Iterator<String> encryptionProtocolNames = encryptionProtocols.keySet().iterator(); while (encryptionProtocolNames.hasNext()) { encryptionProtocolPropertyName = encryptionProtocolNames.next(); index = encryptionProtocols.get(encryptionProtocolPropertyName); // If the property is set. if (index != -1) { name = encryptionProtocolPropertyName.substring(prefixeLength); if (isExistingEncryptionProtocol(name)) { enabled = encryptionProtocolStatus.get( ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS + "." + name); encryptions[index] = name; selectedEncryptions[index] = enabled; } } } // Load default values. String encryptionProtocol; boolean set; int j = 0; for (int i = 0; i < ENCRYPTION_PROTOCOLS.length; ++i) { encryptionProtocol = ENCRYPTION_PROTOCOLS[i]; // Specify a default value only if there is no specific value set. if (!encryptionProtocols.containsKey( ProtocolProviderFactory.ENCRYPTION_PROTOCOL + "." + encryptionProtocol)) { set = false; // Search for the first empty element. while (j < encryptions.length && !set) { if (encryptions[j] == null) { encryptions[j] = encryptionProtocol; // By default only ZRTP is set to true. selectedEncryptions[j] = encryptionProtocol.equals("ZRTP"); set = true; } ++j; } } } this.encryptionConfigurationTableModel.init(encryptions, selectedEncryptions); }
public void updateTableData() { // we need to get the stored filters Object[] row_data; rowData.removeAllElements(); for (Iterator it = m_filters.keySet().iterator(); it.hasNext(); ) { row_data = new Object[2]; row_data[0] = it.next(); row_data[1] = m_filters.get(row_data[0]); rowData.add(row_data); } fireTableDataChanged(); }
public PagoMulta(Integer id_multa) { try { initComponents(); setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(0); GestorMultas gm = new GestorMultas(); GestorAlquileres ga = new GestorAlquileres(); Multa existe = gm.buscarmultas(id_multa); jTextField1.setText(existe.getId_multa().toString()); jTextField2.setText(existe.getIdC().toString()); Integer numero = existe.getIdAlquiler(); String[] columnas = {"Cod_Pelicula", "Titulo"}; modelo.setColumnIdentifiers(columnas); Collection listaAlq = ga.listaPeliculasAlquiladas(numero); ArrayList peliculasAlq = (ArrayList) listaAlq; Iterator<Peliculas> it = peliculasAlq.iterator(); while (it.hasNext()) { Peliculas pel = it.next(); String cod_pelicula = pel.getCod_pelicula(); String titulo = pel.getTitulo(); Object[] fila = {cod_pelicula, titulo}; modelo.addRow(fila); } this.jTable1.setModel(modelo); this.jScrollPane1.setRowHeader(null); jTextField3.setText(filas().toString()); jLabel12.setText(existe.getFecha_vencimiento().toString()); CeViSy actual = new CeViSy(); jLabel13.setText(actual.calcfecha().toString()); jTextField6.setText(existe.getMonto_multa().toString()); } catch (DateAccessException e) { System.out.println(e); } }
private void resetMarks() { interpToMark.removeAll(); shiftToMark.removeAll(); Iterator marks = mediator.getMarkerModel().getLabels().iterator(); boolean hasMark = false; while (marks.hasNext()) { String mark = (String) marks.next(); if (!ChronicleViewer.CURR_FRAME_LABEL.equals(mark)) { JMenuItem mi = new JMenuItem(mark); mi.addActionListener(itmAction); interpToMark.add(mi); mi = new JMenuItem(mark); mi.addActionListener(stmAction); shiftToMark.add(mi); hasMark = true; } } shiftToMark.setEnabled(hasMark); interpToMark.setEnabled(hasMark); }
public void end() { final int[] selected = table.getSelectedRows(); model.clear(rows.size()); Iterator i = rows.iterator(); while (i.hasNext()) { model.addEntry((Map) i.next()); } rows.clear(); if (SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { model.fireListeners(); fixSelection(selected); } }); } else { model.fireListeners(); fixSelection(selected); } }