TV-Browser 2.7.5 API

tvdataservice
Class MutableProgram

java.lang.Object
  extended by tvdataservice.MutableProgram
All Implemented Interfaces:
Program
Direct Known Subclasses:
OnDemandProgram

public class MutableProgram
extends Object
implements Program

One program. Consists of the Channel, the time, the title and some extra information.

Author:
Til Schneider, www.murfman.de

Field Summary
protected static Marker[] EMPTY_MARKER_ARR
          A plugin array that can be shared by all the programs that are not marked by any plugin.
static int MAX_SHORT_INFO_LENGTH
          The maximum length of a short info.
protected  String mTitle
          Contains the title
 
Fields inherited from interface devplugin.Program
DEFAULT_MARK_PRIORITY, HIGHER_MEDIUM_MARK_PRIORITY, INFO_AUDIO_DESCRIPTION, INFO_AUDIO_DOLBY_DIGITAL_5_1, INFO_AUDIO_DOLBY_SURROUND, INFO_AUDIO_MONO, INFO_AUDIO_STEREO, INFO_AUDIO_TWO_CHANNEL_TONE, INFO_CATEGORIE_ARTS, INFO_CATEGORIE_CHILDRENS, INFO_CATEGORIE_DOCUMENTARY, INFO_CATEGORIE_MAGAZINE_INFOTAINMENT, INFO_CATEGORIE_MOVIE, INFO_CATEGORIE_NEWS, INFO_CATEGORIE_OTHERS, INFO_CATEGORIE_SERIES, INFO_CATEGORIE_SHOW, INFO_CATEGORIE_SPORTS, INFO_LIVE, INFO_NEW, INFO_ORIGINAL_WITH_SUBTITLE, INFO_SUBTITLE, INFO_SUBTITLE_FOR_AURALLY_HANDICAPPED, INFO_VISION_16_TO_9, INFO_VISION_4_TO_3, INFO_VISION_BLACK_AND_WHITE, INFO_VISION_HD, IS_VALID_STATE, LOWER_MEDIUM_MARK_PRIORITY, MARK_PRIORITY, MAX_MARK_PRIORITY, MEDIUM_MARK_PRIORITY, MIN_MARK_PRIORITY, NO_MARK_PRIORITY, WAS_DELETED_STATE, WAS_UPDATED_STATE
 
Constructor Summary
MutableProgram(Channel channel, Date localDate, boolean isLoading)
          Creates a new instance of MutableProgram.
MutableProgram(Channel channel, Date localDate, int localHours, int localMinutes)
          Deprecated. Since 2.2.2. Use MutableProgram(Channel, devplugin.Date, int, int, boolean) instead.
MutableProgram(Channel channel, Date localDate, int localHours, int localMinutes, boolean isLoading)
          Creates a new instance of MutableProgram.
 
Method Summary
 void addChangeListener(ChangeListener listener)
          Adds a ChangeListener to the program.
 boolean equals(Object o)
           
 boolean equalsAllFields(MutableProgram program)
          check if two programs are identical by their field contents
protected  void fireStateChanged()
          Send a ChangeEvent, whose source is this program, to each listener.
static String generateShortInfoFromDescription(String shortInfo)
          Trimm text for shortinfo-field
 byte[] getBinaryField(ProgramFieldType type)
          Gets the value of a binary field from the program.
 Channel getChannel()
          Returns the channel object of this program.
 Date getDate()
          Returns the date of this program.
 String getDateString()
          get the date of this program as nicely formatted string
 String getDescription()
          Returns a description about the program.
 String getEndTimeString()
          get the end time of this program as nicely formatted string
protected  Object getField(ProgramFieldType type, int fieldFormat)
           
 int getFieldCount()
          Gets the number of fields this program has.
 Iterator<ProgramFieldType> getFieldIterator()
          Gets an iterator over the types of all fields this program has.
 int getHours()
          Gets the hour-component of the start time of the program.
 String getID()
          Gets the ID of this program.
 int getInfo()
          Returns additional information of the program (or zero).
 int getIntField(ProgramFieldType type)
          Gets the value of a int field from the program.
 String getIntFieldAsString(ProgramFieldType type)
          Gets the value of a int field as String.
 int getLength()
          Gets the length of this program in minutes.
 Date getLocalDate()
           
 int getLocalStartTime()
           
 PluginAccess[] getMarkedByPlugins()
          Deprecated. use getMarkerArr()
 Marker[] getMarkerArr()
          Gets all Markers that have marked this program.
 int getMarkPriority()
          Gets the priority of the marking of this program.
 int getMinutes()
          Gets the minute-component of the start time of the program.
 int getProgramState()
          Returns the state of this program.
 String getShortInfo()
          Returns a short information about the program (about three lines).
 int getStartTime()
          Gets the the start time of the program in minutes after midnight.
 String getTextField(ProgramFieldType type)
          Gets the value of a text field from the program.
 int getTimeField(ProgramFieldType type)
          Gets the value of a time field from the program.
 String getTimeFieldAsString(ProgramFieldType type)
          Gets the value of a time field as String of the pattern "h:mm".
 String getTimeString()
          get the start time of this program as nicely formatted string
 String getTitle()
          Returns the title of this program.
 boolean isExpired()
          Gets whether this program is expired.
 boolean isOnAir()
          Gets whether this program is marked as "on air".
 void mark(Marker marker)
          Marks the program for a plugin.
 void mark(Plugin javaPlugin)
          Marks the program for a Java plugin.
 void removeChangeListener(ChangeListener listener)
          Removes a ChangeListener from the program.
 void setBinaryField(ProgramFieldType type, byte[] value)
          Set a binary field.
 void setDescription(String description)
          Sets a description about the program.
protected  void setField(ProgramFieldType type, int fieldFormat, Object value)
           
 void setInfo(int info)
          Sets additional information of the program (or zero).
 void setIntField(ProgramFieldType type, int value)
          Set an int field.
 void setLength(int length)
          Sets the length of this program in minutes.
protected  void setMarkerArr(Marker[] marker)
          Sets the marker array of this program.
protected  void setMarkPriority(int markPriority)
          Sets the mark priority for this program
 void setProgramLoadingIsComplete()
          Sets the loading state to false.
protected  void setProgramState(int state)
          Sets the state of this program to a program state.
 void setShortInfo(String shortInfo)
          Sets a short information about the program (about three lines).
 void setTextField(ProgramFieldType type, String value)
          Set a text field.
 void setTimeField(ProgramFieldType type, int value)
          Set a time field.
 void setTitle(String title)
          Sets the title of this program.
 String toString()
          Gets a String representation of this program for debugging.
 void unmark(Marker marker)
          Removes the marks from the program for a plugin.
 void unmark(Plugin javaPlugin)
          Removes the marks from the program for a Java plugin.
 void validateMarking()
          Informs the ChangeListeners for repainting if a Plugin uses more than one Icon for the Program.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SHORT_INFO_LENGTH

public static final int MAX_SHORT_INFO_LENGTH
The maximum length of a short info. Used for generating a short info out of a (long) description.

See Also:
Constant Field Values

EMPTY_MARKER_ARR

protected static final Marker[] EMPTY_MARKER_ARR
A plugin array that can be shared by all the programs that are not marked by any plugin.


mTitle

protected String mTitle
Contains the title

Constructor Detail

MutableProgram

public MutableProgram(Channel channel,
                      Date localDate,
                      int localHours,
                      int localMinutes)
Deprecated. Since 2.2.2. Use MutableProgram(Channel, devplugin.Date, int, int, boolean) instead.

Creates a new instance of MutableProgram.

The parameters channel, date, hours and minutes build the ID. That's why they are not mutable.

Parameters:
channel - The channel object of this program.
localDate - The date of this program.
localHours - The hour-component of the start time of the program.
localMinutes - The minute-component of the start time of the program.

MutableProgram

public MutableProgram(Channel channel,
                      Date localDate,
                      int localHours,
                      int localMinutes,
                      boolean isLoading)
Creates a new instance of MutableProgram.

The parameters channel, date, hours and minutes build the ID. That's why they are not mutable.

Parameters:
channel - The channel object of this program.
localDate - The date of this program.
localHours - The hour-component of the start time of the program.
localMinutes - The minute-component of the start time of the program.
isLoading - If the program is curently being created.
See Also:
setProgramLoadingIsComplete()

MutableProgram

public MutableProgram(Channel channel,
                      Date localDate,
                      boolean isLoading)
Creates a new instance of MutableProgram.

The parameters channel, date, hours and minutes build the ID. That's why they are not mutable.

Parameters:
channel - The channel object of this program.
localDate - The date of this program.
isLoading - If the program is curently loading.
See Also:
setProgramLoadingIsComplete()
Method Detail

addChangeListener

public void addChangeListener(ChangeListener listener)
Adds a ChangeListener to the program.

Specified by:
addChangeListener in interface Program
Parameters:
listener - the ChangeListener to add
See Also:
fireStateChanged(), removeChangeListener(javax.swing.event.ChangeListener)

removeChangeListener

public void removeChangeListener(ChangeListener listener)
Removes a ChangeListener from the program.

Specified by:
removeChangeListener in interface Program
Parameters:
listener - the ChangeListener to remove
See Also:
fireStateChanged(), addChangeListener(javax.swing.event.ChangeListener)

fireStateChanged

protected void fireStateChanged()
Send a ChangeEvent, whose source is this program, to each listener.

See Also:
addChangeListener(javax.swing.event.ChangeListener), EventListenerList

getTimeString

public final String getTimeString()
Description copied from interface: Program
get the start time of this program as nicely formatted string

Specified by:
getTimeString in interface Program
Returns:
the start time string

getEndTimeString

public final String getEndTimeString()
Description copied from interface: Program
get the end time of this program as nicely formatted string

Specified by:
getEndTimeString in interface Program
Returns:
the end time string

getDateString

public final String getDateString()
Description copied from interface: Program
get the date of this program as nicely formatted string

Specified by:
getDateString in interface Program
Returns:
the date string

isOnAir

public boolean isOnAir()
Gets whether this program is marked as "on air".

Specified by:
isOnAir in interface Program

mark

public final void mark(Plugin javaPlugin)
Marks the program for a Java plugin.

Specified by:
mark in interface Program
Parameters:
javaPlugin - The plugin to mark the program for.

unmark

public final void unmark(Plugin javaPlugin)
Removes the marks from the program for a Java plugin.

If the program wasn't marked for the plugin, nothing happens.

Specified by:
unmark in interface Program
Parameters:
javaPlugin - The plugin to remove the mark for.

mark

public final void mark(Marker marker)
Marks the program for a plugin.

Specified by:
mark in interface Program
Parameters:
marker - The plugin to mark the program for.

unmark

public final void unmark(Marker marker)
Removes the marks from the program for a plugin.

If the program wasn't marked for the plugin, nothing happens.

Specified by:
unmark in interface Program
Parameters:
marker - The plugin to remove the mark for.

getMarkedByPlugins

public PluginAccess[] getMarkedByPlugins()
Deprecated. use getMarkerArr()

Gets all Plugins that have marked this program.

Specified by:
getMarkedByPlugins in interface Program

getMarkerArr

public Marker[] getMarkerArr()
Description copied from interface: Program
Gets all Markers that have marked this program.

Specified by:
getMarkerArr in interface Program

isExpired

public boolean isExpired()
Gets whether this program is expired.

Specified by:
isExpired in interface Program

getID

public String getID()
Gets the ID of this program. This ID is unique for a certain date.

Specified by:
getID in interface Program
Returns:
The ID of this program.

getBinaryField

public byte[] getBinaryField(ProgramFieldType type)
Description copied from interface: Program
Gets the value of a binary field from the program.

Specified by:
getBinaryField in interface Program
Parameters:
type - The type of the wanted field. Must have a binary format.
Returns:
The value of the field or null, if there is no value for this field.

getTextField

public String getTextField(ProgramFieldType type)
Description copied from interface: Program
Gets the value of a text field from the program.

Specified by:
getTextField in interface Program
Parameters:
type - The type of the wanted field. Must have a text format.
Returns:
The value of the field or null, if there is no value for this field.

getIntField

public int getIntField(ProgramFieldType type)
Description copied from interface: Program
Gets the value of a int field from the program.

Specified by:
getIntField in interface Program
Parameters:
type - The type of the wanted field. Must have a int format.
Returns:
The value of the field or -1, if there is no value for this field.

getIntFieldAsString

public String getIntFieldAsString(ProgramFieldType type)
Gets the value of a int field as String.

Specified by:
getIntFieldAsString in interface Program
Parameters:
type - The type of the wanted field. Must have a int format.
Returns:
The value of the field as String or null, if there is no value for this field.

getTimeField

public int getTimeField(ProgramFieldType type)
Description copied from interface: Program
Gets the value of a time field from the program.

Specified by:
getTimeField in interface Program
Parameters:
type - The type of the wanted field. Must have a time format.
Returns:
The value of the field or -1, if there is no value for this field.

getTimeFieldAsString

public String getTimeFieldAsString(ProgramFieldType type)
Gets the value of a time field as String of the pattern "h:mm".

Specified by:
getTimeFieldAsString in interface Program
Parameters:
type - The type of the wanted field. Must have a time format.
Returns:
The value of the field as String or null, if there is no value for this field.

getField

protected Object getField(ProgramFieldType type,
                          int fieldFormat)

getFieldCount

public int getFieldCount()
Gets the number of fields this program has.

Specified by:
getFieldCount in interface Program
Returns:
the number of fields this program has.

getFieldIterator

public Iterator<ProgramFieldType> getFieldIterator()
Gets an iterator over the types of all fields this program has.

Specified by:
getFieldIterator in interface Program
Returns:
an iterator over ProgramFieldTypes.

setBinaryField

public void setBinaryField(ProgramFieldType type,
                           byte[] value)
Set a binary field.

Parameters:
type - The type of the field.
value - The binary value to set.

setTextField

public void setTextField(ProgramFieldType type,
                         String value)
Set a text field.

Parameters:
type - The type of the field.
value - The text value to set.

setIntField

public void setIntField(ProgramFieldType type,
                        int value)
Set an int field.

Parameters:
type - The type of the field.
value - The int value to set.

setTimeField

public void setTimeField(ProgramFieldType type,
                         int value)
Set a time field.

Parameters:
type - The type of the field.
value - The time value to set.

setField

protected void setField(ProgramFieldType type,
                        int fieldFormat,
                        Object value)

generateShortInfoFromDescription

public static String generateShortInfoFromDescription(String shortInfo)
Trimm text for shortinfo-field

Parameters:
shortInfo - generate Text from this field
Returns:
Text that fits into shortInfo
Since:
2.7

setTitle

public void setTitle(String title)
Sets the title of this program.

Parameters:
title - the new title of this program.

getTitle

public String getTitle()
Returns the title of this program.

Specified by:
getTitle in interface Program
Returns:
the title of this program.

setShortInfo

public void setShortInfo(String shortInfo)
Sets a short information about the program (about three lines). May be null.

If the legth of the short info exceeds 100 characters it will be cut using a smart algorithm.

Parameters:
shortInfo - The new short info.

getShortInfo

public String getShortInfo()
Returns a short information about the program (about three lines). May be null.

Specified by:
getShortInfo in interface Program
Returns:
The short info.

setDescription

public void setDescription(String description)
Sets a description about the program. May be null.

Parameters:
description - The description.

getDescription

public String getDescription()
Returns a description about the program. May be null.

Specified by:
getDescription in interface Program
Returns:
The description.

getStartTime

public int getStartTime()
Gets the the start time of the program in minutes after midnight.

Specified by:
getStartTime in interface Program
Returns:
the start time.

getHours

public int getHours()
Gets the hour-component of the start time of the program.

Specified by:
getHours in interface Program
Returns:
the hour-component of the start time.

getMinutes

public int getMinutes()
Gets the minute-component of the start time of the program.

Specified by:
getMinutes in interface Program
Returns:
the minute-component of the start time.

getLocalStartTime

public int getLocalStartTime()
Returns:
The local start time.

setLength

public void setLength(int length)
Sets the length of this program in minutes.

Parameters:
length - the new length.

getLength

public int getLength()
Gets the length of this program in minutes.

Specified by:
getLength in interface Program
Returns:
the length.

setInfo

public void setInfo(int info)
Sets additional information of the program (or zero).

Parameters:
info - The new additional information.

getInfo

public int getInfo()
Returns additional information of the program (or zero).

Specified by:
getInfo in interface Program
Returns:
the new additional information.

getChannel

public Channel getChannel()
Returns the channel object of this program.

Specified by:
getChannel in interface Program
Returns:
The channel.

getDate

public Date getDate()
Returns the date of this program.

Specified by:
getDate in interface Program
Returns:
the date.

getLocalDate

public Date getLocalDate()
Returns:
The local date

toString

public String toString()
Gets a String representation of this program for debugging.

Overrides:
toString in class Object
Returns:
A String representation for debugging.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

equalsAllFields

public boolean equalsAllFields(MutableProgram program)
check if two programs are identical by their field contents

Parameters:
program -
Returns:
true, if all fields are equal
Since:
2.6

setProgramState

protected void setProgramState(int state)
Sets the state of this program to a program state.

Parameters:
state - The state of this program.
Since:
2.2

getProgramState

public int getProgramState()
Returns the state of this program.

Specified by:
getProgramState in interface Program
Returns:
The program state.
Since:
2.2

validateMarking

public final void validateMarking()
Informs the ChangeListeners for repainting if a Plugin uses more than one Icon for the Program.

Specified by:
validateMarking in interface Program
Since:
2.2.2
See Also:
Plugin.getMarkIconsForProgram(Program)

setMarkerArr

protected void setMarkerArr(Marker[] marker)
Sets the marker array of this program.

Parameters:
marker - The marker array.
Since:
2.2.1

setProgramLoadingIsComplete

public void setProgramLoadingIsComplete()
Sets the loading state to false. Call this after creation of the program from the data service.

Since:
2.2.2

getMarkPriority

public int getMarkPriority()
Gets the priority of the marking of this program.

Specified by:
getMarkPriority in interface Program
Returns:
The mark priority.
Since:
2.5.1

setMarkPriority

protected void setMarkPriority(int markPriority)
Sets the mark priority for this program

Since:
2.5.1

TV-Browser 2.7.5 API

TV-Browser 2.7.5, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)