bus.addHandler(ExportFicheStEvent.TYPE, new ExportFicheStHandler() {
@SuppressWarnings("unchecked")
@Override
public void onExport(ExportFicheStEvent event) {
DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(Constants.DATE_FORMAT);
NumberFormat numberFormat = NumberFormat.getFormat(Constants.NUMBER_FORMAT);
// bus.fireEvent(new DeductionGridUpdateEvent(centerPanel.getDeductionDtoList()));
// Information Generals
String chainter = navigation.getContext().getCurrentChantier().getNom();
ComponentManager componentManager = ComponentManager.get();
TextField<String> societte = (TextField<String>) componentManager.get("INFORMATION_PANEL_SOCIETE_ID");
TextField<String> lot = (TextField<String>) componentManager.get("INFORMATION_PANEL_LOT_ID");
ComboBox<LotTypeDto> lotType = (ComboBox<LotTypeDto>) componentManager.get("INFORMATION_PANEL_LOT_TYPE_ID");
TextField<String> sitravaux = (TextField<String>) componentManager.get("INFORMATION_PANEL_SITRAVAUX_ID");
NumberField montant = (NumberField) componentManager.get("INFORMATION_PANEL_MONTANT_ID");
// Conditions Particilifers
ComboBox<SimpleDto> simpleDto = (ComboBox<SimpleDto>) componentManager.get("INFORMATION_PANEL_PAYMENT_ID");
NumberField rg = (NumberField) componentManager.get("INFORMATIONAL_PANEL_RG_ID");
ComboBox<SimpleDto> decennalenecessaire = (ComboBox<SimpleDto>) componentManager.get("INFORMATIONAL_PANEL_DECENNALENECESSAIRE_ID");
ComboBox<SimpleDto> demandedagrement = (ComboBox<SimpleDto>) componentManager.get("INFORMATIONAL_PANEL_DEMANDEDAGREMENT_ID");
ComboBox<SimpleDto> dgdpresente = (ComboBox<SimpleDto>) componentManager.get("INFORMATIONAL_PANEL_DGDPRESENTE_ID");
DateField dgdpresentedate = (DateField) componentManager.get("INFORMATIONAL_PANEL_DGDPRESENTEDATE_ID");
// Presation
NumberField pilotage = (NumberField) componentManager.get("INFORMATIONAL_PANEL_PILOTAGE_ID");
NumberField assurances = (NumberField) componentManager.get("INFORMATIONAL_PANEL_ASSURANCES_ID");
NumberField prorata = (NumberField) componentManager.get("INFORMATIONAL_PANEL_PRORATE_ID");
NumberField canto = (NumberField) componentManager.get("INFORMATIONAL_PANEL_CANTO_ID");
NumberField badge = (NumberField) componentManager.get("INFORMATIONAL_PANEL_BADGE_ID");
NumberField grue = (NumberField) componentManager.get("INFORMATIONAL_PANEL_GRUE_ID");
NumberField lift = (NumberField) componentManager.get("INFORMATIONAL_PANEL_LIFT_ID");
NumberField benne = (NumberField) componentManager.get("INFORMATIONAL_PANEL_BENNE_ID");
NumberField netoyage = (NumberField) componentManager.get("INFORMATIONAL_PANEL_NETOYAGE_ID");
// Information Commemlaires
LabelField conducteur = (LabelField) componentManager.get("INFORMATIONAL_PANEL_CONDUCTEUR_ID");
DateField dateOfMarket = (DateField) componentManager.get("INFORMATIONAL_PANEL_DATEOFMARKET_ID");
List<NameValuePair> values = new ArrayList<NameValuePair>();
// Add General Information
String lotype = lotType.getValue() != null ? lotType.getValue().getName() : "";
String generaleInformation = chainter + Constants.SEPRATE + lot.getValue() + Constants.SEPRATE + sitravaux.getValue() + Constants.SEPRATE + societte.getValue() + Constants.SEPRATE
+ lotype + Constants.SEPRATE + montant.getValue();
values.add(new NameValuePair("generaleInformation", generaleInformation));
// Add Conditions Particilifers
String dgdpresentedate_ = dgdpresentedate.getValue() != null ? dateTimeFormat.format(dgdpresentedate.getValue()) : "null";
String conditionsparticulieres = simpleDto.getValue().getLabel() + Constants.SEPRATE + rg.getValue() + Constants.SEPRATE + decennalenecessaire.getValue().getLabel()
+ Constants.SEPRATE + demandedagrement.getValue().getLabel() + Constants.SEPRATE + dgdpresente.getValue().getLabel() + Constants.SEPRATE + dgdpresentedate_;
values.add(new NameValuePair("conditionsparticulieres", conditionsparticulieres));
// Add Prestations
String prestations = pilotage.getValue() + Constants.SEPRATE + assurances.getValue() + Constants.SEPRATE + prorata.getValue() + Constants.SEPRATE + canto.getValue()
+ Constants.SEPRATE + badge.getValue() + Constants.SEPRATE + grue.getValue() + Constants.SEPRATE + lift.getValue() + Constants.SEPRATE + benne.getValue() + Constants.SEPRATE
+ netoyage.getValue();
values.add(new NameValuePair("prestations", prestations));
// Add Informationa Complementaires
String date_of_market = "null";
if (dateOfMarket.getValue() != null) {
date_of_market = dateTimeFormat.format(dateOfMarket.getValue());
}
String informationscomplementaires = conducteur.getValue() + Constants.SEPRATE + date_of_market;
values.add(new NameValuePair("informationscomplementaires", informationscomplementaires));
List<CautionFournieDto> listCautionFournieDto = centerPanel.getCautionFournieDtoList();
String cautionFournies = "";
String caution_date = "";
for (CautionFournieDto cautionFournieDto : listCautionFournieDto) {
caution_date = cautionFournieDto.getDate() != null ? dateTimeFormat.format(cautionFournieDto.getDate()) : "";
cautionFournies += caution_date + Constants.SEPRATE + numberFormat.format(cautionFournieDto.getAmount()) + Constants.SEPRATE;
}
values.add(new NameValuePair("cautionFournies", cautionFournies));
// Add Gestion
List<GestionDto> listGestion = centerPanel.getGestionDtoList();