Package com.structis.fichesst.client.widget

Examples of com.structis.fichesst.client.widget.CustomFieldSet


  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    TableLayout layout = new TableLayout(1);
    layout.setWidth("100%");
    setLayout(layout);
    CustomFieldSet chantierInfo = new CustomFieldSet();
    chantierInfo.setCollapsible(false);
    FormLayout fl_fldstNewFieldset_0 = new FormLayout();
    fl_fldstNewFieldset_0.setLabelWidth(130);
    chantierInfo.setLayout(fl_fldstNewFieldset_0);

    formPanel = new CustomFormPanel();
    formPanel.setLabelWidth(135);

    final TextField<String> chatierName = new CustomTextField<String>();
    chatierName.setName(ChantierModel.NOM);
    chatierName.setFieldLabel(messages.nameChantier());
    chatierName.addListener(Events.OnKeyUp, new Listener<BaseEvent>() {
      @Override
      public void handleEvent(BaseEvent be) {
        if( !formPanel.isValid() ) {
          return;
        }

        isEdit = true;
        bus.fireEvent(new IsEditEvent(isEdit));
      }
    });
    formPanel.add(chatierName);

    prorataTheorique = createIntegerField("Prorata Théorique", true);
    prorataTheorique.setName(ChantierModel.PRORATA_THEORIQUE);
    prorataTheorique.addListener(Events.OnKeyUp, new Listener<BaseEvent>() {
      @Override
      public void handleEvent(BaseEvent be) {
        if( !formPanel2.isValid() ) {
          return;
        }

        saveLayout.setEnabled(true);
        isEdit = true;
        bus.fireEvent(new IsEditEvent(isEdit));
      }
    });

    formPanel2 = new CustomFormPanel();
    formPanel2.setLabelWidth(135);
    formPanel2.add(prorataTheorique);

    chantierInfo.add(formPanel, new FormData("35%"));
    add(chantierInfo);
    chantierInfo.setHeading("INFORMATIONS CHANTIER");

    CustomFieldSet fldstNewFieldset_1 = new CustomFieldSet();
    fldstNewFieldset_1.setLayout(new RowLayout(Orientation.VERTICAL));
    add(fldstNewFieldset_1);
    fldstNewFieldset_1.setHeading("SYNTHESE DES FICHES ST");

    LayoutContainer linksPanel = new LayoutContainer();
    linksPanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
    LayoutContainer topPanel = new LayoutContainer();
    topPanel.setHeight(25);
    topPanel.setLayout(new BorderLayout());
    topPanel.add(linksPanel, new BorderLayoutData(LayoutRegion.EAST, 645));
    topPanel.add(formPanel2, new BorderLayoutData(LayoutRegion.WEST, 500));
    fldstNewFieldset_1.add(topPanel);
    fldstNewFieldset_1.add(new HTML("<br>"));
    saveLayout = new LayoutContainer();

    HTML save = new HTML("<img src='./images/sauvegarder.png'/> " + messages.saveSynthese(), false);
    save.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    save.setStyleName("actionHTML");
    saveLayout.add(save);
    saveLayout.setEnabled(false);
    save.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        bus.fireEvent(new SyntheseEvent());
        saveLayout.setEnabled(false);
        bus.fireEvent(new IsEditEvent(false));
      }
    });
    linksPanel.add(saveLayout);
    if( isAdminOrContributor(role, user) ) {
      save.setVisible(true);
      chatierName.enable();
      prorataTheorique.enable();
    }
    else {
      save.setVisible(false);
      chatierName.disable();
      prorataTheorique.disable();
    }

    HTML printSubcontractor = new HTML("<img src='./images/imprimer.png'/> " + messages.printSubcontractor(), false);
    printSubcontractor.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    printSubcontractor.setStyleName("actionHTML");
    linksPanel.add(new HTML(LINKS_SPACE, false));
    linksPanel.add(printSubcontractor);
    printSubcontractor.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        List<FicheStDto> allModels = new ArrayList<FicheStDto>();
        allModels.addAll(ficheStGrid1.getStore().getModels());
        allModels.addAll(ficheStGrid2.getStore().getModels());
        CreateFicheSTPopUpReportWindow popUpReport = new CreateFicheSTPopUpReportWindow(bus, allModels, true);
        popUpReport.show();
      }
    });

    HTML printRefacturations = new HTML("<img src='./images/imprimer.png'/> " + messages.printRefacturations(), false);
    printRefacturations.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    printRefacturations.setStyleName("actionHTML");
    linksPanel.add(new HTML(LINKS_SPACE, false));
    linksPanel.add(printRefacturations);
    printRefacturations.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        List<FicheStDto> allModels = new ArrayList<FicheStDto>();
        allModels.addAll(ficheStGrid1.getStore().getModels());
        allModels.addAll(ficheStGrid2.getStore().getModels());
        CreateFicheSTPopUpReportWindow popUpReport = new CreateFicheSTPopUpReportWindow(bus, allModels, false);
        popUpReport.show();
      }
    });

    ficheStGrid1 = createFicheStGrid(messages.totalSt());
    fldstNewFieldset_1.add(ficheStGrid1);

    // Honoraires lot type
    ficheStGrid2 = createFicheStGrid("Honoraires");
    ficheStGrid2.hideHeader();

    // Hide it. Only show it if having data (check at loadFicheStData() method)
    ficheStGrid2.hide();
    fldstNewFieldset_1.add(ficheStGrid2);
    loadFicheStData();
    if( isAdminOrContributor(role, user) ) {
      FlexTable ft1 = new FlexTable();
      ft1.setWidget(0, 0, new HTML(SPACES_4));
      HTML addRow = new HTML("<img src='./images/ajouter.png'/> " + messages.newSubcontractor(), false);
      addRow.setStyleName("actionHTML2");
      ft1.setWidget(0, 1, addRow);
      addRow.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          GuiUtil.gotoEcran(new FicheSTEcran(chantier, null, role, user));
          /* bus.fireEvent(new LoadFichestEcranEvent(chantier)); */
        }
      });

      fldstNewFieldset_1.add(ft1);
    }

    FieldSet transferPpFieldSet = new CustomFieldSet();
    transferPpFieldSet.setHeading("SYNTHESE DES TRANSFERT PP");
    transferPpFieldSet.setLayout(new BorderLayout());
    setDefaultBackgroundColor(transferPpFieldSet);
    saveLayout2 = new LayoutContainer();
    HTML save2 = new HTML("<img src='./images/sauvegarder.png'/> Sauvegarder la synthèse", false);
    save2.setStyleName("actionHTML");
    save2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    save2.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        if( !formPanel2.isValid() ) {
          return;
        }

        bus.fireEvent(new SyntheseEvent());
        saveLayout2.setEnabled(false);
      }
    });
    saveLayout2.add(save2);
    saveLayout2.setEnabled(false);
    transferPpFieldSet.add(saveLayout2, new BorderLayoutData(LayoutRegion.EAST));
    if( isAdminOrContributor(role, user) ) {
      save2.setVisible(true);
    }
    else {
      save2.setVisible(false);
    }

    createTransfertPpGrid(role, user, chantier);
    transferPpFieldSet.add(transfertPpGrid, new BorderLayoutData(LayoutRegion.WEST, 1000));
    add(transferPpFieldSet);
    transferPpFieldSet.setHeight("430");

    transfertPpGrid.addListener(Events.BeforeEdit, new Listener<GridEvent<TransfertPpSummaryDto>>() {
      @Override
      public void handleEvent(GridEvent<TransfertPpSummaryDto> be) {
        @SuppressWarnings("unused")
        TransfertPpSummaryDto transfertPpSummaryDto = transfertPpGrid.getSelectionModel().getSelectedItem();
        if(isAdminOrContributor(role, user)) {
          be.setCancelled(false);
        }
        else {
          be.setCancelled(true);
        }
      }
    });
    transfertPpGrid.addListener(Events.AfterEdit, new Listener<GridEvent<TransfertPpSummaryDto>>() {
      @Override
      public void handleEvent(GridEvent<TransfertPpSummaryDto> be) {
        saveLayout2.setEnabled(true);
        isEdit = true;
        bus.fireEvent(new IsEditEvent(isEdit));
      }
    });

    FieldSet fldstNewFieldset_3 = new CustomFieldSet();
    fldstNewFieldset_3.setHeading("TOTAL CHANTIER");
    fldstNewFieldset_3.setLayout(new BorderLayout());
    fldstNewFieldset_3.setHeight(175);
    add(fldstNewFieldset_3);

    createFicheStSummaryGrid();
    fldstNewFieldset_3.add(ficheStSummaryGrid);

    buttons = new SyntheseButtonsPanel(bus, role, user);
    add(buttons);

    bindModel(formPanel, this.chantier);
View Full Code Here


  public AvancementsPanel(SimpleEventBus b,RoleModel roleModel,UtilisateurGrpModel utilisateurGrpModel) {
    super();
    this.bus = b;
    this.role = roleModel;
    this.user = utilisateurGrpModel;
    FieldSet avancementsFieldSet = new CustomFieldSet();
    LayoutContainer layoutContainer_1 = new LayoutContainer();
    layoutContainer_1.setBorders(false);
    TableLayout layout3 = new TableLayout(3);
    layout3.setWidth("100%");
    layoutContainer_1.setLayout(layout3);
   
    initFieldReport();
   
    progressLabel = new HTML("", false);
    setProgressLabelText(0.0);
    bus.addHandler(EtatAvancementEvent.TYPE, new EtatAvancementHandler() {
      @Override
      public void onGetEtatAvancement(EtatAvancementEvent event) {
        double cumuleSum = 0.0;
        double totalTraite = 0.0;
        if( event.getListGestion() != null && event.getListGestion().size() > 0 ) {
          listGestion = event.getListGestion();
          GestionDto gestionDto = null;
          for( int i = 0 ; i < listGestion.size() ; i++ ) {
            gestionDto = listGestion.get(i);
            totalTraite += gestionDto.getTraite();
          }
        }

        List<ProgressDto> listProcess = null;
        if( event.getListProcess() == null ) {
          listProcess = progressGrid.getStore().getModels();
        }
        else
          listProcess = event.getListProcess();
        if( listProcess != null && listProcess.size() > 0 ) {
          ProgressDto progressDto = null;
          for( int i = 0 ; i < listProcess.size() ; i++ ) {
            progressDto = listProcess.get(i);
            cumuleSum = progressDto.getCumule();
          }
        }

        if( totalTraite == 0 ) {
          etatAvancement = 0.0;
        }
        else {
          etatAvancement = (cumuleSum / totalTraite) * 100;
        }
        setProgressLabelText(etatAvancement);
      }
    });

    TableData td_htmlNewHtml = new TableData();
    td_htmlNewHtml.setHorizontalAlign(HorizontalAlignment.LEFT);
    layoutContainer_1.add(progressLabel, td_htmlNewHtml);

    saveButton = new HTML("<img src='./images/sauvegarder.png'/> " + messages.saveForm(), false);
    saveButton.setStyleName("actionHTML");
    saveButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        bus.fireEvent(new SaveFicheStEvent());
      }
    });
   
    TableData td_saveButton = new TableData();
    td_saveButton.setHorizontalAlign(HorizontalAlignment.RIGHT);
    layoutContainer_1.add(saveButton, td_saveButton);
   
    bus.addHandler(ExportAvancementPanelEvent.TYPE, new ExportAvancementPanelHandler() {
     
      @Override
      public void onExport(ExportAvancementPanelEvent event) {
        exportAvancementsPanel();
      }
    });
   
    HTML print2 = new HTML("<img src='./images/imprimer.png'/> " + messages.printPromotions(), false);
    print2.setStyleName("actionHTML");
    print2.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent arg0) {
        exportAvancementsPanel();
      }
    });
    TableData td_print2 = new TableData();
    td_print2.setWidth("250");
    td_print2.setHorizontalAlign(HorizontalAlignment.RIGHT);
    layoutContainer_1.add(print2, td_print2);

    avancementsFieldSet.add(layoutContainer_1);

    avancementsFieldSet.add(new HTML("<br>", true));
    avancementsFieldSet.setCollapsible(true);
    avancementsFieldSet.setHeading(messages.avancement());
    TableLayout avancementsTableLayout = new TableLayout(1);
    avancementsTableLayout.setWidth("100%");
    avancementsFieldSet.setLayout(avancementsTableLayout);

    FieldSet fldstNewFieldset_1 = new FieldSet();
    fldstNewFieldset_1.setCollapsible(true);
    fldstNewFieldset_1.setHeading(messages.deductionsDetails());

    createPenaltiesGrid();
    fldstNewFieldset_1.add(penaltyGrid);

    fldstNewFieldset_1.add(new HTML("<br>"));

    createGrid3();
    fldstNewFieldset_1.add(grid_3);

    FlexTable ft11 = new FlexTable();
    ft11.setWidget(0, 0, new HTML(SPACES_4));
    addRow = new HTML("<img src='./images/ajouter.png'/> " + messages.addRow(), false);
    addRow.setStyleName("actionHTML2");
    ft11.setWidget(0, 1, addRow);

    addRow.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        showAddDialog();
      }

      private void showAddDialog() {
        Dialog dialog = new Dialog();
        dialog.setHeading(messages.titlePopup());
        dialog.setLayout(new BorderLayout());
        dialog.setWidth(500);
        dialog.setHeight(220);
        dialog.setBodyBorder(false);
        dialog.setHideOnButtonClick(true);
        dialog.setButtons(Dialog.OKCANCEL);
        dialog.setButtonAlign(HorizontalAlignment.CENTER);
        dialog.setScrollMode(Scroll.AUTO);
        dialog.setModal(true);
        dialog.setBlinkModal(true);
        Button cancelButton = dialog.getButtonById(Dialog.CANCEL);
        cancelButton.setText(messages.cancel());
        Button okButton = dialog.getButtonById(Dialog.OK);
        okButton.setText(messages.ok());

        final AddAvancementForm addDataForm = new AddAvancementForm();
        dialog.add(addDataForm, new BorderLayoutData(LayoutRegion.CENTER));

        okButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent ce) {
            ProgressDto model = addDataForm.getDataModel();
            progressGrid.getStore().add(model);
            progressGrid.getView().refresh(true);
            //bus.fireEvent(new EtatAvancementEvent(listGestion,progressGrid.getStore().getModels()));
          }
        });

        dialog.show();
      }
    });

    LayoutContainer leftPanel = new LayoutContainer();
    leftPanel.setLayout(new TableLayout(1));

    leftPanel.add(new HTML("<br>"));

    createProgressGrid();
    leftPanel.add(progressGrid);

    leftPanel.add(ft11);

    leftPanel.add(new HTML("<br>"));
    leftPanel.add(fldstNewFieldset_1);
    TableData layoutData9 = new TableData();
    layoutData9.setWidth(COLUMNS_WIDTH_3[1]);
    setLayout(new RowLayout(Orientation.VERTICAL));
    add(avancementsFieldSet);

    setDefaultBackgroundColor(avancementsFieldSet);

    LayoutContainer layoutContainer_3 = new LayoutContainer();
    TableLayout tl3 = new TableLayout(3);
    tl3.setWidth("100%");
    layoutContainer_3.setLayout(tl3);
    avancementsFieldSet.add(layoutContainer_3);

    LayoutContainer rightPanel = new LayoutContainer();
    layoutContainer_3.add(leftPanel);

    TableData td2 = new TableData();
View Full Code Here

    });

    flexTable.setWidget(0, 1, addRow);
    cautionFieldset.add(layoutContainer_9);

    mainFieldSet = new CustomFieldSet();
    mainFieldSet.setHeading(messages.generalInformation());
    mainFieldSet.add(formPanel);
    add(mainFieldSet);

    //Set IDs for applying CSS
View Full Code Here

  gridChantier.setAutoExpandColumn("nom");
  gridChantier.setHeight(370);
  gridChantier.setAutoExpandMax(1500);
  gridChantier.setAutoExpandMin(250);
  gridChantier.setWidth(1500);
  FieldSet fsChantier = new CustomFieldSet();
  add(fsChantier);
  fsChantier.setHeading("Chantiers existants");
  fsChantier.setAutoHeight(true);
  // fsChantier.setHeight(400);
  contentChantier.setLayout(new FitLayout());
  contentChantier.setHeaderVisible(false);
  contentChantier.setHeight(200);
  // contentChantier.setAutoHeight(true);
  contentChantier.add(gridChantier);
  fsChantier.add(contentChantier);
  fsNouveauxChantier = new CustomFieldSet();
  fsNouveauxChantier.setCollapsible(false);
  fsNouveauxChantier.setLayout(new ColumnLayout());
  LabelField lblfldNomDuChantier = new LabelField(messages.nameChantier() + ":");
  fsNouveauxChantier.add(lblfldNomDuChantier);
  txtChantier = new TextField<String>();
View Full Code Here

    super();
    this.bus = b;
    this.ficheStId = ficheStId;
    this.role = roleModel;
    this.user = utilisateurGrpModel;
    FieldSet paymentFieldSet = new CustomFieldSet();
    paymentFieldSet.setCollapsible(true);
    setDefaultBackgroundColor(paymentFieldSet);
    paymentFieldSet.setHeading(messages.accomptes());
    TableLayout tl12 = new TableLayout(1);
    tl12.setWidth("100%");
    paymentFieldSet.setLayout(tl12);

    LayoutContainer accomptesPanel1 = new LayoutContainer();
    TableLayout tl_accomptesPanel1 = new TableLayout(2);
    tl_accomptesPanel1.setWidth("98%");
    tl_accomptesPanel1.setCellHorizontalAlign(HorizontalAlignment.RIGHT);
    accomptesPanel1.setLayout(tl_accomptesPanel1);
    saveButton = new HTML("<img src='./images/sauvegarder.png'/> " + messages.saveForm());
    saveButton.setStyleName("actionHTML");
    saveButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        bus.fireEvent(new SaveFicheStEvent());
      }
    });
    // Report
    txtTotalDeduction = new TextField<String>();
    txtTotalDeduction.setId("ACCOMPTES_PANEL_TOTALDEDUCTION_ID");
    txtTotalDeduction.setValue(totaldeduction);
    txtTotalDeduction.hide();
    add(txtTotalDeduction);

    accomptesPanel1.add(saveButton);

    bus.addHandler(ExportSuiviDesAccomptesPanelEvent.TYPE, new ExportSuiviDesAccomptesPanelHandler() {

      @Override
      public void onExport(ExportSuiviDesAccomptesPanelEvent event) {
        exportAccomptesPanel();
      }
    });

    HTML printPayment = new HTML("<img src='./images/imprimer.png'/> " + messages.printAcomptes());
    printPayment.setStyleName("actionHTML");
    printPayment.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent arg0) {
        exportAccomptesPanel();
      }
    });

    TableData td = new TableData();
    td.setWidth("230px");
    accomptesPanel1.add(printPayment, td);
    paymentFieldSet.add(accomptesPanel1);

    LayoutContainer accomptesPanel2 = new LayoutContainer();
    TableLayout tl3 = new TableLayout(3);
    tl3.setWidth("100%");
    tl3.setCellHorizontalAlign(HorizontalAlignment.LEFT);
    accomptesPanel2.setLayout(tl3);
    HTML chantier2 = new HTML("<label>" + messages.chantier() + ":</label>" + SPACES + "Chantier 1", true);
    // Report
    chantier = "Chantier 1";
    TableData td2 = new TableData();
    td2.setWidth("300px");
    accomptesPanel2.add(chantier2, td2);

    String conducter = navigation.getContext().getMapConducteurdetravaux().get(ficheStId);
    if (conducter == null)
      conducter = "";
    final HTML responsable = new HTML("<label>" + messages.responsable() + ":</label>" + SPACES + conducter, true);
    bus.addHandler(ConducteurEvent.TYPE, new ConducteurHandler() {
      @Override
      public void onChangeConducteur(ConducteurEvent conducteurEvent) {
        String conducter = conducteurEvent.getConducter() != null ? conducteurEvent.getConducter() : "";
        responsable.setHTML("<label>" + messages.responsable() + ":</label>" + SPACES + conducter);
        responsables = conducteurEvent.getConducter();
      }
    });
    // Report
    responsables = "";
    TableData td3 = new TableData();
    td3.setWidth("400px");
    accomptesPanel2.add(responsable, td3);

    String societe_ = navigation.getContext().getMapSociete().get(ficheStId);
    if (societe_ == null)
      societe_ = "";
    final HTML societe2 = new HTML("<label>" + messages.societe() + ":</label>" + SPACES + societe_, true);
    bus.addHandler(SocieteEvent.TYPE, new SocieteHandler() {
      @Override
      public void onChangeSociete(SocieteEvent societeEvent) {
        String societe = societeEvent.getSociete() != null ? societeEvent.getSociete() : "";
        societe2.setHTML("<label>" + messages.societe() + ":</label>" + SPACES + societe);
        societe = societeEvent.getSociete();

      }
    });
    societe = "";

    accomptesPanel2.add(societe2);
    paymentFieldSet.add(accomptesPanel2);

    FieldSet deductionsPaymentsFieldSet = new FieldSet();
    deductionsPaymentsFieldSet.setWidth("100%");
    deductionsPaymentsFieldSet.setCollapsible(true);
    setBackgroundColor(deductionsPaymentsFieldSet, BACKGROUD_COLOR_2);
    TableLayout tl1 = new TableLayout(1);
    tl1.setWidth("100%");
    deductionsPaymentsFieldSet.setLayout(tl1);
    deductionsPaymentsFieldSet.setHeading(messages.retenuesEffectuees());

    createDeductionGrid();
    deductionsPaymentsFieldSet.add(deductionGrid);

    FlexTable flexTable = new FlexTable();
    HTML space = new HTML(SPACES_4);
    flexTable.setWidget(0, 0, space);
    addRow.setStyleName("actionHTML2");
    addRow.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        showAddAccomptesDialog();
      }

      private void showAddAccomptesDialog() {
        final Dialog dialog = new Dialog();
        dialog.setHeading(messages.titlePopup());
        dialog.setLayout(new BorderLayout());
        dialog.setWidth(600);
        dialog.setHeight(400);
        dialog.setBodyBorder(false);
        dialog.setHideOnButtonClick(false);
        dialog.setButtons(Dialog.OKCANCEL);
        dialog.setButtonAlign(HorizontalAlignment.CENTER);
        dialog.setScrollMode(Scroll.AUTO);
        dialog.setModal(true);
        dialog.setBlinkModal(true);
        Button cancelButton = dialog.getButtonById(Dialog.CANCEL);
        cancelButton.setText(messages.cancel());
        Button okButton = dialog.getButtonById(Dialog.OK);
        okButton.setText(messages.ok());

        final AddAccomptesForm addDataForm = new AddAccomptesForm();
        dialog.add(addDataForm, new BorderLayoutData(LayoutRegion.CENTER));

        okButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (addDataForm.isValid()) {
              DeductionDto model = addDataForm.getDataModel();
              deductionGrid.getStore().add(model);
              deductionGrid.getView().refresh(true);
              // bus.fireEvent(new
              // DeductionGridUpdateEvent(deductionGrid.getStore().getModels()));
              dialog.hide();
            }
          }
        });

        cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            dialog.hide();
          }
        });

        dialog.show();
      }
    });

    flexTable.setWidget(0, 1, addRow);
    deductionsPaymentsFieldSet.add(flexTable);

    paymentFieldSet.add(deductionsPaymentsFieldSet);

    LayoutContainer accomptesPanel3 = new LayoutContainer();
    accomptesPanel3.setWidth("75%");
    TableLayout tl2 = new TableLayout(3);
    tl2.setWidth("100%");
    accomptesPanel3.setLayout(tl2);

    FieldSet penaltyFielSet = new FieldSet();
    // penaltyFielSet.setWidth("80%");
    setBackgroundColor(penaltyFielSet, BACKGROUD_COLOR_2);
    penaltyFielSet.setHeading(messages.penalites().toUpperCase());
    TableData td4 = new TableData();
    td4.setWidth("55%");

    createPenaltyGrid();
    penaltyFielSet.add(penaltyGrid);

    FlexTable flexTable2 = new FlexTable();
    HTML space2 = new HTML(SPACES_4);
    flexTable2.setWidget(0, 0, space2);
    addRow2.setStyleName("actionHTML2");
    addRow2.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        showAddPenaltyDialog();
      }

      private void showAddPenaltyDialog() {
        Dialog dialog = new Dialog();
        dialog.setHeading(messages.titlePopup());
        dialog.setLayout(new BorderLayout());
        dialog.setWidth(500);
        dialog.setHeight(260);
        dialog.setBodyBorder(false);
        dialog.setHideOnButtonClick(true);
        dialog.setButtons(Dialog.OKCANCEL);
        dialog.setButtonAlign(HorizontalAlignment.CENTER);
        dialog.setScrollMode(Scroll.AUTO);
        dialog.setModal(true);
        dialog.setBlinkModal(true);
        Button cancelButton = dialog.getButtonById(Dialog.CANCEL);
        cancelButton.setText(messages.cancel());
        Button okButton = dialog.getButtonById(Dialog.OK);
        okButton.setText(messages.ok());

        final AddPenaltyForm addDataForm = new AddPenaltyForm();
        dialog.add(addDataForm, new BorderLayoutData(LayoutRegion.CENTER));

        okButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            PenaltyDto model = addDataForm.getDataModel();
            penaltyGrid.getStore().add(model);
            penaltyGrid.getView().refresh(true);
          }
        });

        dialog.show();
      }
    });

    flexTable2.setWidget(0, 1, addRow2);

    penaltyFielSet.add(flexTable2);
    accomptesPanel3.add(penaltyFielSet, td4);

    LayoutContainer lc1 = new LayoutContainer();
    lc1.setWidth("100%");
    setDefaultBackgroundColor(lc1);
    lc1.setHeight(300);
    TableData td5 = new TableData();
    td5.setWidth("50px");
    accomptesPanel3.add(new HTML(SPACES + SPACES), td5);

    LayoutContainer layoutContainer = new LayoutContainer();
    layoutContainer.setWidth("100%");
    setDefaultBackgroundColor(layoutContainer);
    FormLayout fl_layoutContainer = new FormLayout();
    fl_layoutContainer.setLabelAlign(LabelAlign.TOP);
    layoutContainer.setLayout(fl_layoutContainer);

    comment.setName(FicheStDto.ACPT_COMMENTAIRES);
    comment.setId("ACCOMPTESPANEL_COMMENT");
    int height = 110;
    TableLayout tl10 = new TableLayout(1);
    tl10.setWidth("100%");
    setLayout(tl10);
    lc1.setLayout(new RowLayout(Orientation.VERTICAL));
    comment.setHeight(height);
    comment.setFieldLabel(messages.comment());
    layoutContainer.add(comment, new FormData("390%"));
    lc1.add(layoutContainer);
    lc1.add(new HTML("<br>"));
    LayoutContainer layoutContainer_1 = new LayoutContainer();
    layoutContainer_1.setWidth("100%");
    layoutContainer_1.setHeight(123);
    setDefaultBackgroundColor(layoutContainer_1);
    FormLayout fl_layoutContainer_1 = new FormLayout();
    fl_layoutContainer_1.setLabelAlign(LabelAlign.TOP);
    layoutContainer_1.setLayout(fl_layoutContainer_1);
    // internalComment.setWidth("120%");
    internalComment.setName(FicheStDto.ACPT_COMMENTAIRES_INTERNES);
    internalComment.setId("ACCOMPTESPANEL_INTERNAL_COMMENT");
    internalComment.setHeight(height);
    internalComment.setFieldLabel(messages.internalComment());
    layoutContainer_1.add(internalComment, new FormData("390%"));
    lc1.add(layoutContainer_1);

    formPanel.add(lc1);
    accomptesPanel3.add(formPanel);
    paymentFieldSet.add(accomptesPanel3);
    add(paymentFieldSet);

    if ((user.getBadmin() != null && user.getBadmin()) || (role.getBcontributeur() != null && role.getBcontributeur())) {
      saveButton.setVisible(true);
      addRow.setVisible(true);
View Full Code Here

    public GestionPanel(SimpleEventBus b, RoleModel roleModel, UtilisateurGrpModel utilisateurGrpModel) {
  super();
  this.bus = b;
  this.role = roleModel;
  this.user = utilisateurGrpModel;
  FieldSet gestionFieldSet = new CustomFieldSet();
  gestionFieldSet.setCollapsible(true);
  gestionFieldSet.setLayout(new RowLayout(Orientation.VERTICAL));

  LayoutContainer layoutContainer_10 = new LayoutContainer();
  layoutContainer_10.setLayout(new BorderLayout());

  LayoutContainer buttonPanel = new LayoutContainer();
  buttonPanel.setId("buttonPanel");
  buttonPanel.setLayout(new RowLayout(Orientation.HORIZONTAL));

  saveButton = new HTML("<img src='./images/sauvegarder.png'/> " + messages.saveForm(), false);
  saveButton.setStyleName("actionHTML");
  buttonPanel.add(saveButton);
  saveButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
    bus.fireEvent(new SaveFicheStEvent());
      }
  });

  buttonPanel.add(new HTML(LINKS_SPACE, false));
  bus.addHandler(ExportGestionPanelEvent.TYPE, new ExportGestionPanelHandler() {
      @Override
      public void onExport(ExportGestionPanelEvent event) {
    exportGestion();
      }
  });

  HTML print = new HTML("<img src='./images/imprimer.png'/> " + messages.print(), false);
  print.setStyleName("actionHTML");
  print.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent arg0) {
    exportGestion();
      }
  });
  buttonPanel.add(print);
  layoutContainer_10.add(buttonPanel, new BorderLayoutData(LayoutRegion.EAST, 350.0f));
  gestionFieldSet.add(layoutContainer_10);
  layoutContainer_10.setHeight("30");

  addFicheST = new HTML("<img src='./images/ajouter.png'/> " + messages.addRow(), false);

  LayoutContainer layoutContainer_11 = new LayoutContainer();

  createGestionGrid();

  layoutContainer_11.add(gestionGrid);

  gestionFieldSet.add(layoutContainer_11);

  LayoutContainer layoutContainer_12 = new LayoutContainer();
  TableLayout tl_layoutContainer_12 = new TableLayout(2);
  tl_layoutContainer_12.setWidth("100%");
  layoutContainer_12.setLayout(tl_layoutContainer_12);
  gestionFieldSet.add(layoutContainer_12);
  layoutContainer_12.setBorders(false);

  FlexTable ft1 = new FlexTable();
  int commonWidth = 265;
  ft1.setWidget(0, 0, new HTML(SPACES_4));

  addFicheST.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
    showAddDialog();
      }

      private void showAddDialog() {
    final Dialog dialog = new Dialog();
    dialog.setHeading(messages.titlePopup());
    dialog.setLayout(new BorderLayout());
    dialog.setWidth(600);
    dialog.setHeight(550);
    dialog.setBodyBorder(false);
    dialog.setHideOnButtonClick(false);
    dialog.setButtons(Dialog.OKCANCEL);
    dialog.setButtonAlign(HorizontalAlignment.CENTER);
    dialog.setScrollMode(Scroll.AUTO);
    dialog.setModal(true);
    dialog.setBlinkModal(true);
    Button cancelButton = dialog.getButtonById(Dialog.CANCEL);
    cancelButton.setText(messages.cancel());
    Button okButton = dialog.getButtonById(Dialog.OK);
    okButton.setText(messages.ok());

    final AddGestionForm addGestionForm = new AddGestionForm();
    dialog.add(addGestionForm, new BorderLayoutData(LayoutRegion.CENTER));

    okButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        @Override
        public void componentSelected(ButtonEvent ce) {
      if (addGestionForm.isValid()) {
          GestionDto model = addGestionForm.getDataModel();
          gestionGrid.getStore().add(model);

          bus.fireEvent(new EtatAvancementEvent(gestionGrid.getStore().getModels(), null));
          dialog.hide();
      }
        }
    });

    cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        @Override
        public void componentSelected(ButtonEvent ce) {
      dialog.hide();
        }
    });

    dialog.show();
      }
  });

  addFicheST.setStyleName("actionHTML2");
  ft1.setWidget(0, 1, addFicheST);
  TableData td_ft1 = new TableData();
  td_ft1.setVerticalAlign(VerticalAlignment.TOP);
  layoutContainer_12.add(ft1, td_ft1);
  ft1.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP);

  LayoutContainer layoutContainer_13 = new LayoutContainer();

  TableLayout tl_layoutContainer_13 = new TableLayout(1);
  tl_layoutContainer_13.setCellHorizontalAlign(HorizontalAlignment.RIGHT);
  tl_layoutContainer_13.setWidth("100%");
  layoutContainer_13.setLayout(tl_layoutContainer_13);

  FlexTable ft2 = new FlexTable();
  ft2.setBorderWidth(2);
  inforGrid = createInforGrid();

  ft2.setWidget(0, 0, new HTML("<label>" + messages.dont() + ":<label> "));
  ft2.setWidget(0, 1, inforGrid);

  layoutContainer_13.add(ft2);
  ft2.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);

  summary = new CustomFormPanel();
  TableLayout tl_summary = new TableLayout(2);
  tl_summary.setBorder(1);
  summary.setLayout(tl_summary);

  TableData td_summary = new TableData();
  td_summary.setPadding(5);
  layoutContainer_13.add(summary, td_summary);
  HTML budgetLabel = new HTML(messages.budget());
  TableData td_budgetPanel = new TableData();
  td_budgetPanel.setHorizontalAlign(HorizontalAlignment.LEFT);
  LayoutContainer budgetPanel = new LayoutContainer();
  budgetPanel.setStyleAttribute("background-color", HEADER_BACKGROUND_COLOR);
  budgetPanel.add(budgetLabel);
  summary.add(budgetPanel, td_budgetPanel);
  NumberField budget = createNumberField(null);
  budget.setName(FicheStDto.GEST_BUDGET_INITIAL);
  budget.setId("GESTIONAL_PANEL_BUDGET_ID");
  budget.setWidth(commonWidth);
  summary.add(budget);
  if (budget != null) {
      budgetInitial = budget.getValue() + "";
  }
  HTML ecardDernierLabel = new HTML(messages.ecardDernier());

  TableData td_ecardDernierPanel = new TableData();
  td_ecardDernierPanel.setHorizontalAlign(HorizontalAlignment.LEFT);
  LayoutContainer ecardDernierPanel = new LayoutContainer();
  ecardDernierPanel.setStyleAttribute("background-color", HEADER_BACKGROUND_COLOR);
  ecardDernierPanel.add(ecardDernierLabel);
  summary.add(ecardDernierPanel, td_ecardDernierPanel);
  NumberField ecardDernier = createNumberField(null);
  ecardDernier.setName(FicheStDto.GEST_ECART_DERNIER_PT);
  ecardDernier.setId("GESTIONAL_PANEL_ECARDDERNIER_ID");
  ecardDernier.setWidth(commonWidth);
  summary.add(ecardDernier);
  if (ecardDernier != null) {
      dernierPoint = ecardDernier.getValue() + "";
  }
  HTML dateDernierLabel = new HTML(messages.dernierDate());

  LayoutContainer dateDernierPanel = new LayoutContainer();
  dateDernierPanel.setStyleAttribute("background-color", HEADER_BACKGROUND_COLOR);
  dateDernierPanel.add(dateDernierLabel);
  TableData td_dateDernierPanel = new TableData();
  td_dateDernierPanel.setHorizontalAlign(HorizontalAlignment.LEFT);
  summary.add(dateDernierPanel, td_dateDernierPanel);
  DateField dateDernier = new DateField();
  dateDernier.setName(FicheStDto.GEST_DATE_DERNIER_PT);
  dateDernier.setId("GESTION_PANEL_DATEDERNIER_ID");
  dateDernier.setWidth(commonWidth);
  summary.add(dateDernier);

  if (dateDernier != null) {
      dernier = dateDernier.getValue() + "";
  }

  layoutContainer_12.add(layoutContainer_13);
  gestionFieldSet.setHeading(messages.gestion());
  add(gestionFieldSet);

  // Set background color to green
  setDefaultBackgroundColor(layoutContainer_10);
  setDefaultBackgroundColor(gestionFieldSet);
View Full Code Here

TOP

Related Classes of com.structis.fichesst.client.widget.CustomFieldSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.