KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnet > Browser > InputTriggerEditDialog


1 /*
2  * InputTriggerEditDialog.java
3  *
4  * Created on 17. květen 2004, 22:47
5  */

6
7 package SOFA.SOFAnet.Browser;
8
9 import SOFA.SOFAnet.Repository.InputTrigger;
10 import SOFA.SOFAnet.Repository.NodeNameFilter;
11 import SOFA.SOFAnet.Repository.BundleNameFilter;
12 import SOFA.SOFAnet.Repository.NodeNameList;
13 import SOFA.SOFAnet.Repository.OutputTrigger;
14 import SOFA.SOFAnet.Repository.NodeNameLicList;
15 import java.util.Date JavaDoc;
16 import java.text.DateFormat JavaDoc;
17 import java.text.ParseException JavaDoc;
18 import javax.swing.*;
19 import java.awt.Component JavaDoc;
20 import java.awt.Frame JavaDoc;
21
22 /**
23  *
24  * @author Ladislav Sobr
25  */

26 public class InputTriggerEditDialog extends javax.swing.JDialog JavaDoc
27 {
28   private InputTrigger inputTrigger;
29   private BundleNameFilter bundleFilter;
30   private NodeNameFilter nodeFilter;
31   private OutputTrigger alpOutputTrigger;
32   private NodeNameLicList apNodeNameLicList;
33   private InputTriggerShareActionPropertiesEditDialog.ActionShareParameters asParameters;
34   private NodeNameList apoNodeNameList;
35   private boolean isOK;
36   
37   public static boolean showDialog(Component JavaDoc frameComp, InputTrigger inputTrigger, String JavaDoc title)
38   {
39     Frame JavaDoc frame = JOptionPane.getFrameForComponent(frameComp);
40     InputTriggerEditDialog dialog = new InputTriggerEditDialog(frame, true, inputTrigger, title);
41     dialog.setLocationRelativeTo(frameComp);
42     dialog.setVisible(true);
43     return dialog.isOK();
44   }
45   
46   /** Creates new form InputTriggerEditDialog */
47   public InputTriggerEditDialog(java.awt.Frame JavaDoc parent, boolean modal, InputTrigger inputTrigger, String JavaDoc title)
48   {
49     super(parent, modal);
50     this.inputTrigger = inputTrigger;
51     bundleFilter = inputTrigger.getBundleFilter();
52     nodeFilter = inputTrigger.getNodeFilter();
53     alpOutputTrigger = inputTrigger.getAlpOutputTrigger();
54     apNodeNameLicList = inputTrigger.getApNodeNameLicList();
55     apoNodeNameList = inputTrigger.getApoNodeNameList();
56     asParameters = new InputTriggerShareActionPropertiesEditDialog.ActionShareParameters(inputTrigger);
57     isOK = false;
58     
59     initComponents();
60     setTitle(title);
61     
62     nameTextField.setText(inputTrigger.getName());
63     descriptionTextField.setText(inputTrigger.getDescription());
64     pushCheckBox.setSelected(inputTrigger.isPushSource());
65     pullCheckBox.setSelected(inputTrigger.isPullSource());
66     madeCheckBox.setSelected(inputTrigger.isMadeSource());
67     switch (inputTrigger.getBundleType())
68     {
69     default:
70     case InputTrigger.BUNDLETYPE_FULL:
71       bundleCheckBox.setSelected(true);
72       bundleOfferCheckBox.setSelected(false);
73       break;
74     case InputTrigger.BUNDLETYPE_OFFER:
75       bundleCheckBox.setSelected(false);
76       bundleOfferCheckBox.setSelected(true);
77       break;
78     case InputTrigger.BUNDLETYPE_ALL:
79       bundleCheckBox.setSelected(true);
80       bundleOfferCheckBox.setSelected(true);
81       break;
82     }
83
84     if (bundleFilter != null)
85     {
86       bundleFilterCheckBox.setSelected(true);
87       bundleFilterButton.setEnabled(true);
88     }
89     else
90     {
91       bundleFilterCheckBox.setSelected(false);
92       bundleFilterButton.setEnabled(false);
93     }
94     
95     if (nodeFilter != null)
96     {
97       nodeFilterCheckBox.setSelected(true);
98       nodeFilterButton.setEnabled(true);
99     }
100     else
101     {
102       nodeFilterCheckBox.setSelected(false);
103       nodeFilterButton.setEnabled(false);
104     }
105
106     if (bundleFilter != null) bundleFilter = (BundleNameFilter)bundleFilter.clone();
107     else bundleFilter = new BundleNameFilter();
108     if (nodeFilter != null) nodeFilter = (NodeNameFilter)nodeFilter.clone();
109     else nodeFilter = new NodeNameFilter();
110     if (apoNodeNameList != null) apoNodeNameList = (NodeNameList)apoNodeNameList.clone();
111     else apoNodeNameList = new NodeNameList();
112     if (alpOutputTrigger != null) alpOutputTrigger = (OutputTrigger)alpOutputTrigger.clone();
113     else alpOutputTrigger = new OutputTrigger();
114     if (apNodeNameLicList != null) apNodeNameLicList = (NodeNameLicList)apNodeNameLicList.clone();
115     else apNodeNameLicList = new NodeNameLicList();
116     
117     Date JavaDoc validFrom = inputTrigger.getValidFrom();
118     Date JavaDoc validTo = inputTrigger.getValidTo();
119     DateFormat JavaDoc dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
120
121     if (validFrom != null) validFromTextField.setText(dateFormat.format(validFrom));
122     else validFromTextField.setText("");
123
124     if (validTo != null) validToTextField.setText(dateFormat.format(validTo));
125     else validToTextField.setText("");
126     
127     autodeleteCheckBox.setSelected(inputTrigger.getAutoDelete());
128     
129     if (inputTrigger.isContract())
130     {
131       contractIDTextField.setText(inputTrigger.getContractID());
132       contractRuleTextField.setText(inputTrigger.getContractRule());
133     }
134     
135     int actions = inputTrigger.getActions();
136
137     if ((actions & InputTrigger.ACTION_INSTALL) != 0)
138     {
139       actionInstallCheckBox.setSelected(true);
140     }
141     else
142     {
143       actionInstallCheckBox.setSelected(false);
144     }
145     
146     if ((actions & InputTrigger.ACTION_SHARE) != 0)
147     {
148       actionShareCheckBox.setSelected(true);
149       editShareParametersButton.setEnabled(true);
150     }
151     else
152     {
153       actionShareCheckBox.setSelected(false);
154       editShareParametersButton.setEnabled(false);
155     }
156     
157     if ((actions & InputTrigger.ACTION_ALLOW_PULL) != 0)
158     {
159       actionAllowPullCheckBox.setSelected(true);
160       alpOutputTriggerButton.setEnabled(true);
161     }
162     else
163     {
164       actionAllowPullCheckBox.setSelected(false);
165       alpOutputTriggerButton.setEnabled(false);
166     }
167     
168     if ((actions & InputTrigger.ACTION_PUSH) != 0)
169     {
170       actionPushCheckBox.setSelected(true);
171       apNodeNameLicListButton.setEnabled(true);
172     }
173     else
174     {
175       actionPushCheckBox.setSelected(false);
176       apNodeNameLicListButton.setEnabled(false);
177     }
178     
179     if ((actions & InputTrigger.ACTION_PUSH_OFFER) != 0)
180     {
181       actionPushOfferCheckBox.setSelected(true);
182       apoNodeNameListButton.setEnabled(true);
183     }
184     else
185     {
186       actionPushOfferCheckBox.setSelected(false);
187       apoNodeNameListButton.setEnabled(false);
188     }
189     
190     if ((actions & InputTrigger.ACTION_DELETE) != 0)
191     {
192       actionDeleteCheckBox.setSelected(true);
193     }
194     else
195     {
196       actionDeleteCheckBox.setSelected(false);
197     }
198     
199   }
200   
201   public boolean isOK()
202   {
203     return isOK;
204   }
205   
206   /** This method is called from within the constructor to
207    * initialize the form.
208    * WARNING: Do NOT modify this code. The content of this method is
209    * always regenerated by the Form Editor.
210    */

211   private void initComponents()//GEN-BEGIN:initComponents
212
{
213     nameAndDescriptionPanel = new javax.swing.JPanel JavaDoc();
214     nameLabel = new javax.swing.JLabel JavaDoc();
215     nameTextField = new javax.swing.JTextField JavaDoc();
216     descriptionLabel = new javax.swing.JLabel JavaDoc();
217     descriptionTextField = new javax.swing.JTextField JavaDoc();
218     jPanel7 = new javax.swing.JPanel JavaDoc();
219     jPanel1 = new javax.swing.JPanel JavaDoc();
220     sourcePanel = new javax.swing.JPanel JavaDoc();
221     pushCheckBox = new javax.swing.JCheckBox JavaDoc();
222     pullCheckBox = new javax.swing.JCheckBox JavaDoc();
223     madeCheckBox = new javax.swing.JCheckBox JavaDoc();
224     bundleTypePanel = new javax.swing.JPanel JavaDoc();
225     bundleCheckBox = new javax.swing.JCheckBox JavaDoc();
226     bundleOfferCheckBox = new javax.swing.JCheckBox JavaDoc();
227     jPanel2 = new javax.swing.JPanel JavaDoc();
228     jPanel3 = new javax.swing.JPanel JavaDoc();
229     parametersPanel = new javax.swing.JPanel JavaDoc();
230     bundleFilterPanel = new javax.swing.JPanel JavaDoc();
231     bundleFilterCheckBox = new javax.swing.JCheckBox JavaDoc();
232     bundleFilterButton = new javax.swing.JButton JavaDoc();
233     nodeFilterPanel = new javax.swing.JPanel JavaDoc();
234     nodeFilterCheckBox = new javax.swing.JCheckBox JavaDoc();
235     nodeFilterButton = new javax.swing.JButton JavaDoc();
236     validFromPanel = new javax.swing.JPanel JavaDoc();
237     validFromLabel = new javax.swing.JLabel JavaDoc();
238     validFromTextField = new javax.swing.JTextField JavaDoc();
239     validToPanel = new javax.swing.JPanel JavaDoc();
240     validToLabel = new javax.swing.JLabel JavaDoc();
241     validToTextField = new javax.swing.JTextField JavaDoc();
242     autodeleteCheckBox = new javax.swing.JCheckBox JavaDoc();
243     contractPanel = new javax.swing.JPanel JavaDoc();
244     jPanel5 = new javax.swing.JPanel JavaDoc();
245     contractIDLabel = new javax.swing.JLabel JavaDoc();
246     contractIDTextField = new javax.swing.JTextField JavaDoc();
247     contractRuleLabel = new javax.swing.JLabel JavaDoc();
248     contractRuleTextField = new javax.swing.JTextField JavaDoc();
249     jPanel4 = new javax.swing.JPanel JavaDoc();
250     actionsPanel = new javax.swing.JPanel JavaDoc();
251     actionInstallPanel = new javax.swing.JPanel JavaDoc();
252     actionInstallCheckBox = new javax.swing.JCheckBox JavaDoc();
253     actionSharePanel = new javax.swing.JPanel JavaDoc();
254     actionShareCheckBox = new javax.swing.JCheckBox JavaDoc();
255     editShareParametersButton = new javax.swing.JButton JavaDoc();
256     actionAllowPullPanel = new javax.swing.JPanel JavaDoc();
257     actionAllowPullCheckBox = new javax.swing.JCheckBox JavaDoc();
258     alpOutputTriggerButton = new javax.swing.JButton JavaDoc();
259     actionPushPanel = new javax.swing.JPanel JavaDoc();
260     actionPushCheckBox = new javax.swing.JCheckBox JavaDoc();
261     apNodeNameLicListButton = new javax.swing.JButton JavaDoc();
262     actionPushOfferPanel = new javax.swing.JPanel JavaDoc();
263     actionPushOfferCheckBox = new javax.swing.JCheckBox JavaDoc();
264     apoNodeNameListButton = new javax.swing.JButton JavaDoc();
265     actionDeleteCheckBox = new javax.swing.JCheckBox JavaDoc();
266     jPanel6 = new javax.swing.JPanel JavaDoc();
267     OKButton = new javax.swing.JButton JavaDoc();
268     cancelButton = new javax.swing.JButton JavaDoc();
269
270     setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
271     nameAndDescriptionPanel.setLayout(new java.awt.GridLayout JavaDoc(4, 0));
272
273     nameAndDescriptionPanel.setBorder(new javax.swing.border.TitledBorder JavaDoc("Name and Description of Input Trigger"));
274     nameLabel.setText("Name:");
275     nameAndDescriptionPanel.add(nameLabel);
276
277     nameTextField.setEditable(false);
278     nameAndDescriptionPanel.add(nameTextField);
279
280     descriptionLabel.setText("Description:");
281     nameAndDescriptionPanel.add(descriptionLabel);
282
283     nameAndDescriptionPanel.add(descriptionTextField);
284
285     getContentPane().add(nameAndDescriptionPanel, java.awt.BorderLayout.NORTH);
286
287     jPanel7.setLayout(new java.awt.BorderLayout JavaDoc());
288
289     jPanel1.setLayout(new java.awt.GridLayout JavaDoc(1, 0));
290
291     sourcePanel.setBorder(new javax.swing.border.TitledBorder JavaDoc("Source"));
292     pushCheckBox.setText("Push");
293     sourcePanel.add(pushCheckBox);
294
295     pullCheckBox.setText("Pull");
296     sourcePanel.add(pullCheckBox);
297
298     madeCheckBox.setText("Made");
299     sourcePanel.add(madeCheckBox);
300
301     jPanel1.add(sourcePanel);
302
303     bundleTypePanel.setBorder(new javax.swing.border.TitledBorder JavaDoc("Bundle Type"));
304     bundleCheckBox.setText("Bundle");
305     bundleTypePanel.add(bundleCheckBox);
306
307     bundleOfferCheckBox.setText("Bundle Offer");
308     bundleTypePanel.add(bundleOfferCheckBox);
309
310     jPanel1.add(bundleTypePanel);
311
312     jPanel7.add(jPanel1, java.awt.BorderLayout.NORTH);
313
314     jPanel2.setLayout(new java.awt.BorderLayout JavaDoc());
315
316     jPanel3.setLayout(new java.awt.GridLayout JavaDoc(1, 0));
317
318     parametersPanel.setLayout(new java.awt.GridLayout JavaDoc(5, 0));
319
320     parametersPanel.setBorder(new javax.swing.border.TitledBorder JavaDoc("Parameters"));
321     bundleFilterPanel.setLayout(new javax.swing.BoxLayout JavaDoc(bundleFilterPanel, javax.swing.BoxLayout.X_AXIS));
322
323     bundleFilterCheckBox.setText("Bundle Filter");
324     bundleFilterCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc()
325     {
326       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
327       {
328         bundleFilterCheckBoxActionPerformed(evt);
329       }
330     });
331
332     bundleFilterPanel.add(bundleFilterCheckBox);
333
334     bundleFilterButton.setText("Edit Bundle Filter");
335     bundleFilterButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
336     {
337       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
338       {
339         bundleFilterButtonActionPerformed(evt);
340       }
341     });
342
343     bundleFilterPanel.add(bundleFilterButton);
344
345     parametersPanel.add(bundleFilterPanel);
346
347     nodeFilterPanel.setLayout(new javax.swing.BoxLayout JavaDoc(nodeFilterPanel, javax.swing.BoxLayout.X_AXIS));
348
349     nodeFilterCheckBox.setText("Node Filter");
350     nodeFilterCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc()
351     {
352       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
353       {
354         nodeFilterCheckBoxActionPerformed(evt);
355       }
356     });
357
358     nodeFilterPanel.add(nodeFilterCheckBox);
359
360     nodeFilterButton.setText("Edit Node Filter");
361     nodeFilterButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
362     {
363       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
364       {
365         nodeFilterButtonActionPerformed(evt);
366       }
367     });
368
369     nodeFilterPanel.add(nodeFilterButton);
370
371     parametersPanel.add(nodeFilterPanel);
372
373     validFromPanel.setLayout(new javax.swing.BoxLayout JavaDoc(validFromPanel, javax.swing.BoxLayout.X_AXIS));
374
375     validFromLabel.setText("Valid From:");
376     validFromPanel.add(validFromLabel);
377
378     validFromPanel.add(validFromTextField);
379
380     parametersPanel.add(validFromPanel);
381
382     validToPanel.setLayout(new javax.swing.BoxLayout JavaDoc(validToPanel, javax.swing.BoxLayout.X_AXIS));
383
384     validToLabel.setText("Valid To:");
385     validToPanel.add(validToLabel);
386
387     validToPanel.add(validToTextField);
388
389     parametersPanel.add(validToPanel);
390
391     autodeleteCheckBox.setText("Automatically Delete When Expired");
392     parametersPanel.add(autodeleteCheckBox);
393
394     jPanel3.add(parametersPanel);
395
396     contractPanel.setLayout(new java.awt.BorderLayout JavaDoc());
397
398     contractPanel.setBorder(new javax.swing.border.TitledBorder JavaDoc("Contract Connection"));
399     contractPanel.setMinimumSize(new java.awt.Dimension JavaDoc(200, 111));
400     contractPanel.setPreferredSize(new java.awt.Dimension JavaDoc(200, 111));
401     jPanel5.setLayout(new java.awt.GridLayout JavaDoc(4, 0));
402
403     contractIDLabel.setText("Contract ID:");
404     jPanel5.add(contractIDLabel);
405
406     jPanel5.add(contractIDTextField);
407
408     contractRuleLabel.setText("Contract Rule:");
409     jPanel5.add(contractRuleLabel);
410
411     jPanel5.add(contractRuleTextField);
412
413     contractPanel.add(jPanel5, java.awt.BorderLayout.NORTH);
414
415     jPanel3.add(contractPanel);
416
417     jPanel2.add(jPanel3, java.awt.BorderLayout.NORTH);
418
419     jPanel4.setLayout(new java.awt.BorderLayout JavaDoc());
420
421     actionsPanel.setLayout(new java.awt.GridLayout JavaDoc(6, 0));
422
423     actionsPanel.setBorder(new javax.swing.border.TitledBorder JavaDoc("Actions"));
424     actionInstallPanel.setLayout(new javax.swing.BoxLayout JavaDoc(actionInstallPanel, javax.swing.BoxLayout.X_AXIS));
425
426     actionInstallCheckBox.setText("Install Bundle");
427     actionInstallPanel.add(actionInstallCheckBox);
428
429     actionsPanel.add(actionInstallPanel);
430
431     actionSharePanel.setLayout(new javax.swing.BoxLayout JavaDoc(actionSharePanel, javax.swing.BoxLayout.X_AXIS));
432
433     actionShareCheckBox.setText("Share Bundle");
434     actionShareCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc()
435     {
436       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
437       {
438         actionShareCheckBoxActionPerformed(evt);
439       }
440     });
441
442     actionSharePanel.add(actionShareCheckBox);
443
444     editShareParametersButton.setText("Edit Share Parameters");
445     editShareParametersButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
446     {
447       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
448       {
449         editShareParametersButtonActionPerformed(evt);
450       }
451     });
452
453     actionSharePanel.add(editShareParametersButton);
454
455     actionsPanel.add(actionSharePanel);
456
457     actionAllowPullPanel.setLayout(new javax.swing.BoxLayout JavaDoc(actionAllowPullPanel, javax.swing.BoxLayout.X_AXIS));
458
459     actionAllowPullCheckBox.setText("Allow Pull");
460     actionAllowPullCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc()
461     {
462       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
463       {
464         actionAllowPullCheckBoxActionPerformed(evt);
465       }
466     });
467
468     actionAllowPullPanel.add(actionAllowPullCheckBox);
469
470     alpOutputTriggerButton.setText("Edit Output Trigger");
471     alpOutputTriggerButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
472     {
473       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
474       {
475         alpOutputTriggerButtonActionPerformed(evt);
476       }
477     });
478
479     actionAllowPullPanel.add(alpOutputTriggerButton);
480
481     actionsPanel.add(actionAllowPullPanel);
482
483     actionPushPanel.setLayout(new javax.swing.BoxLayout JavaDoc(actionPushPanel, javax.swing.BoxLayout.X_AXIS));
484
485     actionPushCheckBox.setText("Push Bundle");
486     actionPushCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc()
487     {
488       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
489       {
490         actionPushCheckBoxActionPerformed(evt);
491       }
492     });
493
494     actionPushPanel.add(actionPushCheckBox);
495
496     apNodeNameLicListButton.setText("Edit Nodes & Licence Numbers");
497     apNodeNameLicListButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
498     {
499       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
500       {
501         apNodeNameLicListButtonActionPerformed(evt);
502       }
503     });
504
505     actionPushPanel.add(apNodeNameLicListButton);
506
507     actionsPanel.add(actionPushPanel);
508
509     actionPushOfferPanel.setLayout(new javax.swing.BoxLayout JavaDoc(actionPushOfferPanel, javax.swing.BoxLayout.X_AXIS));
510
511     actionPushOfferCheckBox.setText("Push Bundle Offer");
512     actionPushOfferCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc()
513     {
514       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
515       {
516         actionPushOfferCheckBoxActionPerformed(evt);
517       }
518     });
519
520     actionPushOfferPanel.add(actionPushOfferCheckBox);
521
522     apoNodeNameListButton.setText("Edit Nodes");
523     apoNodeNameListButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
524     {
525       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
526       {
527         apoNodeNameListButtonActionPerformed(evt);
528       }
529     });
530
531     actionPushOfferPanel.add(apoNodeNameListButton);
532
533     actionsPanel.add(actionPushOfferPanel);
534
535     actionDeleteCheckBox.setText("Delete Bundle");
536     actionsPanel.add(actionDeleteCheckBox);
537
538     jPanel4.add(actionsPanel, java.awt.BorderLayout.NORTH);
539
540     jPanel2.add(jPanel4, java.awt.BorderLayout.CENTER);
541
542     jPanel7.add(jPanel2, java.awt.BorderLayout.CENTER);
543
544     getContentPane().add(jPanel7, java.awt.BorderLayout.CENTER);
545
546     OKButton.setText("OK");
547     OKButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
548     {
549       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
550       {
551         OKButtonActionPerformed(evt);
552       }
553     });
554
555     jPanel6.add(OKButton);
556
557     cancelButton.setText("Cancel");
558     cancelButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
559     {
560       public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
561       {
562         cancelButtonActionPerformed(evt);
563       }
564     });
565
566     jPanel6.add(cancelButton);
567
568     getContentPane().add(jPanel6, java.awt.BorderLayout.SOUTH);
569
570     pack();
571   }//GEN-END:initComponents
572

573   private void cancelButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_cancelButtonActionPerformed
574
{//GEN-HEADEREND:event_cancelButtonActionPerformed
575
dispose();
576   }//GEN-LAST:event_cancelButtonActionPerformed
577

578   private void OKButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_OKButtonActionPerformed
579
{//GEN-HEADEREND:event_OKButtonActionPerformed
580
if (!bundleCheckBox.isSelected() && !bundleOfferCheckBox.isSelected())
581     {
582       JOptionPane.showMessageDialog(this, "Invalid Bundle Type - at least one option must be selected", "Error", JOptionPane.ERROR_MESSAGE);
583       return;
584     }
585     
586     Date JavaDoc validFrom = null;
587     Date JavaDoc validTo = null;
588     try
589     {
590       DateFormat JavaDoc dateFormat = DateFormat.getInstance();
591       String JavaDoc validFromText = validFromTextField.getText().trim().toLowerCase();
592       if (validFromText.length() != 0 && validFromText.compareTo("no limitation") != 0) validFrom = dateFormat.parse(validFromText);
593
594       String JavaDoc validToText = validToTextField.getText().trim().toLowerCase();
595       if (validToText.length() != 0 && validToText.compareTo("no limitation") != 0) validTo = dateFormat.parse(validToText);
596     }
597     catch (ParseException JavaDoc e)
598     {
599       JOptionPane.showMessageDialog(this, "Error occured while parsing 'Valid From' or 'Valid To':\n" + e, "Error", JOptionPane.ERROR_MESSAGE);
600       return;
601     }
602     
603     String JavaDoc contractID = contractIDTextField.getText().trim();
604     String JavaDoc contractRule = contractRuleTextField.getText().trim();
605     if (contractID.length() != 0 && contractRule.length() == 0)
606     {
607       JOptionPane.showMessageDialog(this, "Missing Contract Rule", "Error", JOptionPane.ERROR_MESSAGE);
608       return;
609     }
610     
611     inputTrigger.setDescription(descriptionTextField.getText());
612     
613     inputTrigger.setPushSource(pushCheckBox.isSelected());
614     inputTrigger.setPullSource(pullCheckBox.isSelected());
615     inputTrigger.setMadeSource(madeCheckBox.isSelected());
616     if (bundleCheckBox.isSelected())
617     {
618       if (bundleOfferCheckBox.isSelected()) inputTrigger.setBundleType(InputTrigger.BUNDLETYPE_ALL);
619       else inputTrigger.setBundleType(InputTrigger.BUNDLETYPE_FULL);
620     }
621     else
622     {
623       if (bundleOfferCheckBox.isSelected()) inputTrigger.setBundleType(InputTrigger.BUNDLETYPE_OFFER);
624       else inputTrigger.setBundleType(InputTrigger.BUNDLETYPE_FULL);
625     }
626
627     if (!bundleFilterCheckBox.isSelected()) bundleFilter = null;
628     if (!nodeFilterCheckBox.isSelected()) nodeFilter = null;
629     inputTrigger.setBundleFilter(bundleFilter);
630     inputTrigger.setNodeFilter(nodeFilter);
631     inputTrigger.setValidFrom(validFrom);
632     inputTrigger.setValidTo(validTo);
633     inputTrigger.setAutoDelete(autodeleteCheckBox.isSelected());
634     if (contractID.length() != 0) inputTrigger.setContract(contractID, contractRule);
635     else inputTrigger.setContract(null, null);
636     
637     int actions = 0;
638     if (actionInstallCheckBox.isSelected()) actions |= InputTrigger.ACTION_INSTALL;
639     if (actionShareCheckBox.isSelected()) actions |= InputTrigger.ACTION_SHARE;
640     else asParameters = null;
641     if (actionAllowPullCheckBox.isSelected()) actions |= InputTrigger.ACTION_ALLOW_PULL;
642     else alpOutputTrigger = null;
643     if (actionPushCheckBox.isSelected()) actions |= InputTrigger.ACTION_PUSH;
644     else apNodeNameLicList = null;
645     if (actionPushOfferCheckBox.isSelected()) actions |= InputTrigger.ACTION_PUSH_OFFER;
646     else apoNodeNameList = null;
647     if (actionDeleteCheckBox.isSelected()) actions |= InputTrigger.ACTION_DELETE;
648     
649     inputTrigger.setActions(actions);
650     
651     if (asParameters != null) asParameters.save(inputTrigger);
652     inputTrigger.setAlpOutputTrigger(alpOutputTrigger);
653     inputTrigger.setApNodeNameLicList(apNodeNameLicList);
654     inputTrigger.setApoNodeNameList(apoNodeNameList);
655     
656     isOK = true;
657     dispose();
658   }//GEN-LAST:event_OKButtonActionPerformed
659

660   private void apoNodeNameListButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_apoNodeNameListButtonActionPerformed
661
{//GEN-HEADEREND:event_apoNodeNameListButtonActionPerformed
662
StringListEditDialog.showDialog(this, apoNodeNameList.getList(), "Node Name", "Node Name List");
663   }//GEN-LAST:event_apoNodeNameListButtonActionPerformed
664

665   private void actionPushOfferCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_actionPushOfferCheckBoxActionPerformed
666
{//GEN-HEADEREND:event_actionPushOfferCheckBoxActionPerformed
667
apoNodeNameListButton.setEnabled(actionPushOfferCheckBox.isSelected());
668   }//GEN-LAST:event_actionPushOfferCheckBoxActionPerformed
669

670   private void apNodeNameLicListButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_apNodeNameLicListButtonActionPerformed
671
{//GEN-HEADEREND:event_apNodeNameLicListButtonActionPerformed
672
NodeNameLicListEditDialog.showDialog(this, apNodeNameLicList, "Action Push Node Name-Licence List");
673   }//GEN-LAST:event_apNodeNameLicListButtonActionPerformed
674

675   private void actionPushCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_actionPushCheckBoxActionPerformed
676
{//GEN-HEADEREND:event_actionPushCheckBoxActionPerformed
677
apNodeNameLicListButton.setEnabled(actionPushCheckBox.isSelected());
678   }//GEN-LAST:event_actionPushCheckBoxActionPerformed
679

680   private void alpOutputTriggerButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_alpOutputTriggerButtonActionPerformed
681
{//GEN-HEADEREND:event_alpOutputTriggerButtonActionPerformed
682
OutputTriggerEditDialog.showDialog(this, alpOutputTrigger, "Allow Pull Action Output Trigger Editor");
683   }//GEN-LAST:event_alpOutputTriggerButtonActionPerformed
684

685   private void actionAllowPullCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_actionAllowPullCheckBoxActionPerformed
686
{//GEN-HEADEREND:event_actionAllowPullCheckBoxActionPerformed
687
alpOutputTriggerButton.setEnabled(actionAllowPullCheckBox.isSelected());
688   }//GEN-LAST:event_actionAllowPullCheckBoxActionPerformed
689

690   private void editShareParametersButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_editShareParametersButtonActionPerformed
691
{//GEN-HEADEREND:event_editShareParametersButtonActionPerformed
692
InputTriggerShareActionPropertiesEditDialog.showDialog(this, asParameters);
693   }//GEN-LAST:event_editShareParametersButtonActionPerformed
694

695   private void actionShareCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_actionShareCheckBoxActionPerformed
696
{//GEN-HEADEREND:event_actionShareCheckBoxActionPerformed
697
editShareParametersButton.setEnabled(actionShareCheckBox.isSelected());
698   }//GEN-LAST:event_actionShareCheckBoxActionPerformed
699

700   private void nodeFilterButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_nodeFilterButtonActionPerformed
701
{//GEN-HEADEREND:event_nodeFilterButtonActionPerformed
702
StringListEditDialog.showDialog(this, nodeFilter.getPatterns(), "Node Name Pattern", "Node Filter Editor");
703   }//GEN-LAST:event_nodeFilterButtonActionPerformed
704

705   private void nodeFilterCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_nodeFilterCheckBoxActionPerformed
706
{//GEN-HEADEREND:event_nodeFilterCheckBoxActionPerformed
707
nodeFilterButton.setEnabled(nodeFilterCheckBox.isSelected());
708   }//GEN-LAST:event_nodeFilterCheckBoxActionPerformed
709

710   private void bundleFilterButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_bundleFilterButtonActionPerformed
711
{//GEN-HEADEREND:event_bundleFilterButtonActionPerformed
712
StringListEditDialog.showDialog(this, bundleFilter.getPatterns(), "Bundle Name Pattern", "Bundle Filter Editor");
713   }//GEN-LAST:event_bundleFilterButtonActionPerformed
714

715   private void bundleFilterCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_bundleFilterCheckBoxActionPerformed
716
{//GEN-HEADEREND:event_bundleFilterCheckBoxActionPerformed
717
bundleFilterButton.setEnabled(bundleFilterCheckBox.isSelected());
718   }//GEN-LAST:event_bundleFilterCheckBoxActionPerformed
719

720   // Variables declaration - do not modify//GEN-BEGIN:variables
721
private javax.swing.JButton JavaDoc OKButton;
722   private javax.swing.JCheckBox JavaDoc actionAllowPullCheckBox;
723   private javax.swing.JPanel JavaDoc actionAllowPullPanel;
724   private javax.swing.JCheckBox JavaDoc actionDeleteCheckBox;
725   private javax.swing.JCheckBox JavaDoc actionInstallCheckBox;
726   private javax.swing.JPanel JavaDoc actionInstallPanel;
727   private javax.swing.JCheckBox JavaDoc actionPushCheckBox;
728   private javax.swing.JCheckBox JavaDoc actionPushOfferCheckBox;
729   private javax.swing.JPanel JavaDoc actionPushOfferPanel;
730   private javax.swing.JPanel JavaDoc actionPushPanel;
731   private javax.swing.JCheckBox JavaDoc actionShareCheckBox;
732   private javax.swing.JPanel JavaDoc actionSharePanel;
733   private javax.swing.JPanel JavaDoc actionsPanel;
734   private javax.swing.JButton JavaDoc alpOutputTriggerButton;
735   private javax.swing.JButton JavaDoc apNodeNameLicListButton;
736   private javax.swing.JButton JavaDoc apoNodeNameListButton;
737   private javax.swing.JCheckBox JavaDoc autodeleteCheckBox;
738   private javax.swing.JCheckBox JavaDoc bundleCheckBox;
739   private javax.swing.JButton JavaDoc bundleFilterButton;
740   private javax.swing.JCheckBox JavaDoc bundleFilterCheckBox;
741   private javax.swing.JPanel JavaDoc bundleFilterPanel;
742   private javax.swing.JCheckBox JavaDoc bundleOfferCheckBox;
743   private javax.swing.JPanel JavaDoc bundleTypePanel;
744   private javax.swing.JButton JavaDoc cancelButton;
745   private javax.swing.JLabel JavaDoc contractIDLabel;
746   private javax.swing.JTextField JavaDoc contractIDTextField;
747   private javax.swing.JPanel JavaDoc contractPanel;
748   private javax.swing.JLabel JavaDoc contractRuleLabel;
749   private javax.swing.JTextField JavaDoc contractRuleTextField;
750   private javax.swing.JLabel JavaDoc descriptionLabel;
751   private javax.swing.JTextField JavaDoc descriptionTextField;
752   private javax.swing.JButton JavaDoc editShareParametersButton;
753   private javax.swing.JPanel JavaDoc jPanel1;
754   private javax.swing.JPanel JavaDoc jPanel2;
755   private javax.swing.JPanel JavaDoc jPanel3;
756   private javax.swing.JPanel JavaDoc jPanel4;
757   private javax.swing.JPanel JavaDoc jPanel5;
758   private javax.swing.JPanel JavaDoc jPanel6;
759   private javax.swing.JPanel JavaDoc jPanel7;
760   private javax.swing.JCheckBox JavaDoc madeCheckBox;
761   private javax.swing.JPanel JavaDoc nameAndDescriptionPanel;
762   private javax.swing.JLabel JavaDoc nameLabel;
763   private javax.swing.JTextField JavaDoc nameTextField;
764   private javax.swing.JButton JavaDoc nodeFilterButton;
765   private javax.swing.JCheckBox JavaDoc nodeFilterCheckBox;
766   private javax.swing.JPanel JavaDoc nodeFilterPanel;
767   private javax.swing.JPanel JavaDoc parametersPanel;
768   private javax.swing.JCheckBox JavaDoc pullCheckBox;
769   private javax.swing.JCheckBox JavaDoc pushCheckBox;
770   private javax.swing.JPanel JavaDoc sourcePanel;
771   private javax.swing.JLabel JavaDoc validFromLabel;
772   private javax.swing.JPanel JavaDoc validFromPanel;
773   private javax.swing.JTextField JavaDoc validFromTextField;
774   private javax.swing.JLabel JavaDoc validToLabel;
775   private javax.swing.JPanel JavaDoc validToPanel;
776   private javax.swing.JTextField JavaDoc validToTextField;
777   // End of variables declaration//GEN-END:variables
778

779 }
780
Popular Tags