PageRenderTime 56ms CodeModel.GetById 12ms app.highlight 37ms RepoModel.GetById 1ms app.codeStats 1ms

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

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 657 lines | 545 code | 78 blank | 34 comment | 23 complexity | 970a32c3d1c602a2e3a09f26bf43552d 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 java.util.ArrayList;
 26import javax.swing.JComponent;
 27import javax.swing.table.TableCellRenderer;
 28import mpv5.data.PropertyStore;
 29import mpv5.db.common.Context;
 30import mpv5.db.common.DatabaseObject;
 31import mpv5.db.common.NodataFoundException;
 32import mpv5.db.objects.ScheduleTypes;
 33import mpv5.db.objects.User;
 34import mpv5.globals.Messages;
 35import mpv5.logging.Log;
 36import mpv5.ui.dialogs.ControlApplet;
 37import mpv5.ui.dialogs.Popup;
 38import mpv5.ui.panels.MPControlPanel;
 39import mpv5.utils.models.MPTableModel;
 40import mpv5.utils.renderer.TableCellRendererForDatabaseObjects;
 41import mpv5.utils.tables.TableFormat;
 42
 43/**
 44 *
 45 *  
 46 */
 47public class ControlPanel_Schedule extends javax.swing.JPanel implements ControlApplet {
 48
 49    private static final long serialVersionUID = 1L;
 50    TableCellRendererForDatabaseObjects rend = new TableCellRendererForDatabaseObjects();
 51    private PropertyStore oldvalues;
 52    private ScheduleTypes s;
 53
 54    /** Creates new form GeneralListPanel */
 55    public ControlPanel_Schedule() {
 56        initComponents();
 57
 58        labeledCombobox2.setContext(Context.getUser());
 59        labeledCombobox2.setSearchEnabled(true);
 60        labeledCombobox2.setEditable(true);
 61        labeledCombobox2.triggerSearch();
 62
 63        initTable();
 64        setData();
 65        loadPropertys();
 66    }
 67
 68    /** This method is called from within the constructor to
 69     * initialize the form.
 70     * WARNING: Do NOT modify this code. The content of this method is
 71     * always regenerated by the Form Editor.
 72     */
 73    @SuppressWarnings("unchecked")
 74    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 75    private void initComponents() {
 76
 77        jPanel1 = new javax.swing.JPanel();
 78        labeledCombobox2 = new mpv5.ui.beans.LabeledCombobox();
 79        jLabel1 = new javax.swing.JLabel();
 80        labeledTextField2 = new mpv5.ui.beans.LabeledTextField();
 81        jPanel2 = new javax.swing.JPanel();
 82        add = new javax.swing.JButton();
 83        copy = new javax.swing.JButton();
 84        copy1 = new javax.swing.JButton();
 85        remove = new javax.swing.JButton();
 86        jPanel3 = new javax.swing.JPanel();
 87        jScrollPane2 = new javax.swing.JScrollPane();
 88        jTable1 = new  mpv5.ui.misc.MPTable(this) {
 89            public Component prepareRenderer(TableCellRenderer renderer,
 90                int rowIndex, int vColIndex) {
 91                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
 92                if (c instanceof JComponent) {
 93                    JComponent jc = (JComponent)c;
 94                    jc.setToolTipText(String.valueOf(getValueAt(rowIndex, vColIndex)));
 95                }
 96                return c;
 97            }
 98        };
 99        jPanel4 = new javax.swing.JPanel();
100        offer = new javax.swing.JCheckBox();
101        orders = new javax.swing.JCheckBox();
102        confi = new javax.swing.JCheckBox();
103        deliv = new javax.swing.JCheckBox();
104        bills = new javax.swing.JCheckBox();
105        jPanel8 = new javax.swing.JPanel();
106        bill_warn = new mpv5.ui.beans.LabeledTextField();
107        jLabel2 = new javax.swing.JLabel();
108        jLabel3 = new javax.swing.JLabel();
109        bill_alert = new mpv5.ui.beans.LabeledTextField();
110        order_alert = new mpv5.ui.beans.LabeledTextField();
111        order_warn = new mpv5.ui.beans.LabeledTextField();
112        offer_alert = new mpv5.ui.beans.LabeledTextField();
113        offer_warn = new mpv5.ui.beans.LabeledTextField();
114        deliv_alert = new mpv5.ui.beans.LabeledTextField();
115        deliv_warn = new mpv5.ui.beans.LabeledTextField();
116        confi_alert = new mpv5.ui.beans.LabeledTextField();
117        confi_warn = new mpv5.ui.beans.LabeledTextField();
118        jPanel6 = new javax.swing.JPanel();
119        jButton2 = new javax.swing.JButton();
120        jButton1 = new javax.swing.JButton();
121        jButton5 = new javax.swing.JButton();
122
123        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
124        setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("RemindPanel.border.title"))); // NOI18N
125
126        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_Schedule.jPanel1.border.title"))); // NOI18N
127        jPanel1.setName("jPanel1"); // NOI18N
128
129        labeledCombobox2.set_Label(bundle.getString("ControlPanel_Schedule.labeledCombobox2._Label")); // NOI18N
130        labeledCombobox2.setName("labeledCombobox2"); // NOI18N
131
132        jLabel1.setText(bundle.getString("ControlPanel_Schedule.jLabel1.text")); // NOI18N
133        jLabel1.setName("jLabel1"); // NOI18N
134
135        labeledTextField2.set_Label(bundle.getString("ControlPanel_Schedule.labeledTextField2._Label")); // NOI18N
136        labeledTextField2.setName("labeledTextField2"); // NOI18N
137
138        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
139        jPanel1.setLayout(jPanel1Layout);
140        jPanel1Layout.setHorizontalGroup(
141            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
142            .addGroup(jPanel1Layout.createSequentialGroup()
143                .addContainerGap()
144                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
145                    .addGroup(jPanel1Layout.createSequentialGroup()
146                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
147                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
148                        .addComponent(labeledCombobox2, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE))
149                    .addComponent(labeledTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE))
150                .addGap(306, 306, 306))
151        );
152        jPanel1Layout.setVerticalGroup(
153            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
154            .addGroup(jPanel1Layout.createSequentialGroup()
155                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
156                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
157                    .addComponent(labeledCombobox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
158                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
159                .addComponent(labeledTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
160        );
161
162        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
163        jPanel2.setName("jPanel2"); // NOI18N
164
165        add.setText(bundle.getString("ControlPanel_Schedule.add.text")); // NOI18N
166        add.setName("add"); // NOI18N
167        add.addActionListener(new java.awt.event.ActionListener() {
168            public void actionPerformed(java.awt.event.ActionEvent evt) {
169                addActionPerformed(evt);
170            }
171        });
172        jPanel2.add(add);
173
174        copy.setText(bundle.getString("ControlPanel_Schedule.copy.text")); // NOI18N
175        copy.setToolTipText(bundle.getString("ControlPanel_Schedule.copy.toolTipText")); // NOI18N
176        copy.setName("copy"); // NOI18N
177        copy.addActionListener(new java.awt.event.ActionListener() {
178            public void actionPerformed(java.awt.event.ActionEvent evt) {
179                copyActionPerformed(evt);
180            }
181        });
182        jPanel2.add(copy);
183
184        copy1.setText(bundle.getString("ControlPanel_Schedule.copy1.text")); // NOI18N
185        copy1.setToolTipText(bundle.getString("ControlPanel_Schedule.copy1.toolTipText")); // NOI18N
186        copy1.setName("copy1"); // NOI18N
187        copy1.addActionListener(new java.awt.event.ActionListener() {
188            public void actionPerformed(java.awt.event.ActionEvent evt) {
189                copy1ActionPerformed(evt);
190            }
191        });
192        jPanel2.add(copy1);
193
194        remove.setText(bundle.getString("ControlPanel_Schedule.remove.text")); // NOI18N
195        remove.setName("remove"); // NOI18N
196        remove.addActionListener(new java.awt.event.ActionListener() {
197            public void actionPerformed(java.awt.event.ActionEvent evt) {
198                removeActionPerformed(evt);
199            }
200        });
201        jPanel2.add(remove);
202
203        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_Schedule.jPanel3.border.title"))); // NOI18N
204        jPanel3.setName("jPanel3"); // NOI18N
205        jPanel3.setLayout(new java.awt.BorderLayout());
206
207        jScrollPane2.setName("jScrollPane2"); // NOI18N
208
209        jTable1.setAutoCreateRowSorter(true);
210        jTable1.setModel(new javax.swing.table.DefaultTableModel(
211            new Object [][] {
212
213            },
214            new String [] {
215
216            }
217        ));
218        jTable1.setName("jTable1"); // NOI18N
219        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
220            public void mouseClicked(java.awt.event.MouseEvent evt) {
221                jTable1MouseClicked(evt);
222            }
223        });
224        jScrollPane2.setViewportView(jTable1);
225
226        jPanel3.add(jScrollPane2, java.awt.BorderLayout.CENTER);
227
228        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_Schedule.jPanel4.border.title"))); // NOI18N
229        jPanel4.setDoubleBuffered(true);
230        jPanel4.setName("jPanel4"); // NOI18N
231        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.PAGE_AXIS));
232
233        offer.setText(bundle.getString("ControlPanel_Schedule.offer.text")); // NOI18N
234        offer.setName("offer"); // NOI18N
235        jPanel4.add(offer);
236
237        orders.setText(bundle.getString("ControlPanel_Schedule.orders.text")); // NOI18N
238        orders.setName("orders"); // NOI18N
239        jPanel4.add(orders);
240
241        confi.setText(bundle.getString("ControlPanel_Schedule.confi.text")); // NOI18N
242        confi.setName("confi"); // NOI18N
243        jPanel4.add(confi);
244
245        deliv.setText(bundle.getString("ControlPanel_Schedule.deliv.text")); // NOI18N
246        deliv.setName("deliv"); // NOI18N
247        jPanel4.add(deliv);
248
249        bills.setText(bundle.getString("ControlPanel_Schedule.bills.text")); // NOI18N
250        bills.setName("bills"); // NOI18N
251        jPanel4.add(bills);
252
253        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_Schedule.jPanel8.border.title"))); // NOI18N
254        jPanel8.setName("jPanel8"); // NOI18N
255
256        bill_warn.set_Label(bundle.getString("ControlPanel_Schedule.bill_warn._Label")); // NOI18N
257        bill_warn.set_Text(bundle.getString("ControlPanel_Schedule.bill_warn._Text")); // NOI18N
258        bill_warn.setName("bill_warn"); // NOI18N
259
260        jLabel2.setText(bundle.getString("ControlPanel_Schedule.jLabel2.text")); // NOI18N
261        jLabel2.setName("jLabel2"); // NOI18N
262
263        jLabel3.setText(bundle.getString("ControlPanel_Schedule.jLabel3.text")); // NOI18N
264        jLabel3.setName("jLabel3"); // NOI18N
265
266        bill_alert.set_Label(bundle.getString("ControlPanel_Schedule.bill_alert._Label")); // NOI18N
267        bill_alert.set_Text(bundle.getString("ControlPanel_Schedule.bill_alert._Text")); // NOI18N
268        bill_alert.setName("bill_alert"); // NOI18N
269
270        order_alert.set_Label(bundle.getString("ControlPanel_Schedule.order_alert._Label")); // NOI18N
271        order_alert.set_Text(bundle.getString("ControlPanel_Schedule.order_alert._Text")); // NOI18N
272        order_alert.setName("order_alert"); // NOI18N
273
274        order_warn.set_Label(bundle.getString("ControlPanel_Schedule.order_warn._Label")); // NOI18N
275        order_warn.set_Text(bundle.getString("ControlPanel_Schedule.order_warn._Text")); // NOI18N
276        order_warn.setName("order_warn"); // NOI18N
277
278        offer_alert.set_Label(bundle.getString("ControlPanel_Schedule.offer_alert._Label")); // NOI18N
279        offer_alert.set_Text(bundle.getString("ControlPanel_Schedule.offer_alert._Text")); // NOI18N
280        offer_alert.setName("offer_alert"); // NOI18N
281
282        offer_warn.set_Label(bundle.getString("ControlPanel_Schedule.offer_warn._Label")); // NOI18N
283        offer_warn.set_Text(bundle.getString("ControlPanel_Schedule.offer_warn._Text")); // NOI18N
284        offer_warn.setName("offer_warn"); // NOI18N
285
286        deliv_alert.set_Label(bundle.getString("ControlPanel_Schedule.deliv_alert._Label")); // NOI18N
287        deliv_alert.set_Text(bundle.getString("ControlPanel_Schedule.deliv_alert._Text")); // NOI18N
288        deliv_alert.setName("deliv_alert"); // NOI18N
289
290        deliv_warn.set_Label(bundle.getString("ControlPanel_Schedule.deliv_warn._Label")); // NOI18N
291        deliv_warn.set_Text(bundle.getString("ControlPanel_Schedule.deliv_warn._Text")); // NOI18N
292        deliv_warn.setName("deliv_warn"); // NOI18N
293
294        confi_alert.set_Label(bundle.getString("ControlPanel_Schedule.confi_alert._Label")); // NOI18N
295        confi_alert.set_Text(bundle.getString("ControlPanel_Schedule.confi_alert._Text")); // NOI18N
296        confi_alert.setName("confi_alert"); // NOI18N
297
298        confi_warn.set_Label(bundle.getString("ControlPanel_Schedule.confi_warn._Label")); // NOI18N
299        confi_warn.set_Text(bundle.getString("ControlPanel_Schedule.confi_warn._Text")); // NOI18N
300        confi_warn.setName("confi_warn"); // NOI18N
301
302        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
303        jPanel8.setLayout(jPanel8Layout);
304        jPanel8Layout.setHorizontalGroup(
305            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
306            .addGroup(jPanel8Layout.createSequentialGroup()
307                .addContainerGap()
308                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
309                    .addGroup(jPanel8Layout.createSequentialGroup()
310                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE)
311                        .addContainerGap())
312                    .addGroup(jPanel8Layout.createSequentialGroup()
313                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
314                            .addGroup(jPanel8Layout.createSequentialGroup()
315                                .addComponent(order_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
316                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
317                                .addComponent(order_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
318                            .addGroup(jPanel8Layout.createSequentialGroup()
319                                .addComponent(offer_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
320                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
321                                .addComponent(offer_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
322                            .addGroup(jPanel8Layout.createSequentialGroup()
323                                .addComponent(deliv_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
324                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
325                                .addComponent(deliv_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
326                            .addGroup(jPanel8Layout.createSequentialGroup()
327                                .addComponent(confi_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
328                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
329                                .addComponent(confi_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
330                            .addGroup(jPanel8Layout.createSequentialGroup()
331                                .addComponent(bill_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
332                                .addGap(10, 10, 10)
333                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
334                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
335                                    .addComponent(bill_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
336                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
337        );
338        jPanel8Layout.setVerticalGroup(
339            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
340            .addGroup(jPanel8Layout.createSequentialGroup()
341                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
342                    .addComponent(jLabel2)
343                    .addComponent(jLabel3))
344                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
345                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
346                    .addComponent(bill_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
347                    .addComponent(bill_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
348                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
349                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350                    .addComponent(order_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
351                    .addComponent(order_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
352                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
353                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
354                    .addComponent(offer_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
355                    .addComponent(offer_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
356                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
357                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
358                    .addComponent(deliv_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
359                    .addComponent(deliv_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
360                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
361                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
362                    .addComponent(confi_warn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
363                    .addComponent(confi_alert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
364                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
365        );
366
367        jPanel6.setBackground(new java.awt.Color(255, 255, 255));
368        jPanel6.setName("jPanel6"); // NOI18N
369        jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
370
371        jButton2.setText(bundle.getString("ControlPanel_Schedule.jButton2.text")); // NOI18N
372        jButton2.setName("jButton2"); // NOI18N
373        jButton2.addActionListener(new java.awt.event.ActionListener() {
374            public void actionPerformed(java.awt.event.ActionEvent evt) {
375                jButton2ActionPerformed(evt);
376            }
377        });
378        jPanel6.add(jButton2);
379
380        jButton1.setText(bundle.getString("ControlPanel_Schedule.jButton1.text")); // NOI18N
381        jButton1.setName("jButton1"); // NOI18N
382        jButton1.addActionListener(new java.awt.event.ActionListener() {
383            public void actionPerformed(java.awt.event.ActionEvent evt) {
384                jButton1ActionPerformed(evt);
385            }
386        });
387        jPanel6.add(jButton1);
388
389        jButton5.setText(bundle.getString("ControlPanel_Schedule.jButton5.text")); // NOI18N
390        jButton5.setName("jButton5"); // NOI18N
391        jButton5.addActionListener(new java.awt.event.ActionListener() {
392            public void actionPerformed(java.awt.event.ActionEvent evt) {
393                jButton5ActionPerformed(evt);
394            }
395        });
396        jPanel6.add(jButton5);
397
398        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
399        this.setLayout(layout);
400        layout.setHorizontalGroup(
401            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
402            .addGroup(layout.createSequentialGroup()
403                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
404                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
405                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE))
406                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
407                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
408                    .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
409                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE)
410                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
411                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
412                .addContainerGap())
413        );
414        layout.setVerticalGroup(
415            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
416            .addGroup(layout.createSequentialGroup()
417                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
418                    .addGroup(layout.createSequentialGroup()
419                        .addGap(5, 5, 5)
420                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
421                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
422                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
423                        .addGap(1, 1, 1)
424                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
425                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 507, javax.swing.GroupLayout.PREFERRED_SIZE))
426                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
427                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
428                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
429                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
430                .addContainerGap(21, Short.MAX_VALUE))
431        );
432    }// </editor-fold>//GEN-END:initComponents
433
434    private void addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addActionPerformed
435        ScheduleTypes s1 = new ScheduleTypes();
436        s1.setCname(labeledTextField2.getText());
437        s1.setUser(Integer.parseInt(labeledCombobox2.getSelectedItem().getId()));
438        s1.save();
439        setData();
440}//GEN-LAST:event_addActionPerformed
441
442    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
443        s = (ScheduleTypes) ((MPTableModel) jTable1.getModel()).getValueAt(jTable1.convertRowIndexToModel(jTable1.getSelectedRow()), 0);
444        labeledTextField2.setText(s.__getCname());
445        labeledCombobox2.setSelectedItem(User.getUsername(s.__getUserSids()));
446    }//GEN-LAST:event_jTable1MouseClicked
447
448    private void removeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeActionPerformed
449        if (s.delete()) {
450            ((MPTableModel) jTable1.getModel()).removeRow(jTable1.convertRowIndexToModel(jTable1.getSelectedRow()));
451        }
452    }//GEN-LAST:event_removeActionPerformed
453
454    private void copyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyActionPerformed
455        ScheduleTypes s2 = new ScheduleTypes();
456        s2.setCname(labeledTextField2.getText());
457        s2.setUser(User.getCurrentUser().getID());
458        s2.save();
459        setData();
460    }//GEN-LAST:event_copyActionPerformed
461
462    private void copy1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copy1ActionPerformed
463        s.setCname(labeledTextField2.getText());
464        s.setUser(User.getCurrentUser().getID());
465        s.save();
466        setData();
467    }//GEN-LAST:event_copy1ActionPerformed
468
469    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
470        setPropertys();
471    }//GEN-LAST:event_jButton2ActionPerformed
472
473    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
474        setPropertys();
475        mpv5.db.objects.User.getCurrentUser().saveProperties();
476        Popup.notice(Messages.RESTART_REQUIRED);
477    }//GEN-LAST:event_jButton1ActionPerformed
478
479    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
480        ControlPanel_AdvancedUserProperties c = new ControlPanel_AdvancedUserProperties();
481        MPControlPanel.instanceOf().openDetails(c);
482    }//GEN-LAST:event_jButton5ActionPerformed
483    // Variables declaration - do not modify//GEN-BEGIN:variables
484    private javax.swing.JButton add;
485    private mpv5.ui.beans.LabeledTextField bill_alert;
486    private mpv5.ui.beans.LabeledTextField bill_warn;
487    private javax.swing.JCheckBox bills;
488    private javax.swing.JCheckBox confi;
489    private mpv5.ui.beans.LabeledTextField confi_alert;
490    private mpv5.ui.beans.LabeledTextField confi_warn;
491    private javax.swing.JButton copy;
492    private javax.swing.JButton copy1;
493    private javax.swing.JCheckBox deliv;
494    private mpv5.ui.beans.LabeledTextField deliv_alert;
495    private mpv5.ui.beans.LabeledTextField deliv_warn;
496    private javax.swing.JButton jButton1;
497    private javax.swing.JButton jButton2;
498    private javax.swing.JButton jButton5;
499    private javax.swing.JLabel jLabel1;
500    private javax.swing.JLabel jLabel2;
501    private javax.swing.JLabel jLabel3;
502    private javax.swing.JPanel jPanel1;
503    private javax.swing.JPanel jPanel2;
504    private javax.swing.JPanel jPanel3;
505    private javax.swing.JPanel jPanel4;
506    private javax.swing.JPanel jPanel6;
507    private javax.swing.JPanel jPanel8;
508    private javax.swing.JScrollPane jScrollPane2;
509    private javax.swing.JTable jTable1;
510    private mpv5.ui.beans.LabeledCombobox labeledCombobox2;
511    private mpv5.ui.beans.LabeledTextField labeledTextField2;
512    private javax.swing.JCheckBox offer;
513    private mpv5.ui.beans.LabeledTextField offer_alert;
514    private mpv5.ui.beans.LabeledTextField offer_warn;
515    private mpv5.ui.beans.LabeledTextField order_alert;
516    private mpv5.ui.beans.LabeledTextField order_warn;
517    private javax.swing.JCheckBox orders;
518    private javax.swing.JButton remove;
519    // End of variables declaration//GEN-END:variables
520
521    public Component getAndRemoveActionPanel() {
522        this.remove(jPanel2);
523        validate();
524        return jPanel2;
525    }
526
527    public void setValues(PropertyStore values) {
528        oldvalues = values;
529    }
530
531    public String getUname() {
532        return "StageTypes";
533    }
534
535    public void reset() {
536        setValues(oldvalues);
537    }
538
539    private void setData() {
540        try {
541            final ArrayList<DatabaseObject> STypes = DatabaseObject.getObjects(Context.getScheduleTypes(), true);
542            Object[][] data = new Object[STypes.size()][3];
543
544            for (int i = 0; i < STypes.size(); i++) {
545                ScheduleTypes st = (ScheduleTypes) STypes.get(i);
546                data[i][0] = (DatabaseObject) st;
547                data[i][1] = User.getUsername(st.__getUserSids());
548                data[i][2] = st.__getCname();
549            }
550            MPTableModel m = new MPTableModel(data);
551            m.setTypes(new Class[]{DatabaseObject.class,
552                        String.class,
553                        String.class});
554            jTable1.setModel(m);
555            jTable1.getColumn(m.getColumnIdentifiers().get(0)).setMinWidth(0);
556            jTable1.getColumn(m.getColumnIdentifiers().get(0)).setMaxWidth(0);
557            jTable1.getColumn(m.getColumnIdentifiers().get(0)).setResizable(false);
558        } catch (NodataFoundException ex) {
559            Log.Debug(this, ex);
560        }
561    }
562
563    private void initTable() {
564        jTable1.setDefaultRenderer(String.class,
565                rend);
566        jTable1.setDefaultRenderer(DatabaseObject.class,
567                rend);
568        TableFormat.hideHeader(jTable1);
569    }
570
571    private void setPropertys() {
572        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("bills.warn.days", bill_warn.getText());
573        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("bills.alert.days", bill_alert.getText());
574        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("order.warn.days", order_warn.getText());
575        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("order.alert.days", order_alert.getText());
576        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("offer.warn.days", offer_warn.getText());
577        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("offer.alert.days", offer_alert.getText());
578        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("deliver.warn.days", deliv_warn.getText());
579        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("deliver.alert.days", deliv_alert.getText());
580        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("confirmation.warn.days", confi_warn.getText());
581        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("confirmation.alert.days", confi_alert.getText());
582
583        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("org.openyabs.uiproperty", "hideunpaidbills", bills.isSelected());
584        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("org.openyabs.uiproperty", "hideunattentedorders", orders.isSelected());
585        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("org.openyabs.uiproperty", "hideunacceptedoffers", offer.isSelected());
586        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("org.openyabs.uiproperty", "hideunattenteddeliverys", deliv.isSelected());
587        mpv5.db.objects.User.getCurrentUser().getProperties().changeProperty("org.openyabs.uiproperty", "hideunattentedconfirmations", confi.isSelected());
588    }
589
590    private void loadPropertys() {
591        bills.setSelected(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("org.openyabs.uiproperty", "hideunpaidbills"));
592        orders.setSelected(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("org.openyabs.uiproperty", "hideunattentedorders"));
593        offer.setSelected(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("org.openyabs.uiproperty", "hideunacceptedoffers"));
594        deliv.setSelected(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("org.openyabs.uiproperty", "hideunattenteddeliverys"));
595        confi.setSelected(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("org.openyabs.uiproperty", "hideunattentedconfirmations"));
596
597        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("bills.warn.days")) {
598            bill_warn.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("bills.warn.days"));
599        } else {
600            bill_warn.setText("14");
601        }
602
603        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("bills.alert.days")) {
604            bill_alert.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("bills.alert.days"));
605        } else {
606            bill_alert.setText("30");
607        }
608
609        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("order.warn.days")) {
610            order_warn.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("order.warn.days"));
611        } else {
612            order_warn.setText("14");
613        }
614
615        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("order.alert.days")) {
616            order_alert.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("order.alert.days"));
617        } else {
618            order_alert.setText("30");
619        }
620
621        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("offer.warn.days")) {
622            offer_warn.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("offer.warn.days"));
623        } else {
624            offer_warn.setText("14");
625        }
626
627        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("offer.alert.days")) {
628            offer_alert.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("offer.alert.days"));
629        } else {
630            offer_alert.setText("30");
631        }
632
633        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("deliver.warn.days")) {
634            deliv_warn.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("deliver.warn.days"));
635        } else {
636            deliv_warn.setText("14");
637        }
638
639        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("deliver.alert.days")) {
640            deliv_alert.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("deliver.alert.days"));
641        } else {
642            deliv_alert.setText("30");
643        }
644
645        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("confirmation.warn.days")) {
646            confi_warn.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("confirmation.warn.days"));
647        } else {
648            confi_warn.setText("14");
649        }
650
651        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("confirmation.alert.days")) {
652            confi_alert.setText(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("confirmation.alert.days"));
653        } else {
654            confi_alert.setText("30");
655        }
656    }
657}