@Override
public Object render(final ChantierModel model, String property, ColumnData config, int rowIndex, int colIndex, final ListStore<ChantierModel> store, Grid<ChantierModel> grid) {
layoutcell = new LayoutContainer();
layoutcell = new LayoutContainer();
layoutcell.setLayout(new ColumnLayout());
Listener<MessageBoxEvent> callback = new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
Button btt = be.getButtonClicked();
if (Dialog.OK.equals(btt.getItemId())) {
if (storeChantier == null) {
return;
} else {
storeChantier.remove(model);
storeChantier.commitChanges();
service.deleteChantier(model.getId(), new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable arg0) {
}
@Override
public void onSuccess(Void arg0) {
}
});
}
}
}
};
img = createDeleteButton(callback, messages.confirmDelete());
Image img1 = new Image("./images/imprimer.png");
img1.setTitle("Imprimer");
img1.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
// syn
List<NameValuePair> params = new ArrayList<NameValuePair>();
String exportPdfUrl = GWT.getHostPageBaseURL() + "acceuil.pdf";
params.add(new NameValuePair("chantierId", model.getId() + ""));
ReportUtil.showReport(exportPdfUrl, params.toArray(new NameValuePair[params.size()]));
}
});
Image img2 = new Image("./images/voir.png");
img2.setTitle("Voir");
if (user.getBadmin() != null && user.getBadmin() == true) {
layoutcell.add(img);
}
layoutcell.add(new Html(" "));
layoutcell.add(img1);
layoutcell.add(new Html(" "));
layoutcell.add(img2);
layoutcell.add(new Html(" "));
img2.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
serviceRole.findRoleById(model.getId(), user.getId(), new AsyncCallback<RoleModel>() {
@Override
public void onFailure(Throwable arg0) {
}
@Override
public void onSuccess(RoleModel role) {
if (role != null && role.getBcontributeur() == false && role.getBlecteur() == false && user.getBadmin() == false) {
GuiUtil.gotoEcran(new ErrorEcran());
} else {
GuiUtil.gotoEcran(new SyntheseEcran(model, role, user));
}
}
});
}
});
return layoutcell;
}
};
column = new ColumnConfig("supprimer", "", 150);
column.setSortable(false);
column.setMenuDisabled(true);
column.setGroupable(false);
column.setFixed(true);
column.setResizable(false);
column.setRenderer(deleteBtn);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column_1 = new ColumnConfig();
column_1.setId("nom");
column_1.setHeader("Nom du chantier");
column_1.setSortable(false);
column_1.setMenuDisabled(true);
column_1.setFixed(true);
column_1.setAlignment(HorizontalAlignment.LEFT);
configs.add(column_1);
storeChantier = new ListStore<ChantierModel>();
ColumnModel cm = new ColumnModel(configs);
gridChantier = new CustomEditorGrid<ChantierModel>(storeChantier, cm);
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>();
txtChantier.addKeyListener(new KeyListener() {
@Override