Description :
Cette fonctionnalité est essentielle pour l'application. En effet elle permet l'ajout, la modification ainsi que la suppression d'un projet.
view.getBtnProducts().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) { if (view.getBtnProducts().getText() == "Add this project") { if (view.getTxtNameProject().getText().equals("") || view.getTxtDescriptionProduct().getText().equals("")) { Utils.MsgBox(view.getShell(), "Please complete all fields", "information"); } else { boolean nomUtilise = false; for (Product product : DAO.getProducts()) { if (product.getName().equals(view.getTxtNameProject().getText())) { nomUtilise = true; } } if (nomUtilise == true) { Utils.MsgBox(view.getShell(), "A project already has this name", "information"); } else { Product product = new Product(view.getTxtNameProject().getText(), view.getTxtDescriptionProduct().getText(), null, null, null); DAO.SQLProduct(product, "insert"); view.getTableViewerProducts().add(product); Utils.MsgBox(view.getShell(), "Project is create", "information"); } } } else { // Code update product } } });
view.getBtnProducts().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) { if (view.getBtnProducts().getText() == "Add this project") { // Code add product } else { if (view.getTxtDescriptionProduct().getText().equals("")) { Utils.MsgBox(view.getShell(), "Please complete all fields", "information"); } else { productActif.setName(view.getTxtNameProject().getText()); productActif.setDescription(view.getTxtDescriptionProduct().getText()); DAO.SQLProduct(productActif, "update"); view.getTableViewerProducts().refresh(); Utils.MsgBox(view.getShell(), "Project is update", "information"); } } } });
view.getTltmDelProduct().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) { MessageBox messageBoxproduct = new MessageBox(view.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); messageBoxproduct.setText("SCRUMTOOL"); messageBoxproduct.setMessage("Do you really want to delete this project ?"); int responseProduct = messageBoxproduct.open(); if (responseProduct == SWT.YES) { DAO.SQLProduct(productActif, "delete"); view.getTableViewerProducts().remove(productActif); view.getGrpProject().setVisible(false); } } });
view.getTltmEditCollaboratorsProduct().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) { EditCollaboratorsProduct vAddCollaborators = new EditCollaboratorsProduct(); CeditCollaboratorsProduct cEditCollaborators = new CeditCollaboratorsProduct(vAddCollaborators); vAddCollaborators.init(); cEditCollaborators.init(productActif); cEditCollaborators.listener(productActif); vAddCollaborators.open(); } });
view.getTltmOpenProduct().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) { OverviewProduct overview = new OverviewProduct(); overview.init(); CoverviewProduct cOverview = new CoverviewProduct(overview); cOverview.listener(userActif,productActif); cOverview.init(userActif, productActif); cOverview.reload(userActif, productActif); view.close(); overview.open(); } });