KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > progress > JobTreeElement


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.progress;
12
13 import org.eclipse.swt.graphics.Image;
14
15 /**
16  * The JobTreeElement is the abstract superclass of items
17  * displayed in the tree.
18  */

19 abstract class JobTreeElement implements Comparable JavaDoc {
20
21     /**
22      * Return the parent of this object.
23      * @return Object
24      */

25     abstract Object JavaDoc getParent();
26
27     /**
28      * Return whether or not the receiver has children.
29      * @return boolean
30      */

31     abstract boolean hasChildren();
32
33     /**
34      * Return the children of the receiver.
35      * @return Object[]
36      */

37     abstract Object JavaDoc[] getChildren();
38
39     /**
40      * Return the displayString for the receiver.
41      * @return String
42      */

43     abstract String JavaDoc getDisplayString();
44     
45     /**
46      * Return the displayString for the receiver.
47      * @param showProgress Whether or not progress is being
48      * shown (if relevant).
49      * @return String
50      */

51     String JavaDoc getDisplayString(boolean showProgress){
52         return getDisplayString();
53     }
54
55     /**
56      * Get the image for the reciever. By default there is no image.
57      * @return Image or <code>null</code>.
58      */

59     public Image getDisplayImage() {
60         return null;
61     }
62
63     /**
64      * Return the condensed version of the display string
65      * @return String
66      */

67     String JavaDoc getCondensedDisplayString() {
68         return getDisplayString();
69     }
70
71     /**
72      * Return whether or not the receiver is an info.
73      * @return boolean
74      */

75     abstract boolean isJobInfo();
76
77     /* (non-Javadoc)
78      * @see java.lang.Comparable#compareTo(java.lang.Object)
79      */

80     public int compareTo(Object JavaDoc arg0) {
81         return getDisplayString().compareTo(
82                 ((JobTreeElement) arg0).getDisplayString());
83     }
84
85     /**
86      * Return whether or not this is currently active.
87      * @return boolean
88      */

89     abstract boolean isActive();
90
91     /**
92      * Return whether or not the receiver can be cancelled.
93      * @return boolean
94      */

95     public boolean isCancellable() {
96         return false;
97     }
98
99     /**
100      * Cancel the receiver.
101      */

102     public void cancel() {
103         //By default do nothing.
104
}
105 }
106
Popular Tags