View Javadoc

1   /*
2    * Created on Apr 26, 2005, Copyright UC Regents
3    */
4   package org.telscenter.pas.navigation;
5   
6   import java.awt.BorderLayout;
7   import java.awt.Color;
8   import java.awt.Component;
9   import java.awt.Dimension;
10  import java.awt.FlowLayout;
11  import java.awt.Font;
12  import java.awt.Image;
13  import java.awt.event.ActionEvent;
14  import java.awt.event.ActionListener;
15  import java.awt.event.MouseEvent;
16  import java.awt.event.MouseListener;
17  import java.awt.event.WindowAdapter;
18  import java.awt.event.WindowEvent;
19  import java.beans.BeanInfo;
20  import java.util.Collection;
21  import java.util.HashMap;
22  import java.util.HashSet;
23  import java.util.Iterator;
24  import java.util.Map;
25  import java.util.Set;
26  import java.util.logging.Level;
27  import java.util.logging.Logger;
28  
29  import javax.swing.AbstractAction;
30  import javax.swing.Action;
31  import javax.swing.BorderFactory;
32  import javax.swing.Box;
33  import javax.swing.BoxLayout;
34  import javax.swing.ImageIcon;
35  import javax.swing.JButton;
36  import javax.swing.JComponent;
37  import javax.swing.JDialog;
38  import javax.swing.JLabel;
39  import javax.swing.JPanel;
40  import javax.swing.JScrollPane;
41  import javax.swing.JTextArea;
42  import javax.swing.SwingConstants;
43  import javax.swing.ToolTipManager;
44  import javax.swing.UIManager;
45  import javax.swing.border.CompoundBorder;
46  import javax.swing.border.LineBorder;
47  
48  import net.sf.sail.core.entity.ISock;
49  import net.sf.sail.core.entity.ISockEntry;
50  import net.sf.sail.core.util.SailBeanUtils;
51  
52  import org.apache.commons.collections.map.ListOrderedMap;
53  import org.jdesktop.swingx.JXTaskPaneContainer;
54  import org.jdesktop.swingx.plaf.LookAndFeelAddons;
55  import org.jdesktop.swingx.plaf.aqua.AquaLookAndFeelAddons;
56  import org.telscenter.pas.beans.ExitSessionAction;
57  import org.telscenter.pas.beans.PasActivity;
58  import org.telscenter.pas.beans.PasStep;
59  import org.telscenter.pas.common.ui.CommonUI;
60  import org.telscenter.pas.common.ui.StringUtils;
61  import org.telscenter.pas.common.ui.border.CustomLineBorder;
62  import org.telscenter.pas.common.ui.button.GradientTextIcon;
63  import org.telscenter.pas.common.ui.panel.SimpleGradientPanel;
64  import org.telscenter.pas.navigation.events.INavigationListener;
65  import org.telscenter.pas.service.PasProjectServiceProvider;
66  import org.telscenter.pas.steps.ChallengeQuestion;
67  import org.telscenter.pas.steps.INoteStep;
68  import org.telscenter.pas.steps.Note;
69  import org.telscenter.pas.steps.ProjectInfoStep;
70  import org.telscenter.pas.steps.ShowAllWorkStep;
71  import org.telscenter.pas.steps.StudentAssessment;
72  import org.telscenter.pas.steps.icons.PasStepIconProvider;
73  import org.telscenter.pas.ui.MultiLineLabelUI;
74  import org.telscenter.pas.ui.frames.PasFrame;
75  import org.telscenter.pas.ui.panel.PasGroupButtonPanel;
76  import org.telscenter.pas.ui.util.PasColors;
77  
78  public class PasProjectNavigationTaskPanel extends PasProjectNavigationPanel {
79  	/***
80  	 * 
81  	 */
82  	private static final String STEP_INDEX = "step_index";
83  
84  	private static final String HINT_TOOL_TIP = "Get a Hint";
85  
86  	/***
87  	 * 
88  	 */
89  	private static final String ACTIVITY_INDEX = "ACTIVITY_INDEX";
90  
91  	protected static final String STEP = "STEP";
92  
93  	/***
94  	 * Logger for this class
95  	 */
96  	private static final Logger logger = Logger
97  			.getLogger(PasProjectNavigationTaskPanel.class.getName());
98  
99  	protected static final Image DEFAULTIMAGE_32 = PasStepIconProvider.getIcon(
100 			"blank", BeanInfo.ICON_COLOR_32x32); //$NON-NLS-1$
101 
102 	protected JButton lastStepButton;
103 
104 	protected String userNames;
105 
106 	private Map<PasStep, PasGroupButtonPanel> stepsToButtonPanels = new HashMap<PasStep, PasGroupButtonPanel>();
107 
108 	private ListOrderedMap stepsToGroups = new ListOrderedMap();
109 
110 	private AbstractAction projectInfoAction;
111 
112 	private AbstractAction showAllWorkAction;
113 
114 	private JButton toggleSidebarOff;
115 
116 	private PasFrame projectFrame;
117 
118 	private PasStep projInfoStep;
119 
120 	private PasStep workStep;
121 
122 	private PasGroupButtonPanel backgroundGradientPanel;
123 
124 	private LineBorder selectedLineBorder = (LineBorder) BorderFactory
125 			.createLineBorder(PasColors.navigationSelectionEndColor, 1);
126 
127 	private LineBorder nonSelectedLineBorder = (LineBorder) BorderFactory
128 			.createLineBorder(PasColors.navigationNonSelectionColor, 0);
129 
130 	private JPanel compactNavigationViewPanel;
131 
132 	private JPanel upperLeftCornerPanel;
133 
134 	private JTextArea userNameLabel;
135 
136 	private JLabel activityLabel;
137 
138 	private JLabel stepLabel;
139 
140 	private JButton minusStepButton;
141 
142 	private JButton addStepButton;
143 
144 	private JButton compactHintButton;
145 
146 	private JLabel projectNameLabel;
147 
148 	private JButton showAllWorkButton;
149 
150 	private JButton projInfoButton;
151 
152 	public PasProjectNavigationTaskPanel(PasProjectServiceProvider provider) {
153 
154 		// for gradient painting
155 		System.setProperty("sun.awt.noerasebackground", "true");
156 
157 		pasProjectServiceProvider = provider;
158 		this.projectFrame = pasProjectServiceProvider.getPasProject()
159 				.getProjectFrame();
160 		pasProjectServiceProvider.getNavigationService().addNavigationListener(
161 				new INavigationListener() {
162 					public void newCurrentStep(PasStep currentStep) {
163 						adjustScrollPanels(currentStep);
164 					}
165 				});
166 		upperLeftCornerPanel = initUpperLeftCorner();
167 		initCompactNavigationView();
168 		// So ToolTips from disabled hint buttons don't display differently from
169 		// the ToolTips from their corresponding panels and step buttons. (They
170 		// are supposed to look the same.)
171 		UIManager.put("ToolTip.backgroundInactive", UIManager
172 				.get("ToolTip.background"));
173 		UIManager.put("ToolTip.foregroundInactive", UIManager
174 				.get("ToolTip.foreground"));
175 		ToolTipManager.sharedInstance().setInitialDelay(
176 				ToolTipManager.sharedInstance().getInitialDelay() + 250);
177 		ToolTipManager.sharedInstance().setReshowDelay(0);
178 	}
179 
180 	/***
181 	 * 
182 	 */
183 	protected void initCompactNavigationView() {
184 		JPanel mainPanel = createVerticalImagePanel();
185 
186 		compactNavigationViewPanel = new JPanel();
187 		compactNavigationViewPanel
188 				.setBackground(PasColors.compactNavBackgroundStartColor);
189 		compactNavigationViewPanel.setLayout(new BorderLayout(0, 0));
190 
191 		compactNavigationViewPanel.add(mainPanel, BorderLayout.NORTH);
192 
193 		SimpleGradientPanel gradientPanel = createGradientPanel();
194 
195 		Box innerGradient = Box.createVerticalBox();
196 		innerGradient.setOpaque(false);
197 		innerGradient.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
198 
199 		JButton collapseCompactViewButton = this.projectFrame
200 				.getSidebarMediator().getCollapseCompactViewButton();
201 
202 		JPanel bPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 2, 2));
203 		bPanel.setOpaque(false);
204 		bPanel.add(collapseCompactViewButton);
205 
206 		innerGradient.add(Box.createVerticalStrut(25));
207 		innerGradient.add(bPanel);
208 		innerGradient.add(Box.createVerticalStrut(40));
209 
210 		JPanel navPanel = createNavButtonPanel();
211 
212 		JPanel nPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 2, 2));
213 		nPanel.setOpaque(false);
214 		nPanel.add(navPanel);
215 
216 		innerGradient.add(nPanel);
217 		innerGradient.add(Box.createVerticalStrut(10));
218 
219 		compactHintButton = new JButton(makeHintAction());
220 		compactHintButton.setToolTipText(HINT_TOOL_TIP);
221 		CommonUI.makeHintbutton(compactHintButton);
222 
223 		JPanel hintButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER,
224 				2, 2));
225 		hintButtonPanel.setOpaque(false);
226 		hintButtonPanel.add(compactHintButton);
227 		compactHintButton.setEnabled(false);
228 		innerGradient.add(hintButtonPanel);
229 
230 		JPanel p = new JPanel(new BorderLayout(0, 0));
231 		p.setOpaque(false);
232 		p.add(innerGradient, BorderLayout.NORTH);
233 
234 		gradientPanel.add(p);
235 
236 		compactNavigationViewPanel.add(gradientPanel, BorderLayout.CENTER);
237 
238 	}
239 
240 	private SimpleGradientPanel createGradientPanel() {
241 		SimpleGradientPanel gradientPanel = new SimpleGradientPanel();
242 		gradientPanel.setDirection(SimpleGradientPanel.VERTICAL);
243 		gradientPanel.setLayout(new BoxLayout(gradientPanel, BoxLayout.Y_AXIS));
244 		// add the components
245 		gradientPanel.setStartColor(PasColors.compactNavBackgroundStartColor);
246 		gradientPanel.setEndColor(PasColors.compactNavBackgroundEndColor);
247 		gradientPanel.setAlignmentY(Component.TOP_ALIGNMENT);
248 		return gradientPanel;
249 	}
250 
251 	/***
252 	 * @return
253 	 */
254 	protected JPanel createVerticalImagePanel() {
255 		JPanel topImagePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
256 		topImagePanel.setOpaque(false);
257 		topImagePanel.setBorder(BorderFactory.createEmptyBorder());
258 
259 		JButton wiseVerIcon = new JButton(new ImageIcon(this.getClass()
260 				.getResource("icons/wiseVerIcon.png")));
261 		wiseVerIcon
262 				.setToolTipText("Web-Based Inquiry Science Environment (v3.0)");
263 		CommonUI.makeButtonTransparent(wiseVerIcon);
264 		wiseVerIcon.setBorder(BorderFactory.createEmptyBorder(0, 1, 1, 1));
265 		topImagePanel.add(wiseVerIcon);
266 
267 		JPanel mainPanel = new JPanel();
268 		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
269 		mainPanel.setBackground(PasColors.pandaPanelBackgroundColor);
270 		mainPanel.setBorder(BorderFactory.createEmptyBorder());
271 		mainPanel.add(topImagePanel);
272 
273 		// da stripe
274 		JPanel innerStripedPanel = getInnerStripedPanel();
275 
276 		mainPanel.add(innerStripedPanel);
277 		return mainPanel;
278 	}
279 
280 	/***
281 	 * @return
282 	 */
283 	private JPanel getInnerStripedPanel() {
284 		JPanel innerStripedPanel = new JPanel(new BorderLayout(0, 0));
285 		innerStripedPanel.setBackground(PasColors.innerStripBackgroundColor);
286 		innerStripedPanel.setBorder(new CustomLineBorder(
287 				PasColors.outerStripeBackgroundColor, 2, Color.white, 0,
288 				PasColors.outerStripeBackgroundColor, 2,
289 				PasColors.outerStripeBackgroundColor, 0));
290 
291 		innerStripedPanel.setPreferredSize(new Dimension(innerStripedPanel
292 				.getPreferredSize().width, 6));
293 		innerStripedPanel.setMaximumSize(new Dimension(innerStripedPanel
294 				.getMaximumSize().width, 6));
295 		return innerStripedPanel;
296 	}
297 
298 	/***
299 	 * This method determines the last step that was opened in the project
300 	 * (based on looking at the last opened element in the navigation log sock),
301 	 * and starts off the project by navigating immediately to that step in the
302 	 * project. If there is no last step that was opened, the very first step of
303 	 * the entire project will be opened upon loading the project (if there is
304 	 * no current step the student was on), or the current step is navigated to.
305 	 * 
306 	 * @return
307 	 */
308 	protected Action addStepAction = new AbstractAction() {
309 
310 		public void actionPerformed(ActionEvent e) {
311 			if (activities.length == 0) {
312 				logger
313 						.warning("cannot go to first step since there are no activities");
314 				return;
315 			}
316 
317 			// will be null if user hasn't navigated anywhere yet
318 			PasStep currentStep = pasProjectServiceProvider
319 					.getNavigationService().getCurrentStep();
320 
321 			// first step of the project
322 			if (currentStep == null) {
323 				workStep = new ShowAllWorkStep(pasProjectServiceProvider
324 						.getPasProject(), pasProjectServiceProvider
325 						.getNavigationService());
326 
327 				PasStep[] steps = activities[0].getSteps();
328 
329 				if (steps.length > 0) {
330 					ISockEntry<String> lastStepVisited = getLastStepVisitedInNavigationLogSock();
331 					if (lastStepVisited != null) {
332 						navigateToLastStepVisited(lastStepVisited, e);
333 					} else {
334 						PasStep firstStep = steps[0];
335 						navigateToStep(firstStep, e);
336 					}
337 				}
338 				if (steps.length > 1)
339 					minusStepButton.setEnabled(true);
340 			}// if
341 
342 			else {
343 				// set the next one
344 
345 				PasStep nextStep = (PasStep) stepsToGroups.nextKey(currentStep);
346 				AbstractAction changeStepAction = new ChangeStepAction(null);
347 				changeStepAction.putValue(STEP, nextStep);
348 				changeStepAction.actionPerformed(e);
349 
350 				minusStepButton.setEnabled(true);
351 				adjustPanelSelection(nextStep);
352 			}// if
353 		}
354 	};
355 
356 	private ImageIcon projInfoActiveIcon;
357 
358 	private ImageIcon projInfoSelectedIcon;
359 
360 	private ImageIcon allNotesActiveIcon;
361 
362 	private ImageIcon allNotesSelectedIcon;
363 
364 	private ImageIcon exitButtonActive;
365 
366 	private ImageIcon exitButtonDisabledSelected;
367 
368 	/***
369 	 * navigates to the corresponding step in the navigation task panel and
370 	 * updates the dashboard. the corresponding step, of course, will be
371 	 * highlighted as well
372 	 * 
373 	 * @param step
374 	 * @param e
375 	 * @return
376 	 */
377 	private void navigateToStep(PasStep step, ActionEvent e) {
378 		AbstractAction changeStepAction = new ChangeStepAction(null);
379 		changeStepAction.putValue(STEP, step);
380 		changeStepAction.actionPerformed(e);
381 		adjustPanelSelection(step);
382 		updateDashboard(step);
383 
384 	}
385 
386 	/***
387 	 * navigates to the last step visited in the project by checking the last
388 	 * item in the navigation log sock with all the steps in the project by
389 	 * iterating through the activities and corresponding steps, checking each
390 	 * step with this last item until the identical one is found then this step
391 	 * is shown in the navigation task panel and the dashboard is updated. the
392 	 * corresponding step, of course, will be highlighted as well
393 	 * 
394 	 * @param lastStepVisited
395 	 * @param e
396 	 * @return
397 	 */
398 	private void navigateToLastStepVisited(ISockEntry<String> lastStepVisited,
399 			ActionEvent e) {
400 		for (int iterator = 0; iterator < activities.length; iterator++) {
401 			PasStep[] stepsIterator = activities[iterator].getSteps();
402 			for (PasStep step : stepsIterator) {
403 				String thisStepStr = pasProjectServiceProvider.getPasProject()
404 						.getItemLog("step_open", step);
405 				if (lastStepVisited.getValue().equals(thisStepStr)) {
406 					navigateToStep(step, e);
407 				}
408 			}
409 		}
410 	}
411 
412 	/***
413 	 * retrieves the last visited step which has been opened in the project from
414 	 * the navigation log sock
415 	 * 
416 	 * @return lastElement
417 	 */
418 	private ISockEntry<String> getLastStepVisitedInNavigationLogSock() {
419 		ISock<String> navigationLogSock = pasProjectServiceProvider
420 				.getPasProject().getNavigationLogSock();
421 		ISockEntry<String> lastStepVisited = null;
422 		if (navigationLogSock != null) {
423 			Iterator<ISockEntry<String>> iter = navigationLogSock
424 					.entryIterator();
425 			ISockEntry<String> thisElement = null;
426 			while (iter.hasNext()) {
427 				thisElement = iter.next();
428 				Object sockEntryValue = thisElement.getValue();
429 				if (sockEntryValue.toString().indexOf("step_open") > -1) {
430 					lastStepVisited = thisElement;
431 				}
432 			}
433 		}
434 
435 		return lastStepVisited;
436 	}
437 
438 	/***
439 	 * @return
440 	 */
441 	private JPanel createNavButtonPanel() {
442 
443 		JPanel outerPanel = createOuterPanel();
444 		createAddStepButton();
445 		createMinusStepButton();
446 		minusStepButton.addActionListener(new ActionListener() {
447 
448 			public void actionPerformed(ActionEvent e) {
449 				System.out.println("minus step action called");
450 				PasStep currentStep = pasProjectServiceProvider
451 						.getNavigationService().getCurrentStep();
452 
453 				PasStep previousStep = (PasStep) stepsToGroups
454 						.previousKey(currentStep);
455 
456 				if (previousStep != null) {
457 					AbstractAction changeStepAction = new ChangeStepAction(null);
458 					changeStepAction.putValue(STEP, previousStep);
459 					changeStepAction.actionPerformed(e);
460 					// compactHintButton.setEnabled(previousStep.hasHints());
461 					adjustPanelSelection(previousStep);
462 				} else {
463 					minusStepButton.setEnabled(false);
464 				}
465 
466 			}
467 		});
468 		JPanel dashPanel = createDashPanel();
469 
470 		activityLabel = new JLabel("A0");
471 		activityLabel.setToolTipText("Activity #");
472 		activityLabel.setHorizontalAlignment(JLabel.CENTER);
473 		activityLabel.setHorizontalTextPosition(JLabel.CENTER);
474 		Font labelFont = activityLabel.getFont().deriveFont(12f);
475 
476 		activityLabel.setFont(labelFont);
477 		activityLabel.setOpaque(false);
478 		activityLabel.setForeground(PasColors.compactNavFontColor);
479 		activityLabel.setBackground(Color.cyan);
480 		activityLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
481 
482 		createStepLabel(labelFont);
483 
484 		JPanel apPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
485 		apPanel.setBorder(BorderFactory.createEmptyBorder());
486 		apPanel.setOpaque(false);
487 		apPanel.add(activityLabel);
488 
489 		dashPanel.add(apPanel);
490 
491 		JPanel spPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
492 		spPanel.setOpaque(false);
493 		spPanel.add(stepLabel);
494 		spPanel.setBorder(BorderFactory.createEmptyBorder());
495 
496 		dashPanel.add(spPanel);
497 
498 		JPanel upPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
499 		upPanel.setBorder(BorderFactory.createEmptyBorder());
500 		upPanel.setOpaque(false);
501 		upPanel.add(minusStepButton);
502 
503 		JPanel middlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
504 		middlePanel.setBorder(BorderFactory.createEmptyBorder());
505 		middlePanel.setOpaque(false);
506 		middlePanel.add(dashPanel);
507 
508 		JPanel downPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
509 		downPanel.setBorder(BorderFactory.createEmptyBorder());
510 		downPanel.setOpaque(false);
511 		downPanel.add(addStepButton);
512 
513 		outerPanel.add(upPanel);
514 		outerPanel.add(middlePanel);
515 		outerPanel.add(downPanel);
516 
517 		return outerPanel;
518 	}
519 
520 	/***
521 	 * @return
522 	 */
523 	private JPanel createDashPanel() {
524 		JPanel dashPanel = new JPanel();
525 		dashPanel.setOpaque(false);
526 		dashPanel.setLayout(new BoxLayout(dashPanel, BoxLayout.Y_AXIS));
527 		dashPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
528 				.createLineBorder(PasColors.compactNavDashBorder, 1),
529 				BorderFactory.createEmptyBorder(1, 1, 1, 1)));
530 		dashPanel.setAlignmentX(SwingConstants.CENTER);
531 		return dashPanel;
532 	}
533 
534 	/***
535 	 * @param labelFont
536 	 */
537 	private void createStepLabel(Font labelFont) {
538 		stepLabel = new JLabel("S0");
539 		stepLabel.setToolTipText("Step #");
540 		stepLabel.setHorizontalAlignment(JLabel.CENTER);
541 		stepLabel.setHorizontalTextPosition(JLabel.CENTER);
542 		stepLabel.setFont(labelFont);
543 		stepLabel.setForeground(PasColors.compactNavFontColor);
544 		stepLabel.setOpaque(false);
545 		stepLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
546 	}
547 
548 	/***
549 	 * 
550 	 */
551 	private void createMinusStepButton() {
552 		minusStepButton = new JButton();
553 		CommonUI.makeButtonTransparent(minusStepButton);
554 		minusStepButton.setToolTipText("Go Back One Step");
555 		minusStepButton.setOpaque(false);
556 		minusStepButton.setHorizontalAlignment(SwingConstants.CENTER);
557 		// down.setBackground(Color.red);
558 		minusStepButton.setVerticalAlignment(SwingConstants.CENTER);
559 		minusStepButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
560 		minusStepButton.setRolloverEnabled(true);
561 		minusStepButton.setRolloverIcon(new ImageIcon(this.getClass()
562 				.getResource("icons/minusStepRollover.png")));
563 		minusStepButton.setIcon(new ImageIcon(this.getClass().getResource(
564 				"icons/minusStepNormal.png")));
565 	}
566 
567 	/***
568 	 * 
569 	 */
570 	private void createAddStepButton() {
571 		addStepButton = new JButton();
572 		CommonUI.makeButtonTransparent(addStepButton);
573 		addStepButton.setOpaque(false);
574 		addStepButton.setAction(addStepAction);
575 		addStepButton.setToolTipText("Go Forward One Step");
576 		addStepButton.setHorizontalAlignment(SwingConstants.CENTER);
577 		// up.setBackground(Color.red);
578 		addStepButton.setVerticalAlignment(SwingConstants.CENTER);
579 		addStepButton.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
580 		addStepButton.setRolloverEnabled(true);
581 		addStepButton.setRolloverIcon(new ImageIcon(this.getClass()
582 				.getResource("icons/addStepRollover.png")));
583 		addStepButton.setIcon(new ImageIcon(this.getClass().getResource(
584 				"icons/addStepNormal.png")));
585 	}
586 
587 	/***
588 	 * @return
589 	 */
590 	private JPanel createOuterPanel() {
591 		JPanel outerPanel = new JPanel();
592 		outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
593 		outerPanel.setBorder(BorderFactory.createEmptyBorder());
594 		outerPanel.setOpaque(false);
595 		outerPanel.setAlignmentX(SwingConstants.CENTER);
596 		return outerPanel;
597 	}
598 
599 	protected void setActivityLabel(int activityNum, String activityDescription) {
600 		activityLabel.setText("A" + activityNum);
601 		activityLabel.setToolTipText("Activity " + activityNum + ": "
602 				+ activityDescription);
603 	}
604 
605 	protected void setStepLabel(int stepNum, String stepDescription) {
606 		stepLabel.setText("S" + stepNum);
607 		stepLabel.setToolTipText("Step " + stepNum + ": " + stepDescription);
608 	}
609 
610 	protected Action makeStepAction(final PasStep step, int stepNumber) {
611 
612 		Image image = SailBeanUtils.getLargeBeanIcon(step);
613 		if (image == null)
614 			image = DEFAULTIMAGE_32;
615 		ImageIcon icon = new ImageIcon(image);
616 		AbstractAction changeStepAction;
617 		if (pasProjectServiceProvider.getPasProject().isAutoNumbering()) {
618 			changeStepAction = new ChangeStepAction(stepNumber + ". "
619 					+ step.getTitle());
620 		} else {
621 			changeStepAction = new ChangeStepAction(step.getTitle());
622 		}// if
623 		changeStepAction.putValue(STEP, step);
624 		changeStepAction.putValue(Action.SMALL_ICON, icon);
625 		return changeStepAction;
626 	}
627 
628 	protected PasGroupButtonPanel makeStepButtonGroupPanel(JButton button) {
629 		CommonUI.makeButtonTransparent(button);
630 		button.setDisabledIcon(button.getIcon());
631 		button.setFont(button.getFont().deriveFont(10f));
632 		createBgGradientPanel(button);
633 
634 		// added 5 feb 07 jlei
635 		JButton middleButton = new JButton();
636 		ChangeStepAction middleAction = new ChangeStepAction(null);
637 		middleAction.putValue(STEP, button.getAction().getValue(STEP));
638 		middleButton.setAction(middleAction);
639 		CommonUI.makeButtonTransparent(middleButton);
640 		backgroundGradientPanel.setMiddleButton(middleButton);
641 
642 		backgroundGradientPanel.setBorder(nonSelectedLineBorder);
643 		PasButtonGroupListener pb = new PasButtonGroupListener(
644 				backgroundGradientPanel);
645 
646 		backgroundGradientPanel.addMouseListener(pb);
647 		button.addMouseListener(pb);
648 
649 		// added 5 feb 07 jlei
650 		middleButton.addMouseListener(pb);
651 
652 		JButton hintButton = new JButton(makeHintAction());
653 		hintButton.setToolTipText(HINT_TOOL_TIP);
654 		hintButton.addMouseListener(new HintDisableAction());
655 		hintButton.addMouseListener(pb);
656 		CommonUI.makeHintbutton(hintButton);
657 
658 		backgroundGradientPanel.setRightButton(hintButton);
659 
660 		return backgroundGradientPanel;
661 
662 	}
663 
664 	/***
665 	 * @param button
666 	 */
667 	private void createBgGradientPanel(JButton button) {
668 		backgroundGradientPanel = new PasGroupButtonPanel(
669 				new BorderLayout(0, 0));
670 		backgroundGradientPanel.setDirection(PasGroupButtonPanel.VERTICAL);
671 		backgroundGradientPanel
672 				.setStartColor(PasColors.navigationNonSelectionColor);
673 		backgroundGradientPanel
674 				.setEndColor(PasColors.navigationNonSelectionColor);
675 		backgroundGradientPanel.setSelected(false);
676 		backgroundGradientPanel.setLeftButton(button);
677 	}
678 
679 	class HintDisableAction implements MouseListener {
680 
681 		/*
682 		 * (non-Javadoc)
683 		 * 
684 		 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
685 		 */
686 		public void mouseClicked(MouseEvent me) {
687 			JButton b = (JButton) me.getSource();
688 
689 			if (b.getParent() instanceof PasGroupButtonPanel) {
690 				PasGroupButtonPanel bp = (PasGroupButtonPanel) b.getParent();
691 				if (bp.isSelected() == false) {
692 					bp.getLeftButton().getAction().actionPerformed(null); // changes
693 					// the
694 					// step
695 				}// if
696 			}// if
697 
698 		}
699 
700 		/*
701 		 * (non-Javadoc)
702 		 * 
703 		 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
704 		 */
705 		public void mouseEntered(MouseEvent arg0) {
706 			// TODO Auto-generated method stub
707 
708 		}
709 
710 		/*
711 		 * (non-Javadoc)
712 		 * 
713 		 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
714 		 */
715 		public void mouseExited(MouseEvent arg0) {
716 			// TODO Auto-generated method stub
717 
718 		}
719 
720 		/*
721 		 * (non-Javadoc)
722 		 * 
723 		 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
724 		 */
725 		public void mousePressed(MouseEvent arg0) {
726 			// TODO Auto-generated method stub
727 
728 		}
729 
730 		/*
731 		 * (non-Javadoc)
732 		 * 
733 		 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
734 		 */
735 		public void mouseReleased(MouseEvent arg0) {
736 			// TODO Auto-generated method stub
737 
738 		}
739 
740 	}
741 
742 	protected void makePanelSelected(PasGroupButtonPanel panel) {
743 		panel.setSelected(true);
744 		panel.setStartColor(PasColors.navigationSelectionStartColor);
745 		panel.setEndColor(PasColors.navigationSelectionEndColor);
746 		panel.setBorder(selectedLineBorder);
747 		panel.getRightButton().setEnabled(panel.hasHints());
748 		if (panel.getRightButton().isEnabled()) {
749 			panel.getRightButton().setToolTipText(HINT_TOOL_TIP);
750 		}
751 	}
752 
753 	protected void makePanelNonSelected(PasGroupButtonPanel panel) {
754 		panel.setSelected(false);
755 		panel.setStartColor(PasColors.navigationNonSelectionColor);
756 		panel.setEndColor(PasColors.navigationNonSelectionColor);
757 		panel.setBorder(nonSelectedLineBorder);
758 		panel.getRightButton().setEnabled(false);
759 		panel.getRightButton().setSelected(false);
760 		panel.getRightButton().setToolTipText(panel.getToolTipText());
761 	}
762 
763 	protected void makePanelRollover(PasGroupButtonPanel panel) {
764 		panel.setStartColor(PasColors.navigationRolloverStartColor);
765 		panel.setEndColor(PasColors.navigationRolloverEndColor);
766 		panel.setBorder(nonSelectedLineBorder);
767 	}
768 
769 	protected void makePanelNonRollover(PasGroupButtonPanel panel) {
770 		panel.setStartColor(PasColors.navigationNonSelectionColor);
771 		panel.setEndColor(PasColors.navigationNonSelectionColor);
772 		panel.setBorder(nonSelectedLineBorder);
773 	}
774 
775 	public void adjustPanelSelection(PasStep step) {
776 
777 		PasGroupButtonPanel panel = stepsToButtonPanels.get(step);
778 		adjustPanelSelection(panel);
779 	}
780 
781 	protected void adjustPanelSelection(PasGroupButtonPanel panel) {
782 
783 		Collection<PasStep> set = stepsToButtonPanels.keySet();
784 
785 		for (Iterator<PasStep> iterator = set.iterator(); iterator.hasNext();) {
786 			PasStep pasStep = iterator.next();
787 
788 			PasGroupButtonPanel sp = stepsToButtonPanels.get(pasStep);
789 
790 			if (panel.equals(sp)) {
791 				if (!panel.isSelected())
792 					makePanelSelected(panel);
793 			} else {
794 				makePanelNonSelected(sp);
795 			}// if
796 		}// for
797 
798 	}
799 
800 	protected boolean isNoteOpen() {
801 
802 		Collection<PasStep> set = stepsToButtonPanels.keySet();
803 
804 		for (Iterator<PasStep> iterator = set.iterator(); iterator.hasNext();) {
805 			PasStep pasStep = iterator.next();
806 
807 			if (pasStep instanceof INoteStep) {
808 				if (((INoteStep) pasStep).getNoteUI().isNoteOpen())
809 					return true;
810 			}
811 		}// for
812 
813 		return false;
814 	}
815 
816 	class PasButtonGroupListener implements MouseListener {
817 
818 		PasGroupButtonPanel panel;
819 
820 		/***
821 		 * @param backgroundGradientPanel
822 		 */
823 		public PasButtonGroupListener(PasGroupButtonPanel panel) {
824 			this.panel = panel;
825 		}
826 
827 		public void mouseClicked(MouseEvent e) {
828 
829 			adjustPanelSelection(panel);
830 
831 		}
832 
833 		public void mouseEntered(MouseEvent e) {
834 			if (!panel.isSelected()) {
835 				makePanelRollover(panel);
836 			}// if
837 		}
838 
839 		public void mouseExited(MouseEvent e) {
840 			if (!panel.isSelected()) {
841 				makePanelNonRollover(panel);
842 			}// if
843 		}
844 
845 		public void mousePressed(MouseEvent e) {
846 		}
847 
848 		public void mouseReleased(MouseEvent e) {
849 		}
850 	}
851 
852 	public class ChangeStepAction extends AbstractAction {
853 
854 		public ChangeStepAction(String title) {
855 			super(title);
856 		}
857 
858 		public ChangeStepAction(String title, ImageIcon icon) {
859 			super(title, icon);
860 		}
861 
862 		public void actionPerformed(ActionEvent e) {
863 			PasStep previousStep = pasProjectServiceProvider
864 					.getNavigationService().getCurrentStep();
865 
866 			final PasStep step = (PasStep) this.getValue(STEP);
867 
868 			// check notes open, if so disable navigation, pop dialog.
869 			PasFrame pasFrame = pasProjectServiceProvider.getPasProject()
870 			.getProjectFrame();
871 			
872 			if (previousStep instanceof Note && step instanceof Note) {
873 				INoteStep note = (INoteStep) previousStep;
874 
875 				if (note.getNoteUI().isNoteOpen()) {
876 					note.showNoteAlreadyOpenDialog(pasFrame);
877 					return;
878 				}// if
879 
880 			} //else if (previousStep instanceof QtiNote && step instanceof QtiNote) {
881 //				QtiNote note = (QtiNote) previousStep;
882 //
883 //				if (note.getNoteUI().isNoteOpen()) {
884 //					note.showNoteAlreadyOpenDialog(pasFrame);
885 //					return;
886 //				}// if
887 //
888 //			}// if
889 
890 			compactHintButton.setEnabled(step.hasHints());
891 			if (compactHintButton.isEnabled()) {
892 				compactHintButton.setToolTipText(HINT_TOOL_TIP);
893 			} else {
894 				compactHintButton.setToolTipText(null);
895 			}
896 
897 			if (previousStep != null) {
898 				pasProjectServiceProvider.getNavigationService()
899 						.setPreviousStep(previousStep);
900 			} else {
901 				previousStep = (PasStep) stepsToGroups.previousKey(step);
902 				pasProjectServiceProvider.getNavigationService()
903 						.setPreviousStep(previousStep);
904 			}// if
905 
906 			// update the dashboard
907 			updateDashboard(step);
908 
909 			if (previousStep instanceof StudentAssessment) {
910 				final StudentAssessment sa = (StudentAssessment) previousStep;
911 
912 				if (sa.getStudentAssessmentUI() != null
913 						&& ( sa.getStudentAssessmentUI().isLeaveStep() == true && sa.isSubmitted() == false )) {
914 					final JDialog dialog = sa.getStudentAssessmentUI()
915 							.showSubmitDialog(projectFrame);
916 					dialog.addWindowListener(new WindowAdapter() {
917 
918 						public void windowDeactivated(WindowEvent e) {
919 							if (sa.getStudentAssessmentUI().getLeaveAction()
920 									.hasLeft()) {
921 								// go to the next selected step
922 								if (logger.isLoggable(Level.CONFIG)) {
923 									logger.config("OKED"); //$NON-NLS-1$
924 								}
925 								pasProjectServiceProvider
926 										.getNavigationService().setCurrentStep(
927 												step);
928 								adjustPanelSelection(stepsToButtonPanels
929 										.get(step));
930 
931 							} else {
932 								// we still want to work on the assmt
933 								
934 								adjustPanelSelection(stepsToButtonPanels
935 										.get(sa));
936 								
937 								if (logger.isLoggable(Level.CONFIG)) {
938 									logger.config("CANCELED"); //$NON-NLS-1$
939 								}
940 								// don't have the container refresh the ui
941 								// for this instance
942 								// just do jack
943 
944 							}
945 							dialog.setVisible(false);
946 						}// windowActivated
947 					});
948 				} else {
949 					pasProjectServiceProvider.getNavigationService()
950 							.setCurrentStep(step);
951 				}// if
952 			} else {
953 				pasProjectServiceProvider.getNavigationService()
954 						.setCurrentStep(step);
955 			}// if instanceof student assessment
956 
957 		}
958 
959 	}
960 
961 	/***
962 	 * @param step
963 	 */
964 	protected void adjustScrollPanels(PasStep step) {
965 		if (lastStepButton != null)
966 			lastStepButton.setEnabled(true);
967 
968 		PasGroupButtonPanel panel = stepsToButtonPanels.get(step);
969 		lastStepButton = panel.getLeftButton();
970 
971 		PasTaskPaneGroup targetGroup = (PasTaskPaneGroup) stepsToGroups
972 				.get(step);
973 
974 		// find groups to collapse
975 		Set<PasTaskPaneGroup> toCollapse = new HashSet<PasTaskPaneGroup>();
976 		@SuppressWarnings("unchecked")
977 		Collection<PasTaskPaneGroup> values = stepsToGroups.values();
978 		for (PasTaskPaneGroup group : values) {
979 			if (group != targetGroup && group.isExpanded())
980 				toCollapse.add(group);
981 		}
982 
983 		// collapse them
984 		for (Iterator<PasTaskPaneGroup> iter = toCollapse.iterator(); iter
985 				.hasNext();) {
986 			PasTaskPaneGroup group = iter.next();
987 			group.setExpanded(false);
988 		}
989 
990 		targetGroup.setExpanded(true);
991 	}
992 
993 	protected void doHint() {
994 
995 	}
996 
997 	protected Action makeHintAction() {
998 
999 		Action action = new AbstractAction(null, null) {
1000 
1001 			public void actionPerformed(ActionEvent e) {
1002 
1003 				final JButton b = (JButton) e.getSource();
1004 				b.setSelected(true);
1005 				b.setEnabled(false);
1006 
1007 				PasStep currentStep = pasProjectServiceProvider
1008 						.getNavigationService().getCurrentStep();
1009 
1010 				if (currentStep != null && currentStep.getHintSet() != null) {
1011 					if (currentStep.getHintSet().size() > 0) {
1012 						JDialog popupHint = pasProjectServiceProvider
1013 								.getHintService().popupHint(
1014 										currentStep.getHintSet());
1015 
1016 						popupHint.addWindowListener(new WindowAdapter() {
1017 
1018 							public void windowOpened(WindowEvent e) {
1019 
1020 							}
1021 
1022 							public void windowActivated(WindowEvent arg0) {
1023 
1024 							};
1025 
1026 							public void windowClosed(WindowEvent arg0) {
1027 								b.setEnabled(true);
1028 							}
1029 
1030 						});
1031 
1032 					}// if
1033 				}// if
1034 
1035 			}
1036 		};
1037 		return action;
1038 	}
1039 
1040 	protected Action makeProjectInfoAction() {
1041 		projectInfoAction = new AbstractAction(null, null) {
1042 			public void actionPerformed(final ActionEvent e) {
1043 				PasFrame pasFrame = pasProjectServiceProvider.getPasProject()
1044 						.getProjectFrame();
1045 				Component comp = null;
1046 				System.out.println("activating project InfoAction");
1047 				try {
1048 					projInfoStep = new ProjectInfoStep(
1049 							pasProjectServiceProvider.getPasProject());
1050 					comp = projInfoStep.getComponent();
1051 
1052 				} catch (RuntimeException ex) {
1053 					ex.printStackTrace();
1054 					JPanel panel = new JPanel(new BorderLayout());
1055 					panel.add(new JLabel("project info is having problems"),
1056 							BorderLayout.CENTER);
1057 					panel.add(new JLabel(e.toString()), BorderLayout.SOUTH);
1058 					comp = panel;
1059 				}
1060 
1061 				pasFrame.updateMainPanel(comp);
1062 				workStep.afterComponentAdded();
1063 			}
1064 		};
1065 
1066 		return projectInfoAction;
1067 	}
1068 
1069 	protected Action makeShowAllWorkAction() {
1070 		showAllWorkAction = new AbstractAction(null, null) {
1071 			public void actionPerformed(final ActionEvent e) {
1072 				PasFrame pasFrame = pasProjectServiceProvider.getPasProject()
1073 						.getProjectFrame();
1074 				Component comp = null;
1075 				try {
1076 					if (workStep != null)
1077 						comp = workStep.getComponent();
1078 
1079 				} catch (RuntimeException ex) {
1080 					ex.printStackTrace();
1081 					JPanel panel = new JPanel(new BorderLayout());
1082 					panel.add(new JLabel(workStep + " is having problems"),
1083 							BorderLayout.CENTER);
1084 					panel.add(new JLabel(e.toString()), BorderLayout.SOUTH);
1085 					comp = panel;
1086 				}
1087 
1088 				pasFrame.updateMainPanel(comp);
1089 				workStep.afterComponentAdded();
1090 			}
1091 		};
1092 
1093 		return showAllWorkAction;
1094 	}
1095 
1096 	public void updateDisplay() {
1097 		try {
1098 			LookAndFeelAddons.setAddon(AquaLookAndFeelAddons.class);
1099 		} catch (InstantiationException e) {
1100 			// TODO Auto-generated catch block
1101 			logger.severe("exception: " + e); //$NON-NLS-1$
1102 		} catch (IllegalAccessException e) {
1103 			logger.severe("exception: " + e); //$NON-NLS-1$
1104 		}
1105 
1106 		removeAll();
1107 		setLayout(new BorderLayout());
1108 		this.setBorder(CommonUI.createEtchedBorder());
1109 		this.setBackground(PasColors.navigationPanelBackgroundColor);
1110 		add(upperLeftCornerPanel, BorderLayout.NORTH);
1111 
1112 		JPanel buttonAndTaskPane = new JPanel(new BorderLayout(0, 0));
1113 		buttonAndTaskPane.setOpaque(false);
1114 
1115 		JXTaskPaneContainer taskPaneContainer = new JXTaskPaneContainer();
1116 		taskPaneContainer
1117 				.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
1118 		taskPaneContainer
1119 				.setBackground(PasColors.navigationPanelTaskPaneBackgroundColor);
1120 		boolean passedFirst = false;
1121 
1122 		PasStep previousStep = pasProjectServiceProvider.getNavigationService()
1123 				.getPreviousStep();
1124 
1125 		if (previousStep == null) {
1126 			minusStepButton.setEnabled(false);
1127 		}
1128 
1129 		for (int i = 0; i < activities.length; i++) {
1130 			PasActivity ac = activities[i];
1131 			if (ac == null)
1132 				continue;
1133 
1134 			PasTaskPaneGroup activityGroup = setActivityGroup(i, ac);
1135 			// Take the border off, what a hack, eh
1136 			JComponent contentPane = (JComponent) activityGroup
1137 					.getContentPane();
1138 			CompoundBorder compoundBorder = (CompoundBorder) contentPane
1139 					.getBorder();
1140 			contentPane.setBorder(BorderFactory.createCompoundBorder(
1141 					compoundBorder.getOutsideBorder(), BorderFactory
1142 							.createEmptyBorder()));
1143 			contentPane.setBackground(Color.WHITE);
1144 
1145 			GradientTextIcon r = new GradientTextIcon(activityGroup.getFont()
1146 					.deriveFont(Font.BOLD), "A" + (i + 1),
1147 					PasColors.pandaPanelBackgroundColor, Color.BLACK,
1148 					GradientTextIcon.VERTICAL);
1149 
1150 			activityGroup.setIcon(r);
1151 
1152 			String activityTitle = ac.getTitle();
1153 
1154 			if (activityTitle.length() > 35) {
1155 				activityTitle = activityTitle.substring(0, 35) + "...";
1156 			}
1157 
1158 			activityGroup.setTitle(activityTitle);
1159 			activityGroup.setScrollOnExpand(true);
1160 
1161 			PasStep[] steps = ac.getSteps();
1162 			int stepIndex = 0;
1163 			for (int j = 0; j < steps.length; j++) {
1164 				PasStep step = steps[j];
1165 
1166 				JButton jlb = new JButton(makeStepAction(step, ++stepIndex));
1167 
1168 				PasGroupButtonPanel panel = makeStepButtonGroupPanel(jlb);
1169 
1170 				// FIXME this is a major hack.  the navigation panel should not be checking for certain step types
1171 				if (step instanceof ChallengeQuestion) {
1172 					ChallengeQuestion cqStep = (ChallengeQuestion) step;
1173 					cqStep.setPasProject(pasProjectServiceProvider
1174 							.getPasProject());
1175 					cqStep.setNavigationService(pasProjectServiceProvider
1176 							.getNavigationService());
1177 					cqStep.setGotoStep(steps[(cqStep).getGotoStepIndex()]);
1178 				}
1179 
1180 				String stepTT;
1181 				if (pasProjectServiceProvider.getPasProject().isAutoNumbering()) {
1182 					stepTT = "Step " + (j + 1) + ": " + step.getTitle();
1183 				} else {
1184 					stepTT = step.getTitle();
1185 				}// if
1186 
1187 				jlb.setToolTipText(stepTT);
1188 				panel.setToolTipText(stepTT);
1189 				panel.getMiddleButton().setToolTipText(stepTT);
1190 				panel.setHasHints(step.hasHints());
1191 				activityGroup.add(panel);
1192 				stepsToButtonPanels.put(step, panel);
1193 				panel.putClientProperty(STEP_INDEX, new Integer(j + 1));
1194 				panel.putClientProperty(ACTIVITY_INDEX, new Integer(i + 1));
1195 				stepsToGroups.put(step, activityGroup);
1196 			}
1197 
1198 			activityGroup.setExpanded(!passedFirst);
1199 
1200 			passedFirst = true;
1201 
1202 			taskPaneContainer.add(activityGroup);
1203 
1204 		}
1205 
1206 		JScrollPane scroll = createTaskScrollPane(taskPaneContainer);
1207 		buttonAndTaskPane.add(scroll, BorderLayout.CENTER);
1208 		add(buttonAndTaskPane, BorderLayout.CENTER);
1209 
1210 		setBorder(null);
1211 	}
1212 
1213 	/***
1214 	 * @param i
1215 	 * @param ac
1216 	 * @return
1217 	 */
1218 	private PasTaskPaneGroup setActivityGroup(int i, PasActivity ac) {
1219 		PasTaskPaneGroup activityGroup = new PasTaskPaneGroup();
1220 
1221 		activityGroup.setFont(activityGroup.getFont().deriveFont(10f));
1222 
1223 		activityGroup.setToolTipText("Activity " + (i + 1) + ": "
1224 				+ ac.getTitle());
1225 		activityGroup.putClientProperty(ACTIVITY_INDEX, new Integer(i + 1));
1226 		return activityGroup;
1227 	}
1228 
1229 	/*
1230 	 * @param taskPaneContainer @return
1231 	 */
1232 	private JScrollPane createTaskScrollPane(
1233 			JXTaskPaneContainer taskPaneContainer) {
1234 		JScrollPane scroll = new JScrollPane(taskPaneContainer);
1235 		scroll.getVerticalScrollBar().setUnitIncrement(50);
1236 		scroll.getVerticalScrollBar().setBlockIncrement(50);
1237 		scroll.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(2,
1238 				2, 2, 2), BorderFactory.createLineBorder(
1239 				PasColors.navgationPanelScrollBorderColor, 2)));
1240 		scroll.setBackground(PasColors.navigationPanelScollBackgroundColor);
1241 		scroll.setForeground(PasColors.navigationPanelScollForegroundColor);
1242 		return scroll;
1243 	}
1244 
1245 	protected JPanel initUpperLeftCorner() {
1246 		JPanel topPandaPanel = createPandaPanel();
1247 		// bottom Panda
1248 		SimpleGradientPanel bottomPandaPanel = createBottomPandaPanel();
1249 		JPanel mainPandaPanel = createMainPandaPanel(topPandaPanel,
1250 				bottomPandaPanel);
1251 		return mainPandaPanel;
1252 	}
1253 
1254 	/*
1255 	 * @param topPandaPanel @param bottomPandaPanel @return
1256 	 */
1257 	private JPanel createMainPandaPanel(JPanel topPandaPanel,
1258 			SimpleGradientPanel bottomPandaPanel) {
1259 		JPanel mainPandaPanel = new JPanel();
1260 		mainPandaPanel
1261 				.setLayout(new BoxLayout(mainPandaPanel, BoxLayout.Y_AXIS));
1262 		mainPandaPanel.add(topPandaPanel);
1263 
1264 		mainPandaPanel.add(bottomPandaPanel);
1265 		return mainPandaPanel;
1266 	}
1267 
1268 	/*
1269 	 * @return
1270 	 */
1271 	private SimpleGradientPanel createBottomPandaPanel() {
1272 		SimpleGradientPanel bottomPandaPanel = new SimpleGradientPanel();
1273 		bottomPandaPanel.setDirection(SimpleGradientPanel.VERTICAL);
1274 		bottomPandaPanel.setStartColor(PasColors.pandaPanelBackgroundColor);
1275 		bottomPandaPanel.setEndColor(PasColors.navigationPanelBackgroundColor);
1276 		bottomPandaPanel.setLayout(new BoxLayout(bottomPandaPanel,
1277 				BoxLayout.Y_AXIS));
1278 		bottomPandaPanel.add(createProjectNamePanel());
1279 		bottomPandaPanel.add(Box.createGlue());
1280 		bottomPandaPanel.add(createUserNamePanel());
1281 		bottomPandaPanel.add(createButtonBarPanel());
1282 		return bottomPandaPanel;
1283 	}
1284 
1285 	/***
1286 	 * @return
1287 	 */
1288 	protected JPanel createButtonBarPanel() {
1289 		JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 2));
1290 		p.setOpaque(false);
1291 
1292 		p.add(projectFrame.getSidebarMediator().getExpandCompactViewButton());
1293 
1294 		allNotesActiveIcon = new ImageIcon(this.getClass().getResource(
1295 				"icons/allNotesActive.png"));
1296 		allNotesSelectedIcon = new ImageIcon(this.getClass().getResource(
1297 				"icons/allNotesSelected.png"));
1298 
1299 		projInfoActiveIcon = new ImageIcon(this.getClass().getResource(
1300 				"icons/projectInfoActive.png"));
1301 
1302 		projInfoSelectedIcon = new ImageIcon(this.getClass().getResource(
1303 				"icons/projectInfoSelected.png"));
1304 
1305 		createProjectInfoButton();
1306 		createShowAllWorkButton();
1307 
1308 		exitButtonActive = new ImageIcon(this.getClass().getResource(
1309 				"icons/exitButtonActive.png"));
1310 		exitButtonDisabledSelected = new ImageIcon(this.getClass().getResource(
1311 				"icons/exitButtonActive.png"));
1312 
1313 		JButton exitButton = createExitButton();
1314 
1315 		p.add(projInfoButton);
1316 		p.add(showAllWorkButton);
1317 		p.add(exitButton);
1318 		p.setBorder(BorderFactory.createEmptyBorder(15, 0, 15, 0));
1319 		return p;
1320 	}
1321 
1322 	/***
1323 	 * 
1324 	 */
1325 	private void createProjectInfoButton() {
1326 		projInfoButton = new JButton(makeProjectInfoAction());
1327 		CommonUI.makeButtonTransparent(projInfoButton);
1328 		projInfoButton.setIcon(projInfoActiveIcon);
1329 		projInfoButton.setDisabledIcon(projInfoSelectedIcon);
1330 		projInfoButton.setRolloverIcon(new ImageIcon(this.getClass()
1331 				.getResource("icons/projectInfoRollover.png")));
1332 		projInfoButton.setToolTipText("Project Info");
1333 		projInfoButton.setEnabled(true);
1334 	}
1335 
1336 	/***
1337 	 * 
1338 	 */
1339 	private void createShowAllWorkButton() {
1340 		showAllWorkButton = new JButton(makeShowAllWorkAction());
1341 		CommonUI.makeButtonTransparent(showAllWorkButton);
1342 		showAllWorkButton.setIcon(allNotesActiveIcon);
1343 		showAllWorkButton.setDisabledIcon(allNotesSelectedIcon);
1344 		showAllWorkButton.setRolloverIcon(new ImageIcon(this.getClass()
1345 				.getResource("icons/allNotesRollover.png")));
1346 
1347 		showAllWorkButton.setToolTipText("Show All Work");
1348 		showAllWorkButton.setEnabled(true);
1349 	}
1350 
1351 	/***
1352 	 * @return
1353 	 */
1354 	private JButton createExitButton() {
1355 		JButton exitButton = new JButton(new ExitSessionAction(
1356 				pasProjectServiceProvider.getPasProject()));
1357 		exitButton.setToolTipText("Exit the WISE Project");
1358 		CommonUI.makeButtonTransparent(exitButton);
1359 
1360 		exitButton.setIcon(exitButtonActive);
1361 		exitButton.setDisabledIcon(exitButtonDisabledSelected);
1362 		exitButton.setRolloverIcon(new ImageIcon(this.getClass().getResource(
1363 				"icons/exitButtonRollover.png")));
1364 		return exitButton;
1365 	}
1366 
1367 	/***
1368 	 * @return
1369 	 */
1370 	protected JPanel createProjectNamePanel() {
1371 		JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
1372 		p.setOpaque(false);
1373 
1374 		// get the project title
1375 		String projectTitle = pasProjectServiceProvider.getPasProject()
1376 				.getTitle();
1377 
1378 		if (projectTitle == null || projectTitle.equals("")) {
1379 			projectTitle = "Untitled Project";
1380 		}// if
1381 
1382 		projectNameLabel = new JLabel(projectTitle);
1383 		projectNameLabel.setOpaque(false);
1384 		projectNameLabel.setUI(new MultiLineLabelUI());
1385 		projectNameLabel.setFont(projectNameLabel.getFont().deriveFont(14F));
1386 		projectNameLabel.setForeground(PasColors.projectTitleForegroundColor);
1387 		p.add(projectNameLabel);
1388 		return p;
1389 	}
1390 
1391 	public void setProjectName(String projectName) {
1392 		String wordWrap = StringUtils.wordWrap(projectName, 30, null);
1393 		projectNameLabel.setText(wordWrap);
1394 	}
1395 
1396 	/***
1397 	 * @return
1398 	 */
1399 	protected JPanel createUserNamePanel() {
1400 		JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
1401 		p.setOpaque(false);
1402 		userNameLabel = createUserNameLabel();
1403 		p.add(userNameLabel);
1404 		return p;
1405 	}
1406 
1407 	/* 
1408 	 */
1409 	private JTextArea createUserNameLabel() {
1410 		userNameLabel = new JTextArea(this.getUserNames());
1411 		userNameLabel.setEditable(false);
1412 		// userNameLabel.setWrapStyleWord(true);
1413 		// userNameLabel.setLineWrap(true);
1414 		userNameLabel.setOpaque(false);
1415 		userNameLabel.setFont(userNameLabel.getFont().deriveFont(12F));
1416 		userNameLabel.setForeground(PasColors.userNameForegroundColor);
1417 		return userNameLabel;
1418 	}
1419 
1420 	/***
1421 	 * @return
1422 	 */
1423 	protected JPanel createPandaPanel() {
1424 		JLabel wiseHorButton = createWiseHorButton();
1425 		JLabel pandaButton = createPandaButton();
1426 		JPanel innerStripedPanel = createInnerStripedPanel();
1427 		JPanel pandaPanel = createPandaPanel(wiseHorButton, pandaButton);
1428 		JPanel mainPanel = createMainPanel(innerStripedPanel, pandaPanel);
1429 		return mainPanel;
1430 	}
1431 
1432 	/*
1433 	 * @param innerStripedPanel @param pandaPanel @return
1434 	 */
1435 	private JPanel createMainPanel(JPanel innerStripedPanel, JPanel pandaPanel) {
1436 		JPanel mainPanel = new JPanel();
1437 		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
1438 		mainPanel.setBackground(PasColors.pandaPanelBackgroundColor);
1439 		mainPanel.add(pandaPanel);
1440 		mainPanel.add(innerStripedPanel);
1441 		mainPanel.setMaximumSize(new Dimension(
1442 				mainPanel.getMaximumSize().width, innerStripedPanel
1443 						.getPreferredSize().height));
1444 		return mainPanel;
1445 	}
1446 
1447 	/*
1448 	 * @param wiseHorButton @param pandaButton @return
1449 	 */
1450 	private JPanel createPandaPanel(JLabel wiseHorButton, JLabel pandaButton) {
1451 		JPanel pandaPanel = new JPanel(new BorderLayout(0, 0));
1452 		pandaPanel.setOpaque(false);
1453 		pandaPanel.add(wiseHorButton, BorderLayout.WEST);
1454 		pandaPanel.add(pandaButton, BorderLayout.EAST);
1455 		return pandaPanel;
1456 	}
1457 
1458 	/*
1459 	 * @return
1460 	 */
1461 	private JPanel createInnerStripedPanel() {
1462 		// da stripe
1463 		JPanel innerStripedPanel = new JPanel(new BorderLayout(0, 0));
1464 		innerStripedPanel.setBackground(PasColors.innerStripBackgroundColor);
1465 		innerStripedPanel.setBorder(new CustomLineBorder(
1466 				PasColors.outerStripeBackgroundColor, 2, Color.white, 0,
1467 				PasColors.outerStripeBackgroundColor, 2,
1468 				PasColors.outerStripeBackgroundColor, 0));
1469 
1470 		innerStripedPanel.setPreferredSize(new Dimension(innerStripedPanel
1471 				.getPreferredSize().width, 6));
1472 		innerStripedPanel.setMaximumSize(new Dimension(innerStripedPanel
1473 				.getMaximumSize().width, 6));
1474 		return innerStripedPanel;
1475 	}
1476 
1477 	/*
1478 	 * @return
1479 	 */
1480 	private JLabel createPandaButton() {
1481 		JLabel pandaButton = new JLabel(new ImageIcon(this.getClass()
1482 				.getResource("icons/pandaIcon.png")));
1483 		// this.modButton(pandaButton);
1484 		pandaButton.setToolTipText("Amanda the Panda (WISE mascot)");
1485 		pandaButton.setBorder(BorderFactory.createEmptyBorder(8, 4, 8, 4));
1486 		return pandaButton;
1487 	}
1488 
1489 	/*
1490 	 * @return
1491 	 */
1492 	private JLabel createWiseHorButton() {
1493 		JLabel wiseHorButton = new JLabel(new ImageIcon(this.getClass()
1494 				.getResource("icons/wiseHorIcon.png")));
1495 		// wiseHorButton.setToolTipText("About this WISE Project");
1496 		wiseHorButton
1497 				.setToolTipText("Web-Based Inquiry Science Environment (v3.0)");
1498 		wiseHorButton.setOpaque(false);
1499 		wiseHorButton.setBorder(BorderFactory.createEmptyBorder(8, 4, 8, 4));
1500 		return wiseHorButton;
1501 	}
1502 
1503 	public void setUsersLabel(String userNames) {
1504 		// userNameLabel.setHorizontalAlignment(SwingConstants.CENTER);
1505 		userNameLabel.setOpaque(false);
1506 
1507 		String usersDisplayNames = getUserNames();
1508 
1509 		StringBuffer buf = new StringBuffer();
1510 
1511 		buf
1512 				.append(Messages
1513 						.getString("PasProjectNavigationTaskPanel.HELLO_PREFIX") + usersDisplayNames); //$NON-NLS-1$
1514 
1515 		userNameLabel.setText(buf.toString());
1516 	}
1517 
1518 	public String getUserNames() {
1519 		if (userNames == null)
1520 			return Messages
1521 					.getString("PasProjectNavigationTaskPanel.GUEST_NAME"); //$NON-NLS-1$
1522 
1523 		return userNames;
1524 	}
1525 
1526 	public void setUserNames(String userNames) {
1527 		this.userNames = userNames;
1528 		this.setUsersLabel(userNames);
1529 	}
1530 
1531 	/***
1532 	 * @return the toggleSidebarOff
1533 	 */
1534 	public JButton getToggleSidebarOff() {
1535 		return toggleSidebarOff;
1536 	}
1537 
1538 	/***
1539 	 * @param toggleSidebarOff
1540 	 *            the toggleSidebarOff to set
1541 	 */
1542 	public void setToggleSidebarOff(JButton toggleSidebarOff) {
1543 		this.toggleSidebarOff = toggleSidebarOff;
1544 	}
1545 
1546 	/***
1547 	 * @return the compactNavigationViewPanel
1548 	 */
1549 	public JPanel getCompactNavigationViewPanel() {
1550 		return compactNavigationViewPanel;
1551 	}
1552 
1553 	/***
1554 	 * @param compactNavigationViewPanel
1555 	 *            the compactNavigationViewPanel to set
1556 	 */
1557 	public void setCompactNavigationViewPanel(JPanel compactNavigationViewPanel) {
1558 		this.compactNavigationViewPanel = compactNavigationViewPanel;
1559 	}
1560 
1561 	/***
1562 	 * @param pasStep
1563 	 * @param panel
1564 	 */
1565 	protected void updateDashboard(PasStep pasStep) {
1566 
1567 		JPanel panel = stepsToButtonPanels.get(pasStep);
1568 
1569 		Integer stepIndex = (Integer) panel.getClientProperty(STEP_INDEX);
1570 		PasTaskPaneGroup activityGroup = (PasTaskPaneGroup) stepsToGroups
1571 				.get(pasStep);
1572 
1573 		Integer activityIndex = (Integer) activityGroup
1574 				.getClientProperty(ACTIVITY_INDEX);
1575 
1576 		setStepLabel(stepIndex.intValue(), pasStep.getTitle());
1577 		setActivityLabel(activityIndex.intValue(), activityGroup.getTitle());
1578 
1579 		if (pasProjectServiceProvider.getNavigationService().getPreviousStep() == null)
1580 			minusStepButton.setEnabled(false);
1581 		else
1582 			minusStepButton.setEnabled(true);
1583 
1584 		PasStep nextStep = (PasStep) stepsToGroups.nextKey(pasStep);
1585 		if (nextStep == null)
1586 			addStepButton.setEnabled(false);
1587 		else
1588 			addStepButton.setEnabled(true);
1589 
1590 	}
1591 
1592 	/***
1593 	 * @return the addStepButton
1594 	 */
1595 	public JButton getAddStepButton() {
1596 		return addStepButton;
1597 	}
1598 
1599 	/*
1600 	 * (non-Javadoc)
1601 	 * 
1602 	 * @see org.telscenter.pas.navigation.PasProjectNavigationPanel#showFirstStep()
1603 	 */
1604 	@Override
1605 	public void showFirstStep() {
1606 		addStepAction.actionPerformed(null);
1607 
1608 	}
1609 
1610 	public PasFrame getProjectFrame() {
1611 		return this.projectFrame;
1612 	}
1613 
1614 	
1615 
1616 }