List of usage examples for javax.swing DefaultComboBoxModel addElement
public void addElement(E anObject)
From source file:gdt.jgui.entity.query.JQueryPanel.java
private void initItemValueSelector() { DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); try {/* w w w. ja va2s. c o m*/ String element$ = (String) elementComboBox.getSelectedItem(); String field$ = (String) itemNameFieldComboBox.getSelectedItem(); String itemName$ = (String) itemNameComboBox.getSelectedItem(); Entigrator entigrator = console.getEntigrator(entihome$); String[] sa = select(); ArrayList<String> sl = new ArrayList<String>(); Sack entity; String[] ia; String value$; Core item; for (String s : sa) { entity = entigrator.getEntityAtKey(s); if (entity == null) continue; ia = entity.elementList(element$); if (ia != null) for (String i : ia) { value$ = null; item = entity.getElementItem(element$, i); if ("name".equals(field$) && itemName$.equals(item.name)) value$ = item.value; if ("type".equals(field$) && itemName$.equals(item.type)) value$ = item.value; if (value$ != null && !sl.contains(value$)) sl.add(value$); } } Collections.sort(sl); for (String s : sl) model.addElement(s); itemValueComboBox.setModel(model); } catch (Exception e) { Logger.getLogger(getClass().getName()).severe(e.toString()); itemValueComboBox.setModel(model); } }
From source file:neg.JRViewerFactura.java
/** This method is called from within the constructor to * initialize the form./*ww w . j av a2 s . c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; tlbToolBar = new javax.swing.JPanel(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); pnlSep01 = new javax.swing.JPanel(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); pnlSep02 = new javax.swing.JPanel(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); pnlSep03 = new javax.swing.JPanel(); btnZoomIn = new javax.swing.JButton(); btnZoomOut = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); } cmbZoom.setModel(model); jButton1 = new javax.swing.JButton(); jButtonMail = new javax.swing.JButton(); pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); pnlStatus = new javax.swing.JPanel(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); tlbToolBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnSave.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnSave.setMaximumSize(new java.awt.Dimension(23, 23)); btnSave.setMinimumSize(new java.awt.Dimension(23, 23)); btnSave.setPreferredSize(new java.awt.Dimension(23, 23)); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); tlbToolBar.add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrint.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrint.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrint.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); tlbToolBar.add(btnPrint); btnReload.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/reload.GIF"))); // NOI18N btnReload.setToolTipText(getBundleString("reload")); btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnReload.setMaximumSize(new java.awt.Dimension(23, 23)); btnReload.setMinimumSize(new java.awt.Dimension(23, 23)); btnReload.setPreferredSize(new java.awt.Dimension(23, 23)); tlbToolBar.add(btnReload); pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFirst.setMaximumSize(new java.awt.Dimension(23, 23)); btnFirst.setMinimumSize(new java.awt.Dimension(23, 23)); btnFirst.setPreferredSize(new java.awt.Dimension(23, 23)); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); tlbToolBar.add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); tlbToolBar.add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setMaximumSize(new java.awt.Dimension(23, 23)); btnNext.setMinimumSize(new java.awt.Dimension(23, 23)); btnNext.setPreferredSize(new java.awt.Dimension(23, 23)); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); tlbToolBar.add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnLast.setMaximumSize(new java.awt.Dimension(23, 23)); btnLast.setMinimumSize(new java.awt.Dimension(23, 23)); btnLast.setPreferredSize(new java.awt.Dimension(23, 23)); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); tlbToolBar.add(btnLast); txtGoTo.setToolTipText(getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); tlbToolBar.add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23)); btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23)); btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23)); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); tlbToolBar.add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); tlbToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); tlbToolBar.add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); tlbToolBar.add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); tlbToolBar.add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); tlbToolBar.add(cmbZoom); jButton1.setForeground(new java.awt.Color(255, 0, 0)); jButton1.setText("Cancelar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); tlbToolBar.add(jButton1); jButtonMail.setForeground(new java.awt.Color(255, 0, 0)); jButtonMail.setText("Mail"); jButtonMail.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonMailActionPerformed(evt); } }); tlbToolBar.add(jButtonMail); add(tlbToolBar, java.awt.BorderLayout.NORTH); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setBackground(java.awt.Color.gray); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setBackground(java.awt.Color.gray); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); add(pnlMain, java.awt.BorderLayout.CENTER); pnlStatus.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0)); lblStatus.setFont(new java.awt.Font("Dialog", 1, 10)); lblStatus.setText("Page i of n"); pnlStatus.add(lblStatus); add(pnlStatus, java.awt.BorderLayout.SOUTH); }
From source file:neg.JRViewerFactura.java
private void iniciarComponentes(final String nombre, final BeanCorreoCliente mail, int flag) { java.awt.GridBagConstraints gridBagConstraints; tlbToolBar = new javax.swing.JPanel(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); pnlSep01 = new javax.swing.JPanel(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); pnlSep02 = new javax.swing.JPanel(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); pnlSep03 = new javax.swing.JPanel(); btnZoomIn = new javax.swing.JButton(); btnZoomOut = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); }/*from w w w .j a va 2s . c om*/ cmbZoom.setModel(model); jButton1 = new javax.swing.JButton(); pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); pnlStatus = new javax.swing.JPanel(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); tlbToolBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnSave.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnSave.setMaximumSize(new java.awt.Dimension(23, 23)); btnSave.setMinimumSize(new java.awt.Dimension(23, 23)); btnSave.setPreferredSize(new java.awt.Dimension(23, 23)); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt, nombre); } }); tlbToolBar.add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrint.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrint.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrint.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); tlbToolBar.add(btnPrint); if (flag == 0) { btnReload.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/mail.gif"))); // NOI18N btnReload.setToolTipText("Email"); btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnReload.setMaximumSize(new java.awt.Dimension(23, 23)); btnReload.setMinimumSize(new java.awt.Dimension(23, 23)); btnReload.setPreferredSize(new java.awt.Dimension(23, 23)); btnReload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } private void btnReloadActionPerformed(ActionEvent evt) { Cliente finalCliente = new Cliente(); BeanCliente datosCl = new BeanCliente(); datosCl = finalCliente.getDatosFacturaCliente(finalCliente.getClienteID(mail.getCliente())); //Comprobamos si se tienen que enviar la factura por email o correo ordinario if (datosCl.getCorreo() == 1) { JLabel errorFields = new JLabel("Las facturas para el cliente " + datosCl.getNombre() + " se envan mediante correo ordinario "); JOptionPane.showMessageDialog(null, errorFields); } else { String query = "SELECT cc_nombre,cc_email FROM cc_contactos_cliente where cl_id =" + finalCliente.getClienteID(mail.getCliente()); CSDesktop.BuscaMailCliente = new JInternalFrame("Seleccionar Mail Cliente", true, false, false, true); // adjuntar panel al panel de contenido del marco interno CSSelectMailClienteFactura panel = new CSSelectMailClienteFactura(query, mail, nombre); CSDesktop.BuscaMailCliente.getContentPane().add(panel, BorderLayout.CENTER); // establecer tamao de marco interno en el tamao de su contenido CSDesktop.BuscaMailCliente.pack(); // adjuntar marco interno al escritorio y mostrarlo CSDesktop.elEscritorio.add(CSDesktop.BuscaMailCliente); CSDesktop.BuscaMailCliente.setLocation(150, 50); CSDesktop.BuscaMailCliente.setVisible(true); } } }); btnReload.setEnabled(true); tlbToolBar.add(btnReload); } pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFirst.setMaximumSize(new java.awt.Dimension(23, 23)); btnFirst.setMinimumSize(new java.awt.Dimension(23, 23)); btnFirst.setPreferredSize(new java.awt.Dimension(23, 23)); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); tlbToolBar.add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); tlbToolBar.add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setMaximumSize(new java.awt.Dimension(23, 23)); btnNext.setMinimumSize(new java.awt.Dimension(23, 23)); btnNext.setPreferredSize(new java.awt.Dimension(23, 23)); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); tlbToolBar.add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnLast.setMaximumSize(new java.awt.Dimension(23, 23)); btnLast.setMinimumSize(new java.awt.Dimension(23, 23)); btnLast.setPreferredSize(new java.awt.Dimension(23, 23)); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); tlbToolBar.add(btnLast); txtGoTo.setToolTipText(getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); tlbToolBar.add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23)); btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23)); btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23)); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); tlbToolBar.add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); tlbToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); tlbToolBar.add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); tlbToolBar.add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); tlbToolBar.add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); tlbToolBar.add(cmbZoom); jButton1.setForeground(new java.awt.Color(255, 0, 0)); jButton1.setText("Cancelar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); tlbToolBar.add(jButton1); add(tlbToolBar, java.awt.BorderLayout.NORTH); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setBackground(java.awt.Color.gray); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setBackground(java.awt.Color.gray); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); add(pnlMain, java.awt.BorderLayout.CENTER); pnlStatus.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0)); lblStatus.setFont(new java.awt.Font("Dialog", 1, 10)); lblStatus.setText("Page i of n"); pnlStatus.add(lblStatus); add(pnlStatus, java.awt.BorderLayout.SOUTH); }
From source file:neg.JRViewerInformeUnitario.java
/** This method is called from within the constructor to * initialize the form./* ww w .j a v a 2 s . co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; tlbToolBar = new javax.swing.JPanel(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); pnlSep01 = new javax.swing.JPanel(); btnExcel = new javax.swing.JButton(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); pnlSep02 = new javax.swing.JPanel(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); pnlSep03 = new javax.swing.JPanel(); btnZoomIn = new javax.swing.JButton(); btnZoomOut = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); } cmbZoom.setModel(model); jButton1 = new javax.swing.JButton(); pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); pnlStatus = new javax.swing.JPanel(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); tlbToolBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnSave.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnSave.setMaximumSize(new java.awt.Dimension(23, 23)); btnSave.setMinimumSize(new java.awt.Dimension(23, 23)); btnSave.setPreferredSize(new java.awt.Dimension(23, 23)); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); tlbToolBar.add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrint.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrint.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrint.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); tlbToolBar.add(btnPrint); btnReload.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/reload.GIF"))); // NOI18N btnReload.setToolTipText(getBundleString("reload")); btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnReload.setMaximumSize(new java.awt.Dimension(23, 23)); btnReload.setMinimumSize(new java.awt.Dimension(23, 23)); btnReload.setPreferredSize(new java.awt.Dimension(23, 23)); btnReload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); tlbToolBar.add(btnReload); pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); btnExcel.setToolTipText(getBundleString("print")); btnExcel.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnExcel.setMaximumSize(new java.awt.Dimension(23, 23)); btnExcel.setMinimumSize(new java.awt.Dimension(23, 23)); btnExcel.setPreferredSize(new java.awt.Dimension(23, 23)); btnExcel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnExcelActionPerformed(evt); } }); pnlSep01.add(btnExcel); tlbToolBar.add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFirst.setMaximumSize(new java.awt.Dimension(23, 23)); btnFirst.setMinimumSize(new java.awt.Dimension(23, 23)); btnFirst.setPreferredSize(new java.awt.Dimension(23, 23)); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); tlbToolBar.add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); tlbToolBar.add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setMaximumSize(new java.awt.Dimension(23, 23)); btnNext.setMinimumSize(new java.awt.Dimension(23, 23)); btnNext.setPreferredSize(new java.awt.Dimension(23, 23)); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); tlbToolBar.add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnLast.setMaximumSize(new java.awt.Dimension(23, 23)); btnLast.setMinimumSize(new java.awt.Dimension(23, 23)); btnLast.setPreferredSize(new java.awt.Dimension(23, 23)); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); tlbToolBar.add(btnLast); txtGoTo.setToolTipText(getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); tlbToolBar.add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23)); btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23)); btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23)); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); tlbToolBar.add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); tlbToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); tlbToolBar.add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); tlbToolBar.add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); tlbToolBar.add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); tlbToolBar.add(cmbZoom); jButton1.setForeground(new java.awt.Color(255, 0, 0)); jButton1.setText("Cancelar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); tlbToolBar.add(jButton1); add(tlbToolBar, java.awt.BorderLayout.NORTH); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); add(pnlMain, java.awt.BorderLayout.CENTER); pnlStatus.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0)); lblStatus.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblStatus.setText("Page i of n"); pnlStatus.add(lblStatus); add(pnlStatus, java.awt.BorderLayout.SOUTH); }
From source file:gtu._work.ui.ExecuteOpener.java
private void initGUI() { final SwingActionUtil swingUtil = SwingActionUtil.newInstance(this); ToolTipManager.sharedInstance().setInitialDelay(0); try {// ww w.j a v a 2 s . c o m { this.setTitle("execute browser"); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setPreferredSize(new java.awt.Dimension(870, 551)); this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("frame.mouseClicked", evt); } }); } { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1); jTabbedPane1.setPreferredSize(new java.awt.Dimension(384, 265)); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { swingUtil.invokeAction("jTabbedPane1.stateChanged", evt); } }); jTabbedPane1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("jTabbedPane1.mouseClicked", evt); } }); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("file list", null, jPanel1, null); { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jPanel1.add(jPanel4, BorderLayout.NORTH); jPanel4.setPreferredSize(new java.awt.Dimension(508, 81)); { jScrollPane1 = new JScrollPane(); jPanel4.add(jScrollPane1, BorderLayout.CENTER); { exeArea = new JTextArea(); jScrollPane1.setViewportView(exeArea); } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jPanel5.setLayout(jPanel5Layout); jPanel4.add(jPanel5, BorderLayout.EAST); jPanel5.setPreferredSize(new java.awt.Dimension(202, 81)); { addArea = new JButton(); jPanel5.add(addArea, BorderLayout.CENTER); addArea.setText("addArea"); addArea.setPreferredSize(new java.awt.Dimension(58, 30)); addArea.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("addArea.actionPerformed", evt); } }); } } { queryText = new JTextField(); jPanel4.add(queryText, BorderLayout.NORTH); queryText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { public void process(DocumentEvent event) { try { String query = JCommonUtil.getDocumentText(event); Pattern ptn = Pattern.compile(query); DefaultListModel model = new DefaultListModel(); for (Object key : prop.keySet()) { String val = key.toString(); if (val.contains(query)) { model.addElement(key); continue; } if (ptn.matcher(val).find()) { model.addElement(key); continue; } } execList.setModel(model); } catch (Exception ex) { } } })); } } { jPanel3 = new JPanel(); jPanel1.add(jPanel3, BorderLayout.CENTER); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jPanel3.setPreferredSize(new java.awt.Dimension(480, 220)); { jScrollPane2 = new JScrollPane(); jPanel3.add(jScrollPane2, BorderLayout.CENTER); { DefaultListModel execListModel = new DefaultListModel(); for (Object obj : prop.keySet()) { execListModel.addElement((String) obj); } execList = new JList(); jScrollPane2.setViewportView(execList); execList.setModel(execListModel); execList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("execList.keyPressed", evt); } }); execList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { swingUtil.invokeAction("execList.valueChanged", evt); } }); execList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("execList.mouseClicked", evt); } }); } } } { jPanel6 = new JPanel(); jPanel1.add(jPanel6, BorderLayout.SOUTH); jPanel6.setPreferredSize(new java.awt.Dimension(741, 47)); { saveList = new JButton(); jPanel6.add(saveList); saveList.setText("save list to default properties"); saveList.setPreferredSize(new java.awt.Dimension(227, 28)); saveList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("saveList.actionPerformed", evt); } }); } { clearExecList = new JButton(); jPanel6.add(clearExecList); clearExecList.setText("clear properties"); clearExecList.setPreferredSize(new java.awt.Dimension(170, 28)); clearExecList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("clearExecList.actionPerformed", evt); } }); } { reloadList = new JButton(); jPanel6.add(reloadList); reloadList.setText("reload list"); reloadList.setPreferredSize(new java.awt.Dimension(156, 28)); reloadList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("reloadList.actionPerformed", evt); } }); } { contentFilterBtn = new JButton(); jPanel6.add(contentFilterBtn); contentFilterBtn.setText("content filter"); contentFilterBtn.setPreferredSize(new java.awt.Dimension(176, 27)); contentFilterBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("contentFilterBtn.actionPerformed", evt); } }); } } } { jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jTabbedPane1.addTab("config", null, jPanel2, null); jPanel2.setPreferredSize(new java.awt.Dimension(573, 300)); jPanel2.setLayout(jPanel2Layout); { executeAll = new JButton(); jPanel2.add(executeAll); executeAll.setText("execute all files"); executeAll.setPreferredSize(new java.awt.Dimension(137, 27)); executeAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("execute.actionPerformed", evt); } }); } { browser = new JButton(); jPanel2.add(browser); browser.setText("add file"); browser.setPreferredSize(new java.awt.Dimension(140, 28)); browser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("browser.actionPerformed", evt); } }); } { loadProp = new JButton(); jPanel2.add(loadProp); loadProp.setText("load properties"); loadProp.setPreferredSize(new java.awt.Dimension(158, 32)); loadProp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("loadProp.actionPerformed", evt); } }); } { executeExport = new JButton(); jPanel2.add(executeExport); executeExport.setText("export list"); executeExport.setPreferredSize(new java.awt.Dimension(145, 31)); executeExport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("executeExport.actionPerformed", evt); } }); } { exportListHasOrignTree = new JButton(); jPanel2.add(exportListHasOrignTree); exportListHasOrignTree.setText("export list has orign tree"); exportListHasOrignTree.setPreferredSize(new java.awt.Dimension(204, 32)); exportListHasOrignTree.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("exportListHasOrignTree.actionPerformed", evt); } }); } { moveFiles = new JButton(); jPanel2.add(moveFiles); moveFiles.setText("move selected"); moveFiles.setPreferredSize(new java.awt.Dimension(161, 31)); moveFiles.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("moveFiles.actionPerformed", evt); } }); } { deleteSelected = new JButton(); jPanel2.add(deleteSelected); deleteSelected.setText("delete selected"); deleteSelected.setPreferredSize(new java.awt.Dimension(165, 31)); deleteSelected.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("deleteSelected.actionPerformed", evt); } }); } { loadClipboardPath = new JButton(); jPanel2.add(loadClipboardPath); loadClipboardPath.setText("load clipboard path"); loadClipboardPath.setPreferredSize(new java.awt.Dimension(222, 31)); loadClipboardPath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("loadClipboardPath.actionPerformed", evt); } }); } { deleteEmptyDir = new JButton(); jPanel2.add(deleteEmptyDir); deleteEmptyDir.setText("delete empty dir"); deleteEmptyDir.setPreferredSize(new java.awt.Dimension(222, 31)); deleteEmptyDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("deleteEmptyDir.actionPerformed", evt); } }); } { openSvnUpdate = new JButton(); jPanel2.add(openSvnUpdate); openSvnUpdate.setText("list svn new or modify file"); openSvnUpdate.setPreferredSize(new java.awt.Dimension(210, 34)); openSvnUpdate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("openSvnUpdate.actionPerformed", evt); } }); } } { jPanel7 = new JPanel(); BorderLayout jPanel7Layout = new BorderLayout(); jPanel7.setLayout(jPanel7Layout); jTabbedPane1.addTab("properties", null, jPanel7, null); { jScrollPane3 = new JScrollPane(); jPanel7.add(jScrollPane3, BorderLayout.CENTER); jScrollPane3.setPreferredSize(new java.awt.Dimension(741, 415)); { DefaultListModel propertiesListModel = new DefaultListModel(); propertiesList = new JList(); reloadCurrentDirPropertiesList(); jScrollPane3.setViewportView(propertiesList); propertiesList.setModel(propertiesListModel); propertiesList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("propertiesList.keyPressed", evt); } }); propertiesList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("propertiesList.mouseClicked", evt); } }); } } } { jPanel8 = new JPanel(); BorderLayout jPanel8Layout = new BorderLayout(); jTabbedPane1.addTab("scanner", null, jPanel8, null); jPanel8.setLayout(jPanel8Layout); { jPanel9 = new JPanel(); jPanel8.add(jPanel9, BorderLayout.NORTH); jPanel9.setPreferredSize(new java.awt.Dimension(741, 187)); { scanDirText = new JTextField(); scanDirText.setToolTipText("scan dir"); jPanel9.add(scanDirText); scanDirText.setPreferredSize(new java.awt.Dimension(225, 24)); scanDirText.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("scanDirText.mouseClicked", evt); } }); } { jScrollPane6 = new JScrollPane(); jPanel9.add(jScrollPane6); jScrollPane6.setPreferredSize(new java.awt.Dimension(168, 69)); { scannerText = new JTextArea(); scannerText.setToolTipText("query condition"); jScrollPane6.setViewportView(scannerText); } } { fileScan = new JButton(); jPanel9.add(fileScan); fileScan.setText("start / stop"); fileScan.setPreferredSize(new java.awt.Dimension(113, 24)); fileScan.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("fileScan.actionPerformed", evt); } }); } { useRegexOnly = new JCheckBox(); jPanel9.add(useRegexOnly); useRegexOnly.setText("regex only"); } { DefaultComboBoxModel scanTypeModel = new DefaultComboBoxModel(); for (ScanType s : ScanType.values()) { scanTypeModel.addElement(s); } scanType = new JComboBox(); scanType.setToolTipText("scan type"); jPanel9.add(scanType); scanType.setModel(scanTypeModel); scanType.setPreferredSize(new java.awt.Dimension(147, 24)); } { DefaultComboBoxModel jComboBox1Model = new DefaultComboBoxModel(); for (FileOrDirType f : FileOrDirType.values()) { jComboBox1Model.addElement(f); } fileOrDirTypeCombo = new JComboBox(); jPanel9.add(fileOrDirTypeCombo); fileOrDirTypeCombo.setModel(jComboBox1Model); fileOrDirTypeCombo.setToolTipText("scan file or directory!"); } { addListToExecList = new JButton(); jPanel9.add(addListToExecList); addListToExecList.setText("add list to file list"); addListToExecList.setPreferredSize(new java.awt.Dimension(158, 24)); addListToExecList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("addListToExecList.actionPerformed", evt); } }); } { ignoreScanText = new JTextField(); ignoreScanText.setToolTipText("ignore scan condition"); ignoreScanText.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } String ignore = null; if (StringUtils.isBlank(ignore = ignoreScanText.getText())) { return; } DefaultListModel model = (DefaultListModel) ignoreScanList.getModel(); model.addElement(ignore); } }); jPanel9.add(ignoreScanText); ignoreScanText.setPreferredSize(new java.awt.Dimension(153, 24)); } { jScrollPane5 = new JScrollPane(); jPanel9.add(jScrollPane5); jScrollPane5.setPreferredSize(new java.awt.Dimension(125, 73)); jScrollPane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); { DefaultListModel ignoreScanListModel = new DefaultListModel(); ignoreScanList = new JList(); ignoreScanList.setToolTipText("ignore scan condition list"); jScrollPane5.setViewportView(ignoreScanList); ignoreScanList.setModel(ignoreScanListModel); ignoreScanList.setPreferredSize(new java.awt.Dimension(125, 73)); ignoreScanList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(ignoreScanList).defaultJListKeyPressed(evt); } }); } } { innerScannerText = new JTextField(); innerScannerText.setToolTipText("inner scan query condition"); jPanel9.add(innerScannerText); innerScannerText.setPreferredSize(new java.awt.Dimension(164, 24)); innerScannerText.addMouseListener(new MouseAdapter() { Thread innerScanThread = null; boolean innerScanStop = false; public void mouseClicked(MouseEvent evt) { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } final String innerText = innerScannerText.getText(); if (arrayBackupForInnerScan == null) { return; } innerScanStop = true; if (innerScanThread == null || innerScanThread.getState() == Thread.State.TERMINATED) { innerScanThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { innerScanStop = false; System.out.println( toString() + " ... start!! ==> " + innerScanStop); DefaultListModel model = new DefaultListModel(); scanList.setModel(model); for (int ii = 0; ii < arrayBackupForInnerScan.length; ii++) { if (arrayBackupForInnerScan[ii].toString() .contains(innerText)) { model.addElement(arrayBackupForInnerScan[ii]); } if (innerScanStop) { System.out.println(toString() + " ... over!! ==> " + innerScanStop); break; } } System.out.println(toString() + " ... run over!! ==> " + innerScanStop); } }, "innerScanner_" + System.currentTimeMillis()); innerScanThread.setDaemon(true); innerScanThread.start(); } } }); } } { jScrollPane4 = new JScrollPane(); jPanel8.add(jScrollPane4, BorderLayout.CENTER); { DefaultListModel scanListModel = new DefaultListModel(); scanList = new JList(); jScrollPane4.setViewportView(scanList); scanList.setModel(scanListModel); scanList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("scanList.mouseClicked", evt); } }); scanList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("scanList.keyPressed", evt); } }); } } { scannerStatus = new JLabel(); jPanel8.add(scannerStatus, BorderLayout.SOUTH); scannerStatus.setPreferredSize(new java.awt.Dimension(741, 27)); } } } swingUtil.addAction("moveFiles.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); if (model.getSize() == 0 || execList.getSelectedValues().length == 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("no selected file can move!", "ERROR"); return; } File exportListTo = FileUtil.getDefaultExportDir(ExecuteOpener.class, true); File file = null; List<File> list = new ArrayList<File>(); for (Object obj : execList.getSelectedValues()) { file = new File((String) obj); if (file.exists() && file.isFile()) { list.add(file); } } File fromBaseDir = FileUtil.exportReceiveBaseDir(list); System.out.println("fromBaseDir = " + fromBaseDir); int cutLen = 0; if (fromBaseDir != null) { cutLen = fromBaseDir.getAbsolutePath().length(); } StringBuilder err = new StringBuilder(); File newFile = null; for (Object obj : execList.getSelectedValues()) { file = new File((String) obj); if (file.exists() && file.isFile()) { newFile = new File(exportListTo + "/" + file.getParent().substring(cutLen), file.getName()); newFile.getParentFile().mkdirs(); System.out.println("move to : " + newFile); file.renameTo(newFile); if (!newFile.exists()) { err.append(file + "\n"); } } } if (err.length() > 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("move file error : \n" + err, "ERROR"); } else { JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "move file success : " + execList.getSelectedValues().length, "SUCCESS"); } } }); swingUtil.addAction("deleteSelected.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { StringBuilder sb = new StringBuilder(); for (Object obj : execList.getSelectedValues()) { sb.append(new File((String) obj).getName() + "\n"); } if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil.newInstance() .confirmButtonYesNo().iconWaringMessage() .showConfirmDialog("are you sure delete file : \n" + sb, "DELETE")) { return; } File file = null; sb = new StringBuilder(); for (Object obj : execList.getSelectedValues()) { file = new File((String) obj); if (!file.exists()) { continue; } if (file.isDirectory() && file.list().length == 0) { if (!file.delete()) { sb.append(file.getName() + "\n"); } continue; } if (!file.delete()) { sb.append(file.getName() + "\n"); } } if (sb.length() != 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("delete error list :\n" + sb, "ERROR"); } else { JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog("delete completed!", "SUCCESS"); } } }); swingUtil.addAction("loadClipboardPath.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = new File(ClipboardUtil.getInstance().getContents()); if (!file.exists()) { return; } List<File> list = new ArrayList<File>(); FileUtil.searchFileMatchs(file, ".*", list); prop.clear(); for (File f : list) { if (f.isFile()) { prop.setProperty(f.getAbsolutePath(), ""); } } DefaultListModel model = new DefaultListModel(); for (Object key : prop.keySet()) { model.addElement(key); } execList.setModel(model); } }); swingUtil.addAction("deleteEmptyDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file is not correct!", "ERROR"); return; } if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil.newInstance() .iconWaringMessage().confirmButtonYesNo() .showConfirmDialog("are you sure delete empty dir in \n" + file, "WARRNING")) { return; } List<File> delDir = new ArrayList<File>(); FileUtil.deleteEmptyDir(file, delDir); JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "delete dir list : \n" + delDir.toString().replace(',', '\n'), "DELETE"); } }); swingUtil.addAction("browser.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectFileAndDirectory().showOpenDialog() .getApproveSelectedFile(); if (file != null) { DefaultListModel model = (DefaultListModel) execList.getModel(); model.addElement(file.getAbsolutePath()); } } }); swingUtil.addAction("addArea.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { if (StringUtils.isBlank(exeArea.getText())) { return; } DefaultListModel model = (DefaultListModel) execList.getModel(); StringTokenizer token = new StringTokenizer(exeArea.getText(), "\t\n\r\f"); while (token.hasMoreElements()) { String val = ((String) token.nextElement()).trim(); model.addElement(val); prop.put(val, ""); } } }); swingUtil.addAction("execute.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); for (Enumeration<?> enu = model.elements(); enu.hasMoreElements();) { String val = (String) enu.nextElement(); exec(val); } } }); swingUtil.addAction("execList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(execList).defaultJListKeyPressed(evt); } }); //DEFAULT PROP SAVE swingUtil.addAction("saveList.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { String orignName = JOptionPaneUtil.newInstance().iconPlainMessage() .showInputDialog("input properties file name", "SAVE"); File saveFile = null; if (StringUtils.isNotBlank(orignName)) { String fileName = orignName; if (!fileName.toLowerCase().endsWith(".properties")) { fileName += ".properties"; } fileName = ExecuteOpener.class.getSimpleName() + "_" + fileName; prop.clear(); DefaultListModel model = (DefaultListModel) execList.getModel(); for (Enumeration<?> enu = model.elements(); enu.hasMoreElements();) { String val = (String) enu.nextElement(); prop.put(val, ""); } saveFile = new File(jarPositionDir, fileName); } else { saveFile = currentPropFile; } prop.store(new FileOutputStream(saveFile), orignName); JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog(saveFile, "PROPERTIES CREATE"); } }); swingUtil.addAction("clearExecList.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { // prop.clear(); // reloadExecListProperties(prop); execList.setModel(new DefaultListModel()); } }); swingUtil.addAction("execList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { // right button single click event if (JMouseEventUtil.buttonRightClick(1, evt)) { JPopupMenuUtil popupUtil = JPopupMenuUtil.newInstance(execList).applyEvent(evt); if (execList.getSelectedValues().length == 1) { popupUtil.addJMenuItem( JFileExecuteUtil.newInstance(new File((String) execList.getSelectedValues()[0])) .createDefaultJMenuItems()); popupUtil.addJMenuItem("----------------", false); } popupUtil.addJMenuItem("eclipse home", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); Object[] arry = model.toArray(); for (Object obj : arry) { try { Runtime.getRuntime().exec(String.format("cmd /c call \"%s\" \"%s\"", "C:/?/eclipse_jee/eclipse.exe", obj)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } } }); popupUtil.addJMenuItem("eclipse company", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); Object[] arry = model.toArray(); for (Object obj : arry) { try { Runtime.getRuntime().exec(String.format("cmd /c call \"%s\" \"%s\"", "C:/?/iisi_eclipse/eclipse.exe", obj)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } } }); popupUtil.addJMenuItem("----------------", false); popupUtil// .addJMenuItem("sort list", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); Object[] arry = model.toArray(); Arrays.sort(arry); DefaultListModel model2 = new DefaultListModel(); for (Object obj : arry) { model2.addElement(obj); } execList.setModel(model2); } }).addJMenuItem("keep exists", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); DefaultListModel model2 = new DefaultListModel(); for (Object obj : model.toArray()) { if (new File((String) obj).exists()) { model2.addElement(obj); } } execList.setModel(model2); } }).addJMenuItem("remove duplicate", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); DefaultListModel model2 = new DefaultListModel(); Set<String> set = new HashSet<String>(); for (Object obj : model.toArray()) { set.add((String) obj); } for (String val : set) { model2.addElement(val); } execList.setModel(model2); } }).addJMenuItem("remove folder", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); for (int ii = 0; ii < model.getSize(); ii++) { if (new File((String) model.getElementAt(ii)).isDirectory()) { model.removeElementAt(ii); ii--; } } } }).addJMenuItem("remove empty folder", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); File dir = null; for (int ii = 0; ii < model.getSize(); ii++) { dir = new File((String) model.getElementAt(ii)); if (dir.isDirectory() && dir.list().length == 0) { model.removeElementAt(ii); ii--; } } } }).addJMenuItem("----------------", false) .addJMenuItem("diff left : " + (diffLeft != null ? diffLeft.getName() : ""), true, new ActionListener() { public void actionPerformed(ActionEvent arg0) { File value = new File( (String) JListUtil.getLeadSelectionObject(execList)); if (value != null && value.isFile() && value.exists()) { diffLeft = value; } } }) .addJMenuItem("diff right : " + (diffRight != null ? diffRight.getName() : ""), true, new ActionListener() { public void actionPerformed(ActionEvent arg0) { File value = new File( (String) JListUtil.getLeadSelectionObject(execList)); if (value != null && value.isFile() && value.exists()) { diffRight = value; } } }) .addJMenuItem((diffLeft != null && diffRight != null) ? "diff compare" : "", (diffLeft != null && diffRight != null), new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Runtime.getRuntime().exec(String.format( "cmd /c call TortoiseMerge.exe /base:\"%s\" /theirs:\"%s\"", diffLeft, diffRight)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } }) .addJMenuItem((execList.getSelectedValues().length == 2) ? "diff compare" : "", (execList.getSelectedValues().length == 2), new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Runtime.getRuntime().exec(String.format( "cmd /c call TortoiseMerge.exe /base:\"%s\" /theirs:\"%s\"", execList.getSelectedValues()[0], execList.getSelectedValues()[1])); } catch (IOException ex) { JCommonUtil.handleException(ex); } } }) .addJMenuItem("----------------", false)// .show();// } // left button double click event int pos = execList.getLeadSelectionIndex(); if (pos == -1) { return; } if (((MouseEvent) evt).getClickCount() < 2) { return; } DefaultListModel model = (DefaultListModel) execList.getModel(); String val = (String) model.getElementAt(pos); exec(val); } }); swingUtil.addAction("loadProp.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectFileOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file not correct!", "ERROR"); return; } reloadExecListProperties(file); setTitle("load prop : " + file.getName()); } }); swingUtil.addAction("reloadList.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { reloadExecListProperties(prop); } }); swingUtil.addAction("exportListHasOrignTree.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); if (model.isEmpty()) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("no file can export!", "ERROR"); return; } List<File> allList = new ArrayList<File>(); for (int ii = 0; ii < model.getSize(); ii++) { allList.add(new File((String) model.getElementAt(ii))); } File baseDir = FileUtil.exportReceiveBaseDir(allList); System.out.println("common base dir : " + baseDir); boolean dynamicBaseDir = baseDir == null; File tmp = null; File copyTo = null; int realCopyCount = 0; File exportListTo = FileUtil.getDefaultExportDir(ExecuteOpener.class, true); for (int ii = 0; ii < model.getSize(); ii++) { String val = (String) model.getElementAt(ii); if (StringUtils.isBlank(val)) { continue; } tmp = new File(val); if (tmp.isDirectory()) { continue; } File copyFrom = getCorrectFile(tmp); if (dynamicBaseDir) { baseDir = FileUtil.getRoot(copyFrom); } copyTo = FileUtil.exportFileToTargetPath(copyFrom, baseDir, exportListTo); if (!copyTo.getParentFile().exists()) { copyTo.getParentFile().mkdirs(); } System.out.println("## file : " + tmp + " -- > " + copyFrom); System.out.println("\t copy to : " + copyTo); FileUtil.copyFile(copyFrom, copyTo); realCopyCount++; } JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "copy completed!\ntotal : " + model.getSize() + "\ncopy : " + realCopyCount, "SUCCESS"); } }); swingUtil.addAction("executeExport.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); if (model.isEmpty()) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("no file can export!", "ERROR"); return; } File tmp = null; File copyTo = null; int realCopyCount = 0; File exportListTo = FileUtil.getDefaultExportDir(ExecuteOpener.class, true); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(exportListTo + "/output_log.txt"), "BIG5")); for (int ii = 0; ii < model.getSize(); ii++) { String val = (String) model.getElementAt(ii); if (StringUtils.isBlank(val)) { continue; } tmp = new File(val); if (tmp.isDirectory()) { continue; } if (isNeedToCopy(exportListTo, tmp)) { File copyFrom = getCorrectFile(tmp); System.out.println("## file : " + tmp + " -- > " + copyFrom); copyTo = new File(exportListTo, copyFrom.getName()); for (int jj = 0; copyTo.exists(); jj++) { String name = copyFrom.getName(); int pos = name.lastIndexOf("."); String prefix = name.substring(0, pos); String rearfix = name.substring(pos); copyTo = new File(exportListTo, prefix + "_R" + jj + rearfix); } FileUtil.copyFile(copyFrom, copyTo); writer.write(tmp.getAbsolutePath() + (!tmp.getName().equals(copyTo.getName()) ? "\t [rename] : " + copyTo.getName() : "")); realCopyCount++; } else { writer.write(tmp.getAbsolutePath() + "\t [has same file, ommit!]"); } writer.newLine(); } writer.flush(); writer.close(); JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "copy completed!\ntotal : " + model.getSize() + "\ncopy : " + realCopyCount, "SUCCESS"); } }); swingUtil.addAction("jTabbedPane1.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } File file = new File(getTitle()); if (file.exists()) { JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog(file, "current properties"); } ClipboardUtil.getInstance().setContents(file); } }); swingUtil.addAction("propertiesList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { File file = (File) propertiesList.getSelectedValue(); JPopupMenuUtil.newInstance(propertiesList).applyEvent(evt) .addJMenuItem("reload list", new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { reloadCurrentDirPropertiesList(); } }).addJMenuItem(JFileExecuteUtil.newInstance(file).createDefaultJMenuItems()).show(); if (file == null) { return; } if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } prop.clear(); prop.load(new FileInputStream(file)); currentPropFile = file; reloadExecListProperties(prop); setTitle("properties : " + file.getName()); } }); swingUtil.addAction("propertiesList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } JListUtil.newInstance(propertiesList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("jTabbedPane1.stateChanged", new Action() { public void action(EventObject evt) throws Exception { if (jTabbedPane1.getSelectedIndex() == 2) { reloadCurrentDirPropertiesList(); } } }); swingUtil.addAction("scanList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(scanList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("scanList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { System.out.println("index = " + scanList.getLeadSelectionIndex()); final Object[] vals = scanList.getSelectedValues(); if (vals == null || vals.length == 0) { return; } JPopupMenuUtil.newInstance(scanList).applyEvent(evt) .addJMenuItem("add to file list : " + vals.length, new ActionListener() { public void actionPerformed(ActionEvent arg0) { File file = null; DefaultListModel model = (DefaultListModel) execList.getModel(); for (Object v : vals) { file = (File) v; model.addElement(file.getAbsolutePath()); } } }).show(); } }); swingUtil.addAction("fileScan.actionPerformed", new Action() { Thread scanMainThread = null; public void action(EventObject evt) throws Exception { String scanText_ = scannerText.getText(); final boolean anyFileMatch = StringUtils.isEmpty(scanText_); final String scanText = anyFileMatch ? UUID.randomUUID().toString() : scanText_; final FileOrDirType fileOrDirType = (FileOrDirType) fileOrDirTypeCombo.getSelectedItem(); String scanDir_ = scanDirText.getText(); final File scanDir = new File(scanDir_); if (StringUtils.isEmpty(scanDir_)) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("scan dir text can't empty!", "ERROR"); return; } if (!scanDir.exists()) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("directory is't exists!", "ERROR"); return; } Object[] igArry_ = ((DefaultListModel) ignoreScanList.getModel()).toArray(); final String[] igArry = new String[igArry_.length]; for (int ii = 0; ii < igArry.length; ii++) { igArry[ii] = (String) igArry_[ii]; } final boolean ignoreCheck = igArry.length > 0; final DefaultListModel model = new DefaultListModel(); final StringTokenizer tok = new StringTokenizer(scanText); if (scanMainThread == null || scanMainThread.getState() == Thread.State.TERMINATED) { scanMainThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { ScanType scanTp; public void run() { currentScannerThreadStop = false; final long startTime = System.currentTimeMillis(); scanTp = (ScanType) scanType.getSelectedItem(); List<Thread> threadList = new ArrayList<Thread>(); final Map<String, Integer> matchCountMap = new HashMap<String, Integer>(); for (; tok.hasMoreElements();) { final String scanVal = (String) tok.nextElement(); System.out.println("add scan condition = " + scanVal); Pattern ppp = null; try { ppp = Pattern.compile(scanVal); } catch (Exception ex) { System.out.println(ex); } final Pattern scanTextPattern = ppp; Thread currentScannerThread = new Thread( Thread.currentThread().getThreadGroup(), new Runnable() { int matchCount = 0; void addElement(File file) { if (scanTp.filter(anyFileMatch, scanVal, scanTextPattern, file, ignoreCheck, igArry)) { for (int ii = 0;; ii++) { try { model.addElement(file); matchCount++; break; } catch (Exception ex) { System.err.println( file + ", error occor !!! ==> " + ex); if (ii > 10) { break; } } } } } void find(File file) { if (currentScannerThreadStop) { return; } if (file == null || !file.exists()) { System.out .println("file == null || !file.exists()\t" + file); return; } scannerStatus.setText( model.getSize() + " : " + file.getAbsolutePath()); if (file.isDirectory()) { if (file.listFiles() != null) { for (File f : file.listFiles()) { find(f); } } else { System.out .println("file.listFiles() == null!!\t" + file); } switch (fileOrDirType) { case DIRECTORY_ONLY: addElement(file); break; case ALL: addElement(file); break; } } if (file.isFile()) { switch (fileOrDirType) { case FILE_ONLY: addElement(file); break; case ALL: addElement(file); break; } } } public void run() { find(scanDir); matchCountMap.put(scanVal, matchCount); } }, "file_scann_" + System.currentTimeMillis()); currentScannerThread.setDaemon(true); currentScannerThread.start(); threadList.add(currentScannerThread); } for (;;) { try { Thread.sleep(1000); boolean allTerminated = true; for (int ii = 0; ii < threadList.size(); ii++) { if (threadList.get(ii).getState() != Thread.State.TERMINATED) { allTerminated = false; break; } } if (allTerminated) { System.out.println("all done..."); break; } } catch (InterruptedException e) { JCommonUtil.handleException(e); } } long endTime = System.currentTimeMillis() - startTime; String status = "scan completed \n during :" + endTime + "\n file : " + model.getSize() + "\n \tResult : \n " + matchCountMap; JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog(status, "COMPLETED"); scannerStatus.setText(status); scanList.setModel(model); arrayBackupForInnerScan = ((DefaultListModel) scanList.getModel()).toArray(); currentScannerThreadStop = false; } }, "file_scann_main_" + System.currentTimeMillis()); scanMainThread.setDaemon(true); scanMainThread.start(); } else { if (JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption( "scanner is running \n want to stop??", "WARNING")) { currentScannerThreadStop = true; } } } }); swingUtil.addAction("scanDirText.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (dir == null) { return; } scanDirText.setText(dir.getAbsolutePath()); } }); swingUtil.addAction("addListToExecList.actionPerformed", new Action() { Thread moveThread = null; public void action(EventObject evt) throws Exception { if (moveThread != null && moveThread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error("add list process already running!"); return; } moveThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { DefaultListModel model = (DefaultListModel) scanList.getModel(); DefaultListModel model2 = (DefaultListModel) execList.getModel(); for (int ii = 0; ii < model.getSize(); ii++) { File f = (File) model.getElementAt(ii); model2.addElement(f.getAbsolutePath()); } if (model.getSize() > 1000) { JCommonUtil._jOptionPane_showMessageDialog_info( "add list completed!\n" + model.getSize()); } } }, "addListToExecList.actionPerformed_" + System.currentTimeMillis()); moveThread.setDaemon(true); moveThread.start(); } }); swingUtil.addAction("openSvnUpdate.actionPerformed", new Action() { Pattern svnPattern = Pattern.compile("^(?:[M|\\?])\\s+\\d*\\s+(.+)$"); Thread svnThread = null; public void action(EventObject evt) throws Exception { if (svnThread != null && svnThread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error("svn scan process already running!"); return; } final File svnDir = JCommonUtil._jFileChooser_selectDirectoryOnly(); if (svnDir == null) { JCommonUtil._jOptionPane_showMessageDialog_error("dir is not correct!"); return; } svnThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { try { Process process = Runtime.getRuntime() .exec(String.format("svn status -u \"%s\"", svnDir)); BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream())); Matcher matcher = null; File file = null; DefaultListModel model = new DefaultListModel(); List<File> scanList = new ArrayList<File>(); for (String line = null; (line = reader.readLine()) != null;) { matcher = svnPattern.matcher(line); if (matcher.find()) { file = new File(matcher.group(1)); if (file.isFile()) { model.addElement(file.getAbsolutePath()); } if (file.isDirectory()) { scanList.clear(); FileUtil.searchFileMatchs(file, ".*", scanList); for (File f : scanList) { model.addElement(f.getAbsolutePath()); } } } else { System.out.println("ignore : [" + line + "]"); } } reader.close(); execList.setModel(model); setTitle("svn : " + svnDir); JCommonUtil._jOptionPane_showMessageDialog_info("svn scan completed!"); } catch (IOException e) { JCommonUtil.handleException(e); } } }, "svn_scan" + System.currentTimeMillis()); svnThread.setDaemon(true); svnThread.start(); } }); swingUtil.addAction("contentFilterBtn.actionPerformed", new Action() { Thread thread = null; String encode = Charset.defaultCharset().displayName(); public void action(EventObject evt) throws Exception { if (thread != null && thread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error("scan process already running!"); return; } final String filter = JCommonUtil._jOptionPane_showInputDialog("input filter content?"); if (StringUtils.isEmpty(filter)) { JCommonUtil._jOptionPane_showMessageDialog_error("filter is empty!"); return; } Pattern tmpPattern = null; try { tmpPattern = Pattern.compile(filter); } catch (Exception ex) { } final Pattern filterPattern = tmpPattern; try { encode = JCommonUtil._jOptionPane_showInputDialog("input encode?", encode); } catch (Exception ex) { JCommonUtil._jOptionPane_showMessageDialog_error("error encode!"); return; } thread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { DefaultListModel model = (DefaultListModel) execList.getModel(); DefaultListModel model_ = new DefaultListModel(); File file = null; BufferedReader reader = null; for (int ii = 0; ii < model.getSize(); ii++) { file = new File((String) model.getElementAt(ii)); if (!file.exists()) { continue; } try { reader = new BufferedReader( new InputStreamReader(new FileInputStream(file), encode)); for (String line = null; (line = reader.readLine()) != null;) { if (line.contains(filter)) { model_.addElement(file.getAbsolutePath()); break; } if (filterPattern != null && filterPattern.matcher(line).find()) { model_.addElement(file.getAbsolutePath()); break; } } reader.close(); } catch (Exception e) { JCommonUtil.handleException(e); } } execList.setModel(model_); JCommonUtil._jOptionPane_showMessageDialog_info("completed!"); } }, UUID.randomUUID().toString()); thread.setDaemon(true); thread.start(); } }); swingUtil.addAction("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new Action() { public void action(EventObject evt) throws Exception { } }); this.setSize(870, 551); } catch (Exception e) { e.printStackTrace(); } }
From source file:edu.ku.brc.specify.datamodel.busrules.BaseTreeBusRules.java
/** * @param parentField/*ww w .j av a 2 s. c o m*/ * @param rankComboBox * @param nodeInForm */ @SuppressWarnings("unchecked") protected void adjustRankComboBoxModel(final GetSetValueIFace parentField, final ValComboBox rankComboBox, final T nodeInForm) { log.debug("Adjusting the model for the 'rank' combo box in a tree node form"); if (nodeInForm == null) { return; } log.debug("nodeInForm = " + nodeInForm.getName()); DefaultComboBoxModel<I> model = (DefaultComboBoxModel<I>) rankComboBox.getModel(); model.removeAllElements(); // this is the highest rank the edited item can possibly be I topItem = null; // this is the lowest rank the edited item can possibly be I bottomItem = null; Object value = parentField.getValue(); T parent = null; if (value instanceof String) { // this happens when the combobox is in view mode, which means it's really a textfield // in that case, the parent of the node in the form will do, since the user can't change the parents parent = nodeInForm.getParent(); } else { parent = (T) parentField.getValue(); } if (parent == null) { return; } // grab all the def items from just below the parent's item all the way to the next enforced level // or to the level of the highest ranked child topItem = parent.getDefinitionItem().getChild(); log.debug("highest valid tree level: " + topItem); if (topItem == null) { // this only happens if a parent was chosen that cannot have children b/c it is at the // lowest defined level in the tree log.warn("Chosen node cannot be a parent node. It is at the lowest defined level of the tree."); return; } // find the child with the highest rank and set that child's def item as the bottom of the range if (!nodeInForm.getChildren().isEmpty()) { for (T child : nodeInForm.getChildren()) { if (bottomItem == null || child.getRankId() > bottomItem.getRankId()) { bottomItem = child.getDefinitionItem().getParent(); } } } log.debug("lowest valid tree level: " + bottomItem); I item = topItem; boolean done = false; while (!done) { model.addElement(item); if (item.getChild() == null || item.getIsEnforced() == Boolean.TRUE || (bottomItem != null && item.getRankId().intValue() == bottomItem.getRankId().intValue())) { done = true; } item = item.getChild(); } if (nodeInForm.getDefinitionItem() != null) { I defItem = nodeInForm.getDefinitionItem(); for (int i = 0; i < model.getSize(); ++i) { I modelItem = (I) model.getElementAt(i); if (modelItem.getRankId().equals(defItem.getRankId())) { log.debug("setting rank selected value to " + modelItem); model.setSelectedItem(modelItem); } } // if (model.getIndexOf(defItem) != -1) // { // model.setSelectedItem(defItem); // } } else if (model.getSize() == 1) { Object defItem = model.getElementAt(0); log.debug("setting rank selected value to the only available option: " + defItem); model.setSelectedItem(defItem); } }
From source file:de.tor.tribes.ui.windows.DSWorkbenchMainFrame.java
/** * Update on server change/*from w w w.java 2 s . c o m*/ */ public void serverSettingsChangedEvent() { try { logger.info("Updating server settings"); // <editor-fold defaultstate="collapsed" desc="Reset user profile specific contents"> UserProfile profile = GlobalOptions.getSelectedProfile(); String playerID = profile.toString(); logger.info(" - using playerID " + playerID); profile.restoreProperties(); jCurrentPlayer.setText(playerID); try { DefaultComboBoxModel model = new DefaultComboBoxModel(); Tribe t = DataHolder.getSingleton().getTribeByName(profile.getTribeName()); Village[] villages = t.getVillageList(); Arrays.sort(villages, Village.CASE_INSENSITIVE_ORDER); for (Village v : villages) { model.addElement(v); } jCurrentPlayerVillages.setModel(model); } catch (Exception e) { jCurrentPlayerVillages.setModel(new DefaultComboBoxModel(new Object[] { "-keine Drfer-" })); } // </editor-fold> //update maps MapPanel.getSingleton().resetServerDependendSettings(); MapPanel.getSingleton().updateMapPosition(dCenterX, dCenterY); MapPanel.getSingleton().getAttackAddFrame().buildUnitBox(); //setup views DSWorkbenchMarkerFrame.getSingleton().resetView(); DSWorkbenchMarkerFrame.getSingleton().restoreProperties(); DSWorkbenchChurchFrame.getSingleton().resetView(); DSWorkbenchChurchFrame.getSingleton().restoreProperties(); DSWorkbenchWatchtowerFrame.getSingleton().resetView(); DSWorkbenchWatchtowerFrame.getSingleton().restoreProperties(); DSWorkbenchAttackFrame.getSingleton().resetView(); DSWorkbenchAttackFrame.getSingleton().restoreProperties(); DSWorkbenchAttackFrame.getSingleton().updateCountdownSettings(); TacticsPlanerWizard.restoreProperties(); ResourceDistributorWizard.restoreProperties(); DSWorkbenchTagFrame.getSingleton().resetView(); DSWorkbenchTagFrame.getSingleton().restoreProperties(); DSWorkbenchConquersFrame.getSingleton().resetView(); DSWorkbenchConquersFrame.getSingleton().restoreProperties(); //update troops table and troops view TroopSetupConfigurationFrame.getSingleton().setup(); DSWorkbenchTroopsFrame.getSingleton().resetView(); DSWorkbenchTroopsFrame.getSingleton().restoreProperties(); DistanceManager.getSingleton().clear(); StatManager.getSingleton().setup(); DSWorkbenchDistanceFrame.getSingleton().resetView(); DSWorkbenchDistanceFrame.getSingleton().restoreProperties(); DSWorkbenchStatsFrame.getSingleton().resetView(); DSWorkbenchStatsFrame.getSingleton().restoreProperties(); DSWorkbenchDoItYourselfAttackPlaner.getSingleton().resetView(); DSWorkbenchDoItYourselfAttackPlaner.getSingleton().restoreProperties(); DSWorkbenchReportFrame.getSingleton().resetView(); DSWorkbenchReportFrame.getSingleton().restoreProperties(); DSWorkbenchSOSRequestAnalyzer.getSingleton().resetView(); DSWorkbenchSOSRequestAnalyzer.getSingleton().restoreProperties(); DSWorkbenchFarmManager.getSingleton().resetView(); DSWorkbenchFarmManager.getSingleton().restoreProperties(); BBCodeEditor.getSingleton().reset(); //update attack planner DSWorkbenchSettingsDialog.getSingleton().setupAttackColorTable(); DSWorkbenchRankFrame.getSingleton().resetView(); DSWorkbenchRankFrame.getSingleton().restoreProperties(); jLabel1.setText("X"); jLabel2.setText("Y"); DSRealManager.getSingleton().checkFilesystem(); jROIBox.setModel(new DefaultComboBoxModel(ROIManager.getSingleton().getROIs())); DSWorkbenchSelectionFrame.getSingleton().resetView(); DSWorkbenchSelectionFrame.getSingleton().restoreProperties(); DSWorkbenchNotepad.getSingleton().resetView(); DSWorkbenchNotepad.getSingleton().restoreProperties(); if (!GlobalOptions.isOfflineMode() && DSWorkbenchSimulatorFrame.getSingleton().isVisible()) { try { DSWorkbenchSimulatorFrame.getSingleton().showIntegratedVersion( DSWorkbenchSettingsDialog.getSingleton().getWebProxy(), GlobalOptions.getSelectedServer()); } catch (Exception e) { logger.warn("Problem during writing Troops to AStar", e); } } ConquerManager.getSingleton().revalidate(true); //relevant for first start LayerOrderConfigurationFrame.getSingleton(); MinimapPanel.getSingleton().redraw(true); DSWorkbenchFormFrame.getSingleton().resetView(); DSWorkbenchFormFrame.getSingleton().restoreProperties(); FormConfigFrame.getSingleton(); DSWorkbenchSearchFrame.getSingleton(); logger.info("Server settings updated"); if (isVisible() && !DSWorkbenchSettingsDialog.getSingleton().isVisible()) { showReminder(); } } catch (Exception e) { throw new RuntimeException("Initialization failed", e); } }
From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java
private void editSubmodelInfo(final SubmodelInfo sInfo) { constDef.setSelected(true);/*from www .j a v a 2s. c om*/ incrDef.setEnabled(false); listDef.setEnabled(false); cancelButton.setEnabled(true); final DefaultComboBoxModel model = (DefaultComboBoxModel) submodelTypeBox.getModel(); model.removeAllElements(); model.addElement("Loading class information..."); final CardLayout cl = (CardLayout) rightMiddle.getLayout(); cl.show(rightMiddle, "SUBMODEL"); try { final ClassElement[] elements = fetchPossibleTypes(sInfo); model.removeAllElements(); for (final ClassElement classElement : elements) model.addElement(classElement); if (sInfo.getActualType() != null) submodelTypeBox.setSelectedItem(new ClassElement(sInfo.getActualType(), sInfo.getInstance())); submodelTypeBox.setEnabled(true); modifyButton.setEnabled(true); } catch (final ComboBoxIsTooFullException e) { String errorMsg = "Too much possibilities for " + sInfo.getName() + ". Please narrow down the domain by " + "defining the possible classes in the @Submodel annotation."; JOptionPane.showMessageDialog(wizard, new JLabel(errorMsg), "Error while analyizing model", JOptionPane.ERROR_MESSAGE); cancelButton.doClick(); } }
From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java
/** Edits the information object <code>info</code> so this method fills the appropriate * components with the informations of <code>info</code>. *///w ww . j ava 2s. c o m private void edit(final ParameterInfo info) { changeText(info.getName(), info.getType()); if (info instanceof SubmodelInfo) { final SubmodelInfo sInfo = (SubmodelInfo) info; editSubmodelInfo(sInfo); } else { String view = null; switch (info.getDefinitionType()) { case ParameterInfo.CONST_DEF: { if (info.isEnum() || info instanceof MasonChooserParameterInfo) { view = "ENUM"; constDef.setSelected(true); incrDef.setEnabled(false); listDef.setEnabled(false); Object[] elements = null; if (info.isEnum()) { @SuppressWarnings("unchecked") final Class<Enum<?>> type = (Class<Enum<?>>) info.getJavaType(); elements = type.getEnumConstants(); } else { final MasonChooserParameterInfo chooserInfo = (MasonChooserParameterInfo) info; elements = chooserInfo.getValidStrings(); } final DefaultComboBoxModel model = (DefaultComboBoxModel) enumDefBox.getModel(); model.removeAllElements(); for (final Object object : elements) { model.addElement(object); } if (info.isEnum()) enumDefBox.setSelectedItem(info.getValue()); else enumDefBox.setSelectedIndex((Integer) info.getValue()); } else if (info.isFile()) { view = "FILE"; constDef.setSelected(true); final File file = (File) info.getValue(); if (file != null) { fileTextField.setText(file.getName()); fileTextField.setToolTipText(file.getAbsolutePath()); } } else { view = "CONST"; constDef.setSelected(true); constDefField.setText(info.valuesToString()); } break; } case ParameterInfo.LIST_DEF: view = "LIST"; listDef.setSelected(true); listDefArea.setText(info.valuesToString()); break; case ParameterInfo.INCR_DEF: view = "INCREMENT"; incrDef.setSelected(true); incrStartValueField.setText(info.startToString()); incrEndValueField.setText(info.endToString()); incrStepField.setText(info.stepToString()); } final CardLayout cl = (CardLayout) rightMiddle.getLayout(); cl.show(rightMiddle, view); enableDisableSettings(true); if (!info.isNumeric()) incrDef.setEnabled(false); if (info.isEnum() || info instanceof MasonChooserParameterInfo || info.isFile()) { incrDef.setEnabled(false); listDef.setEnabled(false); } modifyButton.setEnabled(true); } }
From source file:edu.ku.brc.specify.tasks.subpane.qb.QueryBldrPane.java
public void updateAvailableConcepts() { if (!isUpdatingAvailableConcepts.get() && this.isExportMapping) { isUpdatingAvailableConcepts.set(true); try {/*from w w w . ja v a 2s.co m*/ List<SpExportSchemaItem> available = this.getAvailableConcepts(); for (QueryFieldPanel qfp : queryFieldItems) { JComboBox bx = qfp.getSchemaItemCBX(); if (bx != null) { DefaultComboBoxModel bxm = (DefaultComboBoxModel) bx.getModel(); bxm.removeAllElements(); for (SpExportSchemaItem i : available) { bxm.addElement(i); } SpExportSchemaItem qi = qfp.getSchemaItem(); if (qi != null && qi.getSpExportSchemaItemId() != null) { SpExportSchemaItem unMappedItem = new SpExportSchemaItem(); unMappedItem.setFieldName(getResourceString("QueryBldrPane.UnmappedSchemaItemName")); bxm.insertElementAt(unMappedItem, 0); bxm.insertElementAt(qi, 1); bx.setSelectedIndex(1); } else { //System.out.println("Setting unmapped concept field name to " + qfp.getExportedFieldName()); SpExportSchemaItem unMappedItem = new SpExportSchemaItem(); String expFldName = qfp.getExportedFieldName(); if (StringUtils.isBlank(expFldName)) { if (available.size() > 0) { unMappedItem.setFieldName( getResourceString("QueryBldrPane.UnmappedSchemaItemName")); } else { unMappedItem.setFieldName(qfp.getFieldTitle()); } } else { unMappedItem.setFieldName(expFldName); } bxm.insertElementAt(unMappedItem, 0); bx.setSelectedIndex(0); } bx.setEditable(qi == null || qi.getSpExportSchemaItemId() == null); } } } finally { isUpdatingAvailableConcepts.set(false); } } }