List of usage examples for javax.swing JDialog setVisible
public void setVisible(boolean b)
From source file:net.sf.jabref.util.Util.java
/** * Automatically add links for this set of entries, based on the globally stored list of external file types. The * entries are modified, and corresponding UndoEdit elements added to the NamedCompound given as argument. * Furthermore, all entries which are modified are added to the Set of entries given as an argument. * <p>/*from w ww . ja va2 s .c o m*/ * The entries' bibtex keys must have been set - entries lacking key are ignored. The operation is done in a new * thread, which is returned for the caller to wait for if needed. * * @param entries A collection of BibEntry objects to find links for. * @param ce A NamedCompound to add UndoEdit elements to. * @param changedEntries MODIFIED, optional. A Set of BibEntry objects to which all modified entries is added. * This is used for status output and debugging * @param singleTableModel UGLY HACK. The table model to insert links into. Already existing links are not * duplicated or removed. This parameter has to be null if entries.count() != 1. The hack has been * introduced as a bibtexentry does not (yet) support the function getListTableModel() and the * FileListEntryEditor editor holds an instance of that table model and does not reconstruct it after the * search has succeeded. * @param metaData The MetaData providing the relevant file directory, if any. * @param callback An ActionListener that is notified (on the event dispatch thread) when the search is finished. * The ActionEvent has id=0 if no new links were added, and id=1 if one or more links were added. This * parameter can be null, which means that no callback will be notified. * @param diag An instantiated modal JDialog which will be used to display the progress of the autosetting. This * parameter can be null, which means that no progress update will be shown. * @return the thread performing the autosetting */ public static Runnable autoSetLinks(final Collection<BibEntry> entries, final NamedCompound ce, final Set<BibEntry> changedEntries, final FileListTableModel singleTableModel, final MetaData metaData, final ActionListener callback, final JDialog diag) { final Collection<ExternalFileType> types = ExternalFileTypes.getInstance().getExternalFileTypeSelection(); if (diag != null) { final JProgressBar prog = new JProgressBar(JProgressBar.HORIZONTAL, 0, types.size() - 1); final JLabel label = new JLabel(Localization.lang("Searching for files")); prog.setIndeterminate(true); prog.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); diag.setTitle(Localization.lang("Autosetting links")); diag.getContentPane().add(prog, BorderLayout.CENTER); diag.getContentPane().add(label, BorderLayout.SOUTH); diag.pack(); diag.setLocationRelativeTo(diag.getParent()); } Runnable r = new Runnable() { @Override public void run() { // determine directories to search in List<File> dirs = new ArrayList<>(); List<String> dirsS = metaData.getFileDirectory(Globals.FILE_FIELD); for (String dirs1 : dirsS) { dirs.add(new File(dirs1)); } // determine extensions Collection<String> extensions = new ArrayList<>(); for (final ExternalFileType type : types) { extensions.add(type.getExtension()); } // Run the search operation: Map<BibEntry, List<File>> result; if (Globals.prefs.getBoolean(JabRefPreferences.AUTOLINK_USE_REG_EXP_SEARCH_KEY)) { String regExp = Globals.prefs.get(JabRefPreferences.REG_EXP_SEARCH_EXPRESSION_KEY); result = RegExpFileSearch.findFilesForSet(entries, extensions, dirs, regExp); } else { result = FileUtil.findAssociatedFiles(entries, extensions, dirs); } boolean foundAny = false; // Iterate over the entries: for (Entry<BibEntry, List<File>> entryFilePair : result.entrySet()) { FileListTableModel tableModel; String oldVal = entryFilePair.getKey().getField(Globals.FILE_FIELD); if (singleTableModel == null) { tableModel = new FileListTableModel(); if (oldVal != null) { tableModel.setContent(oldVal); } } else { assert entries.size() == 1; tableModel = singleTableModel; } List<File> files = entryFilePair.getValue(); for (File f : files) { f = FileUtil.shortenFileName(f, dirsS); boolean alreadyHas = false; //System.out.println("File: "+f.getPath()); for (int j = 0; j < tableModel.getRowCount(); j++) { FileListEntry existingEntry = tableModel.getEntry(j); //System.out.println("Comp: "+existingEntry.getLink()); if (new File(existingEntry.link).equals(f)) { alreadyHas = true; break; } } if (!alreadyHas) { foundAny = true; ExternalFileType type; Optional<String> extension = FileUtil.getFileExtension(f); if (extension.isPresent()) { type = ExternalFileTypes.getInstance().getExternalFileTypeByExt(extension.get()); } else { type = new UnknownExternalFileType(""); } FileListEntry flEntry = new FileListEntry(f.getName(), f.getPath(), type); tableModel.addEntry(tableModel.getRowCount(), flEntry); String newVal = tableModel.getStringRepresentation(); if (newVal.isEmpty()) { newVal = null; } if (ce != null) { // store undo information UndoableFieldChange change = new UndoableFieldChange(entryFilePair.getKey(), Globals.FILE_FIELD, oldVal, newVal); ce.addEdit(change); } // hack: if table model is given, do NOT modify entry if (singleTableModel == null) { entryFilePair.getKey().setField(Globals.FILE_FIELD, newVal); } if (changedEntries != null) { changedEntries.add(entryFilePair.getKey()); } } } } // handle callbacks and dialog // FIXME: The ID signals if action was successful :/ final int id = foundAny ? 1 : 0; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (diag != null) { diag.dispose(); } if (callback != null) { callback.actionPerformed(new ActionEvent(this, id, "")); } } }); } }; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // show dialog which will be hidden when the task is done if (diag != null) { diag.setVisible(true); } } }); return r; }
From source file:GUI.GUI_reporting.java
private void btnLancerStatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLancerStatActionPerformed // TODO add your handling code here: // faire la requete sql et ranger les variables aux bon endroits JDialog reponse = new JDialog(); DefaultPieDataset pieDataset = new DefaultPieDataset(); final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String text = ""; String Infox = ""; String Infoy = ""; switch (action) {//////////////////:Pie charts////////////////////////////////////// case 1:/*from ww w .j ava2s . c om*/ //set values pieDataset.setValue("de 700 1100", getEmployeParSalaire(1)); pieDataset.setValue("de 1100 1300", getEmployeParSalaire(2)); pieDataset.setValue("de 1300 1700", getEmployeParSalaire(3)); pieDataset.setValue("Plus de 1700", getEmployeParSalaire(4)); text = "Nombre d'employs par tranche de salaire"; break; case 2: //set values pieDataset.setValue("REA", getEmployeParService(1)); pieDataset.setValue("CHG", getEmployeParService(2)); pieDataset.setValue("CAR", getEmployeParService(3)); text = "Nombre d'employs par service"; break; case 3: //set values pieDataset.setValue("Anesthesiste", getEmployeParSpecialite(1)); pieDataset.setValue("Cardiologue", getEmployeParSpecialite(2)); pieDataset.setValue("Generaliste", getEmployeParSpecialite(3)); pieDataset.setValue("Orthopediste", getEmployeParSpecialite(4)); pieDataset.setValue("Pneumologue", getEmployeParSpecialite(5)); pieDataset.setValue("Radiologue", getEmployeParSpecialite(6)); pieDataset.setValue("Traumatologue", getEmployeParSpecialite(7)); text = "Nombre d'employs par spcialit"; break; case 4: //set values pieDataset.setValue("Jour", getEmployeRotation(1)); pieDataset.setValue("Nuit", getEmployeRotation(2)); text = "Nombre d'employs par rotation"; break; /// diagrammes en barre///////////////////////////// case 5: //dataset.addValue(WIDTH, WIDTH, action); final String REA = "Moyenne pour REA"; final String CHG = "Moyenne pour CHG"; final String CAR = "Moyenne pour CAR"; final String salaire = "salaire"; dataset.addValue(getSalaireParService(1), salaire, REA); dataset.addValue(getSalaireParService(2), salaire, CHG); dataset.addValue(getSalaireParService(3), salaire, CAR); Infox = "service"; Infoy = "salaire"; text = "Salaire moyen par service"; break; case 6: //set values final String malade = "Malade"; final String rea = "REA"; final String chg = "CHG"; final String car = "CAR"; dataset.addValue(getMaladeParService(1), malade, rea); dataset.addValue(getMaladeParService(2), malade, chg); dataset.addValue(getMaladeParService(3), malade, car); Infox = "Service"; Infoy = "Nombre de malades"; text = "Nombre de malade par service"; break; case 7: //set values final String MAAF = "MAAF"; final String MNAM = "MNAM"; final String LMDE = "LMDE"; final String MNH = "MNH"; final String MGEN = "MGEN"; final String MMA = "MMA"; final String CNAMTS = "CNAMTS"; final String CCVRP = "CCVRP"; final String MAS = "MAS"; final String AG2R = "AG2R"; final String MNFTC = "MNFTC"; final String MGSP = "MGSP"; final String salaire0 = "Mutuelle"; Infox = "Mutuelle"; Infoy = "Malades"; text = "Nombre de malades par mutuelle"; // / init dataset.addValue(getMaladeParMutuelle(1), salaire0, MAAF); dataset.addValue(getMaladeParMutuelle(2), salaire0, MNAM); dataset.addValue(getMaladeParMutuelle(3), salaire0, LMDE); dataset.addValue(getMaladeParMutuelle(4), salaire0, MNH); dataset.addValue(getMaladeParMutuelle(5), salaire0, MGEN); dataset.addValue(getMaladeParMutuelle(6), salaire0, MMA); dataset.addValue(getMaladeParMutuelle(7), salaire0, CNAMTS); dataset.addValue(getMaladeParMutuelle(8), salaire0, CCVRP); dataset.addValue(getMaladeParMutuelle(9), salaire0, MAS); dataset.addValue(getMaladeParMutuelle(10), salaire0, AG2R); dataset.addValue(getMaladeParMutuelle(11), salaire0, MNFTC); dataset.addValue(getMaladeParMutuelle(12), salaire0, MGSP); break; case 8: //set values final String malades = "Chambre"; final String reas = "REA"; final String chgs = "CHG"; final String cars = "CAR"; dataset.addValue(getChambreParService(1), malades, reas); dataset.addValue(getChambreParService(2), malades, chgs); dataset.addValue(getChambreParService(3), malades, cars); Infox = "Service"; Infoy = "Nombre de chambre"; text = "Nombre de chambre par service"; break; default: break; } // Piechart if (action > 0 && action < 5) { final JFreeChart pieChart = ChartFactory.createPieChart(text, pieDataset, true, false, false); final ChartPanel cPanel = new ChartPanel(pieChart); reponse.add(cPanel); reponse.pack(); //panelHistogramme.pack(); reponse.setVisible(true); } //Histogramme if (action > 4 && action < 11) { final JFreeChart barChart = ChartFactory.createBarChart(text, Infox, Infoy, dataset, PlotOrientation.VERTICAL, true, true, false); final ChartPanel cPanel = new ChartPanel(barChart); reponse.add(cPanel); reponse.pack(); //panelHistogramme.pack(); reponse.setVisible(true); } /* DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Valeur1", new Integer(27)); pieDataset.setValue("Valeur2", new Integer(10)); pieDataset.setValue("Valeur3", new Integer(50)); pieDataset.setValue("Valeur4", new Integer(5)); JFreeChart pieChart = ChartFactory.createPieChart("Test camembert",pieDataset, true, true, true); ChartPanel cPanel = new ChartPanel(pieChart); panelHistogramme.add(cPanel); */ }
From source file:com.marginallyclever.makelangelo.MainGUI.java
protected void AdjustSounds() { final JDialog driver = new JDialog(mainframe, translator.get("MenuSoundsTitle"), true); driver.setLayout(new GridBagLayout()); final JTextField sound_connect = new JTextField(prefs.get("sound_connect", ""), 32); final JTextField sound_disconnect = new JTextField(prefs.get("sound_disconnect", ""), 32); final JTextField sound_conversion_finished = new JTextField(prefs.get("sound_conversion_finished", ""), 32); final JTextField sound_drawing_finished = new JTextField(prefs.get("sound_drawing_finished", ""), 32); final JButton change_sound_connect = new JButton(translator.get("MenuSoundsConnect")); final JButton change_sound_disconnect = new JButton(translator.get("MenuSoundsDisconnect")); final JButton change_sound_conversion_finished = new JButton(translator.get("MenuSoundsFinishConvert")); final JButton change_sound_drawing_finished = new JButton(translator.get("MenuSoundsFinishDraw")); //final JCheckBox allow_metrics = new JCheckBox(String.valueOf("I want to add the distance drawn to the // total")); //allow_metrics.setSelected(allowMetrics); final JButton cancel = new JButton(translator.get("Cancel")); final JButton save = new JButton(translator.get("Save")); GridBagConstraints c = new GridBagConstraints(); //c.gridwidth=4; c.gridx=0; c.gridy=0; driver.add(allow_metrics,c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1;/*from www . j a v a2 s . c o m*/ c.gridx = 0; c.gridy = 3; driver.add(change_sound_connect, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = 3; driver.add(sound_connect, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = 4; driver.add(change_sound_disconnect, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = 4; driver.add(sound_disconnect, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = 5; driver.add(change_sound_conversion_finished, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = 5; driver.add(sound_conversion_finished, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = 6; driver.add(change_sound_drawing_finished, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = 6; driver.add(sound_drawing_finished, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 2; c.gridy = 12; driver.add(save, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 3; c.gridy = 12; driver.add(cancel, c); ActionListener driveButtons = new ActionListener() { public void actionPerformed(ActionEvent e) { Object subject = e.getSource(); if (subject == change_sound_connect) sound_connect.setText(SelectFile()); if (subject == change_sound_disconnect) sound_disconnect.setText(SelectFile()); if (subject == change_sound_conversion_finished) sound_conversion_finished.setText(SelectFile()); if (subject == change_sound_drawing_finished) sound_drawing_finished.setText(SelectFile()); if (subject == save) { //allowMetrics = allow_metrics.isSelected(); prefs.put("sound_connect", sound_connect.getText()); prefs.put("sound_disconnect", sound_disconnect.getText()); prefs.put("sound_conversion_finished", sound_conversion_finished.getText()); prefs.put("sound_drawing_finished", sound_drawing_finished.getText()); machineConfiguration.SaveConfig(); driver.dispose(); } if (subject == cancel) { driver.dispose(); } } }; change_sound_connect.addActionListener(driveButtons); change_sound_disconnect.addActionListener(driveButtons); change_sound_conversion_finished.addActionListener(driveButtons); change_sound_drawing_finished.addActionListener(driveButtons); save.addActionListener(driveButtons); cancel.addActionListener(driveButtons); driver.getRootPane().setDefaultButton(save); driver.pack(); driver.setVisible(true); }
From source file:com.marginallyclever.makelangelo.MainGUI.java
protected boolean ChooseImageConversionOptions(boolean isDXF) { final JDialog driver = new JDialog(mainframe, translator.get("ConversionOptions"), true); driver.setLayout(new GridBagLayout()); final String[] choices = machineConfiguration.getKnownMachineNames(); final JComboBox<String> machine_choice = new JComboBox<String>(choices); machine_choice.setSelectedIndex(machineConfiguration.getCurrentMachineIndex()); final JSlider input_paper_margin = new JSlider(JSlider.HORIZONTAL, 0, 50, 100 - (int) (machineConfiguration.paper_margin * 100)); input_paper_margin.setMajorTickSpacing(10); input_paper_margin.setMinorTickSpacing(5); input_paper_margin.setPaintTicks(false); input_paper_margin.setPaintLabels(true); //final JCheckBox allow_metrics = new JCheckBox(String.valueOf("I want to add the distance drawn to the // total")); //allow_metrics.setSelected(allowMetrics); final JCheckBox reverse_h = new JCheckBox(translator.get("FlipForGlass")); reverse_h.setSelected(machineConfiguration.reverseForGlass); final JButton cancel = new JButton(translator.get("Cancel")); final JButton save = new JButton(translator.get("Start")); String[] filter_names = new String[image_converters.size()]; Iterator<Filter> fit = image_converters.iterator(); int i = 0;//from w w w .ja v a 2 s . c o m while (fit.hasNext()) { Filter f = fit.next(); filter_names[i++] = f.GetName(); } final JComboBox<String> input_draw_style = new JComboBox<String>(filter_names); input_draw_style.setSelectedIndex(GetDrawStyle()); GridBagConstraints c = new GridBagConstraints(); //c.gridwidth=4; c.gridx=0; c.gridy=0; driver.add(allow_metrics,c); int y = 0; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("MenuLoadMachineConfig")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; c.gridx = 1; c.gridy = y++; driver.add(machine_choice, c); if (!isDXF) { c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("ConversionStyle")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_draw_style, c); } c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("PaperMargin")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_paper_margin, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 1; c.gridy = y++; driver.add(reverse_h, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 2; c.gridy = y; driver.add(save, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 3; c.gridy = y++; driver.add(cancel, c); startConvertingNow = false; ActionListener driveButtons = new ActionListener() { public void actionPerformed(ActionEvent e) { Object subject = e.getSource(); if (subject == save) { long new_uid = Long.parseLong(choices[machine_choice.getSelectedIndex()]); machineConfiguration.LoadConfig(new_uid); SetDrawStyle(input_draw_style.getSelectedIndex()); machineConfiguration.paper_margin = (100 - input_paper_margin.getValue()) * 0.01; machineConfiguration.reverseForGlass = reverse_h.isSelected(); machineConfiguration.SaveConfig(); // if we aren't connected, don't show the new if (connectionToRobot != null && !connectionToRobot.isRobotConfirmed()) { // Force update of graphics layout. previewPane.updateMachineConfig(); // update window title mainframe.setTitle( translator.get("TitlePrefix") + Long.toString(machineConfiguration.robot_uid) + translator.get("TitleNotConnected")); } startConvertingNow = true; driver.dispose(); } if (subject == cancel) { driver.dispose(); } } }; save.addActionListener(driveButtons); cancel.addActionListener(driveButtons); driver.getRootPane().setDefaultButton(save); driver.pack(); driver.setVisible(true); return startConvertingNow; }
From source file:interfaces.InterfazPrincipal.java
private void BotonBuscarClienteSaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonBuscarClienteSaldoActionPerformed String nombreCliente = nombreClienteBusquedaSaldo.getText(); //08-11-2014 listar clientes por nombre ControladorCliente controladorCliente = new ControladorCliente(); ArrayList<Cliente> listaClientes = new ArrayList<>(); if (nombreCliente.equals("")) { listaClientes = controladorCliente.obtenerClientes(); } else {/*from w w w. java 2 s .co m*/ listaClientes = controladorCliente.obtenerClientes(nombreCliente, 0); } //08-11-2014 Crear dialogo de bsqueda final JDialog dialogoEditar = new JDialog(this); dialogoEditar.setTitle("Buscar clientes"); dialogoEditar.setSize(300, 300); dialogoEditar.setResizable(false); JPanel panelDialogo = new JPanel(); panelDialogo.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; JLabel ediitarTextoPrincipalDialogo = new JLabel("Buscar cliente"); c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.insets = new Insets(10, 60, 10, 10); Font textoGrande = new Font("Arial", 1, 16); ediitarTextoPrincipalDialogo.setFont(textoGrande); panelDialogo.add(ediitarTextoPrincipalDialogo, c); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; c.insets = new Insets(10, 10, 10, 10); final JTable tablaDialogo = new JTable(); DefaultTableModel modeloTabla = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { //all cells false return false; } }; ; modeloTabla.addColumn("Identificacin"); modeloTabla.addColumn("Nombre"); //LLenar tabla for (int i = 0; i < listaClientes.size(); i++) { Object[] data = { "1", "2" }; data[0] = listaClientes.get(i).getCliente_id(); data[1] = listaClientes.get(i).getNombre(); modeloTabla.addRow(data); } tablaDialogo.setModel(modeloTabla); tablaDialogo.getColumn("Identificacin").setMinWidth(110); tablaDialogo.getColumn("Nombre").setMinWidth(110); tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll = new JScrollPane(tablaDialogo); scroll.setPreferredSize(new Dimension(220, 150)); panelDialogo.add(scroll, c); c.insets = new Insets(0, 0, 0, 10); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; JButton botonGuardarClienteDialogo = new JButton("Elegir"); panelDialogo.add(botonGuardarClienteDialogo, c); c.gridx = 1; c.gridy = 2; c.gridwidth = 1; JButton botonCerrarClienteDialogo = new JButton("Cancelar"); panelDialogo.add(botonCerrarClienteDialogo, c); dialogoEditar.add(panelDialogo); dialogoEditar.setVisible(true); botonCerrarClienteDialogo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialogoEditar.dispose(); } }); botonGuardarClienteDialogo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int row = tablaDialogo.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog(dialogoEditar, "Por favor seleccione una fila"); } else { Object identificacionCliente = tablaDialogo.getValueAt(row, 0); mostrarIdentificacionCliente.setText(String.valueOf(identificacionCliente)); String nombreClientePago = String.valueOf(tablaDialogo.getValueAt(row, 1)); //Limitar a 15 caracteres if (nombreClientePago.length() >= 15) { nombreClientePago = nombreClientePago.substring(0, 12); } textoPersonaSaldo.setText(nombreClientePago); DefaultTableModel modeloClientes = (DefaultTableModel) TablaDeSaldoClientes.getModel(); for (int i = 0; i < modeloClientes.getRowCount(); i++) { modeloClientes.removeRow(i); } modeloClientes.setRowCount(0); ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura(); //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506); ArrayList<String[]> flujosCliente = controladorFlujoFactura.getTodosFlujo_Factura( " where factura_id in (select factura_id from Factura where cliente_id = " + String.valueOf(identificacionCliente) + " and estado=\"fiado\") order by factura_id"); double pago = 0.0; for (int i = 0; i < flujosCliente.size(); i++) { String[] datos = flujosCliente.get(i); TablaDeSaldoClientes.setModel(modeloClientes); NumberFormat formatter = new DecimalFormat("#0"); String valorMovimiento = String.valueOf(formatter.format(Double.parseDouble(datos[4]))); Object[] rowData = { datos[1], datos[2], datos[3], valorMovimiento }; if (datos[2].equals("deuda")) { pago += Double.parseDouble(datos[4]); } else { pago -= Double.parseDouble(datos[4]); } modeloClientes.addRow(rowData); } TablaDeSaldoClientes.setModel(modeloClientes); NumberFormat formatter = new DecimalFormat("#0"); textoTotalDebe.setText(String.valueOf(formatter.format(pago))); dialogoEditar.dispose(); //Mostrar en table de clientes los datos botonRegistrarAbono.setEnabled(true); } } }); }
From source file:interfaces.InterfazPrincipal.java
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed String nombreCliente = nombreClienteReporteCliente.getText(); String identificacion = identificacionClienteCliente.getText(); try {// w w w .jav a2 s . c o m //08-11-2014 listar clientes por nombre ControladorCliente controladorCliente = new ControladorCliente(); ArrayList<Cliente> listaClientes = new ArrayList<Cliente>(); if (nombreCliente.equals("") && identificacion.equals("")) { listaClientes = controladorCliente.obtenerClientes(); } else { int identificacionNumerico = 0; if (!identificacion.equals("")) { identificacionNumerico = Integer.parseInt(identificacion); } listaClientes = controladorCliente.obtenerClientes(nombreCliente, identificacionNumerico); } //08-11-2014 Crear dialogo de bsqueda final JDialog dialogoEditar = new JDialog(this); dialogoEditar.setTitle("Buscar clientes"); dialogoEditar.setSize(300, 300); dialogoEditar.setResizable(false); JPanel panelDialogo = new JPanel(); panelDialogo.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; JLabel ediitarTextoPrincipalDialogo = new JLabel("Buscar cliente"); c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.insets = new Insets(10, 60, 10, 10); Font textoGrande = new Font("Arial", 1, 16); ediitarTextoPrincipalDialogo.setFont(textoGrande); panelDialogo.add(ediitarTextoPrincipalDialogo, c); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; c.insets = new Insets(10, 10, 10, 10); final JTable tablaDialogo = new JTable(); DefaultTableModel modeloTabla = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { //all cells false return false; } }; ; modeloTabla.addColumn("Identificacin"); modeloTabla.addColumn("Nombre"); //LLenar tabla for (int i = 0; i < listaClientes.size(); i++) { Object[] data = { "1", "2" }; data[0] = listaClientes.get(i).getCliente_id(); data[1] = listaClientes.get(i).getNombre(); modeloTabla.addRow(data); } tablaDialogo.setModel(modeloTabla); tablaDialogo.getColumn("Identificacin").setMinWidth(110); tablaDialogo.getColumn("Nombre").setMinWidth(110); tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll = new JScrollPane(tablaDialogo); scroll.setPreferredSize(new Dimension(220, 150)); panelDialogo.add(scroll, c); c.insets = new Insets(0, 0, 0, 10); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; JButton botonGuardarClienteDialogo = new JButton("Elegir"); panelDialogo.add(botonGuardarClienteDialogo, c); c.gridx = 1; c.gridy = 2; c.gridwidth = 1; JButton botonCerrarClienteDialogo = new JButton("Cancelar"); panelDialogo.add(botonCerrarClienteDialogo, c); dialogoEditar.add(panelDialogo); dialogoEditar.setVisible(true); botonCerrarClienteDialogo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialogoEditar.dispose(); } }); botonGuardarClienteDialogo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int row = tablaDialogo.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog(dialogoEditar, "Por favor seleccione una fila"); } else { Object identificacionCliente = tablaDialogo.getValueAt(row, 0); jTextFieldIdentificacionClienteReporte.setText(String.valueOf(identificacionCliente)); botonGenerarReporteCliente.setEnabled(true); dialogoEditar.dispose(); } } }); // TODO add your handling code here: } catch (Exception e) { JOptionPane.showMessageDialog(this, "El valor de la identificacin de ser numrico"); } }
From source file:interfaces.InterfazPrincipal.java
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed // TODO add your handling code here: String nombre = jTextFieldNombreSaldoProveedores.getText(); ControladorProveedores controladorProveedores = new ControladorProveedores(); ArrayList<Proveedores> listaProveedores = controladorProveedores.obtenerProveedores("", nombre); final JDialog dialogoEditar = new JDialog(this); dialogoEditar.setTitle("Buscar proveedores"); dialogoEditar.setSize(500, 300);//from w ww . ja v a 2 s . c o m dialogoEditar.setResizable(false); JPanel panelDialogo = new JPanel(); panelDialogo.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; JLabel ediitarTextoPrincipalDialogo = new JLabel("Buscar Proveedores"); c.gridx = 0; c.gridy = 0; c.gridwidth = 3; c.insets = new Insets(10, 60, 10, 10); Font textoGrande = new Font("Arial", 1, 16); ediitarTextoPrincipalDialogo.setFont(textoGrande); panelDialogo.add(ediitarTextoPrincipalDialogo, c); c.gridx = 0; c.gridy = 1; c.gridwidth = 3; c.insets = new Insets(10, 10, 10, 10); final JTable tablaDialogo = new JTable(); DefaultTableModel modeloTabla = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { //all cells false return false; } }; ; modeloTabla.addColumn("ID"); modeloTabla.addColumn("Identificacin"); modeloTabla.addColumn("Nombre"); //LLenar tabla for (int i = 0; i < listaProveedores.size(); i++) { Object[] data = { "1", "2", "3" }; data[0] = listaProveedores.get(i).getID(); data[1] = listaProveedores.get(i).getIdentificacion(); data[2] = listaProveedores.get(i).getNombre(); System.out.println("Nombre!!" + data[2]); modeloTabla.addRow(data); } tablaDialogo.setModel(modeloTabla); tablaDialogo.getColumn("ID").setMinWidth(70); tablaDialogo.getColumn("Identificacin").setMinWidth(60); tablaDialogo.getColumn("Nombre").setMinWidth(150); tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll = new JScrollPane(tablaDialogo); scroll.setPreferredSize(new Dimension(220, 150)); panelDialogo.add(scroll, c); c.insets = new Insets(0, 0, 0, 10); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; JButton botonGuardarClienteDialogo = new JButton("Elegir"); panelDialogo.add(botonGuardarClienteDialogo, c); c.gridx = 1; c.gridy = 2; c.gridwidth = 1; JButton botonCerrarClienteDialogo = new JButton("Cancelar"); panelDialogo.add(botonCerrarClienteDialogo, c); dialogoEditar.add(panelDialogo); dialogoEditar.setVisible(true); botonCerrarClienteDialogo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialogoEditar.dispose(); } }); botonGuardarClienteDialogo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int row = tablaDialogo.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog(dialogoEditar, "Por favor seleccione una fila"); } else { Object identificacionCliente = tablaDialogo.getValueAt(row, 0); Object idCliente = tablaDialogo.getValueAt(row, 1); mostrarIDProveedor.setText(String.valueOf(identificacionCliente)); String nombreClientePago = String.valueOf(tablaDialogo.getValueAt(row, 2)); //Limitar a 15 caracteres if (nombreClientePago.length() >= 15) { nombreClientePago = nombreClientePago.substring(0, 12); } textoNombreProveedor.setText(nombreClientePago); DefaultTableModel modeloClientes = (DefaultTableModel) TablaDeSaldoProveedor.getModel(); for (int i = 0; i < modeloClientes.getRowCount(); i++) { modeloClientes.removeRow(i); } modeloClientes.setRowCount(0); ControladorFlujoCompras controladorFlujoCompra = new ControladorFlujoCompras(); //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506); ArrayList<Flujo_Compra> flujosProveedor = controladorFlujoCompra.obtenerFlujosCompras( " where ID_CompraProveedor in (select ID_CompraProveedor from Compra_Proveedores where IDProveedor = " + String.valueOf(identificacionCliente) + ") order by ID_CompraProveedor"); double pago = 0.0; for (int i = 0; i < flujosProveedor.size(); i++) { Flujo_Compra datos = flujosProveedor.get(i); Object[] rowData = { datos.getID_CompraProveedor(), datos.getTipo_flujo(), datos.getFecha(), datos.getMonto() }; if (datos.getTipo_flujo().equals("deuda")) { pago += Double.parseDouble(datos.getMonto() + ""); } else { pago -= Double.parseDouble(datos.getMonto() + ""); } modeloClientes.addRow(rowData); } TablaDeSaldoProveedor.setModel(modeloClientes); deudaActualProveedor.setText(String.valueOf(pago)); dialogoEditar.dispose(); //Mostrar en table de clientes los datos botonRegistrarAbono.setEnabled(true); } } }); }
From source file:userinterface.graph.Histogram.java
/** * Generates the property dialog for a Histogram. Allows the user to select either a new or an exisitng Histogram * to plot data on/*from www . j a va 2 s .c o m*/ * * @param defaultSeriesName * @param handler instance of {@link GUIGraphHandler} * @param minVal the min value in data cache * @param maxVal the max value in data cache * @return Either a new instance of a Histogram or an old one depending on what the user selects */ public static Pair<Histogram, SeriesKey> showPropertiesDialog(String defaultSeriesName, GUIGraphHandler handler, double minVal, double maxVal) { // make sure that the probabilities are valid if (maxVal > 1.0) maxVal = 1.0; if (minVal < 0.0) minVal = 0.0; // set properties for the dialog JDialog dialog = new JDialog(GUIPrism.getGUI(), "Histogram properties", true); dialog.setLayout(new BorderLayout()); JPanel p1 = new JPanel(new FlowLayout()); p1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Number of buckets")); JPanel p2 = new JPanel(new FlowLayout()); p2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Series name")); JSpinner buckets = new JSpinner(new SpinnerNumberModel(10, 5, Integer.MAX_VALUE, 1)); buckets.setToolTipText("Select the number of buckets for this Histogram"); // provides the ability to select a new or an old histogram to plot the series on JTextField seriesName = new JTextField(defaultSeriesName); JRadioButton newSeries = new JRadioButton("New Histogram"); JRadioButton existing = new JRadioButton("Existing Histogram"); newSeries.setSelected(true); JPanel seriesSelectPanel = new JPanel(); seriesSelectPanel.setLayout(new BoxLayout(seriesSelectPanel, BoxLayout.Y_AXIS)); JPanel seriesTypeSelect = new JPanel(new FlowLayout()); JPanel seriesOptionsPanel = new JPanel(new FlowLayout()); seriesTypeSelect.add(newSeries); seriesTypeSelect.add(existing); JComboBox<String> seriesOptions = new JComboBox<>(); seriesOptionsPanel.add(seriesOptions); seriesSelectPanel.add(seriesTypeSelect); seriesSelectPanel.add(seriesOptionsPanel); seriesSelectPanel.setBorder(BorderFactory .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Add series to")); // provides ability to select the min/max range of the plot JLabel minValsLabel = new JLabel("Min range:"); JSpinner minVals = new JSpinner(new SpinnerNumberModel(0.0, 0.0, minVal, 0.01)); minVals.setToolTipText("Does not allow value more than the min value in the probabilities"); JLabel maxValsLabel = new JLabel("Max range:"); JSpinner maxVals = new JSpinner(new SpinnerNumberModel(1.0, maxVal, 1.0, 0.01)); maxVals.setToolTipText("Does not allow value less than the max value in the probabilities"); JPanel minMaxPanel = new JPanel(); minMaxPanel.setLayout(new BoxLayout(minMaxPanel, BoxLayout.X_AXIS)); JPanel leftValsPanel = new JPanel(new BorderLayout()); JPanel rightValsPanel = new JPanel(new BorderLayout()); minMaxPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Range")); leftValsPanel.add(minValsLabel, BorderLayout.WEST); leftValsPanel.add(minVals, BorderLayout.CENTER); rightValsPanel.add(maxValsLabel, BorderLayout.WEST); rightValsPanel.add(maxVals, BorderLayout.CENTER); minMaxPanel.add(leftValsPanel); minMaxPanel.add(rightValsPanel); // fill the old histograms in the property dialog boolean found = false; for (int i = 0; i < handler.getNumModels(); i++) { if (handler.getModel(i) instanceof Histogram) { seriesOptions.addItem(handler.getGraphName(i)); found = true; } } existing.setEnabled(found); seriesOptions.setEnabled(false); // the bottom panel JPanel options = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton ok = new JButton("Plot"); JButton cancel = new JButton("Cancel"); // bind keyboard keys to plot and cancel buttons to improve usability ok.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ok"); ok.getActionMap().put("ok", new AbstractAction() { private static final long serialVersionUID = -7324877661936685228L; @Override public void actionPerformed(ActionEvent e) { ok.doClick(); } }); cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "ok"); cancel.getActionMap().put("ok", new AbstractAction() { private static final long serialVersionUID = 2642213543774356676L; @Override public void actionPerformed(ActionEvent e) { cancel.doClick(); } }); //Action listener for the new series radio button newSeries.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (newSeries.isSelected()) { existing.setSelected(false); seriesOptions.setEnabled(false); buckets.setEnabled(true); buckets.setToolTipText("Select the number of buckets for this Histogram"); minVals.setEnabled(true); maxVals.setEnabled(true); } } }); //Action listener for the existing series radio button existing.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (existing.isSelected()) { newSeries.setSelected(false); seriesOptions.setEnabled(true); buckets.setEnabled(false); minVals.setEnabled(false); maxVals.setEnabled(false); buckets.setToolTipText("Number of buckets can't be changed on an existing Histogram"); } } }); //Action listener for the plot button ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); if (newSeries.isSelected()) { hist = new Histogram(); hist.setNumOfBuckets((int) buckets.getValue()); hist.setIsNew(true); } else if (existing.isSelected()) { String HistName = (String) seriesOptions.getSelectedItem(); hist = (Histogram) handler.getModel(HistName); hist.setIsNew(false); } key = hist.addSeries(seriesName.getText()); if (minVals.isEnabled() && maxVals.isEnabled()) { hist.setMinProb((double) minVals.getValue()); hist.setMaxProb((double) maxVals.getValue()); } } }); //Action listener for the cancel button cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); hist = null; } }); dialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { hist = null; } }); p1.add(buckets, BorderLayout.CENTER); p2.add(seriesName, BorderLayout.CENTER); options.add(ok); options.add(cancel); // add everything to the main panel of the dialog JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(seriesSelectPanel); mainPanel.add(p1); mainPanel.add(p2); mainPanel.add(minMaxPanel); // add main panel to the dialog dialog.add(mainPanel, BorderLayout.CENTER); dialog.add(options, BorderLayout.SOUTH); // set dialog properties dialog.setSize(320, 290); dialog.setLocationRelativeTo(GUIPrism.getGUI()); dialog.setVisible(true); // return the user selected Histogram with the properties set return new Pair<Histogram, SeriesKey>(hist, key); }
From source file:interfaces.InterfazPrincipal.java
private void TablaDeFacturaProductoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeFacturaProductoMouseClicked final int fila = TablaDeFacturaProducto.getSelectedRow(); final DefaultTableModel modeloTabla = (DefaultTableModel) TablaDeFacturaProducto.getModel(); //int identificacion = (int) TablaDeFacturaProducto.getValueAt(fila, 0); // TODO add your handling code here: final JDialog dialogoEdicionProducto = new JDialog(this); dialogoEdicionProducto.setTitle("Editar producto"); dialogoEdicionProducto.setSize(250, 150); dialogoEdicionProducto.setResizable(false); JPanel panelDialogo = new JPanel(); panelDialogo.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; JLabel editarTextoPrincipalDialogo = new JLabel("Editar producto"); c.gridx = 0;// ww w.j a v a2 s . c om c.gridy = 0; c.gridwidth = 3; c.insets = new Insets(15, 40, 10, 0); Font textoGrande = new Font("Arial", 1, 18); editarTextoPrincipalDialogo.setFont(textoGrande); panelDialogo.add(editarTextoPrincipalDialogo, c); c.insets = new Insets(0, 0, 0, 0); c.gridwidth = 0; c.gridy = 1; c.gridx = 0; JLabel textoUnidades = new JLabel("Unidades"); panelDialogo.add(textoUnidades, c); c.gridy = 1; c.gridx = 1; c.gridwidth = 2; final JTextField valorUnidades = new JTextField(); valorUnidades.setText(String.valueOf(modeloTabla.getValueAt(fila, 4))); panelDialogo.add(valorUnidades, c); c.gridwidth = 1; c.gridy = 2; c.gridx = 0; JButton guardarCambios = new JButton("Guardar"); panelDialogo.add(guardarCambios, c); c.gridy = 2; c.gridx = 1; JButton eliminarProducto = new JButton("Eliminar"); panelDialogo.add(eliminarProducto, c); c.gridy = 2; c.gridx = 2; JButton botonCancelar = new JButton("Cerrar"); panelDialogo.add(botonCancelar, c); botonCancelar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialogoEdicionProducto.dispose(); } }); eliminarProducto.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { double precio = (double) modeloTabla.getValueAt(fila, 6); double precioActual = Double.parseDouble(valorActualFactura.getText()); precioActual -= precio; valorActualFactura.setText(String.valueOf(precioActual)); modeloTabla.removeRow(fila); dialogoEdicionProducto.dispose(); } }); guardarCambios.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { int numeroUnidades = Integer.parseInt(valorUnidades.getText()); modeloTabla.setValueAt(numeroUnidades, fila, 4); double precioARestar = (double) modeloTabla.getValueAt(fila, 6); double valorUnitario = Double.parseDouble((String) modeloTabla.getValueAt(fila, 5)); double precioNuevo = valorUnitario * numeroUnidades; modeloTabla.setValueAt(precioNuevo, fila, 6); double precioActual = Double.parseDouble(valorActualFactura.getText()); precioActual -= precioARestar; precioActual += precioNuevo; valorActualFactura.setText(String.valueOf(precioActual)); dialogoEdicionProducto.dispose(); } catch (Exception eve) { JOptionPane.showMessageDialog(dialogoEdicionProducto, "Por favor ingrese un valor numrico"); } } }); dialogoEdicionProducto.add(panelDialogo); dialogoEdicionProducto.setVisible(true); }
From source file:net.phyloviz.project.action.LoadDataSetAction.java
@Override public void actionPerformed(ActionEvent ae) { final JDialog dialog = createLoadingDialog(); EventQueue.invokeLater(new Runnable() { public void run() { Properties prop = new Properties(); String propFileName = "config.properties.pviz"; String projectDir = getProjectLocation(); File visualization = new File(projectDir, VIZ_FOLDER); try { InputStream inputStream = new FileInputStream(new File(projectDir, propFileName)); prop.load(inputStream);// w ww.j av a 2 s . c o m StatusDisplayer.getDefault().setStatusText("Loading DataSet..."); String dataSetName = prop.getProperty("dataset-name"); if (dataSetAlreadyOpened(dataSetName)) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "DataSet already opened!"); WindowManager.getDefault().findTopComponent("DataSetExplorerTopComponent").requestActive(); } else { String typingFactory = prop.getProperty("typing-factory"), typingFile = prop.getProperty("typing-file"), populationFactory = prop.getProperty("population-factory"), populationFile = prop.getProperty("population-file"), populationFK = prop.getProperty("population-foreign-key"), algorithmOutput = prop.getProperty("algorithm-output"), algorithmOutputFactory = prop.getProperty("algorithm-output-factory"), algorithmOutputDistanceProvider = prop.getProperty("algorithm-output-distance"), algorithmOutputLevel = prop.getProperty("algorithm-output-level"), visualizations = prop.getProperty("visualization"), vizfilter = prop.getProperty("visualization-filter"), vizpalette = prop.getProperty("visualization-palette"); String[] algoOutput = algorithmOutput != null ? algorithmOutput.split(",") : new String[] { "" }; String[] algoOutputFactory = algorithmOutputFactory != null ? algorithmOutputFactory.split(",") : new String[] { "" }; String[] algoOutputDistance = algorithmOutputDistanceProvider != null ? algorithmOutputDistanceProvider.split(",") : new String[] { "" }; String[] algoOutputLevel = algorithmOutputLevel != null ? algorithmOutputLevel.split(",") : new String[] { "" }; String[] viz = visualizations != null ? visualizations.split(",") : new String[] {}; if (dataSetName != null && (!dataSetName.equals(""))) { DataSet ds = new DataSet(dataSetName); StatusDisplayer.getDefault().setStatusText("Loading typing data..."); TypingFactory tf = null; TypingData<? extends AbstractProfile> td = null; Collection<? extends ProjectTypingDataFactory> tfLookup = (Lookup.getDefault() .lookupAll(ProjectTypingDataFactory.class)); for (ProjectTypingDataFactory ptdi : tfLookup) { if (ptdi.getClass().getName().equals(typingFactory)) { tf = (TypingFactory) ptdi; td = ptdi.onLoad(new FileReader(new File(projectDir, typingFile))); td.setDescription(tf.toString()); ds.add(ptdi); } } Population pop = null; if (populationFile != null && (!populationFile.equals("")) && populationFK != null) { StatusDisplayer.getDefault().setStatusText("Loading isolate data..."); pop = ((PopulationFactory) Class.forName(populationFactory).newInstance()) .loadPopulation(new FileReader(new File(projectDir, populationFile))); ds.add(pop); int key = Integer.parseInt(populationFK); StatusDisplayer.getDefault().setStatusText("Integrating data..."); td = tf.integrateData(td, pop, key); ds.setPopKey(key); } int v_i = 0; Collection<? extends ProjectItemFactory> pifactory = (Lookup.getDefault() .lookupAll(ProjectItemFactory.class)); for (int i = 0; i < algoOutput.length; i++) { for (ProjectItemFactory pif : pifactory) { String pifName = pif.getClass().getName(); if (pifName.equals(algoOutputFactory[i])) { Visualization v = new Visualization(); PersistentVisualization pv = null; if (viz.length > v_i && viz[v_i].split("\\.")[0].equals(algoOutput[i].split("\\.")[2])) { try (FileInputStream fileIn = new FileInputStream( new File(visualization, viz[v_i++]))) { try (ObjectInputStream in = new ObjectInputStream(fileIn)) { pv = (PersistentVisualization) in.readObject(); } } catch (IOException | ClassNotFoundException e) { Exceptions.printStackTrace(e); } v.pv = pv; if (vizfilter != null) { TreeFilter treefilter = loadTreeFilter(visualization, vizfilter); v.filter = treefilter.filter; DataModel dm = treefilter.datamodel .equals(TypingData.class.getCanonicalName()) ? td : pop; v.category = loadCategoryPalette(visualization, vizpalette, dm, v.filter); } } StatusDisplayer.getDefault().setStatusText("Loading algorithms..."); AbstractDistance ad = null; Collection<? extends DistanceProvider> dpLookup = (Lookup.getDefault() .lookupAll(DistanceProvider.class)); for (DistanceProvider dp : dpLookup) { if (dp.getClass().getCanonicalName().equals(algoOutputDistance[i])) { ad = dp.getDistance(td); } } ProjectItem pi = pif.loadData(ds, td, projectDir, algoOutput[i], ad, Integer.parseInt(algoOutputLevel[i])); if (pi != null) { pi.addVisualization(v); td.add(pi); } else { return; } } } } ds.add(td); Lookup.getDefault().lookup(DataSetTracker.class).add(ds); StatusDisplayer.getDefault().setStatusText("Dataset loaded."); WindowManager.getDefault().findTopComponent("DataSetExplorerTopComponent") .requestActive(); } else { Exceptions.printStackTrace(new IllegalArgumentException("DataSet name not found!")); } } } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | NumberFormatException e) { Exceptions.printStackTrace(e); } dialog.dispose(); } }); dialog.setVisible(true); }