|
Lines 15-20
Link Here
|
| 15 |
package org.eclipse.mylyn.internal.tasks.ui.views; |
15 |
package org.eclipse.mylyn.internal.tasks.ui.views; |
| 16 |
|
16 |
|
| 17 |
import java.text.DateFormat; |
17 |
import java.text.DateFormat; |
|
|
18 |
import java.text.SimpleDateFormat; |
| 18 |
import java.util.Calendar; |
19 |
import java.util.Calendar; |
| 19 |
import java.util.Date; |
20 |
import java.util.Date; |
| 20 |
|
21 |
|
|
Lines 165-174
Link Here
|
| 165 |
Date date = task.getScheduledForDate(); |
166 |
Date date = task.getScheduledForDate(); |
| 166 |
if (date != null) { |
167 |
if (date != null) { |
| 167 |
sb.append("Scheduled for: "); |
168 |
sb.append("Scheduled for: "); |
|
|
169 |
sb.append(new SimpleDateFormat("E").format(date)).append(", "); |
| 168 |
sb.append(DateFormat.getDateInstance(DateFormat.LONG).format(date)); |
170 |
sb.append(DateFormat.getDateInstance(DateFormat.LONG).format(date)); |
| 169 |
sb.append(" ("); |
171 |
sb.append(" (").append(DateFormat.getTimeInstance(DateFormat.SHORT).format(date)).append(")\n"); |
| 170 |
sb.append(DateFormat.getTimeInstance(DateFormat.SHORT).format(date)); |
|
|
| 171 |
sb.append(")\n"); |
| 172 |
} |
172 |
} |
| 173 |
|
173 |
|
| 174 |
long elapsed = TasksUiPlugin.getTaskListManager().getElapsedTime(task); |
174 |
long elapsed = TasksUiPlugin.getTaskListManager().getElapsedTime(task); |
|
Lines 239-245
Link Here
|
| 239 |
} |
239 |
} |
| 240 |
} |
240 |
} |
| 241 |
|
241 |
|
| 242 |
String text = "Completed " + completed + " of " + total; |
242 |
String text = "Open: " + (total - completed) + " Completed: " + completed + " Total: " + total; |
| 243 |
return new ProgressData(completed, total, text); |
243 |
return new ProgressData(completed, total, text); |
| 244 |
} |
244 |
} |
| 245 |
|
245 |
|
|
Lines 407-414
Link Here
|
| 407 |
tipShell = new Shell(parent.getDisplay(), SWT.TOOL | SWT.NO_FOCUS | SWT.MODELESS | SWT.ON_TOP); |
407 |
tipShell = new Shell(parent.getDisplay(), SWT.TOOL | SWT.NO_FOCUS | SWT.MODELESS | SWT.ON_TOP); |
| 408 |
GridLayout gridLayout = new GridLayout(); |
408 |
GridLayout gridLayout = new GridLayout(); |
| 409 |
gridLayout.numColumns = 2; |
409 |
gridLayout.numColumns = 2; |
| 410 |
gridLayout.marginWidth = 2; |
410 |
gridLayout.marginWidth = 5; |
| 411 |
gridLayout.marginHeight = 2; |
411 |
gridLayout.marginHeight = 5; |
| 412 |
tipShell.setLayout(gridLayout); |
412 |
tipShell.setLayout(gridLayout); |
| 413 |
tipShell.setBackground(tipShell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
413 |
tipShell.setBackground(tipShell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
| 414 |
|
414 |
|
|
Lines 416-426
Link Here
|
| 416 |
|
416 |
|
| 417 |
addIconAndLabel(tipShell, null, detailsText); |
417 |
addIconAndLabel(tipShell, null, detailsText); |
| 418 |
|
418 |
|
| 419 |
String statusText = getStatusText(element); |
|
|
| 420 |
if (statusText != null) { |
| 421 |
addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.WARNING), statusText); |
| 422 |
} |
| 423 |
|
| 424 |
String activityText = getActivityText(element); |
419 |
String activityText = getActivityText(element); |
| 425 |
if (activityText != null) { |
420 |
if (activityText != null) { |
| 426 |
addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.CALENDAR), activityText); |
421 |
addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.CALENDAR), activityText); |
|
Lines 433-471
Link Here
|
| 433 |
|
428 |
|
| 434 |
ProgressData progress = getProgressData(element); |
429 |
ProgressData progress = getProgressData(element); |
| 435 |
if (progress != null) { |
430 |
if (progress != null) { |
| 436 |
addLabel(tipShell, progress.text); |
431 |
addIconAndLabel(tipShell, null, progress.text); |
| 437 |
|
432 |
|
|
|
433 |
// label height need to be set to 0 to remove gap below the progress bar |
| 434 |
Label label = new Label(tipShell, SWT.NONE); |
| 435 |
GridData labelGridData = new GridData(SWT.FILL, SWT.TOP, true, false); |
| 436 |
labelGridData.heightHint = 0; |
| 437 |
label.setLayoutData(labelGridData); |
| 438 |
|
| 438 |
Composite progressComposite = new Composite(tipShell, SWT.NONE); |
439 |
Composite progressComposite = new Composite(tipShell, SWT.NONE); |
| 439 |
GridLayout progressLayout = new GridLayout(1, false); |
440 |
GridLayout progressLayout = new GridLayout(1, false); |
| 440 |
progressLayout.marginWidth = 2; |
441 |
progressLayout.marginWidth = 0; |
| 441 |
progressLayout.marginHeight = 0; |
442 |
progressLayout.marginHeight = 0; |
| 442 |
progressLayout.marginBottom = 2; |
|
|
| 443 |
progressLayout.horizontalSpacing = 0; |
| 444 |
progressLayout.verticalSpacing = 0; |
| 445 |
progressComposite.setLayout(progressLayout); |
443 |
progressComposite.setLayout(progressLayout); |
| 446 |
progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1)); |
444 |
progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); |
| 447 |
|
445 |
|
| 448 |
WorkweekProgressBar taskProgressBar = new WorkweekProgressBar(progressComposite); |
446 |
WorkweekProgressBar taskProgressBar = new WorkweekProgressBar(progressComposite); |
| 449 |
taskProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
447 |
taskProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); |
| 450 |
taskProgressBar.reset(progress.completed, progress.total); |
448 |
taskProgressBar.reset(progress.completed, progress.total); |
|
|
449 |
|
| 450 |
// do we really need custom canvas? this work just as fine |
| 451 |
// IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); |
| 452 |
// Color color = themeManager.getCurrentTheme().getColorRegistry().get( |
| 453 |
// TaskListColorsAndFonts.THEME_COLOR_TASK_TODAY_COMPLETED); |
| 454 |
// ProgressBar bar = new ProgressBar(tipShell, SWT.SMOOTH); |
| 455 |
// bar.setForeground(color); |
| 456 |
// bar.setSelection((int) (100d * progress.completed / progress.total)); |
| 457 |
// GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); |
| 458 |
// gridData.heightHint = 5; |
| 459 |
// bar.setLayoutData(gridData); |
| 451 |
} |
460 |
} |
| 452 |
|
461 |
|
|
|
462 |
String statusText = getStatusText(element); |
| 463 |
if (statusText != null) { |
| 464 |
addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.WARNING), statusText); |
| 465 |
} |
| 466 |
|
| 453 |
tipShell.pack(); |
467 |
tipShell.pack(); |
| 454 |
setHoverLocation(tipShell, location); |
468 |
setHoverLocation(tipShell, location); |
| 455 |
tipShell.setVisible(true); |
469 |
tipShell.setVisible(true); |
| 456 |
} |
470 |
} |
| 457 |
|
471 |
|
| 458 |
private void addLabel(Shell parent, String text) { |
|
|
| 459 |
Label textLabel = new Label(parent, SWT.NONE); |
| 460 |
textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); |
| 461 |
textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
| 462 |
textLabel.setAlignment(SWT.CENTER); |
| 463 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); |
| 464 |
gd.horizontalSpan = 2; |
| 465 |
textLabel.setLayoutData(gd); |
| 466 |
textLabel.setText(removeTrailingNewline(text)); |
| 467 |
} |
| 468 |
|
| 469 |
private String removeTrailingNewline(String text) { |
472 |
private String removeTrailingNewline(String text) { |
| 470 |
if (text.endsWith("\n")) { |
473 |
if (text.endsWith("\n")) { |
| 471 |
return text.substring(0, text.length() - 1); |
474 |
return text.substring(0, text.length() - 1); |
|
Lines 477-491
Link Here
|
| 477 |
Label imageLabel = new Label(parent, SWT.NONE); |
480 |
Label imageLabel = new Label(parent, SWT.NONE); |
| 478 |
imageLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); |
481 |
imageLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); |
| 479 |
imageLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
482 |
imageLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
| 480 |
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); |
483 |
imageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); |
| 481 |
imageLabel.setLayoutData(gd); |
|
|
| 482 |
imageLabel.setImage(image); |
484 |
imageLabel.setImage(image); |
| 483 |
|
485 |
|
| 484 |
Label textLabel = new Label(parent, SWT.NONE); |
486 |
Label textLabel = new Label(parent, SWT.NONE); |
| 485 |
textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); |
487 |
textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); |
| 486 |
textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
488 |
textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); |
| 487 |
gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); |
489 |
textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); |
| 488 |
textLabel.setLayoutData(gd); |
|
|
| 489 |
textLabel.setText(removeTrailingNewline(text)); |
490 |
textLabel.setText(removeTrailingNewline(text)); |
| 490 |
} |
491 |
} |