private void popupProduct() {
menu.clear();
menu = new Menu();
//create an item to add product
MenuItem productItem = new MenuItem(constants.addProduct(), "proyecto.jpg");
com.smartgwt.client.widgets.menu.events.ClickHandler prod_aux = new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@Override
public void onClick(MenuItemClickEvent event) {
createFormNewProduct();
}
};
productItem.addClickHandler(prod_aux);
//if there are some item selected the menu will be more items.
if (!idItemSelected.equals("")) {
//create an item for managing the themes of the product selected.
MenuItem openItem = new MenuItem(constants.seeThemes(), "us.png");
com.smartgwt.client.widgets.menu.events.ClickHandler aux = new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@Override
public void onClick(MenuItemClickEvent event) {
new ThemesListPanel(idItemSelected, canvasPrincipal);
}
};
openItem.addClickHandler(aux);
//create an item for managing the releases of the product selected.
MenuItem releasesItem = new MenuItem(constants.seeReleases(), "release.jpg");
com.smartgwt.client.widgets.menu.events.ClickHandler aux_releases = new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@Override
public void onClick(MenuItemClickEvent event) {
//new ReleasesListPanel(idItemSelected, canvasPrincipal);
}
};
releasesItem.addClickHandler(aux_releases);
MenuItemSeparator separator = new MenuItemSeparator();
//create an item for deleting a product selected
MenuItem deleteItem = new MenuItem(constants.delete(), "cancel.png");
com.smartgwt.client.widgets.menu.events.ClickHandler aux_delete_theme = new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@Override
public void onClick(MenuItemClickEvent event) {
if (com.google.gwt.user.client.Window.confirm(constants.sureDeleteProduct())) {
po.deleteProduct(idItemSelected);
productGrid.removeSelectedData();
drawn.remove(idItemSelected);
}
}
};
deleteItem.addClickHandler(aux_delete_theme);
//create an item to modify a product selected
//MenuItem modifyItem = new MenuItem(constants.modify(), "configure.png");
MenuItem modifyItem = new MenuItem("Modfy&Assign", "configure.png");
com.smartgwt.client.widgets.menu.events.ClickHandler modify_handler = new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@Override
public void onClick(MenuItemClickEvent event) {
po.manageProducts(idItemSelected, SHOW);
}
};
modifyItem.addClickHandler(modify_handler);
menu.setVisible(false);
menu.addItem(productItem);
menu.addItem(openItem);
//menu.addItem(releasesItem);