PageRenderTime 47ms CodeModel.GetById 10ms app.highlight 32ms RepoModel.GetById 1ms app.codeStats 0ms

/src/mpv5/ui/panels/ContactsList.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 521 lines | 441 code | 59 blank | 21 comment | 7 complexity | a5a18f2607483fc69ced4834b556060e MD5 | raw file
  1package mpv5.ui.panels;
  2
  3import java.awt.Component;
  4import javax.swing.JComponent;
  5import javax.swing.table.TableCellRenderer;
  6import mpv5.db.common.Context;
  7import mpv5.db.common.DatabaseObject;
  8import mpv5.db.common.DatabaseSearch;
  9import mpv5.db.common.NodataFoundException;
 10import mpv5.db.objects.Contact;
 11import mpv5.globals.Headers;
 12import mpv5.globals.Messages;
 13import mpv5.logging.Log;
 14import mpv5.ui.frames.MPView;
 15import mpv5.ui.misc.MPTable;
 16import mpv5.utils.models.MPTableModel;
 17import mpv5.utils.tables.Selection;
 18import mpv5.utils.tables.TableFormat;
 19import mpv5.ui.misc.TableViewPersistenceHandler;
 20
 21/**
 22 *
 23 * 
 24 */
 25public class ContactsList extends javax.swing.JPanel implements ListPanel {
 26
 27    private static final long serialVersionUID = 1L;
 28    private Context context;
 29    private java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle();
 30
 31    /** Creates new form ListPanel */
 32    public ContactsList() {
 33        initComponents();
 34        setName("contactlist");
 35        prinitingComboBox1.init(listTable);
 36        this.context = Context.getContact();
 37        ((MPTable) listTable).setDefaultColumns(new Integer[]{0, 100, 100, 100, 100, 100, 100}, new Boolean[]{});
 38        ((MPTable) listTable).setPersistanceHandler(new TableViewPersistenceHandler((MPTable)listTable, this));
 39    }
 40
 41    public ContactsList(Context context) {
 42        this();
 43
 44        this.context = context;
 45        context.setSearchFields(Context.DETAILS_CONTACTS);
 46//        fill(true, true, true, true, false);
 47    }
 48
 49    private void fill(boolean customer, boolean supplier, boolean manufacturer, boolean company, boolean filtered) {
 50
 51        context.setContactConditions(customer, supplier, manufacturer, company);
 52        context.setExclusiveContactConditions(customer, supplier, manufacturer, company);
 53        context.useExclusiveConditions(filtered);
 54        if (jTextField1.getText() != null && jTextField1.getText().length() > 0) {
 55            listTable.setModel(new MPTableModel(new DatabaseSearch(context).getValuesFor(Context.DETAILS_CONTACTS, Context.DETAIL_CONTACT_SEARCH.split(","), jTextField1.getText(), true), Headers.CONTACT_DETAILS.getValue(),
 56                    new Class[]{Integer.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class}));
 57        } else {
 58            listTable.setModel(new MPTableModel(new DatabaseSearch(context).getValuesFor(Context.DETAILS_CONTACTS), Headers.CONTACT_DETAILS.getValue()));
 59        }
 60        count.setText(String.valueOf(listTable.getModel().getRowCount()));
 61    }
 62
 63    /** This me4thod is called from within the constructor to
 64     * initialize the form.
 65     * WARNING: Do NOT modify this code. The content of this method is
 66     * always regenerated by the Form Editor.
 67     */
 68    @SuppressWarnings("unchecked")
 69    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 70    private void initComponents() {
 71
 72        jPanel1 = new javax.swing.JPanel();
 73        jScrollPane1 = new javax.swing.JScrollPane();
 74        listTable = new  mpv5.ui.misc.MPTable(this) {
 75            public Component prepareRenderer(TableCellRenderer renderer,
 76                int rowIndex, int vColIndex) {
 77                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
 78                if (c instanceof JComponent) {
 79                    JComponent jc = (JComponent)c;
 80                    jc.setToolTipText(String.valueOf(getValueAt(rowIndex, vColIndex)));
 81                }
 82                return c;
 83            }
 84        };
 85        jPanel2 = new javax.swing.JPanel();
 86        jLabel2 = new javax.swing.JLabel();
 87        count = new javax.swing.JLabel();
 88        jLabel3 = new javax.swing.JLabel();
 89        jTextField1 = new javax.swing.JTextField();
 90        jButton2 = new javax.swing.JButton();
 91        jButton3 = new javax.swing.JButton();
 92        jToolBar2 = new javax.swing.JToolBar();
 93        jLabel1 = new javax.swing.JLabel();
 94        jCheckBox1 = new javax.swing.JCheckBox();
 95        jCheckBox2 = new javax.swing.JCheckBox();
 96        jCheckBox3 = new javax.swing.JCheckBox();
 97        jCheckBox4 = new javax.swing.JCheckBox();
 98        excButton = new javax.swing.JCheckBox();
 99        jButton6 = new javax.swing.JButton();
100        prinitingComboBox1 = new mpv5.ui.beans.PrinitingComboBox();
101        jPanel3 = new javax.swing.JPanel();
102        jLabel4 = new javax.swing.JLabel();
103        jButton5 = new javax.swing.JButton();
104        jButton1 = new javax.swing.JButton();
105        jButton4 = new javax.swing.JButton();
106
107        setName("Form"); // NOI18N
108
109        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
110        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ContactsList.jPanel1.border.title"))); // NOI18N
111        jPanel1.setName("jPanel1"); // NOI18N
112
113        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
114        jScrollPane1.setName("jScrollPane1"); // NOI18N
115
116        listTable.setAutoCreateRowSorter(true);
117        listTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
118        listTable.setDragEnabled(true);
119        listTable.setFillsViewportHeight(true);
120        listTable.setName("listTable"); // NOI18N
121        listTable.setShowVerticalLines(false);
122        listTable.addMouseListener(new java.awt.event.MouseAdapter() {
123            public void mouseClicked(java.awt.event.MouseEvent evt) {
124                listTableMouseClicked(evt);
125            }
126        });
127        jScrollPane1.setViewportView(listTable);
128
129        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ContactsList.jPanel2.border.title"))); // NOI18N
130        jPanel2.setName("jPanel2"); // NOI18N
131
132        jLabel2.setFont(jLabel2.getFont());
133        jLabel2.setText(bundle.getString("ContactsList.jLabel2.text")); // NOI18N
134        jLabel2.setName("jLabel2"); // NOI18N
135
136        count.setFont(count.getFont().deriveFont(count.getFont().getStyle() | java.awt.Font.BOLD));
137        count.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
138        count.setText(bundle.getString("ContactsList.count.text")); // NOI18N
139        count.setBorder(javax.swing.BorderFactory.createEtchedBorder());
140        count.setName("count"); // NOI18N
141
142        jLabel3.setFont(jLabel3.getFont());
143        jLabel3.setText(bundle.getString("ContactsList.jLabel3.text")); // NOI18N
144        jLabel3.setMaximumSize(new java.awt.Dimension(100, 14));
145        jLabel3.setMinimumSize(new java.awt.Dimension(100, 14));
146        jLabel3.setName("jLabel3"); // NOI18N
147        jLabel3.setPreferredSize(new java.awt.Dimension(100, 14));
148
149        jTextField1.setFont(jTextField1.getFont());
150        jTextField1.setText(bundle.getString("ContactsList.jTextField1.text")); // NOI18N
151        jTextField1.setName("jTextField1"); // NOI18N
152        jTextField1.addActionListener(new java.awt.event.ActionListener() {
153            public void actionPerformed(java.awt.event.ActionEvent evt) {
154                jTextField1ActionPerformed(evt);
155            }
156        });
157
158        jButton2.setFont(jButton2.getFont());
159        jButton2.setText(bundle.getString("ContactsList.jButton2.text")); // NOI18N
160        jButton2.setName("jButton2"); // NOI18N
161        jButton2.addActionListener(new java.awt.event.ActionListener() {
162            public void actionPerformed(java.awt.event.ActionEvent evt) {
163                jButton2ActionPerformed(evt);
164            }
165        });
166
167        jButton3.setFont(jButton3.getFont());
168        jButton3.setText(bundle.getString("ContactsList.jButton3.text")); // NOI18N
169        jButton3.setName("jButton3"); // NOI18N
170        jButton3.addActionListener(new java.awt.event.ActionListener() {
171            public void actionPerformed(java.awt.event.ActionEvent evt) {
172                jButton3ActionPerformed(evt);
173            }
174        });
175
176        jToolBar2.setFloatable(false);
177        jToolBar2.setMaximumSize(new java.awt.Dimension(457, 33));
178        jToolBar2.setName("jToolBar2"); // NOI18N
179        jToolBar2.setPreferredSize(new java.awt.Dimension(670, 23));
180
181        jLabel1.setFont(jLabel1.getFont());
182        jLabel1.setText(bundle.getString("ContactsList.jLabel1.text")); // NOI18N
183        jLabel1.setMaximumSize(new java.awt.Dimension(100, 14));
184        jLabel1.setMinimumSize(new java.awt.Dimension(100, 14));
185        jLabel1.setName("jLabel1"); // NOI18N
186        jLabel1.setPreferredSize(new java.awt.Dimension(100, 14));
187        jToolBar2.add(jLabel1);
188
189        jCheckBox1.setFont(jCheckBox1.getFont());
190        jCheckBox1.setText(bundle.getString("ContactsList.jCheckBox1.text")); // NOI18N
191        jCheckBox1.setMargin(new java.awt.Insets(2, 6, 2, 6));
192        jCheckBox1.setMaximumSize(new java.awt.Dimension(333, 33));
193        jCheckBox1.setMinimumSize(new java.awt.Dimension(100, 20));
194        jCheckBox1.setName("jCheckBox1"); // NOI18N
195        jCheckBox1.setPreferredSize(new java.awt.Dimension(100, 20));
196        jCheckBox1.addItemListener(new java.awt.event.ItemListener() {
197            public void itemStateChanged(java.awt.event.ItemEvent evt) {
198                ItemStateChanged(evt);
199            }
200        });
201        jToolBar2.add(jCheckBox1);
202
203        jCheckBox2.setFont(jCheckBox2.getFont());
204        jCheckBox2.setText(bundle.getString("ContactsList.jCheckBox2.text")); // NOI18N
205        jCheckBox2.setMargin(new java.awt.Insets(2, 6, 2, 6));
206        jCheckBox2.setMaximumSize(new java.awt.Dimension(333, 33));
207        jCheckBox2.setMinimumSize(new java.awt.Dimension(100, 20));
208        jCheckBox2.setName("jCheckBox2"); // NOI18N
209        jCheckBox2.setPreferredSize(new java.awt.Dimension(100, 20));
210        jCheckBox2.addItemListener(new java.awt.event.ItemListener() {
211            public void itemStateChanged(java.awt.event.ItemEvent evt) {
212                ItemStateChanged(evt);
213            }
214        });
215        jToolBar2.add(jCheckBox2);
216
217        jCheckBox3.setFont(jCheckBox3.getFont());
218        jCheckBox3.setText(bundle.getString("ContactsList.jCheckBox3.text")); // NOI18N
219        jCheckBox3.setMargin(new java.awt.Insets(2, 6, 2, 6));
220        jCheckBox3.setMaximumSize(new java.awt.Dimension(333, 33));
221        jCheckBox3.setMinimumSize(new java.awt.Dimension(100, 20));
222        jCheckBox3.setName("jCheckBox3"); // NOI18N
223        jCheckBox3.setPreferredSize(new java.awt.Dimension(100, 20));
224        jCheckBox3.addItemListener(new java.awt.event.ItemListener() {
225            public void itemStateChanged(java.awt.event.ItemEvent evt) {
226                ItemStateChanged(evt);
227            }
228        });
229        jToolBar2.add(jCheckBox3);
230
231        jCheckBox4.setFont(jCheckBox4.getFont());
232        jCheckBox4.setText(bundle.getString("ContactsList.jCheckBox4.text")); // NOI18N
233        jCheckBox4.setMargin(new java.awt.Insets(2, 6, 2, 6));
234        jCheckBox4.setMaximumSize(new java.awt.Dimension(333, 33));
235        jCheckBox4.setMinimumSize(new java.awt.Dimension(100, 20));
236        jCheckBox4.setName("jCheckBox4"); // NOI18N
237        jCheckBox4.setPreferredSize(new java.awt.Dimension(100, 20));
238        jCheckBox4.addItemListener(new java.awt.event.ItemListener() {
239            public void itemStateChanged(java.awt.event.ItemEvent evt) {
240                ItemStateChanged(evt);
241            }
242        });
243        jToolBar2.add(jCheckBox4);
244
245        excButton.setFont(excButton.getFont().deriveFont(excButton.getFont().getStyle() | java.awt.Font.BOLD));
246        excButton.setText(bundle.getString("ContactsList.excButton.text")); // NOI18N
247        excButton.setToolTipText(bundle.getString("ContactsList.excButton.toolTipText")); // NOI18N
248        excButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
249        excButton.setMaximumSize(new java.awt.Dimension(333, 33));
250        excButton.setMinimumSize(new java.awt.Dimension(100, 20));
251        excButton.setName("excButton"); // NOI18N
252        excButton.setPreferredSize(new java.awt.Dimension(100, 20));
253        excButton.addItemListener(new java.awt.event.ItemListener() {
254            public void itemStateChanged(java.awt.event.ItemEvent evt) {
255                excButtonItemStateChanged(evt);
256            }
257        });
258        jToolBar2.add(excButton);
259
260        jButton6.setFont(jButton6.getFont());
261        jButton6.setText(bundle.getString("ContactsList.jButton6.text")); // NOI18N
262        jButton6.setName("jButton6"); // NOI18N
263        jButton6.setPreferredSize(new java.awt.Dimension(100, 23));
264        jButton6.addActionListener(new java.awt.event.ActionListener() {
265            public void actionPerformed(java.awt.event.ActionEvent evt) {
266                jButton6ActionPerformed(evt);
267            }
268        });
269
270        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
271        jPanel2.setLayout(jPanel2Layout);
272        jPanel2Layout.setHorizontalGroup(
273            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
274            .addGroup(jPanel2Layout.createSequentialGroup()
275                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
276                    .addGroup(jPanel2Layout.createSequentialGroup()
277                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
278                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
279                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)
280                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
281                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
282                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
283                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
284                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
285                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
286                    .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
287                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
288                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
289                    .addComponent(count, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)
290                    .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE))
291                .addContainerGap())
292        );
293        jPanel2Layout.setVerticalGroup(
294            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
295            .addGroup(jPanel2Layout.createSequentialGroup()
296                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
297                    .addComponent(jButton6, 0, 0, Short.MAX_VALUE)
298                    .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE))
299                .addGap(10, 10, 10)
300                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
301                    .addComponent(count, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
302                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
303                    .addComponent(jButton2)
304                    .addComponent(jButton3)
305                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
306                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
307        );
308
309        prinitingComboBox1.setName("prinitingComboBox1"); // NOI18N
310        prinitingComboBox1.setPreferredSize(new java.awt.Dimension(200, 20));
311
312        jPanel3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(232, 227, 227), 1, true));
313        jPanel3.setName("jPanel3"); // NOI18N
314        jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
315
316        jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() | java.awt.Font.BOLD));
317        jLabel4.setText(bundle.getString("ContactsList.jLabel4.text")); // NOI18N
318        jLabel4.setMaximumSize(new java.awt.Dimension(200, 20));
319        jLabel4.setMinimumSize(new java.awt.Dimension(50, 20));
320        jLabel4.setName("jLabel4"); // NOI18N
321        jLabel4.setPreferredSize(new java.awt.Dimension(150, 20));
322        jPanel3.add(jLabel4);
323
324        jButton5.setFont(jButton5.getFont());
325        jButton5.setText(bundle.getString("ContactsList.jButton5.text")); // NOI18N
326        jButton5.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
327        jButton5.setContentAreaFilled(false);
328        jButton5.setName("jButton5"); // NOI18N
329        jButton5.setPreferredSize(new java.awt.Dimension(120, 23));
330        jButton5.addActionListener(new java.awt.event.ActionListener() {
331            public void actionPerformed(java.awt.event.ActionEvent evt) {
332                jButton5ActionPerformed(evt);
333            }
334        });
335        jPanel3.add(jButton5);
336
337        jButton1.setFont(jButton1.getFont());
338        jButton1.setText(bundle.getString("ContactsList.jButton1.text")); // NOI18N
339        jButton1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
340        jButton1.setContentAreaFilled(false);
341        jButton1.setName("jButton1"); // NOI18N
342        jButton1.setPreferredSize(new java.awt.Dimension(120, 23));
343        jButton1.addActionListener(new java.awt.event.ActionListener() {
344            public void actionPerformed(java.awt.event.ActionEvent evt) {
345                jButton1ActionPerformed(evt);
346            }
347        });
348        jPanel3.add(jButton1);
349
350        jButton4.setFont(jButton4.getFont());
351        jButton4.setText(bundle.getString("ContactsList.jButton4.text")); // NOI18N
352        jButton4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
353        jButton4.setContentAreaFilled(false);
354        jButton4.setName("jButton4"); // NOI18N
355        jButton4.setPreferredSize(new java.awt.Dimension(120, 23));
356        jButton4.addActionListener(new java.awt.event.ActionListener() {
357            public void actionPerformed(java.awt.event.ActionEvent evt) {
358                jButton4ActionPerformed(evt);
359            }
360        });
361        jPanel3.add(jButton4);
362
363        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
364        jPanel1.setLayout(jPanel1Layout);
365        jPanel1Layout.setHorizontalGroup(
366            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
367            .addGroup(jPanel1Layout.createSequentialGroup()
368                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 773, Short.MAX_VALUE)
369                .addContainerGap(45, Short.MAX_VALUE))
370            .addGroup(jPanel1Layout.createSequentialGroup()
371                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
372                .addContainerGap())
373            .addGroup(jPanel1Layout.createSequentialGroup()
374                .addComponent(prinitingComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
375                .addContainerGap())
376            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 818, Short.MAX_VALUE)
377        );
378        jPanel1Layout.setVerticalGroup(
379            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
380            .addGroup(jPanel1Layout.createSequentialGroup()
381                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
382                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
383                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
384                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
385                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
386                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
387                .addComponent(prinitingComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
388        );
389
390        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
391        this.setLayout(layout);
392        layout.setHorizontalGroup(
393            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
394            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
395        );
396        layout.setVerticalGroup(
397            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
398            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
399        );
400    }// </editor-fold>//GEN-END:initComponents
401
402    private void ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ItemStateChanged
403//        fill(jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected(), excButton.isSelected());
404}//GEN-LAST:event_ItemStateChanged
405
406    private void excButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_excButtonItemStateChanged
407
408        fill(jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected(), excButton.isSelected());
409    }//GEN-LAST:event_excButtonItemStateChanged
410
411    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
412        fill(jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected(), excButton.isSelected());
413    }//GEN-LAST:event_jTextField1ActionPerformed
414
415    private void listTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listTableMouseClicked
416
417        if (evt.getClickCount() > 1) {
418            Selection sel = new Selection(listTable);
419            if (sel.checkID()) {
420                try {
421                    mpv5.YabsViewProxy.instance().getIdentifierView().addTab(DatabaseObject.getObject(context, sel.getId()));
422                } catch (NodataFoundException ex) {
423                    Log.Debug(ex);
424                }
425            }
426        }
427    }//GEN-LAST:event_listTableMouseClicked
428
429    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
430
431        DatabaseObject d = DatabaseObject.getObject(Context.getCustomer());
432        ((mpv5.db.objects.Contact) d).setisCustomer(true);
433        mpv5.YabsViewProxy.instance().getIdentifierView().addTab(d, Messages.NEW_CUSTOMER);
434    }//GEN-LAST:event_jButton1ActionPerformed
435
436    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
437        jTextField1ActionPerformed(evt);
438    }//GEN-LAST:event_jButton2ActionPerformed
439
440    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
441        jTextField1.setText("");
442        jTextField1ActionPerformed(evt);
443    }//GEN-LAST:event_jButton3ActionPerformed
444
445    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
446
447        DatabaseObject d = DatabaseObject.getObject(Context.getManufacturer());
448        ((mpv5.db.objects.Contact) d).setisManufacturer(true);
449        mpv5.YabsViewProxy.instance().getIdentifierView().addTab(d, Messages.NEW_MANUFACTURER);
450    }//GEN-LAST:event_jButton4ActionPerformed
451
452    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
453
454        DatabaseObject d = DatabaseObject.getObject(Context.getSupplier());
455        ((mpv5.db.objects.Contact) d).setisSupplier(true);
456        mpv5.YabsViewProxy.instance().getIdentifierView().addTab(d, Messages.NEW_SUPPLIER);
457
458    }//GEN-LAST:event_jButton5ActionPerformed
459
460    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
461        String t = jTextField1.getText();
462        jTextField1.setText("");
463        jTextField1ActionPerformed(evt);
464        jTextField1.setText(t);
465    }//GEN-LAST:event_jButton6ActionPerformed
466    // Variables declaration - do not modify//GEN-BEGIN:variables
467    private javax.swing.JLabel count;
468    private javax.swing.JCheckBox excButton;
469    private javax.swing.JButton jButton1;
470    private javax.swing.JButton jButton2;
471    private javax.swing.JButton jButton3;
472    private javax.swing.JButton jButton4;
473    private javax.swing.JButton jButton5;
474    private javax.swing.JButton jButton6;
475    private javax.swing.JCheckBox jCheckBox1;
476    private javax.swing.JCheckBox jCheckBox2;
477    private javax.swing.JCheckBox jCheckBox3;
478    private javax.swing.JCheckBox jCheckBox4;
479    private javax.swing.JLabel jLabel1;
480    private javax.swing.JLabel jLabel2;
481    private javax.swing.JLabel jLabel3;
482    private javax.swing.JLabel jLabel4;
483    private javax.swing.JPanel jPanel1;
484    private javax.swing.JPanel jPanel2;
485    private javax.swing.JPanel jPanel3;
486    private javax.swing.JScrollPane jScrollPane1;
487    private javax.swing.JTextField jTextField1;
488    private javax.swing.JToolBar jToolBar2;
489    private javax.swing.JTable listTable;
490    private mpv5.ui.beans.PrinitingComboBox prinitingComboBox1;
491    // End of variables declaration//GEN-END:variables
492
493    /**
494     * @return the context
495     */
496    public Context getContext() {
497        return context;
498    }
499
500    /**
501     * @param context the context to set
502     */
503    public void setContext(Context context) {
504        this.context = context;
505    }
506
507    public void refresh() {
508    }
509
510    public void flush() {
511        listTable.setModel(null);
512    }
513
514    public void showType(Contact d) {
515        jCheckBox1.setSelected(d.__getIscustomer());
516        jCheckBox2.setSelected(d.__getIssupplier());
517        jCheckBox3.setSelected(d.__getIsmanufacturer());
518        jCheckBox4.setSelected(d.__getisCompany());
519        jTextField1ActionPerformed(null);
520    }
521}