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();
td2.setWidth(COLUMNS_WIDTH_3[1]);
layoutContainer_3.add(new HTML(" "), td2);
FormLayout fl_rightPanel = new FormLayout();
fl_rightPanel.setLabelAlign(LabelAlign.TOP);
rightPanel.setLayout(fl_rightPanel);
TableData td_rightPanel = new TableData();
td_rightPanel.setWidth(COLUMNS_WIDTH_3[2]);
comment.setMaxLength(MAX_LENGTH_5);
comment.setName(FicheStDto.AVCT_COMMENTAIRES);
comment.setId("AVANCEMENTSPANEL_COMMENT");
comment.setHeight("460px");
comment.setFieldLabel(messages.comment2());
formPanel.add(comment, new FormData("100%"));
rightPanel.add(formPanel);
layoutContainer_3.add(rightPanel, td_rightPanel);
bus.addHandler(DeductionGridUpdateEvent.TYPE, new DeductionGridUpdateHandler() {
@Override
public void onSave(DeductionGridUpdateEvent event) {
List<DeductionDto> deductionDtoList = event.getDeductionDtoList();
int cantoQuantity = 0;
int badgeQuantity = 0;
int grueQuantity = 0;
int liftQuantity = 0;
int benneQuantity = 0;
int nettoyageQuantity = 0;
double autres = 0.0;
for( DeductionDto deductionDto : deductionDtoList ) {
cantoQuantity += deductionDto.getCanto();
badgeQuantity += deductionDto.getBadge();
grueQuantity += deductionDto.getGrue();
liftQuantity += deductionDto.getLift();
benneQuantity += deductionDto.getBenne();
nettoyageQuantity += deductionDto.getNettoyage();
autres += deductionDto.getAutres();
}
grid_3.getStore().removeAll();
List<AnonymousDto> models = new ArrayList<AnonymousDto>();
AnonymousDto model = null;
String[] column1s = { messages.nombre(), messages.amount() };
NumberField canto = (NumberField)ComponentManager.get().get("INFORMATIONAL_PANEL_CANTO_ID");
NumberField badge = (NumberField)ComponentManager.get().get("INFORMATIONAL_PANEL_BADGE_ID");
NumberField grue = (NumberField)ComponentManager.get().get("INFORMATIONAL_PANEL_GRUE_ID");
NumberField lift = (NumberField)ComponentManager.get().get("INFORMATIONAL_PANEL_LIFT_ID");
NumberField benne = (NumberField)ComponentManager.get().get("INFORMATIONAL_PANEL_BENNE_ID");
NumberField netoyage = (NumberField)ComponentManager.get().get("INFORMATIONAL_PANEL_NETOYAGE_ID");
double cantoValue = 0.0;
double badgeValue = 0.0;
double grueValue = 0.0;
double liftValue = 0.0;
double benneValue = 0.0;
double netoyageValue = 0.0;
if(canto!=null && canto.getValue()!=null)
cantoValue = canto.getValue().doubleValue();
if(badge!=null && badge.getValue()!=null)
badgeValue = badge.getValue().doubleValue();
if(grue!=null && grue.getValue()!=null)
grueValue = grue.getValue().doubleValue();
if(lift!=null && lift.getValue()!=null)
liftValue = lift.getValue().doubleValue();
if(benne!=null && benne.getValue()!=null)
benneValue = benne.getValue().doubleValue();
if(netoyage!=null && netoyage.getValue()!=null)
netoyageValue = netoyage.getValue().doubleValue();
double[] column2s = { cantoQuantity, (cantoQuantity * cantoValue) };
double[] column3s = { badgeQuantity, (badgeQuantity * badgeValue) };
double[] column4s = { grueQuantity, (grueQuantity * grueValue) };
double[] column5s = { liftQuantity, (liftQuantity * liftValue) };
double[] column6s = { benneQuantity, (benneQuantity * benneValue) };
double[] column7s = { nettoyageQuantity,(nettoyageQuantity * netoyageValue) };
double[] column8s = { 0, autres };
grid_3_report = "";
for( int i = 0 ; i < 2 ; i++ ) {
model = new AnonymousDto();
model.set(AnonymousDto.COLUMN_1, column1s[i]);
model.set(AnonymousDto.COLUMN_2, column2s[i]);
model.set(AnonymousDto.COLUMN_3, column3s[i]);
model.set(AnonymousDto.COLUMN_4, column4s[i]);
model.set(AnonymousDto.COLUMN_5, column5s[i]);
model.set(AnonymousDto.COLUMN_6, column6s[i]);
model.set(AnonymousDto.COLUMN_7, column7s[i]);
model.set(AnonymousDto.COLUMN_8, column8s[i]);
//For report
grid_3_report += column2s[i] + Constants.SEPRATE + column3s[i] + Constants.SEPRATE + column4s[i] +
Constants.SEPRATE + column5s[i] + Constants.SEPRATE + column6s[i] + Constants.SEPRATE + column7s[i] + Constants.SEPRATE + column8s[i] + Constants.SEPRATE;
models.add(model);
}