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);