* @param up : true if the progress is increased (0% -> 25% -> 50%...)
* if false the progress is decreased
*/
public static void updateProgressIcons(final NodeModel node, final boolean up) {
final ProgressUtilities progUtil = new ProgressUtilities();
final MIconController iconController = (MIconController) IconController.getController();
String activeIcon = null;
final List<MindIcon> icons = node.getIcons();
//get active progress icon and remove it
if (progUtil.hasProgressIcons(node)) {
for (int i = 0; i < icons.size(); i++) {
for (int j = 0; j < iconNames.length; j++) {
if (icons.get(i).getName().equals(iconNames[j])) {
activeIcon = iconNames[j];
break;
}
}
}
ProgressIcons.removeProgressIcons(node);
}
// set initial progress icon always 0%
if (activeIcon == null) {
ProgressIcons.removeProgressIcons(node);
iconController.addIcon(node, progressIcons[0], 0);
}
else {
final int iActiveIcon = Integer.parseInt(activeIcon.substring(0, activeIcon.length() - 1));
//progress is increased
if (up) {
switch (iActiveIcon) {
case 0:
iconController.addIcon(node, progressIcons[1], 0);
break;
case 25:
iconController.addIcon(node, progressIcons[2], 0);
break;
case 50:
iconController.addIcon(node, progressIcons[3], 0);
break;
case 75:
iconController.addIcon(node, progressIcons[4], 0);
if (!progUtil.hasOKIcon(node)) {
iconController.addIcon(node, OKIcon, 0);
}
break;
//at 100% draw an extra OK-icon
case 100:
iconController.addIcon(node, progressIcons[4], 0);
iconController.addIcon(node, OKIcon, 0);
break;
default:
break;
}
}
//progress is decreased
else {
switch (iActiveIcon) {
case 25:
iconController.addIcon(node, progressIcons[0], 0);
break;
case 50:
iconController.addIcon(node, progressIcons[1], 0);
break;
case 75:
iconController.addIcon(node, progressIcons[2], 0);
break;
case 100:
iconController.addIcon(node, progressIcons[3], 0);
break;
case 0:
default:
break;
}