| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package net.sf.webphotos.gui.component; |
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
import java.awt.event.MouseListener; |
| 24 | |
import java.io.Serializable; |
| 25 | |
import javax.swing.JPanel; |
| 26 | |
import net.sf.webphotos.action.AcaoPesquisa; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
public class PainelPesquisa extends JPanel implements Serializable { |
| 35 | |
|
| 36 | |
private AcaoPesquisa acaoPesquisa; |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | 9 | public PainelPesquisa() { |
| 43 | 9 | initComponents(); |
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | 9 | } |
| 51 | |
|
| 52 | |
private void registerResearchActionComponent(AcaoPesquisa acaoPesquisa) { |
| 53 | 0 | btPesquisar.addActionListener(acaoPesquisa); |
| 54 | 0 | txtPesquisa.registerKeyboardAction(acaoPesquisa, |
| 55 | |
javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER, 0), |
| 56 | |
javax.swing.JComponent.WHEN_FOCUSED); |
| 57 | 0 | } |
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
private void initComponents() { |
| 66 | |
|
| 67 | 9 | painelBusca = new javax.swing.JPanel(); |
| 68 | 9 | lblPesquisar = new javax.swing.JLabel(); |
| 69 | 9 | lstCategoriasPesquisa = new javax.swing.JComboBox(); |
| 70 | 9 | lblPalavras = new javax.swing.JLabel(); |
| 71 | 9 | txtPesquisa = new javax.swing.JTextField(); |
| 72 | 9 | btPesquisar = new javax.swing.JButton(); |
| 73 | 9 | painelSQL = new javax.swing.JPanel(); |
| 74 | 9 | btFiltro = new javax.swing.JButton(); |
| 75 | |
|
| 76 | 9 | setMaximumSize(new java.awt.Dimension(65534, 35)); |
| 77 | 9 | setMinimumSize(new java.awt.Dimension(780, 35)); |
| 78 | 9 | setPreferredSize(new java.awt.Dimension(780, 35)); |
| 79 | 9 | setLayout(new java.awt.BorderLayout()); |
| 80 | |
|
| 81 | 9 | painelBusca.setMaximumSize(new java.awt.Dimension(32767, 35)); |
| 82 | 9 | painelBusca.setPreferredSize(new java.awt.Dimension(461, 35)); |
| 83 | 9 | painelBusca.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); |
| 84 | |
|
| 85 | 9 | lblPesquisar.setText("Pesquisar em"); |
| 86 | 9 | painelBusca.add(lblPesquisar); |
| 87 | |
|
| 88 | 9 | lstCategoriasPesquisa.setName("lstCategoriasPesquisa"); |
| 89 | 9 | painelBusca.add(lstCategoriasPesquisa); |
| 90 | |
|
| 91 | 9 | lblPalavras.setText("palavra(s)"); |
| 92 | 9 | painelBusca.add(lblPalavras); |
| 93 | |
|
| 94 | 9 | txtPesquisa.setMinimumSize(new java.awt.Dimension(192, 19)); |
| 95 | 9 | txtPesquisa.setPreferredSize(new java.awt.Dimension(192, 19)); |
| 96 | 9 | painelBusca.add(txtPesquisa); |
| 97 | |
|
| 98 | 9 | btPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/zoom16.gif"))); |
| 99 | 9 | btPesquisar.setText("pesquisar"); |
| 100 | 9 | painelBusca.add(btPesquisar); |
| 101 | |
|
| 102 | 9 | add(painelBusca, java.awt.BorderLayout.CENTER); |
| 103 | |
|
| 104 | 9 | painelSQL.setMaximumSize(new java.awt.Dimension(32767, 35)); |
| 105 | 9 | painelSQL.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); |
| 106 | |
|
| 107 | 9 | btFiltro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/sql.gif"))); |
| 108 | 9 | painelSQL.add(btFiltro); |
| 109 | |
|
| 110 | 9 | add(painelSQL, java.awt.BorderLayout.EAST); |
| 111 | 9 | } |
| 112 | |
|
| 113 | |
private javax.swing.JButton btFiltro; |
| 114 | |
private javax.swing.JButton btPesquisar; |
| 115 | |
private javax.swing.JLabel lblPalavras; |
| 116 | |
private javax.swing.JLabel lblPesquisar; |
| 117 | |
private javax.swing.JComboBox lstCategoriasPesquisa; |
| 118 | |
private javax.swing.JPanel painelBusca; |
| 119 | |
private javax.swing.JPanel painelSQL; |
| 120 | |
private javax.swing.JTextField txtPesquisa; |
| 121 | |
|
| 122 | |
|
| 123 | |
private javax.swing.ComboBoxModel categoriasPesquisaComboBoxModel; |
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
public javax.swing.ComboBoxModel getCategoriasPesquisaComboBoxModel() { |
| 132 | 0 | return categoriasPesquisaComboBoxModel; |
| 133 | |
} |
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
|
| 139 | |
|
| 140 | |
|
| 141 | |
|
| 142 | |
public void setCategoriasPesquisaComboBoxModel(javax.swing.ComboBoxModel lstCategoriasPesquisaModel) { |
| 143 | 6 | this.categoriasPesquisaComboBoxModel = lstCategoriasPesquisaModel; |
| 144 | 6 | lstCategoriasPesquisa.setModel(this.categoriasPesquisaComboBoxModel); |
| 145 | 6 | } |
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
|
| 150 | |
public void addPopupMouseListener(MouseListener popupAction) { |
| 151 | 3 | btFiltro.addMouseListener(popupAction); |
| 152 | 3 | } |
| 153 | |
|
| 154 | |
|
| 155 | |
|
| 156 | |
|
| 157 | |
public void removePopupMouseListener(MouseListener popupAction) { |
| 158 | 0 | btFiltro.removeMouseListener(popupAction); |
| 159 | 0 | } |
| 160 | |
|
| 161 | |
|
| 162 | |
|
| 163 | |
|
| 164 | |
public AcaoPesquisa getAcaoPesquisa() { |
| 165 | 0 | return acaoPesquisa; |
| 166 | |
} |
| 167 | |
|
| 168 | |
|
| 169 | |
|
| 170 | |
|
| 171 | |
public synchronized void setAcaoPesquisa(AcaoPesquisa acaoPesquisa) { |
| 172 | 0 | this.acaoPesquisa = acaoPesquisa; |
| 173 | 0 | registerResearchActionComponent(this.acaoPesquisa); |
| 174 | 0 | } |
| 175 | |
} |