From 06a890b2c4f6403e616bc2803104d8427c0f9c76 Mon Sep 17 00:00:00 2001 From: Honfika Date: Tue, 3 Sep 2013 17:10:55 +0200 Subject: [PATCH] preserve tag tree expanded state after removing a node --- trunk/src/com/jpexs/decompiler/flash/SWF.java | 32 ++--- .../com/jpexs/decompiler/flash/TagNode.java | 5 +- .../jpexs/decompiler/flash/gui/MainFrame.java | 118 +++++++++++++----- .../flash/gui/action/ActionPanel.java | 3 +- .../flash/tags/DefineButton2Tag.java | 5 +- .../flash/tags/DefineSpriteTag.java | 5 +- .../flash/tags/PlaceObject2Tag.java | 5 +- .../flash/tags/PlaceObject3Tag.java | 5 +- .../flash/tags/PlaceObject4Tag.java | 5 +- .../com/jpexs/decompiler/flash/tags/Tag.java | 3 +- .../decompiler/flash/tags/base/Container.java | 3 +- .../flash/tags/base/ContainerItem.java | 26 ++++ .../flash/types/BUTTONCONDACTION.java | 3 +- .../flash/types/CLIPACTIONRECORD.java | 3 +- 14 files changed, 158 insertions(+), 63 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index faebc338a..d0015f9cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -75,6 +75,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; @@ -610,7 +611,7 @@ public class SWF { public List exportActionScript2(AbortRetryIgnoreHandler handler, String outdir, boolean isPcode, boolean parallel, EventListener evl) throws IOException { List ret = new ArrayList<>(); - List list2 = new ArrayList<>(); + List list2 = new ArrayList<>(); list2.addAll(tags); List list = createASTagList(list2, null); @@ -684,13 +685,13 @@ public class SWF { return ret; } - public static List createASTagList(List list, Object parent) { + public static List createASTagList(List list, Object parent) { List ret = new ArrayList<>(); int frame = 1; List frames = new ArrayList<>(); List exportAssetsTags = new ArrayList<>(); - for (Object t : list) { + for (ContainerItem t : list) { if (t instanceof ExportAssetsTag) { exportAssetsTags.add((ExportAssetsTag) t); } @@ -722,7 +723,7 @@ public class SWF { if (((Container) t).getItemCount() > 0) { TagNode tti = new TagNode(t); - List subItems = ((Container) t).getSubItems(); + List subItems = ((Container) t).getSubItems(); tti.subItems = createASTagList(subItems, t); addNode = tti; @@ -870,9 +871,9 @@ public class SWF { return false; } - public static void populateSoundStreamBlocks(List tags, Tag head, List output) { + public static void populateSoundStreamBlocks(List tags, Tag head, List output) { boolean found = false; - for (Object t : tags) { + for (ContainerItem t : tags) { if (t == head) { found = true; continue; @@ -892,8 +893,8 @@ public class SWF { } } - public void populateVideoFrames(int streamId, List tags, HashMap output) { - for (Object t : tags) { + public void populateVideoFrames(int streamId, List tags, HashMap output) { + for (ContainerItem t : tags) { if (t instanceof VideoFrameTag) { output.put(((VideoFrameTag) t).frameNum, (VideoFrameTag) t); } @@ -934,8 +935,7 @@ public class SWF { if (t instanceof SoundStreamHeadTypeTag) { SoundStreamHeadTypeTag shead = (SoundStreamHeadTypeTag) t; List blocks = new ArrayList<>(); - List objs = new ArrayList(this.tags); - populateSoundStreamBlocks(objs, t, blocks); + populateSoundStreamBlocks(this.tags, t, blocks); if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int b = 0; b < blocks.size(); b++) { @@ -1087,7 +1087,8 @@ public class SWF { if (t instanceof SoundStreamHeadTypeTag) { final SoundStreamHeadTypeTag shead = (SoundStreamHeadTypeTag) t; final List blocks = new ArrayList<>(); - List objs = new ArrayList(this.tags); + List objs = new ArrayList<>(); + objs.addAll(this.tags); populateSoundStreamBlocks(objs, t, blocks); if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -1157,8 +1158,7 @@ public class SWF { public byte[] exportMovie(DefineVideoStreamTag videoStream) throws IOException { HashMap frames = new HashMap<>(); - List os = new ArrayList(this.tags); - populateVideoFrames(videoStream.characterID, os, frames); + populateVideoFrames(videoStream.characterID, this.tags, frames); if (frames.isEmpty()) { return new byte[0]; } @@ -1723,9 +1723,9 @@ public class SWF { } private HashMap> actionsMap = new HashMap<>(); - private void getVariables(List objs, String path) { + private void getVariables(List objs, String path) { List processed = new ArrayList<>(); - for (Object o : objs) { + for (ContainerItem o : objs) { if (o instanceof ASMSource) { String infPath = path + "/" + o.toString(); int pos = 1; @@ -1893,7 +1893,7 @@ public class SWF { allVariableNames = new ArrayList<>(); allStrings = new HashMap<>(); - List objs = new ArrayList<>(); + List objs = new ArrayList<>(); int ret = 0; objs.addAll(tags); getVariables(objs, ""); diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index 236f108ea..81fb3cbd6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -45,6 +45,7 @@ import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; import com.jpexs.decompiler.graph.Graph; import com.jpexs.helpers.Helper; @@ -83,7 +84,7 @@ public class TagNode { return tag.toString(); } - public static List createTagList(List list) { + public static List createTagList(List list) { List ret = new ArrayList<>(); int frame = 1; List frames = new ArrayList<>(); @@ -162,7 +163,7 @@ public class TagNode { if (t instanceof Container) { TagNode tti = new TagNode(t); if (((Container) t).getItemCount() > 0) { - List subItems = ((Container) t).getSubItems(); + List subItems = ((Container) t).getSubItems(); tti.subItems = createTagList(subItems); } //ret.add(tti); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 3f362e16b..6d23988c0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -83,6 +83,7 @@ import com.jpexs.decompiler.flash.tags.base.AloneTag; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; @@ -149,6 +150,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -793,7 +795,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel //setJMenuBar(menuBar); - List objs = new ArrayList<>(); + List objs = new ArrayList<>(); if (swf != null) { objs.addAll(swf.tags); } @@ -1050,7 +1052,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } characters = new HashMap<>(); - List list2 = new ArrayList<>(); + List list2 = new ArrayList<>(); if (swf != null) { list2.addAll(swf.tags); } @@ -1649,8 +1651,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - private void parseCharacters(List list) { - for (Object t : list) { + private void parseCharacters(List list) { + for (ContainerItem t : list) { if (t instanceof CharacterTag) { characters.put(((CharacterTag) t).getCharacterId(), (CharacterTag) t); } @@ -1660,8 +1662,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getShapes(List list, List shapes) { - for (Object t : list) { + public static void getShapes(List list, List shapes) { + for (ContainerItem t : list) { if (t instanceof Container) { getShapes(((Container) t).getSubItems(), shapes); } @@ -1674,8 +1676,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getFonts(List list, List fonts) { - for (Object t : list) { + public static void getFonts(List list, List fonts) { + for (ContainerItem t : list) { if (t instanceof Container) { getFonts(((Container) t).getSubItems(), fonts); } @@ -1688,8 +1690,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getActionScript3(List list, List actionScripts) { - for (Object t : list) { + public static void getActionScript3(List list, List actionScripts) { + for (ContainerItem t : list) { if (t instanceof Container) { getActionScript3(((Container) t).getSubItems(), actionScripts); } @@ -1699,8 +1701,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getMorphShapes(List list, List morphShapes) { - for (Object t : list) { + public static void getMorphShapes(List list, List morphShapes) { + for (ContainerItem t : list) { if (t instanceof Container) { getMorphShapes(((Container) t).getSubItems(), morphShapes); } @@ -1710,8 +1712,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getImages(List list, List images) { - for (Object t : list) { + public static void getImages(List list, List images) { + for (ContainerItem t : list) { if (t instanceof Container) { getImages(((Container) t).getSubItems(), images); } @@ -1726,8 +1728,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getTexts(List list, List texts) { - for (Object t : list) { + public static void getTexts(List list, List texts) { + for (ContainerItem t : list) { if (t instanceof Container) { getTexts(((Container) t).getSubItems(), texts); } @@ -1739,8 +1741,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getSprites(List list, List sprites) { - for (Object t : list) { + public static void getSprites(List list, List sprites) { + for (ContainerItem t : list) { if (t instanceof Container) { getSprites(((Container) t).getSubItems(), sprites); } @@ -1750,8 +1752,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } } - public static void getButtons(List list, List buttons) { - for (Object t : list) { + public static void getButtons(List list, List buttons) { + for (ContainerItem t : list) { if (t instanceof Container) { getButtons(((Container) t).getSubItems(), buttons); } @@ -1859,10 +1861,10 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel return ret; } - public List getTagNodesWithType(List list, String type, Object parent, boolean display) { + public List getTagNodesWithType(List list, String type, Object parent, boolean display) { List ret = new ArrayList<>(); int frameCnt = 0; - for (Object o : list) { + for (ContainerItem o : list) { String ttype = getTagType(o); if ("showframe".equals(ttype) && "frame".equals(type)) { frameCnt++; @@ -1968,7 +1970,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel return null; } - public List createTagList(List list, Object parent) { + public List createTagList(List list, Object parent) { List ret = new ArrayList<>(); List frames = getTagNodesWithType(list, "frame", parent, true); List shapes = getTagNodesWithType(list, "shape", parent, true); @@ -1995,7 +1997,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } for (TagNode n : sprites) { - n.subItems = getTagNodesWithType(new ArrayList(((DefineSpriteTag) n.tag).subTags), "frame", n.tag, true); + n.subItems = getTagNodesWithType(((DefineSpriteTag) n.tag).subTags, "frame", n.tag, true); } List exportAssetsTags = new ArrayList<>(); @@ -2010,7 +2012,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel if (t instanceof Container) { TagNode tti = new TagNode(t); if (((Container) t).getItemCount() > 0) { - List subItems = ((Container) t).getSubItems(); + List subItems = ((Container) t).getSubItems(); tti.subItems = createTagList(subItems, t); } //ret.add(tti); @@ -3024,13 +3026,13 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel DefineVideoStreamTag vs = null; if (tagObj instanceof DefineVideoStreamTag) { vs = (DefineVideoStreamTag) tagObj; - swf.populateVideoFrames(vs.getCharacterId(), new ArrayList(swf.tags), videoFrames); + swf.populateVideoFrames(vs.getCharacterId(), swf.tags, videoFrames); frameCount = videoFrames.size(); } List soundFrames = new ArrayList<>(); if (tagObj instanceof SoundStreamHeadTypeTag) { - SWF.populateSoundStreamBlocks(new ArrayList(swf.tags), (Tag) tagObj, soundFrames); + SWF.populateSoundStreamBlocks(swf.tags, (Tag) tagObj, soundFrames); frameCount = soundFrames.size(); } @@ -3077,7 +3079,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel if (tagObj instanceof FrameNode) { FrameNode fn = (FrameNode) tagObj; Object parent = fn.getParent(); - List subs = new ArrayList<>(); + List subs = new ArrayList<>(); if (parent == null) { subs.addAll(swf.tags); } else { @@ -3322,11 +3324,69 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } public void refreshTree() { - List objs = new ArrayList<>(); + List objs = new ArrayList<>(); objs.addAll(swf.tags); + + List> expandedNodes = getExpandedNodes(tagTree); + tagTree.setModel(new TagTreeModel(createTagList(objs, null), new SWFRoot((new File(Main.file)).getName()))); + + expandTreeNodes(tagTree, expandedNodes); } + private List> getExpandedNodes(JTree tree) { + List> expandedNodes = new ArrayList<>(); + int rowCount = tree.getRowCount(); + for (int i = 0; i < rowCount; i++){ + TreePath path = tree.getPathForRow(i); + if (tree.isExpanded(path)) { + List pathAsStringList = new ArrayList<>(); + for (Object pathCompnent : path.getPath()) { + pathAsStringList.add(pathCompnent.toString()); + } + expandedNodes.add(pathAsStringList); + } + } + return expandedNodes; + } + + private void expandTreeNodes(JTree tree, List> pathsToExpand) { + for(List pathAsStringList : pathsToExpand) { + expandTreeNode(tree, pathAsStringList); + } + } + + private void expandTreeNode(JTree tree, List pathAsStringList) { + TreeModel model = tree.getModel(); + Object node = model.getRoot(); + + if (pathAsStringList.isEmpty()) { + return; + } + if (!pathAsStringList.get(0).equals(node.toString())) { + return; + } + + List path = new ArrayList<>(); + path.add(node); + + for (int i = 1; i < pathAsStringList.size(); i++) { + String name = pathAsStringList.get(i); + int childCount = model.getChildCount(node); + for (int j = 0; j < childCount; j++) { + Object child = model.getChild(node, j); + if (child.toString().equals(name)) { + node = child; + path.add(node); + break; + } + } + } + + TreePath tp = new TreePath(path.toArray(new Object[path.size()])); + tree.expandPath(tp); + } + public void setEditText(boolean edit) { textValue.setEditable(edit); textSaveButton.setVisible(edit); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 96bba5c30..718edd20a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -202,8 +202,7 @@ public class ActionPanel extends JPanel implements ActionListener { if ((txt != null) && (!txt.equals(""))) { searchIgnoreCase = ignoreCase; searchRegexp = regexp; - List tags = new ArrayList(Main.swf.tags); - List list = Main.swf.createASTagList(tags, null); + List list = Main.swf.createASTagList(Main.swf.tags, null); Map asms = getASMs("", list); found = new ArrayList<>(); Pattern pat = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 77fe8d4ec..bb7d31ef9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.types.BUTTONCONDACTION; import com.jpexs.decompiler.flash.types.BUTTONRECORD; import com.jpexs.decompiler.flash.types.MATRIX; @@ -177,8 +178,8 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { + List ret = new ArrayList<>(); ret.addAll(actions); return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 53f92fd28..36afab4fd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.MATRIX; @@ -234,8 +235,8 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { + List ret = new ArrayList<>(); ret.addAll(subTags); return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 2d690773c..597013621 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; @@ -249,8 +250,8 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { + List ret = new ArrayList<>(); if (placeFlagHasClipActions) { ret.addAll(clipActions.clipActionRecords); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index 2549dfbea..b3171d046 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; @@ -356,8 +357,8 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { + List ret = new ArrayList<>(); if (placeFlagHasClipActions) { ret.addAll(clipActions.clipActionRecords); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index 8e9358650..5476e0ef2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.Container; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; @@ -358,8 +359,8 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { + List ret = new ArrayList<>(); if (placeFlagHasClipActions) { ret.addAll(clipActions.clipActionRecords); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java index 22b666051..379fae19f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.tags.base.CharacterTag; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; import com.jpexs.decompiler.flash.tags.base.NeedsCharacters; import java.util.HashMap; @@ -28,7 +29,7 @@ import java.util.Set; /** * Represents Tag inside SWF file */ -public class Tag implements NeedsCharacters, Exportable { +public class Tag implements NeedsCharacters, Exportable, ContainerItem { /** * Identifier of tag type diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/Container.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/Container.java index bf8261b3d..92d1d0dfb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/Container.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/Container.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.tags.base; +import com.jpexs.decompiler.flash.tags.Tag; import java.util.List; /** @@ -30,7 +31,7 @@ public interface Container { * * @return List of sub-items */ - public List getSubItems(); + public List getSubItems(); /** * Returns number of sub-items diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java new file mode 100644 index 000000000..609fe7ccd --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.tags.base; + +/** + * Object which contains other objects + * + * @author JPEXS + */ +public interface ContainerItem { + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java index 331178ec2..921ae089f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionListReader; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ASMSource; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; import com.jpexs.helpers.Helper; import com.jpexs.helpers.ReReadableInputStream; @@ -39,7 +40,7 @@ import java.util.logging.Logger; * * @author JPEXS */ -public class BUTTONCONDACTION implements ASMSource, Exportable { +public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem { private long pos; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index 0f9ee96a9..9e87a75f8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionListReader; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ASMSource; +import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; import com.jpexs.helpers.ReReadableInputStream; import java.io.ByteArrayInputStream; @@ -38,7 +39,7 @@ import java.util.logging.Logger; * * @author JPEXS */ -public class CLIPACTIONRECORD implements ASMSource, Exportable { +public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem { public static String keyToString(int key) { if ((key < CLIPACTIONRECORD.KEYNAMES.length) && (key > 0) && (CLIPACTIONRECORD.KEYNAMES[key] != null)) {