org.eclipse.mylar.internal.tasks.ui.editors
Class RepositoryTaskOutlineNode

java.lang.Object
  extended by org.eclipse.mylar.internal.tasks.ui.editors.RepositoryTaskOutlineNode
All Implemented Interfaces:
org.eclipse.jface.viewers.ISelection, IRepositoryTaskSelection

public class RepositoryTaskOutlineNode
extends java.lang.Object
implements IRepositoryTaskSelection

A node for the tree in the RepositoryTaskOutlinePage.

Author:
Mik Kersten (hardening of prototype)

Field Summary
private  java.lang.String bugSummary
           
private  java.lang.Object data
           
private  boolean fromEditor
           
protected  java.lang.String id
          The id of the Bugzilla object that the selection was on.
private  boolean isCommentHeader
           
private  boolean isDescription
           
private  java.lang.String key
          The label for this piece of data.
(package private) static java.lang.String LABEL_COMMENTS
           
(package private) static java.lang.String LABEL_DESCRIPTION
           
(package private) static java.lang.String LABEL_NEW_COMMENT
           
private  java.util.ArrayList<RepositoryTaskOutlineNode> nodeChildren
          The children of this node.
private  RepositoryTaskOutlineNode parent
          The parent of this node or null if it is the bug report
protected  java.lang.String server
          The server of the Bugzilla object that the selection was on.
 
Constructor Summary
RepositoryTaskOutlineNode(java.lang.String id, java.lang.String server, java.lang.String key, java.lang.Object data, java.lang.String summary)
          Creates a new RepositoryTaskOutlineNode.
 
Method Summary
 void addChild(RepositoryTaskOutlineNode bugNode)
          Adds a node to this node's list of children.
 boolean equals(java.lang.Object arg0)
           
 java.lang.String getBugSummary()
           
 RepositoryTaskOutlineNode[] getChildren()
           
 TaskComment getComment()
           
 java.lang.String getContents()
           
 java.lang.Object getData()
           
 java.lang.String getId()
           
 java.lang.String getKey()
           
 java.lang.String getName()
           
 RepositoryTaskOutlineNode getParent()
           
 java.lang.String getServer()
           
 boolean hasComment()
           
 int hashCode()
           
 boolean isCommentHeader()
           
 boolean isDescription()
           
 boolean isEmpty()
           
 boolean isFromEditor()
           
static RepositoryTaskOutlineNode parseBugReport(RepositoryTaskData bug)
           
static RepositoryTaskOutlineNode parseBugReport(RepositoryTaskData bug, boolean hasNewComment)
          Parses the given IBugzillaBug into a tree of RepositoryTaskOutlineNode's suitable for use in the RepositoryTaskOutlinePage view.
protected static RepositoryTaskOutlineNode parseExistingBugReport(RepositoryTaskData bug, boolean hasNewComment)
          Parses the given BugReport into a tree of RepositoryTaskOutlineNode's suitable for use in the RepositoryTaskOutlinePage view.
 void setComment(TaskComment taskComment)
          Sets the Comment object for this selection.
 void setContents(java.lang.String contents)
          Sets the contents of the selection.
 void setData(java.lang.Object data)
          Sets the data that this node represents.
 void setId(java.lang.String id)
          Sets the id of the Bugzilla object that the selection was on.
 void setIsCommentHeader(boolean isCommentHeader)
           
 void setIsDescription(boolean isDescription)
           
 void setParent(RepositoryTaskOutlineNode parent)
           
 void setServer(java.lang.String server)
          Sets the server of the Bugzilla object that the selection was on.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL_DESCRIPTION

static final java.lang.String LABEL_DESCRIPTION
See Also:
Constant Field Values

LABEL_COMMENTS

static final java.lang.String LABEL_COMMENTS
See Also:
Constant Field Values

LABEL_NEW_COMMENT

static final java.lang.String LABEL_NEW_COMMENT
See Also:
Constant Field Values

id

protected java.lang.String id
The id of the Bugzilla object that the selection was on.


server

protected java.lang.String server
The server of the Bugzilla object that the selection was on.


key

private java.lang.String key
The label for this piece of data.


nodeChildren

private java.util.ArrayList<RepositoryTaskOutlineNode> nodeChildren
The children of this node.


parent

private RepositoryTaskOutlineNode parent
The parent of this node or null if it is the bug report


data

private java.lang.Object data

bugSummary

private java.lang.String bugSummary

fromEditor

private boolean fromEditor

isCommentHeader

private boolean isCommentHeader

isDescription

private boolean isDescription
Constructor Detail

RepositoryTaskOutlineNode

public RepositoryTaskOutlineNode(java.lang.String id,
                                 java.lang.String server,
                                 java.lang.String key,
                                 java.lang.Object data,
                                 java.lang.String summary)
Creates a new RepositoryTaskOutlineNode.

Parameters:
id - The id of the bug this outline is for.
server - The server of the bug this outline is for.
key - The label for this node.
image - The image that will be displayed by this node in the tree.
data - The data, if necessary, this node represents.
parent - The parent of this node
Method Detail

isFromEditor

public boolean isFromEditor()

getChildren

public RepositoryTaskOutlineNode[] getChildren()
Returns:
The children of this node, represented as an Object array.

addChild

public void addChild(RepositoryTaskOutlineNode bugNode)
Adds a node to this node's list of children.

Parameters:
bugNode - The new child.

getKey

public java.lang.String getKey()
Returns:
The label of this node.

equals

public boolean equals(java.lang.Object arg0)
Overrides:
equals in class java.lang.Object
Returns:
true if the given object is another node representing the same piece of data in the editor.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getName

public java.lang.String getName()
Returns:
The name of this node.

getData

public java.lang.Object getData()
Returns:
The data (where applicable) this node represents.

setData

public void setData(java.lang.Object data)
Sets the data that this node represents.

Parameters:
data - The new piece of data.

parseBugReport

public static RepositoryTaskOutlineNode parseBugReport(RepositoryTaskData bug,
                                                       boolean hasNewComment)
Parses the given IBugzillaBug into a tree of RepositoryTaskOutlineNode's suitable for use in the RepositoryTaskOutlinePage view.

Parameters:
bug - The bug that needs parsing.
Returns:
The tree of RepositoryTaskOutlineNode's.

parseBugReport

public static RepositoryTaskOutlineNode parseBugReport(RepositoryTaskData bug)

parseExistingBugReport

protected static RepositoryTaskOutlineNode parseExistingBugReport(RepositoryTaskData bug,
                                                                  boolean hasNewComment)
Parses the given BugReport into a tree of RepositoryTaskOutlineNode's suitable for use in the RepositoryTaskOutlinePage view.

Parameters:
bug - The BugReport that needs parsing.
Returns:
The tree of RepositoryTaskOutlineNode's.

hasComment

public boolean hasComment()
Specified by:
hasComment in interface IRepositoryTaskSelection
Returns:
true if a comment was selected.

getComment

public TaskComment getComment()
Specified by:
getComment in interface IRepositoryTaskSelection
Returns:
the Comment object for this selection, or null if a comment was not selected.

setComment

public void setComment(TaskComment taskComment)
Description copied from interface: IRepositoryTaskSelection
Sets the Comment object for this selection. If a comment was not selected, then this should be null.

Specified by:
setComment in interface IRepositoryTaskSelection
Parameters:
taskComment - The selection's comment, or null if not applicable.

getContents

public java.lang.String getContents()
Specified by:
getContents in interface IRepositoryTaskSelection
Returns:
The contents of the selection. This can be null.

setContents

public void setContents(java.lang.String contents)
Description copied from interface: IRepositoryTaskSelection
Sets the contents of the selection.

Specified by:
setContents in interface IRepositoryTaskSelection
Parameters:
contents - The selection.

getId

public java.lang.String getId()
Specified by:
getId in interface IRepositoryTaskSelection
Returns:
The id of the Bugzilla object that the selection was on.

setId

public void setId(java.lang.String id)
Description copied from interface: IRepositoryTaskSelection
Sets the id of the Bugzilla object that the selection was on.

Specified by:
setId in interface IRepositoryTaskSelection
Parameters:
id - The id of the bug.

getServer

public java.lang.String getServer()
Specified by:
getServer in interface IRepositoryTaskSelection
Returns:
The server of the Bugzilla object that the selection was on, or null if no server is supplied.

setServer

public void setServer(java.lang.String server)
Description copied from interface: IRepositoryTaskSelection
Sets the server of the Bugzilla object that the selection was on.

Specified by:
setServer in interface IRepositoryTaskSelection
Parameters:
server - The server of the bug.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface org.eclipse.jface.viewers.ISelection

getParent

public RepositoryTaskOutlineNode getParent()

setParent

public void setParent(RepositoryTaskOutlineNode parent)

isCommentHeader

public boolean isCommentHeader()
Specified by:
isCommentHeader in interface IRepositoryTaskSelection

isDescription

public boolean isDescription()
Specified by:
isDescription in interface IRepositoryTaskSelection

setIsCommentHeader

public void setIsCommentHeader(boolean isCommentHeader)

setIsDescription

public void setIsDescription(boolean isDescription)

getBugSummary

public java.lang.String getBugSummary()
Specified by:
getBugSummary in interface IRepositoryTaskSelection