content: /*
   * Copyright 2016 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package com.github.alexfalappa.nbspringboot.templates.controller;
  
  import javax.swing.JPanel;
  
  import org.openide.WizardDescriptor;
  
  import static com.github.alexfalappa.nbspringboot.templates.controller.ControllerWizardIterator.WIZ_ERROR_HANDLING;
  
  /**
   * Options for new Controller class file wizard.
   *
   * @author Alessandro Falappa
   */
  public final class ControllerVisualPanel1 extends JPanel {
  
      private final ControllerWizardPanel1 panel;
  
      @SuppressWarnings("LeakingThisInConstructor")
      public ControllerVisualPanel1(ControllerWizardPanel1 panel) {
          initComponents();
          this.panel = panel;
      }
  
      void store(WizardDescriptor wd) {
          wd.putProperty(WIZ_ERROR_HANDLING, cbError.getSelectedIndex());
      }
  
      void read(WizardDescriptor wd) {
          cbError.setSelectedIndex((Integer) wd.getProperty(WIZ_ERROR_HANDLING));
      }
  
      /**
       * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of
       * this method is always regenerated by the Form Editor.
       */
      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          cbError = new javax.swing.JComboBox<>();
          lError = new javax.swing.JLabel();
  
          cbError.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "None", "HTTP status code (@ResponseStatus)", "Simple error view", "Customized error model and view" }));
          cbError.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  cbErrorActionPerformed(evt);
              }
          });
  
          org.openide.awt.Mnemonics.setLocalizedText(lError, org.openide.util.NbBundle.getMessage(ControllerVisualPanel1.class, "ControllerVisualPanel1.lError.text")); // NOI18N
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
          this.setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(lError)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(cbError, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addContainerGap()
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                      .addComponent(cbError, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(lError))
                  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
          );
      }// </editor-fold>//GEN-END:initComponents
  
      private void cbErrorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbErrorActionPerformed
          // Notify that the panel changed
          panel.fireChangeEvent();
      }//GEN-LAST:event_cbErrorActionPerformed
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JComboBox<String> cbError;
      private javax.swing.JLabel lError;
      // End of variables declaration//GEN-END:variables
  
  }
  