PageRenderTime 354ms CodeModel.GetById 80ms app.highlight 192ms RepoModel.GetById 70ms app.codeStats 1ms

/src/mpv5/ui/panels/HomeScreen.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 964 lines | 830 code | 78 blank | 56 comment | 57 complexity | 67c55482efbaf42651481e6fe15da405 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.panels;
 23
 24import java.awt.Color;
 25import java.awt.Component;
 26import java.math.BigDecimal;
 27import java.util.ArrayList;
 28import java.util.Date;
 29import java.util.HashMap;
 30import java.util.Iterator;
 31import java.util.List;
 32import javax.swing.ImageIcon;
 33import javax.swing.JComponent;
 34import javax.swing.JSplitPane;
 35import javax.swing.JTable;
 36import javax.swing.table.TableCellRenderer;
 37import mpv5.db.common.Context;
 38import mpv5.db.common.DatabaseObject;
 39import mpv5.db.common.NodataFoundException;
 40import mpv5.db.objects.Group;
 41import mpv5.db.objects.Item;
 42import mpv5.db.objects.Reminder;
 43import mpv5.db.objects.Schedule;
 44import mpv5.db.objects.SubItem;
 45import mpv5.db.objects.User;
 46import mpv5.globals.Constants;
 47import mpv5.globals.Messages;
 48import mpv5.handler.Scheduler;
 49import mpv5.logging.Log;
 50import mpv5.ui.dialogs.Popup;
 51import mpv5.ui.dialogs.ScheduleEvents;
 52import mpv5.ui.misc.MPTable;
 53import mpv5.ui.misc.TableViewPersistenceHandler;
 54import mpv5.ui.panels.calendar.ScheduleCalendar;
 55import mpv5.utils.date.DateConverter;
 56import mpv5.utils.date.vTimeframe;
 57import mpv5.utils.models.MPTableModel;
 58import mpv5.utils.numberformat.FormatNumber;
 59import mpv5.utils.renderer.TableCellRendererForDatabaseObjects;
 60import mpv5.utils.tables.TableFormat;
 61
 62public class HomeScreen
 63        extends javax.swing.JPanel {
 64
 65    private static final long serialVersionUID = 8043431014500289718L;
 66    private List<DatabaseObject> odata;
 67    private List<DatabaseObject> xdata;
 68    TableCellRendererForDatabaseObjects rend = new TableCellRendererForDatabaseObjects();
 69    private final ScheduleDayEventsPanel SDEPanel;
 70    private final ScheduleCalendar sc;
 71    private static HomeScreen icke;
 72    private BigDecimal billsSum = new BigDecimal(0);
 73    private BigDecimal orderSum = new BigDecimal(0);
 74    private BigDecimal offerSum = new BigDecimal(0);
 75
 76    public static HomeScreen getInstance() {
 77        if (icke == null) {
 78            icke = new HomeScreen();
 79        } else {
 80            icke.refresh();
 81        }
 82        return icke;
 83    }
 84
 85    /**
 86     * 
 87     */
 88    private HomeScreen() {
 89        initComponents();
 90
 91        setName("homescreenpanel");
 92
 93        labeledCombobox1.setContext(Context.getGroup());
 94        labeledCombobox2.setModel(Item.getItemEnum());
 95        labeledCombobox3.setContext(Context.getGroup());
 96        labeledCombobox4.setModel(Item.getItemEnum());
 97
 98        timeframeChooser1.setTime(new vTimeframe(DateConverter.getStartOfMonth(new Date()), DateConverter.getEndOfMonth(new Date())));
 99        timeframeChooser2.setTime(new vTimeframe(DateConverter.getStartOfMonth(new Date()), DateConverter.getEndOfMonth(new Date())));
100
101        SDEPanel = ScheduleDayEventsPanel.instanceOf();
102        jSplitPane1.setBottomComponent(SDEPanel);
103        sc = ScheduleCalendar.instanceOf();
104        jSplitPane1.setTopComponent(sc);
105        initTable(overdue);
106        initTable(nextEvents);
107    }
108
109    public JSplitPane getjSplitPane1() {
110        return jSplitPane1;
111    }
112
113    private void initTable(JTable table) {
114        table.setDefaultRenderer(String.class,
115                rend);
116        table.setDefaultRenderer(Date.class,
117                rend);
118        table.setDefaultRenderer(DatabaseObject.class,
119                rend);
120
121        ((MPTable) table).setDefaultColumns(new Integer[]{100,
122                    100,
123                    100,
124                    100,
125                    100,
126                    100},
127                new Boolean[]{true,
128                    true,
129                    true,
130                    true,
131                    true,
132                    true});
133        ((MPTable) table).setPersistanceHandler(new TableViewPersistenceHandler(
134                (MPTable) table,
135                this));
136        TableFormat.hideHeader(table);
137    }
138
139    public JTable getNextEvents() {
140        return nextEvents;
141    }
142
143    public JTable getOverdue() {
144        return overdue;
145    }
146
147    public <T extends DatabaseObject> void show(HashMap<Color, List<T>> map, JTable table) {
148
149        Iterator<Color> it = map.keySet().
150                iterator();
151        List<DatabaseObject> ndata = new ArrayList<DatabaseObject>();
152        while (it.hasNext()) {
153            Color c = it.next();
154            List<T> data = map.get(c);
155            for (int i = 0; i < data.size(); i++) {
156                T databaseObject = data.get(i);
157                databaseObject.defineColor(c);
158                ndata.add(databaseObject);
159            }
160        }
161
162        labeledCombobox1.setSearchEnabled(true);
163        labeledCombobox1.setContext(Context.getGroup());
164        labeledCombobox1.triggerSearch();
165//        timeframeChooser1.setTime(new vTimeframe(DateConverter.getStartOfMonth(new Date()), DateConverter.getEndOfMonth(new Date())));
166
167        labeledCombobox3.setSearchEnabled(true);
168        labeledCombobox3.setContext(Context.getGroup());
169        labeledCombobox3.triggerSearch();
170//        timeframeChooser2.setTime(new vTimeframe(DateConverter.getStartOfMonth(new Date()), DateConverter.getEndOfMonth(new Date())));
171
172        if (table.equals(overdue)) {
173            setData(ndata, table, false);
174            odata = ndata;
175        } else {
176            setData(ndata, table, true);
177            xdata = ndata;
178        }
179        validate();
180    }
181
182    public <T extends DatabaseObject> void setData(List<T> list, JTable table, Boolean isDBObj) {
183        Object[][] data = null;
184        int type;
185        orderSum = new BigDecimal(0);
186        offerSum = new BigDecimal(0);
187        billsSum = new BigDecimal(0);
188        BigDecimal tax;
189        if (list != null) {
190            data = new Object[list.size()][6];
191
192            for (int i = 0; i < list.size(); i++) {
193                if (isDBObj == false) {
194                    DatabaseObject databaseObject = list.get(i);
195                    data[i][0] = databaseObject;
196                    data[i][1] = User.getUsername(databaseObject.__getIntaddedby());
197                    data[i][2] = databaseObject.__getDateadded();
198                    try {
199                        data[i][3] = DatabaseObject.getObject(Context.getGroup(),
200                                databaseObject.__getGroupsids());
201                    } catch (NodataFoundException ex) {
202                        data[i][3] = "N/A";
203                    }
204                    type = ((Item) databaseObject).__getInttype();
205                    //  <li>TYPE_BILL = 0;
206                    //  <li>TYPE_ORDER = 1;
207                    //  <li>TYPE_OFFER = 2;
208                    switch (type) {
209                        case Item.TYPE_BILL:
210                            tax = Constants.BD100.add(((Item) databaseObject).__getTaxvalue()).divide(Constants.BD100, 9, BigDecimal.ROUND_HALF_UP);
211                            billsSum = billsSum.add(((Item) databaseObject).__getNetvalue().multiply(tax));
212                            break;
213                        case Item.TYPE_OFFER:
214                            tax = Constants.BD100.add(((Item) databaseObject).__getTaxvalue()).divide(Constants.BD100, 9, BigDecimal.ROUND_HALF_UP);
215                            offerSum = offerSum.add(((Item) databaseObject).__getNetvalue().multiply(tax));
216                            break;
217                        case Item.TYPE_ORDER:
218                            tax = Constants.BD100.add(((Item) databaseObject).__getTaxvalue()).divide(Constants.BD100, 9, BigDecimal.ROUND_HALF_UP);
219                            orderSum = orderSum.add(((Item) databaseObject).__getNetvalue().multiply(tax));
220                            break;
221                    }
222
223                    data[i][4] = Item.getTypeString(type);
224                    data[i][5] = databaseObject.getIcon();
225                    ((ImageIcon) data[i][5]).setDescription(Item.getStatusString(((Item) databaseObject).__getIntstatus()));
226                } else {
227                    Schedule sched = (Schedule) list.get(i);
228                    data[i][0] = sched;
229                    data[i][1] = User.getUsername(sched.__getIntaddedby());
230                    data[i][2] = sched.__getNextdate();
231                    data[i][3] = sched.__getStopdate();
232                    data[i][4] = Item.getTypeString(0);
233                    data[i][5] = sched.getIcon();
234                    ((ImageIcon) data[i][5]).setDescription(Messages.NEW_BILL.toString());
235                }
236            }
237        } else {
238            data = new Object[0][6];
239        }
240
241        MPTableModel m = new MPTableModel(data);
242        m.setTypes(new Class[]{DatabaseObject.class,
243                    String.class,
244                    Date.class,
245                    DatabaseObject.class,
246                    String.class,           
247                    ImageIcon.class
248                });
249        table.setModel(m);
250
251        if (isDBObj == false) {
252            orders.setText(FormatNumber.formatLokalCurrency(orderSum));
253            offers.setText(FormatNumber.formatLokalCurrency(offerSum));
254            bills.setText(FormatNumber.formatLokalCurrency(billsSum));
255        }
256    }
257
258    /**
259     * Filter by group
260     * @param g
261     */
262    @SuppressWarnings("unchecked")
263    public void filterByTimeframe(vTimeframe g) {
264        HashMap<Color, List<Item>> map = Scheduler.getOverdueEvents();
265        this.show(map, this.getOverdue());
266    }
267
268    /**
269     * Filter by group
270     * @param g
271     */
272    @SuppressWarnings("unchecked")
273    public void filterByTimeframe2(vTimeframe g) {
274        HashMap<Color, List<Schedule>> map = Scheduler.getScheduledBills(g);
275        this.show(map, this.getNextEvents());
276    }
277
278    @SuppressWarnings("unchecked")
279    public void filterByItemType(Integer Type) {
280        setData(odata, overdue, false);
281        if (Type >= 0) {
282            Object[][] data = ((MPTableModel) overdue.getModel()).getData();
283            List<DatabaseObject> list = new ArrayList<DatabaseObject>();
284            for (int i = 0; i < data.length; i++) {
285                Item d = (Item) data[i][0];
286                if (d.__getInttype() == Type) {
287                    list.add(d);
288                }
289            }
290            setData(list, overdue, false);
291        }
292    }
293
294    /**
295     * Filter by group
296     * @param g
297     */
298    @SuppressWarnings({"unchecked"})
299    public void filterByGroup(Group g) {
300        setData(odata, overdue, false);
301        Object[][] data = ((MPTableModel) overdue.getModel()).getData();
302        List<DatabaseObject> list = new ArrayList<DatabaseObject>();
303        if (g.__getIDS().
304                intValue() != 1) {
305            for (int i = 0; i < data.length; i++) {
306                DatabaseObject d = (DatabaseObject) data[i][0];
307                if (d.__getGroupsids() == g.__getIDS()) {
308                    list.add(d);
309                }
310            }
311        } else {
312            for (int i = 0; i < data.length; i++) {
313                DatabaseObject d = (DatabaseObject) data[i][0];
314                list.add(d);
315            }
316        }
317        setData(list, overdue, false);
318    }
319
320    @SuppressWarnings("unchecked")
321    public void filterByItemType2(Integer Type) {
322        setData(xdata, nextEvents, false);
323        if (Type >= 0) {
324            Object[][] data = ((MPTableModel) nextEvents.getModel()).getData();
325            List<DatabaseObject> list = new ArrayList<DatabaseObject>();
326            for (int i = 0; i < data.length; i++) {
327                Item d = (Item) data[i][0];
328                if (d.__getInttype() == Type) {
329                    list.add(d);
330                }
331            }
332            setData(list, nextEvents, false);
333        }
334    }
335
336    /**
337     * Filter by group
338     * @param g
339     */
340    @SuppressWarnings({"unchecked"})
341    public void filterByGroup2(Group g) {
342        setData(xdata, nextEvents, false);
343        Object[][] data = ((MPTableModel) nextEvents.getModel()).getData();
344        List<DatabaseObject> list = new ArrayList<DatabaseObject>();
345        if (g.__getIDS().
346                intValue() != 1) {
347            for (int i = 0; i < data.length; i++) {
348                DatabaseObject d = (DatabaseObject) data[i][0];
349                if (d.__getGroupsids() == g.__getIDS()) {
350                    list.add(d);
351                }
352            }
353        } else {
354            for (int i = 0; i < data.length; i++) {
355                DatabaseObject d = (DatabaseObject) data[i][0];
356                list.add(d);
357            }
358        }
359        setData(list, nextEvents, false);
360    }
361
362    /** This method is called from within the constructor to
363     * initialize the form.
364     * WARNING: Do NOT modify this code. The content of this method is
365     * always regenerated by the Form Editor.
366     */
367    @SuppressWarnings("unchecked")
368    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
369    private void initComponents() {
370
371        jSplitPane1 = new javax.swing.JSplitPane();
372        jPanel1 = new javax.swing.JPanel();
373        jButton1 = new javax.swing.JButton();
374        jButton2 = new javax.swing.JButton();
375        timeframeChooser1 = new mpv5.ui.beans.TimeframeChooser();
376        labeledCombobox1 = new mpv5.ui.beans.LabeledCombobox();
377        jScrollPane2 = new javax.swing.JScrollPane();
378        overdue = new  mpv5.ui.misc.MPTable(this) {
379            private static final long serialVersionUID = 1L;
380            public Component prepareRenderer(TableCellRenderer renderer,
381                int rowIndex, int vColIndex) {
382                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
383                if (c instanceof JComponent) {
384                    JComponent jc = (JComponent)c;
385                    jc.setToolTipText(String.valueOf(getValueAt(rowIndex, vColIndex)));
386                }
387                return c;
388            }
389        };
390        labeledCombobox2 = new mpv5.ui.beans.LabeledCombobox();
391        jButton3 = new javax.swing.JButton();
392        offers = new mpv5.ui.beans.LabeledTextField();
393        bills = new mpv5.ui.beans.LabeledTextField();
394        orders = new mpv5.ui.beans.LabeledTextField();
395        but6 = new javax.swing.JButton();
396        jPanel2 = new javax.swing.JPanel();
397        jButton6 = new javax.swing.JButton();
398        jButton5 = new javax.swing.JButton();
399        timeframeChooser2 = new mpv5.ui.beans.TimeframeChooser();
400        labeledCombobox3 = new mpv5.ui.beans.LabeledCombobox();
401        labeledCombobox4 = new mpv5.ui.beans.LabeledCombobox();
402        jButton4 = new javax.swing.JButton();
403        jScrollPane1 = new javax.swing.JScrollPane();
404        nextEvents = new  mpv5.ui.misc.MPTable(this) {
405            private static final long serialVersionUID = 1L;
406            public Component prepareRenderer(TableCellRenderer renderer,
407                int rowIndex, int vColIndex) {
408                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
409                if (c instanceof JComponent) {
410                    JComponent jc = (JComponent)c;
411                    jc.setToolTipText(String.valueOf(getValueAt(rowIndex, vColIndex)));
412                }
413                return c;
414            }
415        };
416        but5 = new javax.swing.JButton();
417        but4 = new javax.swing.JButton();
418
419        setName("Form"); // NOI18N
420
421        jSplitPane1.setDividerLocation(200);
422        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
423        jSplitPane1.setName("jSplitPane1"); // NOI18N
424
425        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
426        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("HomeScreen.jPanel1.border.title"))); // NOI18N
427        jPanel1.setName("jPanel1"); // NOI18N
428
429        jButton1.setText(bundle.getString("HomeScreen.jButton1.text")); // NOI18N
430        jButton1.setName("jButton1"); // NOI18N
431        jButton1.setPreferredSize(new java.awt.Dimension(60, 23));
432        jButton1.addActionListener(new java.awt.event.ActionListener() {
433            public void actionPerformed(java.awt.event.ActionEvent evt) {
434                jButton1ActionPerformed(evt);
435            }
436        });
437
438        jButton2.setText(bundle.getString("HomeScreen.jButton2.text")); // NOI18N
439        jButton2.setName("jButton2"); // NOI18N
440        jButton2.setPreferredSize(new java.awt.Dimension(60, 23));
441        jButton2.addActionListener(new java.awt.event.ActionListener() {
442            public void actionPerformed(java.awt.event.ActionEvent evt) {
443                jButton2ActionPerformed(evt);
444            }
445        });
446
447        timeframeChooser1.setName("timeframeChooser1"); // NOI18N
448
449        labeledCombobox1.set_Label(bundle.getString("HomeScreen.labeledCombobox1._Label")); // NOI18N
450        labeledCombobox1.setName("labeledCombobox1"); // NOI18N
451
452        jScrollPane2.setName("jScrollPane2"); // NOI18N
453
454        overdue.setAutoCreateRowSorter(true);
455        overdue.setModel(new javax.swing.table.DefaultTableModel(
456            new Object [][] {
457                {},
458                {},
459                {},
460                {}
461            },
462            new String [] {
463
464            }
465        ));
466        overdue.setName("overdue"); // NOI18N
467        overdue.setShowVerticalLines(false);
468        overdue.addMouseListener(new java.awt.event.MouseAdapter() {
469            public void mouseClicked(java.awt.event.MouseEvent evt) {
470                overdueMouseClicked(evt);
471            }
472        });
473        jScrollPane2.setViewportView(overdue);
474
475        labeledCombobox2.set_Label(bundle.getString("HomeScreen.labeledCombobox2._Label")); // NOI18N
476        labeledCombobox2.setName("labeledCombobox2"); // NOI18N
477
478        jButton3.setText(bundle.getString("HomeScreen.jButton3.text")); // NOI18N
479        jButton3.setName("jButton3"); // NOI18N
480        jButton3.setPreferredSize(new java.awt.Dimension(60, 23));
481        jButton3.addActionListener(new java.awt.event.ActionListener() {
482            public void actionPerformed(java.awt.event.ActionEvent evt) {
483                jButton3ActionPerformed(evt);
484            }
485        });
486
487        offers.set_Label(bundle.getString("HomeScreen.offers._Label")); // NOI18N
488        offers.setEnabled(false);
489        offers.setName("offers"); // NOI18N
490
491        bills.set_Label(bundle.getString("HomeScreen.bills._Label")); // NOI18N
492        bills.setEnabled(false);
493        bills.setName("bills"); // NOI18N
494
495        orders.set_Label(bundle.getString("HomeScreen.orders._Label")); // NOI18N
496        orders.setEnabled(false);
497        orders.setName("orders"); // NOI18N
498
499        but6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/agt_reload.png"))); // NOI18N
500        but6.setText(bundle.getString("HomeScreen.but6.text")); // NOI18N
501        but6.setToolTipText(bundle.getString("HomeScreen.but6.toolTipText")); // NOI18N
502        but6.setContentAreaFilled(false);
503        but6.setFocusable(false);
504        but6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
505        but6.setName("but6"); // NOI18N
506        but6.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/xclock.png"))); // NOI18N
507        but6.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/agt_reload.png"))); // NOI18N
508        but6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
509        but6.addActionListener(new java.awt.event.ActionListener() {
510            public void actionPerformed(java.awt.event.ActionEvent evt) {
511                but6ActionPerformed(evt);
512            }
513        });
514
515        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
516        jPanel1.setLayout(jPanel1Layout);
517        jPanel1Layout.setHorizontalGroup(
518            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
519            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 882, Short.MAX_VALUE)
520            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
521                .addComponent(offers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
522                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
523                .addComponent(orders, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
524                .addGap(117, 117, 117)
525                .addComponent(bills, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
526            .addGroup(jPanel1Layout.createSequentialGroup()
527                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
528                    .addGroup(jPanel1Layout.createSequentialGroup()
529                        .addComponent(timeframeChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
530                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
531                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
532                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 435, Short.MAX_VALUE)
533                        .addComponent(but6, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
534                    .addGroup(jPanel1Layout.createSequentialGroup()
535                        .addComponent(labeledCombobox2, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)
536                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
537                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
538                        .addGap(18, 18, 18)
539                        .addComponent(labeledCombobox1, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE)
540                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
541                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
542                .addContainerGap())
543        );
544        jPanel1Layout.setVerticalGroup(
545            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
546            .addGroup(jPanel1Layout.createSequentialGroup()
547                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
548                    .addGroup(jPanel1Layout.createSequentialGroup()
549                        .addContainerGap()
550                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
551                            .addComponent(timeframeChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
552                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
553                    .addComponent(but6, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
554                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
555                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
556                    .addComponent(labeledCombobox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
557                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
558                    .addComponent(labeledCombobox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
559                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
560                .addGap(18, 18, 18)
561                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
562                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
563                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
564                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
565                        .addComponent(orders, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
566                        .addComponent(bills, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
567                    .addComponent(offers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
568                .addContainerGap())
569        );
570
571        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("HomeScreen.jPanel2.border.title"))); // NOI18N
572        jPanel2.setName("jPanel2"); // NOI18N
573
574        jButton6.setText(bundle.getString("HomeScreen.jButton6.text")); // NOI18N
575        jButton6.setName("jButton6"); // NOI18N
576        jButton6.setPreferredSize(new java.awt.Dimension(60, 23));
577        jButton6.addActionListener(new java.awt.event.ActionListener() {
578            public void actionPerformed(java.awt.event.ActionEvent evt) {
579                jButton6ActionPerformed(evt);
580            }
581        });
582
583        jButton5.setText(bundle.getString("HomeScreen.jButton5.text")); // NOI18N
584        jButton5.setName("jButton5"); // NOI18N
585        jButton5.setPreferredSize(new java.awt.Dimension(60, 23));
586        jButton5.addActionListener(new java.awt.event.ActionListener() {
587            public void actionPerformed(java.awt.event.ActionEvent evt) {
588                jButton5ActionPerformed(evt);
589            }
590        });
591
592        timeframeChooser2.setName("timeframeChooser2"); // NOI18N
593
594        labeledCombobox3.set_Label(bundle.getString("HomeScreen.labeledCombobox3._Label")); // NOI18N
595        labeledCombobox3.setName("labeledCombobox3"); // NOI18N
596
597        labeledCombobox4.set_Label(bundle.getString("HomeScreen.labeledCombobox4._Label")); // NOI18N
598        labeledCombobox4.setName("labeledCombobox4"); // NOI18N
599
600        jButton4.setText(bundle.getString("HomeScreen.jButton4.text")); // NOI18N
601        jButton4.setName("jButton4"); // NOI18N
602        jButton4.setPreferredSize(new java.awt.Dimension(60, 23));
603        jButton4.addActionListener(new java.awt.event.ActionListener() {
604            public void actionPerformed(java.awt.event.ActionEvent evt) {
605                jButton4ActionPerformed(evt);
606            }
607        });
608
609        jScrollPane1.setName("jScrollPane1"); // NOI18N
610
611        nextEvents.setAutoCreateRowSorter(true);
612        nextEvents.setModel(new javax.swing.table.DefaultTableModel(
613            new Object [][] {
614                {},
615                {},
616                {},
617                {}
618            },
619            new String [] {
620
621            }
622        ));
623        nextEvents.setName("nextEvents"); // NOI18N
624        nextEvents.setShowVerticalLines(false);
625        nextEvents.addMouseListener(new java.awt.event.MouseAdapter() {
626            public void mouseClicked(java.awt.event.MouseEvent evt) {
627                nextEventsMouseClicked(evt);
628            }
629        });
630        jScrollPane1.setViewportView(nextEvents);
631
632        but5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/edittrash.png"))); // NOI18N
633        but5.setText(bundle.getString("HomeScreen.but5.text")); // NOI18N
634        but5.setToolTipText(bundle.getString("HomeScreen.but5.toolTipText")); // NOI18N
635        but5.setContentAreaFilled(false);
636        but5.setFocusable(false);
637        but5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
638        but5.setName("but5"); // NOI18N
639        but5.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/xclock.png"))); // NOI18N
640        but5.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/bright_edittrash.png"))); // NOI18N
641        but5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
642        but5.addActionListener(new java.awt.event.ActionListener() {
643            public void actionPerformed(java.awt.event.ActionEvent evt) {
644                but5ActionPerformed(evt);
645            }
646        });
647
648        but4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/view_right.png"))); // NOI18N
649        but4.setText(bundle.getString("HomeScreen.but4.text")); // NOI18N
650        but4.setToolTipText(bundle.getString("HomeScreen.but4.toolTipText")); // NOI18N
651        but4.setContentAreaFilled(false);
652        but4.setFocusable(false);
653        but4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
654        but4.setName("but4"); // NOI18N
655        but4.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/xclock.png"))); // NOI18N
656        but4.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/mpv5/resources/images/32/view_right.png"))); // NOI18N
657        but4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
658        but4.addActionListener(new java.awt.event.ActionListener() {
659            public void actionPerformed(java.awt.event.ActionEvent evt) {
660                but4ActionPerformed(evt);
661            }
662        });
663
664        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
665        jPanel2.setLayout(jPanel2Layout);
666        jPanel2Layout.setHorizontalGroup(
667            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
668            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 882, Short.MAX_VALUE)
669            .addGroup(jPanel2Layout.createSequentialGroup()
670                .addComponent(but4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
671                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 804, Short.MAX_VALUE)
672                .addComponent(but5, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
673            .addGroup(jPanel2Layout.createSequentialGroup()
674                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
675                    .addGroup(jPanel2Layout.createSequentialGroup()
676                        .addComponent(timeframeChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
677                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
678                        .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
679                    .addGroup(jPanel2Layout.createSequentialGroup()
680                        .addComponent(labeledCombobox4, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)
681                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
682                        .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
683                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
684                        .addComponent(labeledCombobox3, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE)
685                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
686                        .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
687                .addContainerGap(91, Short.MAX_VALUE))
688        );
689        jPanel2Layout.setVerticalGroup(
690            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
691            .addGroup(jPanel2Layout.createSequentialGroup()
692                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
693                    .addComponent(timeframeChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
694                    .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
695                .addGap(9, 9, 9)
696                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
697                    .addComponent(labeledCombobox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
698                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
699                    .addComponent(labeledCombobox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
700                    .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
701                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
702                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
703                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
704                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
705                    .addComponent(but4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
706                    .addComponent(but5, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
707                .addContainerGap())
708        );
709
710        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
711        this.setLayout(layout);
712        layout.setHorizontalGroup(
713            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
714            .addGroup(layout.createSequentialGroup()
715                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
716                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
717                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
718                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
719                .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE))
720        );
721        layout.setVerticalGroup(
722            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
723            .addGroup(layout.createSequentialGroup()
724                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
725                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
726                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
727            .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE)
728        );
729    }// </editor-fold>//GEN-END:initComponents
730
731    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
732        filterByTimeframe(timeframeChooser1.getTime());
733    }//GEN-LAST:event_jButton1ActionPerformed
734
735    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
736        try {
737            filterByGroup((Group) Group.getObject(Context.getGroup(),
738                    Integer.valueOf(labeledCombobox1.getSelectedItem().
739                    getId())));
740        } catch (Exception ex) {
741            Log.Debug(ex);
742        }
743    }//GEN-LAST:event_jButton2ActionPerformed
744
745    private void nextEventsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nextEventsMouseClicked
746        if (evt.getClickCount() > 1) {
747            try {
748                System.err.println(mpv5.YabsViewProxy.instance().
749                        getIdentifierView());
750                createBill();
751            } catch (Exception e) {
752                Log.Debug(e);
753            }
754        }
755    }//GEN-LAST:event_nextEventsMouseClicked
756
757    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
758        filterByItemType(Integer.valueOf(labeledCombobox2.getSelectedItem().
759                getId()));
760    }//GEN-LAST:event_jButton3ActionPerformed
761
762    private void overdueMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_overdueMouseClicked
763        Reminder rem;
764        DatabaseObject dbo;
765        Item itm;
766        if (evt.getClickCount() > 1) {
767            try {
768                System.err.println(mpv5.YabsViewProxy.instance().
769                        getIdentifierView());
770                dbo = ((DatabaseObject) overdue.getModel().
771                        getValueAt(overdue.convertRowIndexToModel(overdue.getSelectedRow()),
772                        0));
773                if (dbo.getColor().equals(Color.RED)
774                        && (dbo instanceof Item)) {
775                    itm = (Item) dbo;
776                    if (itm.__getInttype() == Item.TYPE_BILL) {
777                        if (Popup.Y_N_dialog(Messages.CREATE_REMINDER.toString())) {
778                            rem = new Reminder();
779                            rem.setCname(Messages.REMINDER.toString() + "@" + dbo.__getCname());
780                            rem.setDateadded(new Date());
781                            rem.setDescription("");
782                            rem.setGroupsids(dbo.__getGroupsids());
783                            rem.setIntaddedby(User.getCurrentUser().getID());
784                            rem.setItemsids(dbo.__getIDS());
785                            rem.save();
786                        }
787                    }
788                }
789                mpv5.YabsViewProxy.instance().
790                        getIdentifierView().
791                        addTab(dbo);
792            } catch (Exception e) {
793                Log.Debug(e);
794            }
795        }
796    }//GEN-LAST:event_overdueMouseClicked
797
798private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
799    filterByItemType2(Integer.valueOf(labeledCombobox4.getSelectedItem().
800            getId()));
801}//GEN-LAST:event_jButton4ActionPerformed
802
803private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
804    try {
805        filterByGroup2((Group) Group.getObject(Context.getGroup(),
806                Integer.valueOf(labeledCombobox3.getSelectedItem().
807                getId())));
808    } catch (Exception ex) {
809        Log.Debug(ex);
810    }
811}//GEN-LAST:event_jButton5ActionPerformed
812
813private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
814    filterByTimeframe2(timeframeChooser2.getTime());
815}//GEN-LAST:event_jButton6ActionPerformed
816
817    private void but4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_but4ActionPerformed
818        Log.Debug(this, "adding new schedule from Homescreen");
819        ScheduleEvents.instanceOf();
820
821    }//GEN-LAST:event_but4ActionPerformed
822
823    private void but5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_but5ActionPerformed
824        Schedule d = (Schedule) nextEvents.getModel().getValueAt(nextEvents.convertRowIndexToModel(nextEvents.getSelectedRow()), 0);
825        Log.Debug(this, "deleting the marked entry from Homescreen (and database :-) )");
826        d.delete();
827        refresh();
828    }//GEN-LAST:event_but5ActionPerformed
829
830    private void but6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_but6ActionPerformed
831        odata = xdata = null;
832        refresh();
833        HashMap<Color, List<Schedule>> map1 = Scheduler.getScheduledBills(null);
834        Iterator<Color> it1 = map1.keySet().
835                iterator();
836        while (it1.hasNext()) {
837            Color c = it1.next();
838            List<Schedule> data = map1.get(c);
839            if (!data.isEmpty()) {
840                this.show(map1, this.getNextEvents());
841                break;
842            }
843        }
844
845        HashMap<Color, List<Item>> map2 = Scheduler.getOverdueEvents();
846        Iterator<Color> it2 = map2.keySet().
847                iterator();
848        while (it2.hasNext()) {
849            Color c = it2.next();
850            List<Item> data = map2.get(c);
851            if (!data.isEmpty()) {
852                this.show(map2, this.getOverdue());
853                break;
854            }
855        }
856    }//GEN-LAST:event_but6ActionPerformed
857    // Variables declaration - do not modify//GEN-BEGIN:variables
858    private mpv5.ui.beans.LabeledTextField bills;
859    private javax.swing.JButton but4;
860    private javax.swing.JButton but5;
861    private javax.swing.JButton but6;
862    private javax.swing.JButton jButton1;
863    private javax.swing.JButton jButton2;
864    private javax.swing.JButton jButton3;
865    private javax.swing.JButton jButton4;
866    private javax.swing.JButton jButton5;
867    private javax.swing.JButton jButton6;
868    private javax.swing.JPanel jPanel1;
869    private javax.swing.JPanel jPanel2;
870    private javax.swing.JScrollPane jScrollPane1;
871    private javax.swing.JScrollPane jScrollPane2;
872    private javax.swing.JSplitPane jSplitPane1;
873    private mpv5.ui.beans.LabeledCombobox labeledCombobox1;
874    private mpv5.ui.beans.LabeledCombobox labeledCombobox2;
875    private mpv5.ui.beans.LabeledCombobox labeledCombobox3;
876    private mpv5.ui.beans.LabeledCombobox labeledCombobox4;
877    private javax.swing.JTable nextEvents;
878    private mpv5.ui.beans.LabeledTextField offers;
879    private mpv5.ui.beans.LabeledTextField orders;
880    private javax.swing.JTable overdue;
881    private mpv5.ui.beans.TimeframeChooser timeframeChooser1;
882    private mpv5.ui.beans.TimeframeChooser timeframeChooser2;
883    // End of variables declaration//GEN-END:variables
884
885    private void createBill() {
886        if (Popup.Y_N_dialog(Messages.SCHEDULE_NEW_ITEMS)) {
887            MPTableModel m = (MPTableModel) nextEvents.getModel();
888            Schedule schedule = (Schedule) m.getValueAt(nextEvents.convertRowIndexToModel(nextEvents.getSelectedRow()),
889                    0);
890            Log.Debug(this, !schedule.__getIsdone());
891            if (!schedule.__getIsdone()) {
892                Log.Debug(this, "Objekt muss generiert werden ...");
893                try {
894                    Item item = schedule.getItem();
895                    SubItem[] subs = item.getSubitems();
896                    item.setIDS(-1);
897                    item.setDateadded(new Date());
898                    try {
899                        item.setDatetodo(DateConverter.addDays(new Date(), Integer.valueOf(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("bills.warn.days"))));
900                        item.setDateend(DateConverter.addDays(new Date(), Integer.valueOf(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("bills.alert.days"))));
901                    } catch (Exception e) {
902                        item.setDatetodo(DateConverter.addDays(new Date(), 14));
903                        item.setDateend(DateConverter.addDays(new Date(), 30));
904                    }
905                    item.setIntreminders(0);
906                    item.setIntstatus(Item.STATUS_IN_PROGRESS);
907                    item.setDescription(item.__getDescription()
908                            + "\n"
909                            + Messages.SCHEDULE_GENERATED
910                            + "\n"
911                            + item.__getCname());
912                    Log.Debug(this, "Objekt wird gesichert ...");
913                    item.save();
914                    for (int j = 0; j < subs.length; j++) {
915                        SubItem subItem = subs[j];
916                        subItem.setItemsids(item.__getIDS());
917                        subItem.setIDS(-1);
918                        subItem.save(true);
919                    }
920                    Log.Debug(this, "Posten wurden gesichert ...");
921                    Date olddate = schedule.__getNextdate();
922                    schedule.setNextdate(DateConverter.addMonths(schedule.__getNextdate(), schedule.__getIntervalmonth()));
923                    if (schedule.__getNextdate().before(schedule.__getStopdate())) {
924                        Schedule s2 = (Schedule) schedule.clone();
925                        s2.setIsdone(false);
926                        s2.setIDS(-1);
927                        s2.save(true);
928                        schedule.setNextdate(olddate);
929                        schedule.setIsdone(true);
930                        schedule.save(true);
931                    } else {
932                        schedule.setNextdate(olddate);
933                        schedule.setIsdone(true);
934                        schedule.save(true);
935                        mpv5.YabsViewProxy.instance().addMessage(Messages.SCHEDULE_ITEM_REMOVED + " " + schedule);
936                    }
937                    Log.Debug(this, "Schedule wurde gesichert ...");
938                    mpv5.YabsViewProxy.instance().
939                            getIdentifierView().
940                            addTab(item);
941                    m.removeRow(nextEvents.convertRowIndexToModel(nextEvents.getSelectedRow()));
942                } catch (NodataFoundException ex) {
943                    Log.Debug(ex);
944                }
945            }
946        }
947    }
948
949    public void refresh() {
950        // ?berf?llige Objekte zur?cksetzen ...
951        timeframeChooser1.setTime(new vTimeframe(DateConverter.getStartOfMonth(new Date()), DateConverter.getEndOfMonth(new Date())));
952        labeledCombobox1.getComboBox().setSelectedIndex(-1);
953        labeledCombobox2.getComboBox().setSelectedIndex(-1);
954        setData(odata, overdue, false);
955        // Zyklische Objekte zur?cksetzen ...
956        timeframeChooser2.setTime(new vTimeframe(DateConverter.getStartOfMonth(new Date()), DateConverter.getEndOfMonth(new Date())));
957        labeledCombobox3.getComboBox().setSelectedIndex(-1);
958        labeledCombobox4.getComboBox().setSelectedIndex(-1);
959        setData(xdata, nextEvents, true);
960        // Navigation rechts aktualisieren ...
961        sc.setDate(new Date());
962        SDEPanel.setDayEvents(null);
963    }
964}