private void checkAllSelectedGefaehrdungen() { List<Gefaehrdung> toCheck = new ArrayList<Gefaehrdung>(); for (GefaehrdungsUmsetzung associatedGefaehrdung : wizard.getAssociatedGefaehrdungen()) { for (Gefaehrdung gefaehrdung : wizard.getAllGefaehrdungen()) { if (gefaehrdung.getId().equals(associatedGefaehrdung.getId())) { toCheck.add(gefaehrdung); } } } Gefaehrdung[] checkarray = toCheck.toArray(new Gefaehrdung[toCheck.size()]); viewer.setCheckedElements(checkarray); }
protected void associateGefaehrdung(Gefaehrdung currentGefaehrdung, boolean select) { RiskAnalysisWizard wizard = ((RiskAnalysisWizard) getWizard()); if (select) { wizard.addAssociatedGefaehrdung(currentGefaehrdung); } else { try { wizard.removeAssociatedGefaehrdung(currentGefaehrdung); } catch (Exception e) { ExceptionUtil.log( e, NLS.bind(Messages.ChooseGefaehrdungPage_18, currentGefaehrdung.getTitel())); } } checkPageComplete(); }
/** Marks all checkboxes of Gefaehrdungen associated to the selected Baustein. */ private void assignBausteinGefaehrdungen() { try { LoadAssociatedGefaehrdungen command = new LoadAssociatedGefaehrdungen(wizard.getCnaElement()); command = ServiceFactory.lookupCommandService().executeCommand(command); List<GefaehrdungsUmsetzung> list = command.getAssociatedGefaehrdungen(); for (GefaehrdungsUmsetzung selectedGefaehrdung : list) { for (Gefaehrdung gefaehrdung : wizard.getAllGefaehrdungen()) { if (gefaehrdung.getId().equals(selectedGefaehrdung.getId())) { associateGefaehrdung(gefaehrdung, true); } } } } catch (CommandException e) { ExceptionUtil.log(e, ""); // $NON-NLS-1$ } }
/** * Fills the CheckboxTableViewer with all Gefaehrdungen available. Is processed each time the * WizardPage is set visible. */ private void initContents() { wizard = ((RiskAnalysisWizard) getWizard()); ArrayList<Gefaehrdung> arrListAllGefaehrdungen = wizard.getAllGefaehrdungen(); /* map a domain model object into multiple images and text labels */ viewer.setLabelProvider(new CheckboxTableViewerLabelProvider()); /* map domain model into array */ viewer.setContentProvider(new ArrayContentProvider()); /* associate domain model with viewer */ viewer.setInput(arrListAllGefaehrdungen); viewer.setSorter(new GefaehrdungenSorter()); assignBausteinGefaehrdungen(); checkAllSelectedGefaehrdungen(); packAllColumns(); ((RiskAnalysisWizard) getWizard()).setCanFinish(false); checkPageComplete(); }