001: /*******************************************************************************
002: * Copyright (c) 2002, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal.cheatsheets.views;
011:
012: import org.eclipse.swt.widgets.*;
013: import org.eclipse.ui.forms.widgets.ImageHyperlink;
014: import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin;
015: import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource;
016: import org.eclipse.ui.internal.cheatsheets.data.SubItem;
017:
018: public class SubItemCompositeHolder {
019: private Label checkDoneLabel;
020: private boolean skipped;
021: private boolean completed;
022: private ImageHyperlink startButton;
023: private String this Value;
024: private SubItem subItem;
025: private Control skipButton;
026: private Control completeButton;
027: private Control subitemLabel;
028:
029: SubItemCompositeHolder(SubItem subItem) {
030: super ();
031: this .subItem = subItem;
032: }
033:
034: /**
035: * @return Label
036: */
037: /*package*/Label getCheckDoneLabel() {
038: return checkDoneLabel;
039: }
040:
041: /**
042: * @return
043: */
044: public boolean isCompleted() {
045: return completed;
046: }
047:
048: /**
049: * @return
050: */
051: public boolean isSkipped() {
052: return skipped;
053: }
054:
055: /**
056: * @param isCompleted
057: */
058: /*package*/void setCompleted(boolean isCompleted) {
059: completed = isCompleted;
060: if (isCompleted && checkDoneLabel != null) {
061: checkDoneLabel
062: .setImage(CheatSheetPlugin
063: .getPlugin()
064: .getImage(
065: ICheatSheetResource.CHEATSHEET_ITEM_COMPLETE));
066: }
067: checkDoneLabel.setVisible(completed || skipped);
068: }
069:
070: /**
071: * @param isSkipped
072: */
073: /*package*/void setSkipped(boolean isSkipped) {
074: skipped = isSkipped;
075: if (isSkipped && checkDoneLabel != null) {
076: checkDoneLabel
077: .setImage(CheatSheetPlugin.getPlugin().getImage(
078: ICheatSheetResource.CHEATSHEET_ITEM_SKIP));
079: }
080: checkDoneLabel.setVisible(completed || skipped);
081: }
082:
083: /**
084: * @return Returns the thisValue.
085: */
086: public String getThisValue() {
087: return this Value;
088: }
089:
090: /**
091: * @param thisValue The thisValue to set.
092: */
093: public void setThisValue(String this Value) {
094: this .this Value = this Value;
095: }
096:
097: /**
098: * @return Returns the subItem.
099: */
100: public SubItem getSubItem() {
101: return subItem;
102: }
103:
104: /**
105: * Hide or reveal all the action/complete/skip buttons
106: * @param isVisible
107: */
108: public void setButtonsVisible(boolean isVisible) {
109: if (startButton != null) {
110: startButton.setVisible(isVisible);
111: }
112: if (skipButton != null) {
113: skipButton.setVisible(isVisible);
114: }
115: if (completeButton != null) {
116: completeButton.setVisible(isVisible);
117: }
118: }
119:
120: public void setSubitemLabel(Control label) {
121: this .subitemLabel = label;
122: }
123:
124: public Control getSubitemLabel() {
125: return subitemLabel;
126: }
127:
128: public void setStartButton(ImageHyperlink startButton) {
129: this .startButton = startButton;
130: }
131:
132: public ImageHyperlink getStartButton() {
133: return startButton;
134: }
135:
136: public void setSkipButton(Control skipButton) {
137: this .skipButton = skipButton;
138: }
139:
140: public Control getSkipButton() {
141: return skipButton;
142: }
143:
144: public void setCompleteButton(Control completeButton) {
145: this .completeButton = completeButton;
146: }
147:
148: public Control getCompleteButton() {
149: return completeButton;
150: }
151:
152: public void setCheckDoneLabel(Label checkDoneLabel) {
153: this.checkDoneLabel = checkDoneLabel;
154: }
155: }
|