ASF Bugzilla – Attachment 32953 Details for
Bug 58204
STYLE: ShapeContainer interface makes internal getShapesList() redundant
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH]
0001-STYLE-ShapeContainer-interface-makes-internal-getSha.patch (text/plain), 8.63 KB, created by
mark.o
on 2015-08-03 07:02:01 UTC
(
hide
)
Description:
[PATCH]
Filename:
MIME Type:
Creator:
mark.o
Created:
2015-08-03 07:02:01 UTC
Size:
8.63 KB
patch
obsolete
>From 537df9057a00dd31bb44adfec398084e11eee0da Mon Sep 17 00:00:00 2001 >From: Mark Olesen <Mark.Olesen@faurecia.com> >Date: Mon, 3 Aug 2015 08:48:19 +0200 >Subject: [PATCH] STYLE: ShapeContainer interface makes internal getShapesList() redundant > >--- > .../apache/poi/xslf/usermodel/XSLFGroupShape.java | 3 +- > .../org/apache/poi/xslf/usermodel/XSLFSheet.java | 55 ++++++++------------ > .../apache/poi/hslf/usermodel/HSLFGroupShape.java | 10 +--- > .../org/apache/poi/hslf/usermodel/HSLFTable.java | 2 +- > 4 files changed, 27 insertions(+), 43 deletions(-) > >diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java >index c2fb36f..9115f0e 100644 >--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java >+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java >@@ -144,8 +144,7 @@ public class XSLFGroupShape extends XSLFShape implements XSLFShapeContainer, Gro > } > > /** >- * >- * @return child shapes contained witin this group >+ * @return child shapes contained within this group > */ > @Override > public List<XSLFShape> getShapes(){ >diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java >index fb6ea54..bfd5080 100644 >--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java >+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java >@@ -25,7 +25,6 @@ import java.util.HashMap; > import java.util.Iterator; > import java.util.List; > import java.util.Map; >- > import javax.xml.namespace.QName; > > import org.apache.poi.POIXMLDocumentPart; >@@ -132,8 +131,14 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > return _drawing; > } > >- private List<XSLFShape> getShapeList(){ >- if(_shapes == null){ >+ /** >+ * Returns an array containing all of the shapes in this sheet >+ * >+ * @return an array of all shapes in this sheet >+ */ >+ @Override >+ public List<XSLFShape> getShapes(){ >+ if (_shapes == null) { > _shapes = buildShapes(getSpTree()); > } > return _shapes; >@@ -142,41 +147,36 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > // shape factory methods > > public XSLFAutoShape createAutoShape(){ >- List<XSLFShape> shapes = getShapeList(); > XSLFAutoShape sh = getDrawing().createAutoShape(); >- shapes.add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } > > public XSLFFreeformShape createFreeform(){ >- List<XSLFShape> shapes = getShapeList(); > XSLFFreeformShape sh = getDrawing().createFreeform(); >- shapes.add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } > > public XSLFTextBox createTextBox(){ >- List<XSLFShape> shapes = getShapeList(); > XSLFTextBox sh = getDrawing().createTextBox(); >- shapes.add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } > > public XSLFConnectorShape createConnector(){ >- List<XSLFShape> shapes = getShapeList(); > XSLFConnectorShape sh = getDrawing().createConnector(); >- shapes.add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } > > public XSLFGroupShape createGroup(){ >- List<XSLFShape> shapes = getShapeList(); > XSLFGroupShape sh = getDrawing().createGroup(); >- shapes.add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } >@@ -190,36 +190,25 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > > XSLFPictureShape sh = getDrawing().createPicture(rel.getId()); > sh.resize(); >- >- getShapeList().add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } > > public XSLFTable createTable(){ >- List<XSLFShape> shapes = getShapeList(); > XSLFTable sh = getDrawing().createTable(); >- shapes.add(sh); >+ getShapes().add(sh); > sh.setParent(this); > return sh; > } > > /** >- * Returns an array containing all of the shapes in this sheet >- * >- * @return an array of all shapes in this sheet >- */ >- public List<XSLFShape> getShapes(){ >- return getShapeList(); >- } >- >- /** > * Returns an iterator over the shapes in this sheet > * > * @return an iterator over the shapes in this sheet > */ > public Iterator<XSLFShape> iterator(){ >- return getShapeList().iterator(); >+ return getShapes().iterator(); > } > > public void addShape(XSLFShape shape) { >@@ -250,7 +239,7 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > } else { > throw new IllegalArgumentException("Unsupported shape: " + xShape); > } >- return getShapeList().remove(xShape); >+ return getShapes().remove(xShape); > } > > /** >@@ -319,8 +308,8 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > getSpTree().set(src.getSpTree()); > > // recursively update each shape >- List<XSLFShape> tgtShapes = getShapeList(); >- List<XSLFShape> srcShapes = src.getShapeList(); >+ List<XSLFShape> tgtShapes = getShapes(); >+ List<XSLFShape> srcShapes = src.getShapes(); > for(int i = 0; i < tgtShapes.size(); i++){ > XSLFShape s1 = srcShapes.get(i); > XSLFShape s2 = tgtShapes.get(i); >@@ -338,7 +327,7 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > */ > public XSLFSheet appendContent(XSLFSheet src){ > CTGroupShape spTree = getSpTree(); >- int numShapes = getShapeList().size(); >+ int numShapes = getShapes().size(); > > CTGroupShape srcTree = src.getSpTree(); > for(XmlObject ch : srcTree.selectPath("*")){ >@@ -362,8 +351,8 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeC > _placeholders = null; > > // recursively update each shape >- List<XSLFShape> tgtShapes = getShapeList(); >- List<XSLFShape> srcShapes = src.getShapeList(); >+ List<XSLFShape> tgtShapes = getShapes(); >+ List<XSLFShape> srcShapes = src.getShapes(); > for(int i = 0; i < srcShapes.size(); i++){ > XSLFShape s1 = srcShapes.get(i); > XSLFShape s2 = tgtShapes.get(numShapes + i); >diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java >index 12c0167..41c08fd 100644 >--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java >+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java >@@ -52,11 +52,6 @@ public class HSLFGroupShape extends HSLFShape implements GroupShape<HSLFShape> { > super(escherRecord, parent); > } > >- @Override >- public List<HSLFShape> getShapes() { >- return getShapeList(); >- } >- > /** > * Sets the anchor (the bounding box rectangle) of this shape. > * All coordinates should be expressed in Master units (576 dpi). >@@ -238,7 +233,7 @@ public class HSLFGroupShape extends HSLFShape implements GroupShape<HSLFShape> { > } > > public Iterator<HSLFShape> iterator() { >- return getShapeList().iterator(); >+ return getShapes().iterator(); > } > > public boolean removeShape(HSLFShape shape) { >@@ -249,7 +244,8 @@ public class HSLFGroupShape extends HSLFShape implements GroupShape<HSLFShape> { > /** > * @return the shapes contained in this group container > */ >- protected List<HSLFShape> getShapeList() { >+ @Override >+ public List<HSLFShape> getShapes() { > // Out escher container record should contain several > // SpContainers, the first of which is the group shape itself > Iterator<EscherRecord> iter = _escherContainer.getChildIterator(); >diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java >index cad0dcd..5cb5698 100644 >--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java >+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java >@@ -162,7 +162,7 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape { > } > > protected void initTable(){ >- List<HSLFShape> shapeList = getShapeList(); >+ List<HSLFShape> shapeList = getShapes(); > > Iterator<HSLFShape> shapeIter = shapeList.iterator(); > while (shapeIter.hasNext()) { >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 58204
: 32953