PageRenderTime 238ms CodeModel.GetById 80ms app.highlight 113ms RepoModel.GetById 38ms app.codeStats 1ms

/src/mpv5/ui/dialogs/subcomponents/ControlPanel_Reminder.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 623 lines | 468 code | 84 blank | 71 comment | 45 complexity | d8af7c7872f5bd6ec9a0462fa3ebe8f0 MD5 | raw file
  1/*
  2 *  This file is part of YaBS.
  3 *
  4 *      YaBS is free software: you can redistribute it and/or modify
  5 *      it under the terms of the GNU General Public License as published by
  6 *      the Free Software Foundation, either version 3 of the License, or
  7 *      (at your option) any later version.
  8 *
  9 *      YaBS is distributed in the hope that it will be useful,
 10 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 *      GNU General Public License for more details.
 13 *
 14 *      You should have received a copy of the GNU General Public License
 15 *      along with YaBS.  If not, see <http://www.gnu.org/licenses/>.
 16 */
 17/*
 18 * GeneralListPanel.java
 19 *
 20 * Created on 03.04.2009, 15:26:37
 21 */
 22package mpv5.ui.dialogs.subcomponents;
 23
 24import java.awt.Component;
 25import mpv5.data.PropertyStore;
 26import mpv5.ui.panels.*;
 27import enoa.handler.TemplateHandler;
 28import java.awt.event.ActionEvent;
 29import java.awt.event.ActionListener;
 30import java.io.File;
 31import java.util.Date;
 32import java.util.HashMap;
 33import java.util.List;
 34import java.util.Vector;
 35import java.util.logging.Level;
 36import java.util.logging.Logger;
 37import javax.swing.DefaultListModel;
 38import mpv5.db.common.Context;
 39import mpv5.db.common.DatabaseObject;
 40import mpv5.db.common.NodataFoundException;
 41import mpv5.db.objects.Item;
 42import mpv5.db.objects.Reminder;
 43import mpv5.db.objects.Stage;
 44import mpv5.db.objects.Template;
 45import mpv5.globals.Constants;
 46import mpv5.globals.Messages;
 47import mpv5.handler.FormFieldsHandler;
 48import mpv5.logging.Log;
 49import mpv5.ui.dialogs.ControlApplet;
 50import mpv5.ui.dialogs.DialogForFile;
 51import mpv5.ui.dialogs.Popup;
 52import mpv5.ui.frames.MPView;
 53import mpv5.utils.export.Export;
 54import mpv5.utils.export.Exportable;
 55import mpv5.utils.files.FileDirectoryHandler;
 56import mpv5.utils.jobs.Job;
 57import mpv5.utils.models.MPTableModel;
 58import mpv5.utils.numberformat.FormatNumber;
 59import mpv5.utils.tables.Selection;
 60
 61/**
 62 *
 63 *  
 64 */
 65public class ControlPanel_Reminder extends javax.swing.JPanel implements DataPanel, ControlApplet {
 66
 67    private static final long serialVersionUID = 1L;
 68    Stage dataOwner = new Stage();
 69    private java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle();
 70
 71    /** Creates new form GeneralListPanel */
 72    public ControlPanel_Reminder() {
 73        initComponents();
 74        labeledTextField1.set_ValueClass(Double.class);
 75
 76        labeledCombobox2.setContext(Context.getGroup());
 77        labeledCombobox2.setSearchEnabled(true);
 78        labeledCombobox2.setEditable(true);
 79        labeledCombobox2.triggerSearch();
 80
 81        try {
 82            jTable1.setModel(new MPTableModel(Context.getStage(), jTable1));
 83        } catch (Exception e) {
 84            Log.Debug(this, e.getMessage());
 85        }
 86    }
 87
 88    /** This method is called from within the constructor to
 89     * initialize the form.
 90     * WARNING: Do NOT modify this code. The content of this method is
 91     * always regenerated by the Form Editor.
 92     */
 93    @SuppressWarnings("unchecked")
 94    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 95    private void initComponents() {
 96
 97        jPanel1 = new javax.swing.JPanel();
 98        jScrollPane1 = new javax.swing.JScrollPane();
 99        jTextPane1 = new javax.swing.JTextPane();
100        labeledTextField1 = new mpv5.ui.beans.LabeledTextField();
101        labeledCombobox2 = new mpv5.ui.beans.LabeledCombobox();
102        jLabel1 = new javax.swing.JLabel();
103        labeledTextField2 = new mpv5.ui.beans.LabeledTextField();
104        jPanel2 = new javax.swing.JPanel();
105        jButton3 = new javax.swing.JButton();
106        jButton7 = new javax.swing.JButton();
107        jButton8 = new javax.swing.JButton();
108        jButton6 = new javax.swing.JButton();
109        jButton2 = new javax.swing.JButton();
110        jButton4 = new javax.swing.JButton();
111        jSeparator1 = new javax.swing.JSeparator();
112        jPanel3 = new javax.swing.JPanel();
113        jScrollPane2 = new javax.swing.JScrollPane();
114        jTable1 = new javax.swing.JTable();
115
116        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
117        setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("RemindPanel.border.title"))); // NOI18N
118        setLayout(new java.awt.BorderLayout());
119
120        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_Reminder.jPanel1.border.title"))); // NOI18N
121        jPanel1.setName("jPanel1"); // NOI18N
122
123        jScrollPane1.setName("jScrollPane1"); // NOI18N
124
125        jTextPane1.setBackground(new java.awt.Color(254, 254, 254));
126        jTextPane1.setName("jTextPane1"); // NOI18N
127        jScrollPane1.setViewportView(jTextPane1);
128
129        labeledTextField1.set_Label(bundle.getString("ControlPanel_Reminder.labeledTextField1._Label")); // NOI18N
130        labeledTextField1.setName("labeledTextField1"); // NOI18N
131
132        labeledCombobox2.set_Label(bundle.getString("ControlPanel_Reminder.labeledCombobox2._Label")); // NOI18N
133        labeledCombobox2.setName("labeledCombobox2"); // NOI18N
134
135        jLabel1.setText(bundle.getString("ControlPanel_Reminder.jLabel1.text")); // NOI18N
136        jLabel1.setName("jLabel1"); // NOI18N
137
138        labeledTextField2.set_Label(bundle.getString("ControlPanel_Reminder.labeledTextField2._Label")); // NOI18N
139        labeledTextField2.setName("labeledTextField2"); // NOI18N
140
141        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
142        jPanel1.setLayout(jPanel1Layout);
143        jPanel1Layout.setHorizontalGroup(
144            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
145            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
146                .addContainerGap()
147                .addComponent(labeledTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
148            .addGroup(jPanel1Layout.createSequentialGroup()
149                .addGap(2, 2, 2)
150                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
151                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
152                    .addComponent(labeledTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
153                    .addGroup(jPanel1Layout.createSequentialGroup()
154                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
155                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
156                        .addComponent(labeledCombobox2, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE))))
157        );
158        jPanel1Layout.setVerticalGroup(
159            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160            .addGroup(jPanel1Layout.createSequentialGroup()
161                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
162                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
163                    .addComponent(labeledCombobox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
164                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
165                .addComponent(labeledTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
166                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
167                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
168                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
169                .addComponent(labeledTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
170        );
171
172        add(jPanel1, java.awt.BorderLayout.EAST);
173
174        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
175        jPanel2.setName("jPanel2"); // NOI18N
176        jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
177
178        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/22/view_text.png"))); // NOI18N
179        jButton3.setText(bundle.getString("ControlPanel_Reminder.jButton3.text")); // NOI18N
180        jButton3.setFocusable(false);
181        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
182        jButton3.setName("jButton3"); // NOI18N
183        jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
184        jButton3.addActionListener(new java.awt.event.ActionListener() {
185            public void actionPerformed(java.awt.event.ActionEvent evt) {
186                jButton3ActionPerformed(evt);
187            }
188        });
189        jPanel2.add(jButton3);
190
191        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/22/mimetypes/pdf.png"))); // NOI18N
192        jButton7.setText(bundle.getString("ControlPanel_Reminder.jButton7.text")); // NOI18N
193        jButton7.setFocusable(false);
194        jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
195        jButton7.setName("jButton7"); // NOI18N
196        jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
197        jButton7.addActionListener(new java.awt.event.ActionListener() {
198            public void actionPerformed(java.awt.event.ActionEvent evt) {
199                jButton7ActionPerformed(evt);
200            }
201        });
202        jPanel2.add(jButton7);
203
204        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/22/mimetypes/odt.png"))); // NOI18N
205        jButton8.setText(bundle.getString("ControlPanel_Reminder.jButton8.text")); // NOI18N
206        jButton8.setFocusable(false);
207        jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
208        jButton8.setName("jButton8"); // NOI18N
209        jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
210        jButton8.addActionListener(new java.awt.event.ActionListener() {
211            public void actionPerformed(java.awt.event.ActionEvent evt) {
212                jButton8ActionPerformed(evt);
213            }
214        });
215        jPanel2.add(jButton8);
216
217        jButton6.setText(bundle.getString("ControlPanel_Reminder.jButton6.text")); // NOI18N
218        jButton6.setName("jButton6"); // NOI18N
219        jButton6.addActionListener(new java.awt.event.ActionListener() {
220            public void actionPerformed(java.awt.event.ActionEvent evt) {
221                jButton6ActionPerformed(evt);
222            }
223        });
224        jPanel2.add(jButton6);
225
226        jButton2.setText(bundle.getString("ControlPanel_Reminder.jButton2.text")); // NOI18N
227        jButton2.setName("jButton2"); // NOI18N
228        jButton2.addActionListener(new java.awt.event.ActionListener() {
229            public void actionPerformed(java.awt.event.ActionEvent evt) {
230                jButton2ActionPerformed(evt);
231            }
232        });
233        jPanel2.add(jButton2);
234
235        jButton4.setText(bundle.getString("ControlPanel_Reminder.jButton4.text")); // NOI18N
236        jButton4.setName("jButton4"); // NOI18N
237        jButton4.addActionListener(new java.awt.event.ActionListener() {
238            public void actionPerformed(java.awt.event.ActionEvent evt) {
239                jButton4ActionPerformed(evt);
240            }
241        });
242        jPanel2.add(jButton4);
243
244        jSeparator1.setName("jSeparator1"); // NOI18N
245        jPanel2.add(jSeparator1);
246
247        add(jPanel2, java.awt.BorderLayout.PAGE_END);
248
249        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_Reminder.jPanel3.border.title"))); // NOI18N
250        jPanel3.setName("jPanel3"); // NOI18N
251        jPanel3.setLayout(new java.awt.BorderLayout());
252
253        jScrollPane2.setName("jScrollPane2"); // NOI18N
254
255        jTable1.setModel(new javax.swing.table.DefaultTableModel(
256            new Object [][] {
257
258            },
259            new String [] {
260
261            }
262        ));
263        jTable1.setName("jTable1"); // NOI18N
264        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
265            public void mouseClicked(java.awt.event.MouseEvent evt) {
266                jTable1MouseClicked(evt);
267            }
268        });
269        jScrollPane2.setViewportView(jTable1);
270
271        jPanel3.add(jScrollPane2, java.awt.BorderLayout.CENTER);
272
273        add(jPanel3, java.awt.BorderLayout.CENTER);
274    }// </editor-fold>//GEN-END:initComponents
275
276    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
277        String msg = Popup.Enter_Value(Messages.ENTER_A_DESCRIPTION);
278        if (msg != null) {
279            Stage s = new Stage();
280            s.setCname(msg);
281            s.setGroupsids(mpv5.db.objects.User.getCurrentUser().__getGroupsids());
282            s.setDescription(jTextPane1.getText());
283            s.setExtravalue(FormatNumber.parseDezimal(labeledTextField1.getText()).doubleValue());
284            if (labeledCombobox2.getSelectedItem() != null) {
285                s.setTemplategroup(Integer.valueOf(labeledCombobox2.getSelectedItem().getId()));
286            }
287
288            s.save();
289        }
290    }//GEN-LAST:event_jButton4ActionPerformed
291
292    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
293
294        dataOwner.delete();
295    }//GEN-LAST:event_jButton6ActionPerformed
296
297    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
298
299        int group = 1;
300
301        PreviewPanel pr;
302        if (dataOwner != null && dataOwner.isExisting()) {
303
304            if (labeledCombobox2.getSelectedItem() != null) {
305                group = Integer.valueOf(labeledCombobox2.getSelectedItem().getId());
306            }
307
308            Template t = TemplateHandler.loadTemplate(group, Constants.TYPE_REMINDER);
309            if (t != null) {
310                Exportable te = TemplateHandler.loadTemplate(group, Constants.TYPE_REMINDER).getExFile();
311                HashMap<String, Object> hm1 = new FormFieldsHandler(dataOwner).getFormattedFormFields(null);
312                File f2 = FileDirectoryHandler.getTempFile("pdf");
313                Export ex = new Export(t);
314                ex.putAll(hm1);
315                ex.setTemplate(te);
316                ex.setTargetFile(f2);
317//                try {
318//                    Stage g = (Stage) DatabaseObject.getObject(Context.getStage(), dataOwner.__getStagesids());
319//                    ex.put("reminder.stage", g.__getCname());
320//                } catch (NodataFoundException ex1) {
321//                    Log.Debug(ex1);
322//                }
323//                try {
324//                    Item i = (Item) DatabaseObject.getObject(Context.getItem(), dataOwner.__getItemsids());
325//                    ex.put("reminder.count", Reminder.getRemindersOf(i).size());
326//                } catch (NodataFoundException nodataFoundException) {
327//                    Log.Debug(nodataFoundException);
328//                }
329
330                pr = new PreviewPanel();
331                pr.setDataOwner(dataOwner);
332                new Job(ex, pr).execute();
333            } else {
334                Popup.notice(Messages.NO_TEMPLATE_DEFINDED);
335            }
336        }
337    }//GEN-LAST:event_jButton3ActionPerformed
338
339    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
340        int group = 1;
341
342        if (dataOwner != null && dataOwner.isExisting()) {
343
344            if (labeledCombobox2.getSelectedItem() != null) {
345                group = Integer.valueOf(labeledCombobox2.getSelectedItem().getId());
346            }
347
348            Template t = TemplateHandler.loadTemplate(group, Constants.TYPE_REMINDER);
349            if (t != null) {
350                Exportable te = TemplateHandler.loadTemplate(group, Constants.TYPE_REMINDER).getExFile();
351                HashMap<String, Object> hm1 = new HashMap<String, Object>();
352                File f2 = FileDirectoryHandler.getTempFile("pdf");
353
354//                try {
355//                    Stage g = (Stage) DatabaseObject.getObject(Context.getStage(), dataOwner.__getStagesids());
356//                    hm1.put("reminder.stage", g.__getCname());
357//                } catch (NodataFoundException ex1) {
358//                    Log.Debug(ex1);
359//                }
360//                try {
361//                    Item i = (Item) DatabaseObject.getObject(Context.getItem(), dataOwner.__getItemsids());
362//                    hm1.put("reminder.count", Reminder.getRemindersOf(i).size());
363//                } catch (NodataFoundException nodataFoundException) {
364//                    Log.Debug(nodataFoundException);
365//                }
366
367                new Job(Export.createFile(dataOwner.__getCname(), t, dataOwner, hm1), new DialogForFile(DialogForFile.FILES_ONLY, dataOwner.__getCname())).execute();
368            } else {
369                Popup.notice(Messages.NO_TEMPLATE_DEFINDED);
370            }
371        }
372    }//GEN-LAST:event_jButton7ActionPerformed
373
374    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
375
376        int group = 1;
377
378        PreviewPanel pr;
379        if (dataOwner != null && dataOwner.isExisting()) {
380
381            if (labeledCombobox2.getSelectedItem() != null) {
382                group = Integer.valueOf(labeledCombobox2.getSelectedItem().getId());
383            }
384
385            Template t = TemplateHandler.loadTemplate(group, Constants.TYPE_REMINDER);
386            if (t != null) {
387                Exportable te = TemplateHandler.loadTemplate(group, Constants.TYPE_REMINDER).getExFile();
388                HashMap<String, Object> hm1 = new HashMap<String, Object>();
389                File f2 = FileDirectoryHandler.getTempFile("odt");
390//
391//                try {
392//                    Stage g = (Stage) DatabaseObject.getObject(Context.getStage(), dataOwner.__getStagesids());
393//                    hm1.put("reminder.stage", g.__getCname());
394//                } catch (NodataFoundException ex1) {
395//                    Log.Debug(ex1);
396//                }
397//                try {
398//                    Item i = (Item) DatabaseObject.getObject(Context.getItem(), dataOwner.__getItemsids());
399//                    hm1.put("reminder.count", Reminder.getRemindersOf(i).size());
400//                } catch (NodataFoundException nodataFoundException) {
401//                    Log.Debug(nodataFoundException);
402//                }
403
404                new Job(Export.sourceFile(dataOwner.__getCname(), t, dataOwner, hm1), new DialogForFile(DialogForFile.FILES_ONLY, dataOwner.__getCname())).execute();
405            } else {
406                Popup.notice(Messages.NO_TEMPLATE_DEFINDED);
407            }
408        }
409    }//GEN-LAST:event_jButton8ActionPerformed
410
411    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
412
413        if (dataOwner != null) {
414            DatabaseObject dato = dataOwner;
415            dato.getPanelData(this);
416            if (dato.save()) {
417            } else {
418                showRequiredFields();
419            }
420        }
421}//GEN-LAST:event_jButton2ActionPerformed
422
423    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
424        Selection s = new Selection(jTable1);
425        if (s.checkID()) {
426            try {
427                setDataOwner(DatabaseObject.getObject(Context.getStage(), s.getId()), true);
428            } catch (NodataFoundException ex) {
429            }
430        }
431    }//GEN-LAST:event_jTable1MouseClicked
432    // Variables declaration - do not modify//GEN-BEGIN:variables
433    private javax.swing.JButton jButton2;
434    private javax.swing.JButton jButton3;
435    private javax.swing.JButton jButton4;
436    private javax.swing.JButton jButton6;
437    private javax.swing.JButton jButton7;
438    private javax.swing.JButton jButton8;
439    private javax.swing.JLabel jLabel1;
440    private javax.swing.JPanel jPanel1;
441    private javax.swing.JPanel jPanel2;
442    private javax.swing.JPanel jPanel3;
443    private javax.swing.JScrollPane jScrollPane1;
444    private javax.swing.JScrollPane jScrollPane2;
445    private javax.swing.JSeparator jSeparator1;
446    private javax.swing.JTable jTable1;
447    private javax.swing.JTextPane jTextPane1;
448    private mpv5.ui.beans.LabeledCombobox labeledCombobox2;
449    private mpv5.ui.beans.LabeledTextField labeledTextField1;
450    private mpv5.ui.beans.LabeledTextField labeledTextField2;
451    // End of variables declaration//GEN-END:variables
452    private double extravalue_;
453    public String cname_;
454    public String description_;
455    public int intaddedby_;
456    public int ids_;
457    public Date dateadded_;
458    public int groupsids_ = 1;
459    public int templategroup_;
460
461    public boolean save() {
462
463        Selection sel = new Selection(jTable1);
464        if (sel.checkID()) {
465            try {
466
467                Stage s = null;
468                try {
469                    s = (Stage) DatabaseObject.getObject(Context.getStage(), sel.getId());
470                } catch (Exception nodataFoundException) {
471                    String msg = Popup.Enter_Value(Messages.ENTER_A_DESCRIPTION);
472                    if (msg == null) {
473                        msg = "autogenerated stage";
474                    }
475                    s = new Stage();
476                    s.setCname(msg);
477                    s.setGroupsids(mpv5.db.objects.User.getCurrentUser().__getGroupsids());
478                    s.setDescription(jTextPane1.getText());
479                    try {
480                        s.setExtravalue(labeledTextField1.getValue(0d));
481                    } catch (NumberFormatException numberFormatException) {
482                        s.setExtravalue(0d);
483                    }
484                    s.save();
485                }
486                dataOwner.setDescription(jTextPane1.getText());
487                try {
488                    dataOwner.setExtravalue(Double.valueOf(labeledTextField1.getText()));
489                } catch (NumberFormatException numberFormatException) {
490                    dataOwner.setExtravalue(0d);
491                }
492            } catch (Exception ex) {
493                Log.Debug(this, ex);
494                return false;
495            }
496        }
497        return true;
498    }
499
500    private void refresh(Item bill) {
501        if (bill != null) {
502            DefaultListModel d = new DefaultListModel();
503            List<Reminder> data = Reminder.getRemindersOf(bill);
504            for (int i = 0; i < data.size(); i++) {
505                Reminder reminder = data.get(i);
506                d.addElement(reminder);
507            }
508
509        } else {
510        }
511    }
512
513    private void expose(Stage r) {
514        dataOwner = r;
515        try {
516            labeledCombobox2.setModel(Item.getObject(Context.getGroup(), r.__getGroupsids()));
517        } catch (NodataFoundException ex) {
518        }
519
520        labeledTextField1.setText(r.__getExtravalue());
521        jTextPane1.setText(r.__getDescription());
522        labeledTextField2.setText(r.__getCname());
523    }
524
525    @Override
526    public boolean collectData() {
527        try {
528            extravalue_ = labeledTextField1.getValue(0d);
529            cname_ = labeledTextField2.getText(true, Messages.NAME.getValue());
530            description_ = jTextPane1.getText();
531            if (labeledCombobox2.getSelectedItem() != null) {
532                templategroup_ = (Integer.valueOf(labeledCombobox2.getSelectedItem().getId()));
533            } else {
534                templategroup_ = 1;
535            }
536        } catch (Exception exception) {
537            return false;
538        }
539        return false;
540    }
541
542    @Override
543    public DatabaseObject getDataOwner() {
544        return dataOwner;
545    }
546
547    @Override
548    public void setDataOwner(DatabaseObject object, boolean populateData) {
549        dataOwner = (Stage) object;
550        if (populateData) {
551            expose(dataOwner);
552        }
553    }
554
555    @Override
556    public void refresh() {
557        refresh(null);
558    }
559
560    @Override
561    public void exposeData() {
562        expose(dataOwner);
563    }
564
565    @Override
566    public void paste(DatabaseObject... dbo) {
567        if (dbo.length > 0) {
568            setDataOwner(dbo[0], true);
569        }
570    }
571
572    @Override
573    public void showRequiredFields() {
574    }
575
576    @Override
577    public void showSearchBar(boolean show) {
578    }
579
580    @Override
581    public void actionAfterSave() {
582    }
583
584    @Override
585    public void actionAfterCreate() {
586    }
587
588    @Override
589    public void actionBeforeCreate() {
590    }
591
592    @Override
593    public void actionBeforeSave() throws ChangeNotApprovedException {
594    }
595
596    @Override
597    public void mail() {
598    }
599
600    @Override
601    public void print() {
602    }
603
604    @Override
605    public Component getAndRemoveActionPanel() {
606        this.remove(jPanel2);
607        validate();
608        return jPanel2;
609    }
610
611    @Override
612    public void setValues(PropertyStore values) {
613    }
614
615    @Override
616    public String getUname() {
617        return "Stages";
618    }
619
620    @Override
621    public void reset() {
622    }
623}