Indicator extension

Add indicator extension classes

Since Workplace4.0 you can add BaseIndicatorExtension in the application development part. This add the ability to make custom tiles indicator. You can declare extensions for the indicator (BaseIndicatorExtension) and for the content (BaseApplicationBuilderExtension). If you put more than one BaseIndicatorExtension in the application development part, they will be executed in order.

Pre build extensions

These extensions are available since Workplace4.0

ProcessTodoIndicatorStrategy

com.moovapps.workplace.impl.controllers.application.indicator.strategy.ProcessTodoIndicatorStrategy This is the default class used for process applications (if you declare no extensions). It extends AbstractProcessViewIndicatorStrategy and return the TODO view count. If you want to modify the indicator computed by default with another extension, declare this and your other extension class. Modify the indicator in your extension class.

AbstractProcessViewIndicatorStrategy

com.moovapps.workplace.sdk.extension.impl.AbstractProcessViewIndicatorStrategy It’s simple class you can extend and implement getView() the view is evaluated to get count.

New in Workplace10. You can now modify the indicator color through your extension class.
If you don’t define a foreground or background color, default Workplace indicator colors will be applied (Foreground white and background red)

Build your own.

Create your own class and extends BaseIndicatorExtension. Implement the compute method.

Examples

DeepThoughtIndicatorExtension

This is a sample extension that :

  • Always respond 42 but add some lags.
  • Change the background color of a tile
  • Change the foreground of a tile
package com.moovapps.workplace.sdk.extension.base;

import com.moovapps.workplace.sdk.beans.IApplication;
import com.moovapps.workplace.sdk.controllers.application.indicator.IApplicationIndicator;
import com.moovapps.workplace.sdk.exception.count.IndicatorException;

import java.util.Random;

/**
 * respond the number 42 (with random lag).
 */
public class DeepThoughtIndicatorExtension extends BaseIndicatorExtension<IApplication> {
	
	private static final com.axemble.vdoc.sdk.utils.Logger LOG = com.axemble.vdoc.sdk.utils.Logger.getLogger(DeepThoughtIndicatorExtension.class);
	/**
	 * 7.5 billion years is too long just use 2s
	 */
	public static final int MAX_COMPUTING_TIME = 2000;
	public static final long ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING = 42L;
	
	@Override
	public IApplicationIndicator compute(IApplication application, IApplicationIndicator applicationIndicator) throws IndicatorException {
		LOG.info(" The Answer to the Ultimate Question of Life, the Universe, and Everything is 42");
		try {
			Thread.sleep(new Random().nextInt(MAX_COMPUTING_TIME));
		} catch (InterruptedException e) {
			LOG.error(e);
		}
		applicationIndicator.setCount(ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING);
		applicationIndicator.setBackgroundColor("#87CEEB");
		applicationIndicator.setColor("#eb003b");
		return applicationIndicator;
	}
}

ProcessColorIndicatorExtension (from Workplace10 only)

This is a sample extension that :

  • Change the background color of a proces tile if the number of process documents in TODO is less than 2 documents
package com.chm.test.workplace.indicator.extensions;


import com.moovapps.workplace.sdk.beans.IProcessApplication;
import com.moovapps.workplace.sdk.controllers.application.indicator.IApplicationIndicator;
import com.moovapps.workplace.sdk.exception.count.IndicatorException;
import com.moovapps.workplace.sdk.extension.impl.ProcessTodoIndicatorExtension;


public class ProcessColorIndicatorExtension extends ProcessTodoIndicatorExtension {
	

	@Override
	public IApplicationIndicator compute(IProcessApplication application, IApplicationIndicator applicationIndicator)
		throws IndicatorException {
		applicationIndicator =  super.compute(application, applicationIndicator);
		
		if (applicationIndicator.getCount()<2)
		{
			applicationIndicator.setBackgroundColor("#00993d");
		}

		return(applicationIndicator);
	}
}