Wizard panels were updated. lazy_projects_108120_root
authoralexpetrov@netbeans.org
Sat, 29 Dec 2007 04:34:14 +0000
changeset 15288427d5c02c91
parent 1527 ff1dacbba2ac
child 1529 0b2568867245
Wizard panels were updated.
bpel.editors/src/org/netbeans/modules/bpel/properties/editors/Bundle.properties
bpel.editors/src/org/netbeans/modules/bpel/properties/editors/DefineCorrelationWizard.java
     1.1 --- a/bpel.editors/src/org/netbeans/modules/bpel/properties/editors/Bundle.properties	Fri Dec 28 16:26:27 2007 +0000
     1.2 +++ b/bpel.editors/src/org/netbeans/modules/bpel/properties/editors/Bundle.properties	Sat Dec 29 04:34:14 2007 +0000
     1.3 @@ -426,3 +426,5 @@
     1.4  LBL_Wizard_Step_Select_Messaging_Activity=Select Messaging Activity
     1.5  LBL_Wizard_Step_Define_Correlation=Define Correlation
     1.6  LBL_Wizard_Step_Correlation_Configuration=Correlation Configuration
     1.7 +LBL_Initiated_Messaging_Activities=Initiated Messaging Activities:
     1.8 +LBL_ErrMsg_No_Activity_For_Correlation=There is no any available activity for correlation
     2.1 --- a/bpel.editors/src/org/netbeans/modules/bpel/properties/editors/DefineCorrelationWizard.java	Fri Dec 28 16:26:27 2007 +0000
     2.2 +++ b/bpel.editors/src/org/netbeans/modules/bpel/properties/editors/DefineCorrelationWizard.java	Sat Dec 29 04:34:14 2007 +0000
     2.3 @@ -40,18 +40,24 @@
     2.4  package org.netbeans.modules.bpel.properties.editors;
     2.5  
     2.6  import java.awt.Component;
     2.7 +import java.awt.Dialog;
     2.8  import java.awt.Dimension;
     2.9 +import java.awt.FlowLayout;
    2.10 +import java.awt.GridBagConstraints;
    2.11 +import java.awt.Insets;
    2.12  import java.text.MessageFormat;
    2.13  import java.util.*;
    2.14 +import javax.swing.JComboBox;
    2.15  import javax.swing.JLabel;
    2.16 +import javax.swing.JList;
    2.17  import javax.swing.JPanel;
    2.18  import javax.swing.event.ChangeListener;
    2.19 +import javax.swing.plaf.basic.BasicComboBoxRenderer;
    2.20  import org.netbeans.modules.bpel.nodes.BpelNode;
    2.21  import org.netbeans.modules.print.api.PrintUtil;
    2.22  import org.openide.DialogDisplayer;
    2.23  import org.openide.WizardDescriptor;
    2.24  import org.openide.WizardDescriptor.Panel;
    2.25 -import org.openide.WizardDescriptor.ValidatingPanel;
    2.26  import org.openide.WizardValidationException;
    2.27  import org.openide.util.ChangeSupport;
    2.28  import org.openide.util.HelpCtx;
    2.29 @@ -70,13 +76,13 @@
    2.30      
    2.31      private WizardDescriptor wizardDescriptor;
    2.32      private BpelNode mainBpelNode;
    2.33 +    private Panel[] wizardPanels;
    2.34      
    2.35      public DefineCorrelationWizard(BpelNode mainBpelNode) {
    2.36          this.mainBpelNode = mainBpelNode;
    2.37          
    2.38 -        WizardDescriptor.Iterator panelIterator = new WizardDescriptor.ArrayIterator(
    2.39 -            getWizardPanelList());
    2.40 -        wizardDescriptor = new WizardDescriptor(panelIterator);
    2.41 +        wizardPanels = getWizardPanelList().toArray(new Panel[] {});
    2.42 +        wizardDescriptor = new WizardDescriptor(wizardPanels);
    2.43          
    2.44          wizardDescriptor.putProperty(PROPERTY_AUTO_WIZARD_STYLE, true);
    2.45          wizardDescriptor.putProperty(PROPERTY_CONTENT_DISPLAYED, true);
    2.46 @@ -93,7 +99,9 @@
    2.47      }
    2.48      
    2.49      public void showWizardDialog() {
    2.50 -        DialogDisplayer.getDefault().createDialog(wizardDescriptor).setVisible(true);
    2.51 +        Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    2.52 +        wizardPanels[0].isValid();
    2.53 +        dialog.setVisible(true);
    2.54      }
    2.55      
    2.56      private List<Panel> getWizardPanelList() {
    2.57 @@ -107,11 +115,12 @@
    2.58          }
    2.59          return panelList;
    2.60      }
    2.61 -
    2.62      //========================================================================//
    2.63      public abstract class WizardAbstractPanel implements WizardDescriptor.ValidatingPanel {
    2.64          protected JPanel wizardPanel = createWizardPanel();
    2.65 -        private ChangeSupport changeSupport = new ChangeSupport(this);
    2.66 +        protected ChangeSupport changeSupport = new ChangeSupport(this);
    2.67 +        protected GridBagConstraints gbc = new GridBagConstraints();
    2.68 +        protected int insetX = 5, insetY = 5;
    2.69          
    2.70          protected JPanel createWizardPanel() {
    2.71              JPanel panel = new JPanel();
    2.72 @@ -146,11 +155,62 @@
    2.73          public boolean isValid() {
    2.74              return true;
    2.75          }
    2.76 +        
    2.77 +        protected void initializeGridBagConstraints() {
    2.78 +            gbc.gridx = 0; gbc.gridy = 0;
    2.79 +            gbc.gridwidth = 1; gbc.gridheight = 1;
    2.80 +            gbc.ipadx = 0; gbc.ipady = 0;
    2.81 +            gbc.fill = GridBagConstraints.NONE;
    2.82 +            gbc.anchor = GridBagConstraints.NORTHWEST;
    2.83 +            gbc.insets = new Insets(insetY, insetX, insetY, insetX);
    2.84 +            gbc.weightx = 1.0; gbc.weighty = 1.0;
    2.85 +        }
    2.86      }
    2.87      //========================================================================//
    2.88      public class WizardSelectMessagingActivityPanel extends WizardAbstractPanel {
    2.89 +        private final Dimension COMBOBOX_DIMENSION = new Dimension(220, 20);
    2.90 +        private final JComboBox activityComboBox = new JComboBox();
    2.91 +        private Object previousSelectedActivity, currentSelectedActivity;
    2.92 +            
    2.93          public WizardSelectMessagingActivityPanel() {
    2.94              super();
    2.95 +            wizardPanel.setLayout(new FlowLayout(FlowLayout.LEFT, insetX, insetY));
    2.96 +            wizardPanel.add(new JLabel(PrintUtil.i18n(
    2.97 +                WizardSelectMessagingActivityPanel.class, "LBL_Initiated_Messaging_Activities")));
    2.98 +
    2.99 +            activityComboBox.setRenderer(new ComboBoxRenderer());
   2.100 +            activityComboBox.setEditable(false);
   2.101 +            activityComboBox.setMinimumSize(COMBOBOX_DIMENSION);
   2.102 +            activityComboBox.setPreferredSize(activityComboBox.getMinimumSize());
   2.103 +            wizardPanel.add(activityComboBox);
   2.104 +        }
   2.105 +
   2.106 +        @Override
   2.107 +        public boolean isValid() {
   2.108 +            boolean isOK = ((activityComboBox.getItemCount() > 0) &&
   2.109 +                            (activityComboBox.getSelectedItem() != null));
   2.110 +            
   2.111 +            wizardDescriptor.putProperty(PROPERTY_ERROR_MESSAGE, isOK ? null :
   2.112 +                PrintUtil.i18n(WizardSelectMessagingActivityPanel.class, "LBL_ErrMsg_No_Activity_For_Correlation"));                              
   2.113 +            return isOK;
   2.114 +        }
   2.115 +
   2.116 +        @Override
   2.117 +        public void validate() throws WizardValidationException {
   2.118 +            previousSelectedActivity = currentSelectedActivity;
   2.119 +            currentSelectedActivity = activityComboBox.getSelectedItem();
   2.120 +        }
   2.121 +        //====================================================================//
   2.122 +        private class ComboBoxRenderer extends BasicComboBoxRenderer.UIResource {
   2.123 +            @Override
   2.124 +            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   2.125 +                Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
   2.126 +                if ((value != null) && (value instanceof BpelNode) &&
   2.127 +                    (component != null) && (component instanceof JLabel)) {
   2.128 +                    ((JLabel) component).setText(((BpelNode) value).getName());
   2.129 +                }
   2.130 +                return component;
   2.131 +            }
   2.132          }
   2.133      }
   2.134      //========================================================================//
   2.135 @@ -158,6 +218,20 @@
   2.136          public WizardDefineCorrelationPanel() {
   2.137              super();
   2.138          }
   2.139 +/*
   2.140 +wizardPanel.setPreferredSize(null);
   2.141 +wizardPanel.setLayout(new GridBagLayout());
   2.142 +initializeGridBagConstraints();
   2.143 +wizardPanel.add(new JLabel(PrintUtil.i18n(
   2.144 +    WizardSelectMessagingActivityPanel.class, "LBL_Initiated_Messaging_Activities")), 
   2.145 +    gbc);
   2.146 +
   2.147 +gbc.gridx = 1;
   2.148 +JComboBox activityComboBox = new JComboBox();
   2.149 +activityComboBox.setMinimumSize(new Dimension(200, 20));
   2.150 +activityComboBox.setPreferredSize(activityComboBox.getMinimumSize());
   2.151 +wizardPanel.add(activityComboBox, gbc);
   2.152 +*/
   2.153      }
   2.154      //========================================================================//
   2.155      public class WizardCorrelationConfigurationPanel extends WizardAbstractPanel {
   2.156 @@ -184,5 +258,4 @@
   2.157  
   2.158          PROPERTY_HELP_DISPLAYED = "WizardPanel_helpDisplayed", // NOI18N
   2.159          PROPERTY_HELP_URL = "WizardPanel_helpURL"; // NOI18N
   2.160 -}
   2.161 -    
   2.162 \ No newline at end of file
   2.163 +}
   2.164 \ No newline at end of file