articleTable.setWidget(0, 2, new Label("Ordering Amount"));
articleTable.setWidget(0, 3, new Label("Remove "));
// Label nameLabel;
Label amountLabel;
IntegerBox amountTB;
Button removeBT;
Button editBT;
Iterator<Article> it = result.iterator();
for (int i = 1; it.hasNext(); i++) {
final Article currentArticle = it.next();
final Label nameLabel = new Label(currentArticle.getName());
amountLabel = new Label(String.valueOf(currentArticle.getAmount()));
amountTB = new IntegerBox();
amountTB.setValue(0);
amountTB.setWidth("20px");
removeBT = new Button("Remove");
editBT=new Button("Edit");
editBT.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Popup pop = new Popup();
ArticleEditor articleEditor = new ArticleEditor(currentArticle.getId(), pop);
pop.setContent(articleEditor);
pop.center();
}
});
removeBT.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
removeArticle(currentArticle.getId());
}
});
articleTable.setWidget(i, 0, nameLabel);
articleTable.setWidget(i, 1, amountLabel);
articleTable.setWidget(i, 2, amountTB);
articleTable.setWidget(i, 3, removeBT);
articleTable.setWidget(i, 4, editBT);
articleTable.setCellSpacing(4);
}
}
});
mainPanel.add(articleTable);
initWidget(mainPanel);
mainPanel.setSize("558px", "126px");
this.newArticleCptPanel = new CaptionPanel("Add a new article");
mainPanel.add(this.newArticleCptPanel);
this.horizontalPanel = new HorizontalPanel();
this.newArticleCptPanel.setContentWidget(this.horizontalPanel);
this.horizontalPanel.setSize("506px", "55px");
this.newNameLabel = new Label("Article Name :");
this.horizontalPanel.add(this.newNameLabel);
this.newNameLabel.setWidth("90px");
this.newNameTB = new TextBox();
this.horizontalPanel.add(this.newNameTB);
this.newNameTB.setSize("109px", "18px");
this.newAmountLabel = new Label("Amount in stock :");
this.horizontalPanel.add(this.newAmountLabel);
this.newAmountTB = new IntegerBox();
this.horizontalPanel.add(this.newAmountTB);
this.newAmountTB.setSize("30px", "18px");
this.addBt = new Button("Add");