示例#1
0
 protected final void export(ExportType type) {
   try {
     final AbstractExport createExport =
         type.createExport(ComptaPropsConfiguration.getInstanceCompta().getRootSociete());
     createExport.setNbCharCpt((Integer) this.spinNbChar.getValue());
     createExport.setNbCharLimitCpt((Integer) this.spinNbCharLimit.getValue());
     final Tuple2<File, Number> res =
         createExport.export(
             this.fileChooser.getSelectedFile(),
             this.du.getDate(),
             this.au.getDate(),
             this.boxJournal.getSelectedRow(),
             this.boxExport.isSelected());
     if (res.get1().intValue() == 0) {
       JOptionPane.showMessageDialog(
           this, "Aucune écriture trouvée. La période est-elle correcte ?");
     } else {
       // Notify
       JOptionPane.showMessageDialog(
           this,
           "L'export des "
               + res.get1()
               + " écritures est terminé.\nLe fichier créé est "
               + res.get0().getAbsolutePath());
       // Close frame
       SwingUtilities.getWindowAncestor(this).dispose();
     }
   } catch (final FileNotFoundException ex) {
     JOptionPane.showMessageDialog(this, "Création du fichier impossible : " + ex.getMessage());
   } catch (Exception e) {
     ExceptionHandler.handle(this, "Erreur d'export", e);
   }
 }
 public GenerationDocumentPayePreferencePanel() {
   super();
   this.mapKeyLabel.put(
       Tuple2.create(FichePayeSheetXML.TEMPLATE_ID, "LocationFichePaye"), "Fiche paye");
   this.mapKeyLabel.put(
       Tuple2.create(LivrePayeSheet.TEMPLATE_ID, "LocationLivrePaye"), "Livre paye");
   this.mapKeyLabel.put(
       Tuple2.create(EtatChargesPayeSheet.TEMPLATE_ID, "LocationEtatChargesPaye"),
       "Etat des charges");
   // uiInit();
 }
  private ListeAddPanel getPanel(
      final SQLElement eltCmd,
      final SQLTableModelSourceOnline tableSource,
      final List<RowAction> allowedActions) {
    final ListeAddPanel panel =
        new ListeAddPanel(eltCmd, new IListe(tableSource)) {
          @Override
          protected void createUI() {
            super.createUI();
            this.btnMngr.setAdditional(
                this.buttonEffacer,
                new ITransformer<JButton, String>() {

                  @Override
                  public String transformChecked(JButton input) {

                    SQLRowAccessor row = getListe().fetchSelectedRow();

                    BigDecimal b = getAvancement(row);

                    if (b.signum() != 0) {
                      return "Vous ne pouvez pas supprimer une commande facturée !";
                    }
                    return null;
                  }
                });
            this.btnMngr.setAdditional(
                this.buttonModifier,
                new ITransformer<JButton, String>() {

                  @Override
                  public String transformChecked(JButton input) {

                    SQLRowAccessor row = getListe().fetchSelectedRow();

                    BigDecimal b = getAvancement(row);

                    if (b.signum() != 0) {
                      return "Vous ne pouvez pas modifier une commande facturée !";
                    }
                    return null;
                  }
                });
          }
        };

    final List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields =
        new ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(2);
    fields.add(
        Tuple2.create(
            panel.getListe().getSource().getColumn(eltCmd.getTable().getField("T_HT")),
            IListTotalPanel.Type.SOMME));
    fields.add(Tuple2.create(this.colAvancement, IListTotalPanel.Type.AVANCEMENT_TTC));
    final IListTotalPanel totalPanel =
        new IListTotalPanel(panel.getListe(), fields, null, "Total des commandes de la liste");

    final GridBagConstraints c = new DefaultGridBagConstraints();
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.EAST;
    c.weightx = 1;
    c.gridy = 4;

    // Date panel
    final IListFilterDatePanel datePanel =
        new IListFilterDatePanel(
            panel.getListe(),
            eltCmd.getTable().getField("DATE"),
            IListFilterDatePanel.getDefaultMap());

    panel
        .getListe()
        .addIListeActions(
            new MouseSheetXmlListeListener(CommandeClientXmlSheet.class) {
              @Override
              public List<RowAction> addToMenu() {
                return allowedActions;
              }
            }.getRowActions());

    datePanel.setFilterOnDefault();

    final JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new GridBagLayout());
    bottomPanel.setOpaque(false);
    final GridBagConstraints c2 = new DefaultGridBagConstraints();
    c2.fill = GridBagConstraints.NONE;
    c2.weightx = 1;
    bottomPanel.add(datePanel, c2);

    c2.gridx++;
    c2.weightx = 0;
    c2.anchor = GridBagConstraints.EAST;
    bottomPanel.add(totalPanel, c2);

    panel.add(bottomPanel, c);
    return panel;
  }