Image extends Component { public boolean remove() { OdfElement containerElement = (OdfElement) mElement.getParentNode(); try { mElement.removeChild(getOdfElement()); if (mElement.hasChildNodes() == false) containerElement.removeChild(mElement); mOwnerDocument.removeElementLinkedResource(getOdfElement()); } catch (DOMException exception) { Logger.getLogger(AbstractParagraphContainer.class.getName()).log(Level.WARNING, exception.getMessage()); return false; } return true; } private  Image(DrawImageElement drawElement); static Image getInstanceof(DrawImageElement imageElement); void setHyperlink(URI linkto); URI getHyperlink(); Document getOwnerDocument(); FrameStyleHandler getStyleHandler(); DrawImageElement getOdfElement(); Frame getFrame(); static Image newImage(FrameContainer container, URI uri); static Image newImage(Frame frame, URI uri); static String getPackagePath(OdfSchemaDocument mOdfSchemaDoc, String imageRef); static URI configureInsertedImage(OdfSchemaDocument mOdfSchemaDoc, DrawImageElement imageElement,
			String packagePath, boolean isResetSize); static Iterator<Image> imageIterator(FrameContainer container); boolean remove(); void updateImage(URI imageUri); InputStream getImageInputStream(); String getInternalPath(); String getMediaTypeString(); void setName(String name); String getName(); void setRectangle(FrameRectangle rectangle); FrameRectangle getRectangle(); void setTitle(String title); String getTitle(); String getDesciption(); void setDescription(String description); void setHorizontalPosition(FrameHorizontalPosition horizontalPos); void setVerticalPosition(FrameVerticalPosition verticalPos); FrameHorizontalPosition getHorizontalPosition(); FrameVerticalPosition getVerticalPosition();  }
@Test public void testRemove() { try { TextDocument doc = TextDocument.newTextDocument(); Paragraph para = doc.addParagraph("imagePara"); Image image = Image.newImage(para, ResourceUtilities.getURI("image_list_item.png")); image.setName("this test image"); image.setHyperlink(new URI("http: doc.save(ResourceUtilities.newTestOutputFile("imageFretest.odt")); TextDocument doc1 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("imageFretest.odt")); Iterator parasIter = doc1.getParagraphIterator(); while(parasIter.hasNext()){ Paragraph parac = (Paragraph)parasIter.next(); String text = parac.getTextContent(); if("imagePara".equals(text)){ TextParagraphElementBase textParaEleBase = parac.getOdfElement(); NodeList nodeImages = textParaEleBase.getElementsByTagName("draw:image"); Node nodeImage = nodeImages.item(0); OdfDrawImage im = (OdfDrawImage)nodeImage; Image ima = Image.getInstanceof(im); ima.getName(); boolean flag = ima.remove(); if(!flag) Assert.fail("remove() method was executed failed."); } } doc1.save(ResourceUtilities.newTestOutputFile("imageEndtest.odt")); TextDocument doc2 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("imageEndtest.odt")); Iterator parasIter2 = doc2.getParagraphIterator(); while(parasIter2.hasNext()){ Paragraph parac = (Paragraph)parasIter2.next(); String text = parac.getTextContent(); if("imagePara".equals(text)){ TextParagraphElementBase textParaEleBase = parac.getOdfElement(); NodeList nodeImages = textParaEleBase.getElementsByTagName("draw:image"); Node nodeImage = nodeImages.item(0); if(nodeImage == null) Assert.assertTrue(true); else Assert.fail(); } } } catch (Exception e) { Logger.getLogger(ImageTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(); } }