1 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 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 38 Label getCheckDoneLabel() { 39 return checkDoneLabel; 40 } 41 42 45 public boolean isCompleted() { 46 return completed; 47 } 48 49 52 public boolean isSkipped() { 53 return skipped; 54 } 55 56 59 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 70 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 81 public String getThisValue() { 82 return thisValue; 83 } 84 85 88 public void setThisValue(String thisValue) { 89 this.thisValue = thisValue; 90 } 91 92 95 public SubItem getSubItem() { 96 return subItem; 97 } 98 99 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 |