001 package org.pscode.xui.ist;
002
003 //import java.awt.Font;
004 //import java.awt.Point;
005 //import java.awt.Color;
006
007 import org.pscode.xui.image.bean.ImageCaption;
008
009 /** JavaBean used to store caption descriptions in an image sequence.
010 Designed for use with the J2SE XMLEncoder/Decoder.
011 @author Andrew Thompson
012 @version 2010-01-08
013 @license LGPL */
014 public class ImageSequenceCaption implements Comparable {
015
016 /** The number of frames for which to display this caption. */
017 public int frameCount;
018
019 /** The first frame to which to apply this title. */
020 public int frameStart;
021
022 /** The ImageCaption used for these frames. */
023 public ImageCaption imageCaption;
024
025 public int compareTo(Object object) {
026 try {
027 ImageSequenceCaption caption = (ImageSequenceCaption)object;
028 if ( frameStart != caption.getFrameStart() ) {
029 return frameStart-caption.getFrameStart();
030 }
031 if ( frameCount != caption.getFrameCount() ) {
032 return frameCount-caption.getFrameCount();
033 }
034 return imageCaption.compareTo( caption );
035 } catch(ClassCastException cce) {
036 return -1;
037 }
038 }
039
040 public ImageSequenceCaption() {
041 imageCaption = new ImageCaption();
042 }
043
044 public void setFrameCount(int frameCount) {
045 this.frameCount = frameCount;
046 }
047
048 public int getFrameCount() {
049 return frameCount;
050 }
051
052 public void setFrameStart(int frameStart) {
053 this.frameStart = frameStart;
054 }
055
056 public int getFrameStart() {
057 return frameStart;
058 }
059
060 public ImageCaption getImageCaption() {
061 return imageCaption;
062 }
063
064 public void setImageCaption(ImageCaption imageCaption) {
065 this.imageCaption = imageCaption;
066 }
067
068 public String toString() {
069 return "#: " + (frameStart+1) + "/" + (frameCount+1) + " : " + imageCaption.getCaptionText();
070 }
071 }