KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > cheatsheets > views > SubItemCompositeHolder


1 /*******************************************************************************
2  * Copyright (c) 2002, 2007 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.cheatsheets.views;
12
13 import org.eclipse.swt.widgets.*;
14 import org.eclipse.ui.forms.widgets.ImageHyperlink;
15 import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin;
16 import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource;
17 import org.eclipse.ui.internal.cheatsheets.data.SubItem;
18
19 public class SubItemCompositeHolder {
20     private Label checkDoneLabel;
21     private boolean skipped;
22     private boolean completed;
23     private ImageHyperlink startButton;
24     private String JavaDoc thisValue;
25     private SubItem subItem;
26     private Control skipButton;
27     private Control completeButton;
28     private Control subitemLabel;
29     
30     SubItemCompositeHolder(SubItem subItem) {
31         super();
32         this.subItem = subItem;
33     }
34
35     /**
36      * @return Label
37      */

38     /*package*/ Label getCheckDoneLabel() {
39         return checkDoneLabel;
40     }
41
42     /**
43      * @return
44      */

45     public boolean isCompleted() {
46         return completed;
47     }
48
49     /**
50      * @return
51      */

52     public boolean isSkipped() {
53         return skipped;
54     }
55
56     /**
57      * @param isCompleted
58      */

59     /*package*/ void setCompleted(boolean isCompleted) {
60         completed = isCompleted;
61         if (isCompleted && checkDoneLabel != null) {
62             checkDoneLabel.setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_COMPLETE));
63         }
64         checkDoneLabel.setVisible(completed || skipped);
65     }
66
67     /**
68      * @param isSkipped
69      */

70     /*package*/ void setSkipped(boolean isSkipped) {
71         skipped = isSkipped;
72         if (isSkipped && checkDoneLabel != null) {
73             checkDoneLabel.setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_SKIP));
74         }
75         checkDoneLabel.setVisible(completed || skipped);
76     }
77
78     /**
79      * @return Returns the thisValue.
80      */

81     public String JavaDoc getThisValue() {
82         return thisValue;
83     }
84
85     /**
86      * @param thisValue The thisValue to set.
87      */

88     public void setThisValue(String JavaDoc thisValue) {
89         this.thisValue = thisValue;
90     }
91
92     /**
93      * @return Returns the subItem.
94      */

95     public SubItem getSubItem() {
96         return subItem;
97     }
98     
99     /**
100      * Hide or reveal all the action/complete/skip buttons
101      * @param isVisible
102      */

103     public void setButtonsVisible(boolean isVisible) {
104         if (startButton != null) {
105             startButton.setVisible(isVisible);
106         }
107         if (skipButton != null) {
108             skipButton.setVisible(isVisible);
109         }
110         if (completeButton != null) {
111             completeButton.setVisible(isVisible);
112         }
113     }
114
115     public void setSubitemLabel(Control label) {
116         this.subitemLabel = label;
117     }
118     
119     public Control getSubitemLabel() {
120         return subitemLabel;
121     }
122     
123     public void setStartButton(ImageHyperlink startButton) {
124         this.startButton = startButton;
125     }
126
127     public ImageHyperlink getStartButton() {
128         return startButton;
129     }
130
131     public void setSkipButton(Control skipButton) {
132         this.skipButton = skipButton;
133     }
134
135     public Control getSkipButton() {
136         return skipButton;
137     }
138
139     public void setCompleteButton(Control completeButton) {
140         this.completeButton = completeButton;
141     }
142
143     public Control getCompleteButton() {
144         return completeButton;
145     }
146
147     public void setCheckDoneLabel(Label checkDoneLabel) {
148         this.checkDoneLabel = checkDoneLabel;
149     }
150 }
151
Popular Tags