Source Code Cross Referenced for EffectingVideo.java in  » Graphic-Library » apollo » org » apollo » datamodel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » apollo » org.apollo.datamodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Apollo - Motion capture and animation system
003:         * Copyright (c) 2005 Apollo
004:         * 
005:         * This program is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU General Public License
007:         * as published by the Free Software Foundation; either version 2
008:         * of the License, or (at your option) any later version.
009:         * 
010:         * This program is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:         * GNU General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU General Public License
016:         * along with this program; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
018:         *
019:         * http://www.gnu.org/copyleft/gpl.html
020:         *
021:         * @author Giovane.Kuhn - brain@netuno.com.br
022:         *
023:         */
024:        package org.apollo.datamodel;
025:
026:        import java.io.File;
027:        import java.io.IOException;
028:        import java.io.Serializable;
029:        import java.util.ArrayList;
030:        import java.util.Collections;
031:        import java.util.Comparator;
032:        import java.util.List;
033:        import java.util.Map;
034:
035:        import org.apollo.ApolloUtil;
036:
037:        /**
038:         * Class represents a video that was transformed with some effects.
039:         * @author Giovane.Kuhn on 03/05/2005
040:         */
041:        public final class EffectingVideo implements  Serializable {
042:
043:            private static final long serialVersionUID = 1L;
044:
045:            /** List of effects to be applied in the video */
046:            private List<VideoEffect> effects;
047:
048:            /** Effecting video file name */
049:            private String relativeVideoFile;
050:
051:            /** Effecting video frames, that contain the markers info */
052:            private Map<Integer, EffectingFrame> frames;
053:
054:            /** Project that's owner */
055:            private Project project;
056:
057:            public Project getProject() {
058:                return project;
059:            }
060:
061:            public void setProject(Project project) {
062:                this .project = project;
063:                if (effects != null) {
064:                    for (VideoEffect effect : effects) {
065:                        effect.setProject(project);
066:                    }
067:                }
068:            }
069:
070:            public List<VideoEffect> getEffects() {
071:                return effects;
072:            }
073:
074:            public void setEffects(List<VideoEffect> effects) {
075:                this .effects = effects;
076:                if (effects != null) {
077:                    for (VideoEffect effect : effects) {
078:                        effect.setProject(project);
079:                    }
080:                }
081:            }
082:
083:            public boolean addEffect(VideoEffect effect) {
084:                if (effects == null) {
085:                    effects = new ArrayList<VideoEffect>();
086:                }
087:                boolean ret = effects.add(effect);
088:                effect.setProject(project);
089:                project.setChanged(EffectingVideo.class);
090:                return ret;
091:            }
092:
093:            public boolean removeEffect(VideoEffect effect) {
094:                if (effects == null) {
095:                    return false;
096:                }
097:                boolean ret = effects.remove(effect);
098:                effect.setProject(null);
099:                project.setChanged(EffectingVideo.class);
100:                return ret;
101:            }
102:
103:            public boolean removeEffects(List<VideoEffect> effect) {
104:                if (effects == null) {
105:                    return false;
106:                }
107:                boolean ret = effects.removeAll(effect);
108:                for (VideoEffect e : effect) {
109:                    e.setProject(null);
110:                }
111:                project.setChanged(EffectingVideo.class);
112:                return ret;
113:            }
114:
115:            public boolean replaceAllEffects(List<VideoEffect> newEffects) {
116:                if (effects != null) {
117:                    for (VideoEffect effect : effects) {
118:                        effect.setProject(null);
119:                    }
120:                }
121:                this .setEffects(new ArrayList<VideoEffect>(newEffects));
122:                if (project != null) {
123:                    project.setChanged(EffectingVideo.class);
124:                }
125:                return true;
126:            }
127:
128:            public boolean changeEffectOrder(VideoEffect effect, int sum) {
129:                if (effects == null || sum == 0) {
130:                    // are not change order
131:                    return false;
132:                }
133:                int index = effects.indexOf(effect);
134:                if (index < 0 || sum == 0) {
135:                    // effect doesn't exists
136:                    return false;
137:                }
138:                if (index == effects.size() - 1 && sum > 0) {
139:                    // effect is already last
140:                    return false;
141:                }
142:                if (index == 0 && sum < 0) {
143:                    // effect is already first
144:                    return false;
145:                }
146:                int newIndex = index + sum;
147:                VideoEffect other = effects.get(newIndex);
148:                assert other != null;
149:                effects.set(newIndex, effect);
150:                effects.set(index, other);
151:                if (project != null) {
152:                    project.setChanged(EffectingVideo.class);
153:                }
154:                return true;
155:            }
156:
157:            public String getCanonicalVideoFile() {
158:                if (relativeVideoFile == null) {
159:                    return null;
160:                }
161:                try {
162:                    return new File(ApolloUtil.getPathName(project
163:                            .getProjectFile()), relativeVideoFile)
164:                            .getCanonicalPath();
165:                } catch (IOException e) {
166:                    throw new RuntimeException(e);
167:                }
168:            }
169:
170:            public String getRelativeVideoFile() {
171:                return relativeVideoFile;
172:            }
173:
174:            public void setRelativeVideoFile(String relativeVideoFile) {
175:                boolean changed = (this .relativeVideoFile != relativeVideoFile || (relativeVideoFile != null && !relativeVideoFile
176:                        .equalsIgnoreCase(this .relativeVideoFile)));
177:                this .relativeVideoFile = relativeVideoFile;
178:                if (project != null && changed) {
179:                    project.setChanged(EffectingVideo.class);
180:                }
181:            }
182:
183:            public Map<Integer, EffectingFrame> getFrames() {
184:                if (frames == null) {
185:                    return Collections.emptyMap();
186:                }
187:                return frames;
188:            }
189:
190:            public List<EffectingFrame> getOrderedFrames() {
191:                if (frames == null) {
192:                    return Collections.emptyList();
193:                }
194:                List<EffectingFrame> ret = new ArrayList<EffectingFrame>(frames
195:                        .values());
196:                Collections.sort(ret, new Comparator<EffectingFrame>() {
197:
198:                    public int compare(EffectingFrame o1, EffectingFrame o2) {
199:                        return o1.getSequence() - o2.getSequence();
200:                    }
201:
202:                });
203:                return ret;
204:            }
205:
206:            public void setFrames(Map<Integer, EffectingFrame> frames) {
207:                this .frames = frames;
208:            }
209:
210:            public EffectingFrame getFrame(Integer sequence) {
211:                if (frames == null) {
212:                    return null;
213:                }
214:                return frames.get(sequence);
215:            }
216:
217:            public void reset(boolean toOriginalMarkers) {
218:                if (frames == null) {
219:                    return;
220:                }
221:                for (EffectingFrame f : frames.values()) {
222:                    f.reset(toOriginalMarkers);
223:                }
224:            }
225:
226:            public void uncolorizeMarkers() {
227:                if (frames == null) {
228:                    return;
229:                }
230:                for (EffectingFrame f : frames.values()) {
231:                    f.uncolorizeMarkers();
232:                }
233:            }
234:
235:            public String toString() {
236:                return ApolloUtil.getFileName(relativeVideoFile, true);
237:            }
238:
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.