- java.lang.Object
-
- devplugin.PluginTreeNode
-
- All Implemented Interfaces:
java.lang.Comparable<PluginTreeNode>
public class PluginTreeNode extends java.lang.Object implements java.lang.Comparable<PluginTreeNode>
The PluginTreeNode class represents a single node of the plugin tree view.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PluginTreeNode.RemovedProgramsHandler
-
Constructor Summary
Constructors Constructor Description PluginTreeNode(boolean handleTvDataUpdate, Plugin plugin)
Creates a new root PluginTreeNodePluginTreeNode(Marker marker)
Creates a new root PluginTreeNode On TV listings updates, thePluginTreeListener
gets informed.PluginTreeNode(Marker marker, boolean handleTvDataUpdate)
Creates a new root PluginTreeNodePluginTreeNode(Plugin plugin)
creates a plugin root node WITHOUT markerPluginTreeNode(ProgramItem item)
Creates a new Node containing a program item.PluginTreeNode(java.lang.String title)
Creates a new PluginTreeNode object with a specified title
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(PluginTreeNode node)
void
addAction(javax.swing.Action action)
void
addActionMenu(ActionMenu menu)
Adds a an action menu to this nodePluginTreeNode
addNode(java.lang.String title)
void
addNodeListener(PluginTreeListener listener)
PluginTreeNode
addProgram(Program program)
Add a single program as child to this tree node.void
addPrograms(java.util.List<Program> listNew)
Add several program as children to this tree node.PluginTreeNode
addProgramWithoutCheck(Program program)
Add a single program node as child to this tree node.void
clear()
int
compareTo(PluginTreeNode other)
boolean
contains(Program prog)
boolean
contains(Program prog, boolean recursive)
ActionMenu[]
getActionMenus()
PluginTreeNode[]
getChildren()
Node
getMutableTreeNode()
ProgramItem[]
getProgramItems()
Program[]
getPrograms()
java.lang.Object
getUserObject()
boolean
isEmpty()
boolean
isLeaf()
void
load(java.io.ObjectInputStream in)
void
removeAllActions()
void
removeAllChildren()
void
removeAllNodeListeners()
boolean
removeNodeListener(PluginTreeListener listener)
void
removeProgram(Program program)
void
removeProgram(ProgramItem item)
void
setGroupingByDateEnabled(boolean enable)
Enables/Disables the 'grouping by date'-feature.void
setGroupingByWeekEnabled(boolean enable)
Enables/Disables 'grouping by week' for nodes showing programs by date.void
setNodeFormatter(NodeFormatter formatter)
Sets the formatter for this node and all of the child nodes.int
size()
Get the number of child nodes.void
store(java.io.ObjectOutputStream out)
java.lang.String
toString()
void
update()
Refreshes the tree in the user interface.
-
-
-
Constructor Detail
-
PluginTreeNode
public PluginTreeNode(java.lang.String title)
Creates a new PluginTreeNode object with a specified title- Parameters:
title
- The title for the node.
-
PluginTreeNode
public PluginTreeNode(Marker marker)
Creates a new root PluginTreeNode On TV listings updates, thePluginTreeListener
gets informed.- Parameters:
marker
- The Marker to create the root node for.
-
PluginTreeNode
public PluginTreeNode(Plugin plugin)
creates a plugin root node WITHOUT marker- Parameters:
plugin
- The Plugin to create the root node for.- Since:
- 3.0
-
PluginTreeNode
public PluginTreeNode(boolean handleTvDataUpdate, Plugin plugin)
Creates a new root PluginTreeNode- Parameters:
plugin
- The plugin to create the root node for.handleTvDataUpdate
- specifies, if thePluginTreeListener
should get called on TV listings updates- Since:
- 3.0
-
PluginTreeNode
public PluginTreeNode(Marker marker, boolean handleTvDataUpdate)
Creates a new root PluginTreeNode- Parameters:
marker
- The Marker to create the root node for.handleTvDataUpdate
- specifies, if thePluginTreeListener
should get called on TV listings updates
-
PluginTreeNode
public PluginTreeNode(ProgramItem item)
Creates a new Node containing a program item.- Parameters:
item
- The program item to create the node for.
-
-
Method Detail
-
addNodeListener
public void addNodeListener(PluginTreeListener listener)
-
removeNodeListener
public boolean removeNodeListener(PluginTreeListener listener)
-
removeAllNodeListeners
public void removeAllNodeListeners()
-
getMutableTreeNode
public Node getMutableTreeNode()
-
addActionMenu
public void addActionMenu(ActionMenu menu)
Adds a an action menu to this node- Parameters:
menu
- The action menu to add to this node.
-
removeAllActions
public void removeAllActions()
-
addAction
public void addAction(javax.swing.Action action)
-
getActionMenus
public ActionMenu[] getActionMenus()
-
setNodeFormatter
public void setNodeFormatter(NodeFormatter formatter)
Sets the formatter for this node and all of the child nodes.- Parameters:
formatter
- the formatter
-
setGroupingByDateEnabled
public void setGroupingByDateEnabled(boolean enable)
Enables/Disables the 'grouping by date'-feature. Default is 'enabled'- Parameters:
enable
-true
if grouping should be enabled,false
if not.
-
setGroupingByWeekEnabled
public void setGroupingByWeekEnabled(boolean enable)
Enables/Disables 'grouping by week' for nodes showing programs by date. Only evaluated if "grouping by date" is enabled. Default is 'disabled'- Parameters:
enable
-true
if grouping should be enabled,false
if not.- See Also:
setGroupingByDateEnabled(boolean)
-
getUserObject
public java.lang.Object getUserObject()
-
removeAllChildren
public void removeAllChildren()
-
add
public void add(PluginTreeNode node)
-
contains
public boolean contains(Program prog, boolean recursive)
-
contains
public boolean contains(Program prog)
-
update
public void update()
Refreshes the tree in the user interface. Call this method after you have added/removed/changed nodes of the tree or its children. Otherwise those changes will not get visible.
-
addPrograms
public void addPrograms(java.util.List<Program> listNew)
Add several program as children to this tree node. If the programs are already contained in this sub tree, it is not added again.
After you have finished adding all programs, you need to callupdate()
to refresh the UI.- Parameters:
listNew
- list of new programs
-
addProgram
public PluginTreeNode addProgram(Program program)
Add a single program as child to this tree node. If the program is already contained in this sub tree, it is not added again.
After you have finished adding all programs, you need to callupdate()
to refresh the UI.- Parameters:
program
- The program to add.- Returns:
- the tree node containing the program
-
addProgramWithoutCheck
public PluginTreeNode addProgramWithoutCheck(Program program)
Add a single program node as child to this tree node. It is not checked if the program is already contained in this sub tree, so you may only use this method with newly created tree nodes!
After you have finished adding all programs, you need to callupdate()
to refresh the UI.- Parameters:
program
- The program to add.- Returns:
- the tree node containing the program
-
removeProgram
public void removeProgram(ProgramItem item)
-
removeProgram
public void removeProgram(Program program)
-
addNode
public PluginTreeNode addNode(java.lang.String title)
-
getProgramItems
public ProgramItem[] getProgramItems()
-
getPrograms
public Program[] getPrograms()
-
store
public void store(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
load
public void load(java.io.ObjectInputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
size
public int size()
Get the number of child nodes.- Returns:
- number of child nodes
-
clear
public void clear()
-
isEmpty
public boolean isEmpty()
-
isLeaf
public boolean isLeaf()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getChildren
public PluginTreeNode[] getChildren()
- Returns:
- copy of child node collection
- Since:
- 3.0
-
compareTo
public int compareTo(PluginTreeNode other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PluginTreeNode>
-
-