Revision 37584 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/panel/FastFilterButtonsPanel.java
FastFilterButtonsPanel.java | ||
---|---|---|
44 | 44 |
*/ |
45 | 45 |
public class FastFilterButtonsPanel extends JPanel implements ActionListener { |
46 | 46 |
|
47 |
private static final long serialVersionUID = 3767011079359743742L;
|
|
47 |
private static final long serialVersionUID = 3767011079359743742L;
|
|
48 | 48 |
|
49 |
private PackagesTablePanel panel;
|
|
50 |
private SwingInstallerManager swingInstallerManager;
|
|
49 |
private PackagesTablePanel panel;
|
|
50 |
private SwingInstallerManager swingInstallerManager;
|
|
51 | 51 |
|
52 |
private JButton searchButton;
|
|
53 |
private JButton resetButton;
|
|
54 |
private JTextField textField;
|
|
55 |
NameAndDescriptionFilter filter = null;
|
|
52 |
private JButton searchButton;
|
|
53 |
private JButton resetButton;
|
|
54 |
private JTextField textField;
|
|
55 |
private NameAndDescriptionFilter filter = null;
|
|
56 | 56 |
|
57 |
public FastFilterButtonsPanel(PackagesTablePanel panel) { |
|
58 |
this.panel = panel; |
|
59 |
swingInstallerManager = |
|
60 |
(DefaultSwingInstallerManager) SwingInstallerLocator |
|
61 |
.getSwingInstallerManager(); |
|
62 |
initComponents(); |
|
63 |
} |
|
57 |
public FastFilterButtonsPanel(PackagesTablePanel panel) { |
|
58 |
this.panel = panel; |
|
59 |
swingInstallerManager = SwingInstallerLocator |
|
60 |
.getSwingInstallerManager(); |
|
61 |
initComponents(); |
|
62 |
} |
|
64 | 63 |
|
65 |
private void initComponents() {
|
|
64 |
private void initComponents() {
|
|
66 | 65 |
|
67 |
filter = new NameAndDescriptionFilter("");
|
|
66 |
filter = new NameAndDescriptionFilter("");
|
|
68 | 67 |
|
69 |
JLabel fastFilterLabel =
|
|
70 |
new JLabel(swingInstallerManager.getText("_fast_filter"));
|
|
68 |
JLabel fastFilterLabel = new JLabel(swingInstallerManager
|
|
69 |
.getText("_fast_filter"));
|
|
71 | 70 |
|
72 |
textField = new JTextField(20);
|
|
71 |
textField = new JTextField(20);
|
|
73 | 72 |
|
74 |
MyKeyListener l = new MyKeyListener();
|
|
73 |
MyKeyListener l = new MyKeyListener();
|
|
75 | 74 |
|
76 |
textField.addKeyListener(l);
|
|
75 |
textField.addKeyListener(l);
|
|
77 | 76 |
|
78 |
searchButton = new JButton(swingInstallerManager.getText("_search"));
|
|
79 |
searchButton.setActionCommand("search");
|
|
80 |
searchButton.addActionListener(this);
|
|
77 |
searchButton = new JButton(swingInstallerManager.getText("_search"));
|
|
78 |
searchButton.setActionCommand("search");
|
|
79 |
searchButton.addActionListener(this);
|
|
81 | 80 |
|
82 |
resetButton = new JButton(swingInstallerManager.getText("_reset"));
|
|
83 |
resetButton.setActionCommand("reset");
|
|
84 |
resetButton.addActionListener(this);
|
|
81 |
resetButton = new JButton(swingInstallerManager.getText("_reset_filters"));
|
|
82 |
resetButton.setActionCommand("reset");
|
|
83 |
resetButton.addActionListener(this);
|
|
85 | 84 |
|
86 |
setLayout(new FlowLayout(FlowLayout.LEFT));
|
|
85 |
setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
|
|
87 | 86 |
|
88 |
add(fastFilterLabel);
|
|
89 |
add(textField);
|
|
90 |
add(searchButton);
|
|
91 |
add(resetButton);
|
|
87 |
add(fastFilterLabel);
|
|
88 |
add(textField);
|
|
89 |
// add(searchButton);
|
|
90 |
add(resetButton);
|
|
92 | 91 |
|
93 |
}
|
|
92 |
}
|
|
94 | 93 |
|
95 |
public void actionPerformed(ActionEvent e) {
|
|
96 |
if ("search".equals(e.getActionCommand())) {
|
|
97 |
searchAction();
|
|
98 |
} else {
|
|
99 |
if ("reset".equals(e.getActionCommand())) {
|
|
100 |
resetAction();
|
|
101 |
}
|
|
102 |
}
|
|
103 |
}
|
|
94 |
public void actionPerformed(ActionEvent e) {
|
|
95 |
if ("search".equals(e.getActionCommand())) {
|
|
96 |
searchAction();
|
|
97 |
} else {
|
|
98 |
if ("reset".equals(e.getActionCommand())) {
|
|
99 |
resetAction();
|
|
100 |
}
|
|
101 |
}
|
|
102 |
}
|
|
104 | 103 |
|
105 |
private void searchAction() {
|
|
106 |
filter.setFilter(textField.getText());
|
|
107 |
panel.setFilter(filter);
|
|
108 |
}
|
|
104 |
private void searchAction() {
|
|
105 |
filter.setFilter(textField.getText());
|
|
106 |
panel.setFilter(filter);
|
|
107 |
}
|
|
109 | 108 |
|
110 |
private void resetAction() { |
|
111 |
this.resetPanel(); |
|
112 |
} |
|
113 |
|
|
114 |
public void resetPanel() { |
|
115 |
textField.setText(""); |
|
116 |
filter.setFilter(""); |
|
117 |
panel.setFilter(filter); |
|
118 |
panel.resetPanel(); |
|
119 |
} |
|
109 |
private void resetAction() { |
|
110 |
this.resetPanel(); |
|
111 |
} |
|
120 | 112 |
|
121 |
private class MyKeyListener implements KeyListener { |
|
113 |
public void resetPanel() { |
|
114 |
textField.setText(""); |
|
115 |
filter.setFilter(""); |
|
116 |
panel.setFilter(filter); |
|
117 |
panel.resetPanel(); |
|
118 |
} |
|
122 | 119 |
|
123 |
public void keyTyped(KeyEvent e) { |
|
124 |
} |
|
120 |
private class MyKeyListener implements KeyListener { |
|
125 | 121 |
|
126 |
public void keyReleased(KeyEvent e) { |
|
127 |
searchAction(); |
|
128 |
textField.requestFocus(); |
|
129 |
textField.setCaretPosition(textField.getDocument().getLength()); |
|
130 |
} |
|
122 |
public void keyTyped(KeyEvent e) { |
|
123 |
} |
|
131 | 124 |
|
132 |
public void keyPressed(KeyEvent e) { |
|
133 |
} |
|
134 |
} |
|
125 |
public void keyReleased(KeyEvent e) { |
|
126 |
searchAction(); |
|
127 |
textField.requestFocus(); |
|
128 |
textField.setCaretPosition(textField.getDocument().getLength()); |
|
129 |
} |
|
135 | 130 |
|
131 |
public void keyPressed(KeyEvent e) { |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
136 | 135 |
} |
Also available in: Unified diff