PageRenderTime 288ms CodeModel.GetById 15ms app.highlight 25ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 595 lines | 482 code | 77 blank | 36 comment | 35 complexity | ad9a2a656f916d2837cb944358dd3084 MD5 | raw file
  1/*
  2This file is part of YaBS.
  3
  4YaBS is free software: you can redistribute it and/or modify
  5it under the terms of the GNU General Public License as published by
  6the Free Software Foundation, either version 3 of the License, or
  7(at your option) any later version.
  8
  9YaBS is distributed in the hope that it will be useful,
 10but WITHOUT ANY WARRANTY; without even the implied warranty of
 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12GNU General Public License for more details.
 13
 14You should have received a copy of the GNU General Public License
 15along with YaBS.  If not, see <http://www.gnu.org/licenses/>.
 16 */
 17/*
 18 * ContactPanel.java
 19 *
 20 * Created on Nov 20, 2008, 8:17:28 AM
 21 */
 22package mpv5.ui.dialogs.subcomponents;
 23
 24import java.awt.Color;
 25import java.awt.Component;
 26import java.awt.event.MouseEvent;
 27import java.io.File;
 28import java.util.ArrayList;
 29import javax.swing.JTextField;
 30import javax.swing.SwingUtilities;
 31import javax.swing.tree.DefaultMutableTreeNode;
 32import javax.swing.tree.TreeNode;
 33import javax.swing.tree.TreeSelectionModel;
 34import mpv5.data.PropertyStore;
 35import mpv5.db.common.Context;
 36import mpv5.db.common.DatabaseObject;
 37import mpv5.db.common.NodataFoundException;
 38import mpv5.db.common.QueryHandler;
 39import mpv5.db.objects.ProductGroup;
 40import mpv5.globals.Messages;
 41
 42import mpv5.logging.Log;
 43import mpv5.ui.dialogs.ControlApplet;
 44import mpv5.ui.dialogs.Popup;
 45import mpv5.ui.dialogs.Wizard;
 46import mpv5.ui.frames.MPView;
 47import mpv5.ui.panels.DataPanel;
 48import mpv5.usermanagement.MPSecurityManager;
 49import mpv5.utils.trees.TreeFormat;
 50import mpv5.utils.ui.TextFieldUtils;
 51
 52/**
 53 *
 54 * 
 55 */
 56public class ControlPanel_ProductGroups extends javax.swing.JPanel implements ControlApplet, DataPanel {
 57
 58    private static final long serialVersionUID = 1L;
 59    private ControlPanel_ProductGroups insta;
 60    private ArrayList<Object[]> arr;
 61    private ProductGroup dataOwner;
 62
 63    /** Creates new form ContactPanel
 64     */
 65    public ControlPanel_ProductGroups() {
 66        if (MPSecurityManager.checkAdminAccess()) {
 67            initComponents();
 68            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 69
 70            gcombobox.setSearchEnabled(true);
 71            gcombobox.setContext(Context.getGroup());
 72
 73            refresh();
 74        }
 75    }
 76
 77    public ControlPanel_ProductGroups(ProductGroup aThis) {
 78        if (MPSecurityManager.checkAdminAccess()) {
 79            initComponents();
 80            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 81
 82            gcombobox.setSearchEnabled(true);
 83            gcombobox.setContext(Context.getGroup());
 84
 85            refresh();
 86            setDataOwner(aThis, true);
 87        }
 88    }
 89
 90    @Override
 91    public void showRequiredFields() {
 92        TextFieldUtils.blinkerRed(cname);
 93        TextFieldUtils.blinkerGrey(parents);
 94    }
 95
 96    /** This method is called from within the constructor to
 97     * initialize the form.
 98     * WARNING: Do NOT modify this code. The content of this method is
 99     * always regenerated by the Form Editor.
100     */
101    @SuppressWarnings("unchecked")
102    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
103    private void initComponents() {
104
105        buttonGroup1 = new javax.swing.ButtonGroup();
106        jPanel1 = new javax.swing.JPanel();
107        jScrollPane1 = new javax.swing.JScrollPane();
108        tree = new javax.swing.JTree();
109        jLabel1 = new javax.swing.JLabel();
110        rightpane = new javax.swing.JPanel();
111        cname = new mpv5.ui.beans.LabeledTextField();
112        jScrollPane3 = new javax.swing.JScrollPane();
113        jTextArea2 = new javax.swing.JTextArea();
114        jLabel2 = new javax.swing.JLabel();
115        jScrollPane2 = new javax.swing.JScrollPane();
116        desc = new javax.swing.JTextArea();
117        jLabel3 = new javax.swing.JLabel();
118        gcombobox = new mpv5.ui.beans.LabeledCombobox();
119        path = new mpv5.ui.beans.LabeledTextField();
120        parents = new mpv5.ui.beans.LabeledTextField();
121        jPanel2 = new javax.swing.JPanel();
122        jButton5 = new javax.swing.JButton();
123        jSeparator1 = new javax.swing.JSeparator();
124        jButton4 = new javax.swing.JButton();
125        jButton3 = new javax.swing.JButton();
126        jButton2 = new javax.swing.JButton();
127        jButton1 = new javax.swing.JButton();
128
129        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
130        setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_ProductGroups.border.title"))); // NOI18N
131        setName("Form"); // NOI18N
132        setLayout(new java.awt.BorderLayout());
133
134        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
135        jPanel1.setName("jPanel1"); // NOI18N
136
137        jScrollPane1.setName("jScrollPane1"); // NOI18N
138
139        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
140        tree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
141        tree.setToolTipText(bundle.getString("ControlPanel_ProductGroups.tree.toolTipText")); // NOI18N
142        tree.setLargeModel(true);
143        tree.setName("tree"); // NOI18N
144        tree.addMouseListener(new java.awt.event.MouseAdapter() {
145            public void mouseClicked(java.awt.event.MouseEvent evt) {
146                treeMouseClicked(evt);
147            }
148        });
149        jScrollPane1.setViewportView(tree);
150
151        jLabel1.setText(bundle.getString("ControlPanel_ProductGroups.jLabel1.text")); // NOI18N
152        jLabel1.setName("jLabel1"); // NOI18N
153
154        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
155        jPanel1.setLayout(jPanel1Layout);
156        jPanel1Layout.setHorizontalGroup(
157            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
158            .addGroup(jPanel1Layout.createSequentialGroup()
159                .addContainerGap()
160                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
161                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
162                    .addComponent(jLabel1))
163                .addContainerGap())
164        );
165        jPanel1Layout.setVerticalGroup(
166            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
167            .addGroup(jPanel1Layout.createSequentialGroup()
168                .addContainerGap()
169                .addComponent(jLabel1)
170                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
171                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)
172                .addContainerGap())
173        );
174
175        add(jPanel1, java.awt.BorderLayout.CENTER);
176
177        rightpane.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_ProductGroups.rightpane.border.title"))); // NOI18N
178        rightpane.setName("rightpane"); // NOI18N
179
180        cname.set_Label(bundle.getString("ControlPanel_ProductGroups.cname._Label")); // NOI18N
181        cname.setName("cname"); // NOI18N
182
183        jScrollPane3.setBackground(new java.awt.Color(254, 254, 254));
184        jScrollPane3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
185        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
186        jScrollPane3.setName("jScrollPane3"); // NOI18N
187
188        jTextArea2.setColumns(20);
189        jTextArea2.setEditable(false);
190        jTextArea2.setLineWrap(true);
191        jTextArea2.setRows(5);
192        jTextArea2.setText(bundle.getString("ControlPanel_ProductGroups.jTextArea2.text")); // NOI18N
193        jTextArea2.setWrapStyleWord(true);
194        jTextArea2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
195        jTextArea2.setName("jTextArea2"); // NOI18N
196        jScrollPane3.setViewportView(jTextArea2);
197
198        jLabel2.setFont(new java.awt.Font("Dialog", 0, 12));
199        jLabel2.setText(bundle.getString("ControlPanel_ProductGroups.jLabel2.text")); // NOI18N
200        jLabel2.setName("jLabel2"); // NOI18N
201
202        jScrollPane2.setName("jScrollPane2"); // NOI18N
203
204        desc.setColumns(20);
205        desc.setRows(5);
206        desc.setName("desc"); // NOI18N
207        jScrollPane2.setViewportView(desc);
208
209        jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));
210        jLabel3.setText(bundle.getString("ControlPanel_ProductGroups.jLabel3.text")); // NOI18N
211        jLabel3.setName("jLabel3"); // NOI18N
212
213        gcombobox.set_Label(bundle.getString("ControlPanel_ProductGroups.gcombobox._Label")); // NOI18N
214        gcombobox.setName("gcombobox"); // NOI18N
215
216        path.set_Label(bundle.getString("ControlPanel_ProductGroups.path._Label")); // NOI18N
217        path.setName("path"); // NOI18N
218
219        parents.set_Label(bundle.getString("ControlPanel_ProductGroups.parents._Label")); // NOI18N
220        parents.setEnabled(false);
221        parents.setName("parents"); // NOI18N
222
223        javax.swing.GroupLayout rightpaneLayout = new javax.swing.GroupLayout(rightpane);
224        rightpane.setLayout(rightpaneLayout);
225        rightpaneLayout.setHorizontalGroup(
226            rightpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
227            .addGroup(rightpaneLayout.createSequentialGroup()
228                .addContainerGap()
229                .addGroup(rightpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
230                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
231                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
232                    .addComponent(cname, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
233                    .addComponent(jLabel2)
234                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
235                    .addComponent(gcombobox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
236                    .addComponent(path, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
237                    .addComponent(parents, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE))
238                .addContainerGap())
239        );
240        rightpaneLayout.setVerticalGroup(
241            rightpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
242            .addGroup(rightpaneLayout.createSequentialGroup()
243                .addComponent(jLabel3)
244                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
245                .addComponent(cname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
246                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
247                .addComponent(jLabel2)
248                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
249                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
250                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
251                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
252                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
253                .addComponent(parents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
254                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
255                .addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
256                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
257                .addComponent(gcombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
258                .addContainerGap(41, Short.MAX_VALUE))
259        );
260
261        add(rightpane, java.awt.BorderLayout.EAST);
262
263        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
264        jPanel2.setName("jPanel2"); // NOI18N
265        jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
266
267        jButton5.setText(bundle.getString("ControlPanel_ProductGroups.jButton5.text")); // NOI18N
268        jButton5.setName("jButton5"); // NOI18N
269        jButton5.addActionListener(new java.awt.event.ActionListener() {
270            public void actionPerformed(java.awt.event.ActionEvent evt) {
271                jButton5ActionPerformed(evt);
272            }
273        });
274        jPanel2.add(jButton5);
275
276        jSeparator1.setName("jSeparator1"); // NOI18N
277        jPanel2.add(jSeparator1);
278
279        jButton4.setText(bundle.getString("ControlPanel_ProductGroups.jButton4.text")); // NOI18N
280        jButton4.setName("jButton4"); // NOI18N
281        jButton4.addActionListener(new java.awt.event.ActionListener() {
282            public void actionPerformed(java.awt.event.ActionEvent evt) {
283                jButton4ActionPerformed(evt);
284            }
285        });
286        jPanel2.add(jButton4);
287
288        jButton3.setText(bundle.getString("ControlPanel_ProductGroups.jButton3.text")); // NOI18N
289        jButton3.setName("jButton3"); // NOI18N
290        jButton3.addActionListener(new java.awt.event.ActionListener() {
291            public void actionPerformed(java.awt.event.ActionEvent evt) {
292                jButton3ActionPerformed(evt);
293            }
294        });
295        jPanel2.add(jButton3);
296
297        jButton2.setText(bundle.getString("ControlPanel_ProductGroups.jButton2.text")); // NOI18N
298        jButton2.setName("jButton2"); // NOI18N
299        jButton2.addActionListener(new java.awt.event.ActionListener() {
300            public void actionPerformed(java.awt.event.ActionEvent evt) {
301                jButton2ActionPerformed(evt);
302            }
303        });
304        jPanel2.add(jButton2);
305
306        jButton1.setText(bundle.getString("ControlPanel_ProductGroups.jButton1.text")); // NOI18N
307        jButton1.setName("jButton1"); // NOI18N
308        jButton1.addActionListener(new java.awt.event.ActionListener() {
309            public void actionPerformed(java.awt.event.ActionEvent evt) {
310                jButton1ActionPerformed(evt);
311            }
312        });
313        jPanel2.add(jButton1);
314
315        add(jPanel2, java.awt.BorderLayout.PAGE_END);
316    }// </editor-fold>//GEN-END:initComponents
317
318    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
319        if (Popup.Y_N_dialog(Messages.REALLY_DELETE)) {
320            if (dataOwner != null) {
321                DatabaseObject dato = dataOwner;
322                dato.getPanelData(this);
323                if (dato.__getIDS().intValue() == 1 || !dato.delete()) {
324                    Popup.notice(Messages.NOT_POSSIBLE + "\n" + Messages.IN_USE);
325                }
326            }
327            refresh();
328        }
329}//GEN-LAST:event_jButton4ActionPerformed
330
331    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
332        reset();
333}//GEN-LAST:event_jButton3ActionPerformed
334
335    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
336
337        if (dataOwner != null) {
338            DatabaseObject dato = dataOwner;
339            dato.getPanelData(this);
340            if (dato.save()) {
341            } else {
342                showRequiredFields();
343            }
344        }
345}//GEN-LAST:event_jButton2ActionPerformed
346
347    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
348
349        if (dataOwner == null) {
350            dataOwner = new ProductGroup();
351        }
352        try {
353            DatabaseObject dato = dataOwner;
354            if (QueryHandler.instanceOf().clone(Context.getGroup()).checkUniqueness(Context.getGroup().getUniqueColumns(), new JTextField[]{cname.getTextField()})) {
355                dato.getPanelData(this);
356                dato.setIDS(-1);
357                if (dato.save()) {
358                } else {
359                    showRequiredFields();
360                }
361            }
362        } catch (Exception e) {
363        }
364        refresh();
365}//GEN-LAST:event_jButton1ActionPerformed
366
367    private void treeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_treeMouseClicked
368        evt.consume();
369        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
370
371        if (evt.getButton() == MouseEvent.BUTTON2 || evt.getButton() == MouseEvent.BUTTON3) {
372            if (node != null) {
373                ProductGroup g = (ProductGroup) node.getUserObject();
374                parents.set_Text(g.__getCname());
375                path.setText(getPath(node, 0));
376            }
377        } else {
378            if (node != null) {
379                ProductGroup g = (ProductGroup) node.getUserObject();
380                setDataOwner(g, true);
381                path.setText(getPath(node, 1));
382            }
383        }
384    }//GEN-LAST:event_treeMouseClicked
385
386    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
387        importf();
388    }//GEN-LAST:event_jButton5ActionPerformed
389    // Variables declaration - do not modify//GEN-BEGIN:variables
390    private javax.swing.ButtonGroup buttonGroup1;
391    private mpv5.ui.beans.LabeledTextField cname;
392    private javax.swing.JTextArea desc;
393    private mpv5.ui.beans.LabeledCombobox gcombobox;
394    private javax.swing.JButton jButton1;
395    private javax.swing.JButton jButton2;
396    private javax.swing.JButton jButton3;
397    private javax.swing.JButton jButton4;
398    private javax.swing.JButton jButton5;
399    private javax.swing.JLabel jLabel1;
400    private javax.swing.JLabel jLabel2;
401    private javax.swing.JLabel jLabel3;
402    private javax.swing.JPanel jPanel1;
403    private javax.swing.JPanel jPanel2;
404    private javax.swing.JScrollPane jScrollPane1;
405    private javax.swing.JScrollPane jScrollPane2;
406    private javax.swing.JScrollPane jScrollPane3;
407    private javax.swing.JSeparator jSeparator1;
408    private javax.swing.JTextArea jTextArea2;
409    private mpv5.ui.beans.LabeledTextField parents;
410    private mpv5.ui.beans.LabeledTextField path;
411    private javax.swing.JPanel rightpane;
412    private javax.swing.JTree tree;
413    // End of variables declaration//GEN-END:variables
414    public String description_ = "";
415    public String defaults_ = "";
416    public String cname_ = "";
417    public int ids_;
418    public int groupsids_ = 1;
419    public int intaddedby_ = 1;
420    public int productgroupsids_;
421    public java.util.Date dateadded_ = new java.util.Date();
422    public String hierarchypath_ = "";
423
424    @Override
425    public void setValues(PropertyStore values) {
426        throw new UnsupportedOperationException("Not supported yet.");
427    }
428
429    @Override
430    public String getUname() {
431        return "ProductGroups";
432    }
433
434    @Override
435    public void reset() {
436      if (dataOwner!=null && dataOwner.isExisting()) {
437            DatabaseObject dato = dataOwner;
438
439            dato.getPanelData(this);
440            dato.reset();
441            setDataOwner(dato, true);
442        }
443    }
444
445    @Override
446    public void refresh() {
447
448        ArrayList<ProductGroup> data = null;
449        try {
450            data = DatabaseObject.getObjects(Context.getProductGroup());
451        } catch (NodataFoundException ex) {
452            Log.Debug(this, ex.getMessage());
453        }
454
455        ProductGroup g;
456        try {
457            g = (ProductGroup) DatabaseObject.getObject(Context.getProductGroup(), 1);
458        } catch (NodataFoundException ex) {
459            g = new ProductGroup(Messages.GROUPNAMES.toString());
460            g.setIDS(-1);
461        }
462
463        tree.setModel(ProductGroup.toTreeModel(data, g));
464        Runnable runnable = new Runnable() {
465
466            @Override
467            public void run() {
468                gcombobox.triggerSearch();
469                TreeFormat.expandTree(tree);
470            }
471        };
472        SwingUtilities.invokeLater(runnable);
473    }
474
475    @Override
476    public boolean collectData() {
477        if (cname.getText().length() == 0) {
478            return false;
479        }
480        cname_ = cname.get_Text();
481        description_ = desc.getText();
482        hierarchypath_ = path.getText();
483        try {
484            productgroupsids_ = DatabaseObject.getObject(Context.getProductGroup(), parents.get_Text()).__getIDS();
485        } catch (NodataFoundException ex) {
486            productgroupsids_ = 1;
487        }
488
489        try {
490            groupsids_ = Integer.valueOf(gcombobox.getSelectedItem().getId());
491        } catch (NumberFormatException numberFormatException) {
492            groupsids_ = 1;
493        }
494
495        return true;
496    }
497
498    @Override
499    public DatabaseObject getDataOwner() {
500        return dataOwner;
501    }
502
503    @Override
504    public void setDataOwner(DatabaseObject object, boolean p) {
505        dataOwner = (ProductGroup) object;
506        if (p) {
507            dataOwner.setPanelData(this);
508            this.exposeData();
509        }
510    }
511
512    @Override
513    public void exposeData() {
514        cname.set_Text(cname_);
515        desc.setText(description_);
516        path.setText(hierarchypath_);
517        try {
518            parents.set_Text(DatabaseObject.getObject(Context.getProductGroup(), productgroupsids_).__getCname());
519        } catch (NodataFoundException ex) {
520            Log.Debug(this, ex.getMessage());
521        }
522        try {
523//        defaults.set_Text(defaults_);
524            gcombobox.setModel(DatabaseObject.getObject(Context.getGroup(), groupsids_));
525        } catch (NodataFoundException ex) {
526            Log.Debug(this, ex.getMessage());
527        }
528    }
529
530    @Override
531    public void paste(DatabaseObject... dbos) {
532        for (DatabaseObject dbo : dbos) {
533            if (dbo.getDbIdentity().equals(Context.getGroup().getDbIdentity())) {
534                setDataOwner(dbo, true);
535            } else {
536                mpv5.YabsViewProxy.instance().addMessage(Messages.NOT_POSSIBLE.toString() + Messages.ACTION_PASTE, Color.RED);
537            }
538        }
539    }
540
541    @Override
542    public void showSearchBar(boolean show) {
543        throw new UnsupportedOperationException("Not supported yet.");
544    }
545
546    @Override
547    public Component getAndRemoveActionPanel() {
548        this.remove(jPanel2);
549        validate();
550        return jPanel2;
551    }
552
553    @Override
554    public void actionAfterSave() {
555        throw new UnsupportedOperationException("Not supported yet.");
556    }
557
558    @Override
559    public void actionAfterCreate() {
560    }
561
562    private String getPath(DefaultMutableTreeNode node, int shift) {
563        TreeNode[] p = node.getPath();
564        String path1 = "";
565        for (int i = 0; i < p.length - shift; i++) {
566            TreeNode treeNode = p[i];
567            path1 += treeNode.toString() + File.separator;
568        }
569
570        return path1;
571    }
572
573    private void importf() {
574        Wizard w = new Wizard(false);
575        w.addPanel(new wizard_CSVImport_1(w));
576        w.addPanel(new wizard_CSV_ProductGroups_Import_1(w));
577        w.showWiz();
578    }
579
580    public void actionBeforeCreate() {
581        throw new UnsupportedOperationException("Not supported yet.");
582    }
583
584    public void actionBeforeSave() {
585        throw new UnsupportedOperationException("Not supported yet.");
586    }
587
588    public void mail() {
589        throw new UnsupportedOperationException("Not supported yet.");
590    }
591
592    public void print() {
593        mpv5.utils.export.Export.print(this);
594    }
595}