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