--- /dev/null
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/*
+ * AccueilUI.java
+ *
+ * Created on 24 juin 2011, 11:15:56
+ */
+package com.axyus.generator.pespj.ui;
+
+import com.axyus.generator.pespj.utils.ControlUtils;
+import com.axyus.swing.components.AbstractWizardPanel;
+import fr.gouv.finances.dgfip.xemelios.tools.ToolServiceProviderFactory;
+import fr.gouv.finances.dgfip.xemelios.tools.XemeliosToolServiceProvider;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import com.axyus.swing.components.JTextFieldLimit;
+
+/**
+ *
+ * @author stephane.melois
+ */
+public class AccueilUI extends AbstractWizardPanel {
+ private boolean inXemelios;
+
+ /** Creates new form AccueilUI */
+ public AccueilUI() {
+ initComponents();
+ }
+
+ /** 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.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ idCollLabel = new javax.swing.JLabel();
+ codCollLabel = new javax.swing.JLabel();
+ idColl = new com.axyus.swing.components.JTextFieldLimit(14);
+ codColl = new com.axyus.swing.components.JTextFieldLimit(3);
+ finess = new com.axyus.swing.components.JTextFieldLimit(9);
+ idPost = new com.axyus.swing.components.JTextFieldLimit(6);
+ finessLabel = new javax.swing.JLabel();
+ codBudgLabel = new javax.swing.JLabel();
+ jSeparator1 = new javax.swing.JSeparator();
+ jLabel8 = new javax.swing.JLabel();
+ codBudg = new com.axyus.swing.components.JTextFieldLimit(2);
+ idPostLabel = new javax.swing.JLabel();
+ libelleCollectiviteBudgetLabel = new javax.swing.JLabel();
+ libelleCollectiviteBudget = new javax.swing.JComboBox();
+
+ setPreferredSize(new java.awt.Dimension(450, 555));
+
+ idCollLabel.setText("<html>Identifiant Collectivité (<font color='red'>*</font>)</html>");
+
+ codCollLabel.setText("<html>Code Collectivité (<font color='red'>*</font>)</html>");
+
+ idColl.addCaretListener(new javax.swing.event.CaretListener() {
+ public void caretUpdate(javax.swing.event.CaretEvent evt) {
+ idCollCaretUpdate(evt);
+ }
+ });
+ idColl.addFocusListener(new java.awt.event.FocusAdapter() {
+ public void focusLost(java.awt.event.FocusEvent evt) {
+ idCollFocusLost(evt);
+ }
+ });
+
+ idPost.setNextFocusableComponent(idColl);
+
+ finessLabel.setText("Finess Juridique");
+
+ codBudgLabel.setText("<html>Code Budget (<font color='red'>*</font>)</html>");
+
+ jLabel8.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
+ jLabel8.setText("Obligatoire M21 & M22");
+
+ idPostLabel.setText("<html>Identifiant du poste (<font color='red'>*</font>)</html>");
+
+ libelleCollectiviteBudgetLabel.setText("Libellé collectivite budget");
+
+ libelleCollectiviteBudget.setEditable(true);
+
+ 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()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jSeparator1)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(codBudgLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(idPostLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(codCollLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(finessLabel, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(idCollLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(libelleCollectiviteBudgetLabel, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(libelleCollectiviteBudget, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(finess, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE))
+ .addGap(18, 18, 18)
+ .addComponent(jLabel8))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(codColl, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(idPost, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(codBudg, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(idColl, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(0, 0, Short.MAX_VALUE)))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap(164, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(idPostLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(idPost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(28, 28, 28)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(idCollLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(idColl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(29, 29, 29)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(codCollLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(codColl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(27, 27, 27)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(codBudgLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(codBudg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(47, 47, 47)
+ .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(46, 46, 46)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(finessLabel)
+ .addComponent(finess, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel8))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(libelleCollectiviteBudgetLabel)
+ .addComponent(libelleCollectiviteBudget, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(66, 66, 66))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void idCollCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_idCollCaretUpdate
+
+ }//GEN-LAST:event_idCollCaretUpdate
+
+ private void idCollFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_idCollFocusLost
+ if(ControlUtils.verifCleLuhn(idColl.getText(), true, false) && isInXemelios()){
+ setBusy(true);
+ XemeliosToolServiceProvider serviceProvider = ToolServiceProviderFactory.newInstance().getServiceProvider();
+ final List<XemeliosToolServiceProvider.XemeliosCollectivite> collectivites = serviceProvider.getAllLibellesFromReferentielBySiret("ref-collec-spl",idColl.getText());
+ List<String> collectivitesString = new ArrayList<String>();
+ for(XemeliosToolServiceProvider.XemeliosCollectivite collectivite:collectivites){
+ collectivitesString.add(collectivite.getLibelleCollectivite());
+ }
+ if(collectivites != null && !collectivites.isEmpty()){
+ libelleCollectiviteBudget.setModel(new DefaultComboBoxModel(collectivitesString.toArray()));
+ }
+ setBusy(false);
+ }
+ }//GEN-LAST:event_idCollFocusLost
+
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private com.axyus.swing.components.JTextFieldLimit codBudg;
+ private javax.swing.JLabel codBudgLabel;
+ private com.axyus.swing.components.JTextFieldLimit codColl;
+ private javax.swing.JLabel codCollLabel;
+ private com.axyus.swing.components.JTextFieldLimit finess;
+ private javax.swing.JLabel finessLabel;
+ private com.axyus.swing.components.JTextFieldLimit idColl;
+ private javax.swing.JLabel idCollLabel;
+ private com.axyus.swing.components.JTextFieldLimit idPost;
+ private javax.swing.JLabel idPostLabel;
+ private javax.swing.JLabel jLabel8;
+ private javax.swing.JSeparator jSeparator1;
+ private javax.swing.JComboBox libelleCollectiviteBudget;
+ private javax.swing.JLabel libelleCollectiviteBudgetLabel;
+ // End of variables declaration//GEN-END:variables
+
+ public JTextFieldLimit getCodBudg() {
+ return codBudg;
+ }
+
+ public JTextFieldLimit getCodColl() {
+ return codColl;
+ }
+
+ public JTextFieldLimit getFiness() {
+ return finess;
+ }
+
+ public JTextFieldLimit getIdColl() {
+ return idColl;
+ }
+
+ public JTextFieldLimit getIdPost() {
+ return idPost;
+ }
+
+ public JComboBox getLibelleCollectiviteBudget() {
+ return libelleCollectiviteBudget;
+ }
+
+ public boolean isInXemelios() {
+ return inXemelios;
+ }
+
+ public void setInXemelios(boolean inXemelios) {
+ this.inXemelios = inXemelios;
+ }
+}