|
TV-Browser 3.3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object devplugin.ProgramReceiveTarget
public final class ProgramReceiveTarget
Is a target for receiving of program from other plugins.
If your plugin should be able to receive programs from other plugins and
handle those programs in a specific way you have to create
ProgramReceiveTargets for the plugin.
To do this use the constructor
public ProgramReceiveTarget(ProgramReceiveIf receiveIf, String name, String targetId)
. The receiveIf
is you Plugin, the name
is the name
the user will be see for selection of the target and the
targetId
is a unique id which is used for identifying the
target.
If your plugin only supports one target simply don't override the method
getProgramReceiveTargets()
.
If you want to compare two targets always use the equals method.
Example:
Plugin name MyPlugin.
MyPlugin is a plugin which want to receive programs for two types of targets.
One target will be used to show the received programs in a dialog window, the
other target will be used to mark the programs for the plugin.
MyPlugin overrides the methods used for identifying it as a receiveable
plugin:
public boolean canReceiveProgramsWithTarget() {
return true;
}
public boolean receivePrograms(Program[] programArr, ProgramReceiveTarget receiveTarget) {
ProgramReceiveTarget[] targets = getSupportedTargets();
if(targets[0].equals(receiveTarget)
showProgramsInDialog(programArr);
else if (targets[1].equals(receiveTarget)
for(Program p : programArr)
p.mark(this);
}
public ProgramReceiveTarget[] getProgramReceiveTargets() {
return getSupportedTargets();
}
The method getSupportedTargets()
looks like this:
private ProgramReceiveTarget[] getSupportedTargets() {
ProgramReceiveTarget target1 = new ProgramReceiveTarget(this,"Show programs in dialog","showDialog");
ProgramReceiveTarget target2 = new ProgramReceiveTarget(this,"Mark programs for MyPlugin","markPrograms");
return new ProgramReceiveTarget[] {target1,target2};
}
With this code the plugin MyPlugin is able to receive the programs from other
plugins and handle it in the specified manner.
Constructor Summary | |
---|---|
ProgramReceiveTarget(java.io.ObjectInputStream in)
Creates an instance of the ProgramReceiveTarget. |
|
ProgramReceiveTarget(ProgramReceiveIf receiveIf,
java.lang.String name,
java.lang.String targetId)
Creates an instance of the ProgramReceiveTarget. |
Method Summary | |
---|---|
int |
compareTo(ProgramReceiveTarget other)
|
static ProgramReceiveTarget[] |
createDefaultTargetArrayForProgramReceiveIf(ProgramReceiveIf receiveIf)
Creates the default target for a ProgramReceiveIf. |
static ProgramReceiveTarget |
createDefaultTargetForProgramReceiveIfId(java.lang.String receiveIfId)
Creates the default target for an id of a ProgramReceiveIf. |
boolean |
equals(java.lang.Object o)
|
ProgramReceiveIf |
getReceifeIfForIdOfTarget()
|
java.lang.String |
getReceiveIfId()
|
java.lang.String |
getTargetId()
|
java.lang.String |
getTargetName()
get the target name (for display) |
int |
hashCode()
|
static boolean |
isDefaultProgramReceiveTargetForProgramReceiveIf(ProgramReceiveIf receiveIf,
ProgramReceiveTarget receiveTarget)
Checks if the given target is the default target for the given ProgramReceiveIf. |
boolean |
isReceiveTargetWithIdOfProgramReceiveIf(ProgramReceiveIf receiveIf,
java.lang.String id)
Checks if the given id is used by this instance of ProgramReceiveTarget and contains to the given ProgramReceiveIf. |
void |
receivePrograms(Program[] programs)
Send the programs to the receive target |
java.lang.String |
toString()
|
void |
writeData(java.io.ObjectOutputStream out)
Use this to save a target. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProgramReceiveTarget(ProgramReceiveIf receiveIf, java.lang.String name, java.lang.String targetId)
receiveIf
- The ProgramReceiveIf (your Plugin) to create for.name
- The name of the target.targetId
- The unique id of the target.public ProgramReceiveTarget(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
writeData(ObjectOutputStream)
.
in
- The input stream.
java.io.IOException
java.lang.ClassNotFoundException
Method Detail |
---|
public static ProgramReceiveTarget[] createDefaultTargetArrayForProgramReceiveIf(ProgramReceiveIf receiveIf)
receiveIf
- The ProgramReceiveIf to create the null target for.
public static ProgramReceiveTarget createDefaultTargetForProgramReceiveIfId(java.lang.String receiveIfId)
receiveIfId
- The id of the ProgramReceiveIf to create for.
public void writeData(java.io.ObjectOutputStream out) throws java.io.IOException
out
-
java.io.IOException
public java.lang.String getTargetName()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getReceiveIfId()
public java.lang.String getTargetId()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public ProgramReceiveIf getReceifeIfForIdOfTarget()
public static boolean isDefaultProgramReceiveTargetForProgramReceiveIf(ProgramReceiveIf receiveIf, ProgramReceiveTarget receiveTarget)
receiveIf
- The ProgramReceiveIf to check.receiveTarget
- The ProgramReceiveTarget to check.
public boolean isReceiveTargetWithIdOfProgramReceiveIf(ProgramReceiveIf receiveIf, java.lang.String id)
id
- The id to check.receiveIf
- The receive if to which the ProgramReceiveTarget is connected.
public int compareTo(ProgramReceiveTarget other)
compareTo
in interface java.lang.Comparable<ProgramReceiveTarget>
public void receivePrograms(Program[] programs)
programs
- programs to send
|
TV-Browser 3.3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |