protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if (formName.equals(form.getForms().Core.YesNoDialog) && result.equals(DialogResult.YES)) { form.setMode(FormMode.EDIT); form.lyrDrawing().tabRegionConfig().btnUpdateRegion().setEnabled(false); clearDrawingConfigControl(); if (form.getLocalContext().getimageRecord() != null) { DrawingImageVo voDrawingImage = new DrawingImageVo(); voDrawingImage.setImage(form.getLocalContext().getimageRecord().getImage()); voDrawingImage.setVersionNumber(form.getLocalContext().getimageRecord().getVersionNumber()); form.getLocalContext().setimageRecord(voDrawingImage); } } else if (formName.equals(form.getForms().Core.YesNoDialog) && (result.equals(DialogResult.NO) || result.equals(DialogResult.CANCEL))) { form.setMode(FormMode.VIEW); } }
/** * Saves a Drawing Image Record */ public ims.core.vo.DrawingImageVo saveDrawingImage(ims.core.vo.DrawingImageVo drawingImage) throws StaleObjectException { if(!drawingImage.isValidated()) throw new DomainRuntimeException("Drawing Image Value Object not validated"); DomainFactory factory = getDomainFactory(); DrawingImage doDrawingImage = DrawingImageVoAssembler.extractDrawingImage(factory, drawingImage); if(doDrawingImage.getVersionNumber() == null) doDrawingImage.setVersionNumber(new Integer(1)); else doDrawingImage.setVersionNumber(new Integer(drawingImage.getVersionNumber().intValue() + 1)); try { factory.save(doDrawingImage); } catch (DomainException e) { throw new DomainRuntimeException("DomainException occurred " + e.getMessage()); } drawingImage.setID_DrawingImage(doDrawingImage.getId()); drawingImage.setVersionNumber(doDrawingImage.getVersionNumber()); return drawingImage; }
protected void onBtnSaveRegionClick() throws ims.framework.exceptions.PresentationLogicException { form.lyrDrawing().tabRegionConfig().btnUpdateRegion().setEnabled(true); DrawingImageVo voDrawingImage = populateDataFromScreen(); voDrawingImage.setID_DrawingImage(null); String[] arrErrors = voDrawingImage.validate(); if (arrErrors == null) { try { domain.saveDrawingImage(voDrawingImage); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return; } } else { engine.showErrors("Validation Errors", arrErrors); return; } form.getLocalContext().setimageRecord(voDrawingImage); listImages(); open(); }
private void displayImage(DrawingImageVo voImageRetrieved) { if (voImageRetrieved != null) { form.getLocalContext().setimageRecord(voImageRetrieved); if (voImageRetrieved.getImageIsNotNull()) { Image repImage = engine.getRegisteredImage(form.getLocalContext().getimageRecord().getImage().getID_AppImage().intValue()); form.lyrDrawing().tabRegionConfig().drawingConfig().setImage(repImage); // Registered image loaded if (voImageRetrieved.getRootGroup() != null && voImageRetrieved.getRootGroup().getGroupIDIsNotNull()) { DrawingControlGroup grp = new DrawingControlGroup(voImageRetrieved.getRootGroup().getGroupID().intValue(), form.lyrDrawing().tabRegionConfig().cmbDrawingImage().getValue().getImageName()); form.lyrDrawing().tabRegionConfig().drawingConfig().setAreas(grp); // set areas DrawingControlGroup rootNode = new DrawingControlGroup(voImageRetrieved.getRootGroup().getGroupID().intValue(), voImageRetrieved.getRootGroup().getGroupName()); convertAllAreasToNode(voImageRetrieved.getRootGroup(), rootNode); form.lyrDrawing().tabRegionConfig().drawingConfig().setAreas(rootNode); form.lyrDrawing().tabRegionConfig().drawingConfig().getAreas(); } } } /* * clearDrawingConfigControl(); * * DrawingImageVo voImageRetrieved = domain.getDrawingImage(voImagetoGet); * * if (voImageRetrieved != null) { form.getLocalContext().setimageRecord(voImageRetrieved); * * DrawingControlGroup rootNode = new DrawingControlGroup(voImageRetrieved.getRootGroup().getGroupID().intValue(), voImageRetrieved.getRootGroup().getGroupName()); convertAllAreasToNode(voImageRetrieved.getRootGroup(), rootNode); form.lyrDrawing().tabRegionConfig().drawingConfig().setAreas(rootNode); DrawingControlGroup areasJustSet = form.lyrDrawing().tabRegionConfig().drawingConfig().getAreas(); } */ }
private DrawingImageVo populateDataFromScreen() { DrawingImageVo voDrawingImage = form.getLocalContext().getimageRecord(); voDrawingImage.setRootGroup(new DrawingGroupVo()); convertAllAreasToVO(form.lyrDrawing().tabRegionConfig().drawingConfig().getAreas(), voDrawingImage.getRootGroup()); voDrawingImage.setImage(voDrawingImage.getImage()); voDrawingImage.setImageName(voDrawingImage.getRootGroup().getGroupName()); return voDrawingImage; }
private void clearDrawingConfigControl() { DrawingImageVo voDrawingImage = form.getLocalContext().getimageRecord(); if (voDrawingImage != null) { Image repImage = engine.getRegisteredImage(voDrawingImage.getImage().getID_AppImage().intValue()); form.lyrDrawing().tabRegionConfig().drawingConfig().setImage(repImage); // will be of type appImage set in select image tab DrawingControlGroup grp = new DrawingControlGroup(1, form.lyrDrawing().tabRegionConfig().cmbDrawingImage().getValue().getImageName()); form.lyrDrawing().tabRegionConfig().drawingConfig().setAreas(grp); } }
protected void onCmbDrawingImageValueChanged() throws PresentationLogicException { if (form.lyrDrawing().tabRegionConfig().cmbDrawingImage().getValue() != null) { form.getLocalContext().setimageSelectedName(form.lyrDrawing().tabRegionConfig().cmbDrawingImage().getValue().getImageName()); DrawingImageVo image = domain.getDrawingImage(form.lyrDrawing().tabRegionConfig().cmbDrawingImage().getValue()); if (image != null) { displayImage(image); } else { // engine.showErrors( new String[]{"No image available"}); throw new FormOpenException(); } form.lyrDrawing().tabRegionConfig().btnNewRegion().setEnabled(true); form.lyrDrawing().tabRegionConfig().btnUpdateRegion().setEnabled(true); } else { form.lyrDrawing().tabRegionConfig().btnNewRegion().setEnabled(false); form.lyrDrawing().tabRegionConfig().btnUpdateRegion().setEnabled(false); form.lyrDrawing().tabRegionConfig().drawingConfig().setImage(null); //WDEV-15254 form.lyrDrawing().tabRegionConfig().drawingConfig().setAreas(null); } }
public DrawingImageVo getDrawingImage(DrawingImageVo drawingImage) { DrawingConfiguration drawingConfigImpl = (DrawingConfiguration)getDomainImpl(DrawingConfigurationImpl.class); return drawingConfigImpl.getDrawingImage(drawingImage); }
private void initialiseDrawingControl(boolean bInitCtrl) { if(bInitCtrl) { form.drawingBodyChart().setImage(form.getImages().COE.BodyChart); for(int i=0; i<SkinWoundType.getNegativeInstances().length; i++) form.drawingBodyChart().addBrush(SkinWoundType.getNegativeInstances()[i].getId(), SkinWoundType.getNegativeInstances()[i].getText(), SkinWoundType.getNegativeInstances()[i].getColor()); //load the image associated image to this Form AppImageVo voAppImage = new AppImageVo(); voAppImage.setID_AppImage(new Integer(form.getImages().COE.BodyChart.getImageId())); DrawingImageVo voImage = new DrawingImageVo(); //TODO: Leave till COE release of 03/03/05 has gone voImage.setImage(voAppImage); voImage.setImageName(getCurrentImageName()); //When no version no - the domain will return getLast() if(getCurrentVersionNumber() != null) voImage.setVersionNumber(getCurrentVersionNumber()); DrawingImageVo voImageRetrieved = domain.getDrawingImage(voImage); if (voImageRetrieved != null) { DrawingControlGroup rootNode = new DrawingControlGroup(voImageRetrieved.getRootGroup().getGroupID().intValue(), voImageRetrieved.getRootGroup().getGroupName()); convertAllAreasToNode(voImageRetrieved.getRootGroup(), rootNode); form.drawingBodyChart().setAreas(rootNode); form.getGlobalContext().COE.SkinBodyChart.setAreas(rootNode.getAllAreas()); form.getGlobalContext().COE.SkinBodyChart.setGroups(getAllGroups(rootNode)); form.getLocalContext().setImageLoaded(new Boolean(true)); form.getLocalContext().setCurrentVersionNo(voImageRetrieved.getVersionNumber()); form.getLocalContext().setImageLoaded(new Boolean(true)); } else { DrawingControlGroup root = new DrawingControlGroup(-1, "Body Chart"); form.drawingBodyChart().setAreas(root); form.getLocalContext().setImageLoaded(new Boolean(false)); engine.showMessage("No active image available"); } } }
private void initialiseDrawingControl(boolean bInit) { //Initialise the control only when the page is visited if(bInit) { form.drawingBodyChart().setImage(form.getImages().COE.BodyChart); for(int i=0; i<PainHypersensitivity.getNegativeInstances().length; i++) form.drawingBodyChart().addBrush(PainHypersensitivity.getNegativeInstances()[i].getId(), PainHypersensitivity.getNegativeInstances()[i].getText(), PainHypersensitivity.getNegativeInstances()[i].getColor()); //load the image associated image to this Form AppImageVo voAppImage = new AppImageVo(); voAppImage.setID_AppImage(new Integer(form.getImages().COE.BodyChart.getImageId())); DrawingImageVo voImage = new DrawingImageVo(); //TODO: Leave till COE release of 03/03/05 has gone voImage.setImage(voAppImage); voImage.setImageName(getCurrentImageName()); //When no version no - the domain will return getLast() if(getCurrentVersionNumber() != null) voImage.setVersionNumber(getCurrentVersionNumber()); DrawingImageVo voImageRetrieved = domain.getDrawingImage(voImage); if(voImageRetrieved != null) { DrawingControlGroup rootNode = new DrawingControlGroup(voImageRetrieved.getRootGroup().getGroupID().intValue(), voImageRetrieved.getRootGroup().getGroupName()); convertAllAreasToNode(voImageRetrieved.getRootGroup(), rootNode); form.drawingBodyChart().setAreas(rootNode); form.getGlobalContext().COE.PainBodyChart.setAreaList(rootNode.getAllAreas()); form.getGlobalContext().COE.PainBodyChart.setGroupList(getAllGroups(rootNode)); form.getLocalContext().setImageLoaded(new Boolean(true)); form.getLocalContext().setCurrentVersionNo(voImageRetrieved.getVersionNumber()); } else { //Load default image DrawingControlGroup root = new DrawingControlGroup(-1, "Body Chart"); form.drawingBodyChart().setAreas(root); form.getLocalContext().setImageLoaded(new Boolean(false)); } } }
/** * Gets the drawing image */ public DrawingImageVo getDrawingImage(DrawingImageVo drawingImage) { DrawingConfiguration drawingConfigImpl = (DrawingConfiguration)getDomainImpl(DrawingConfigurationImpl.class); return drawingConfigImpl.getDrawingImage(drawingImage); }