Tile extension

Add tile extension classes

Since Workplace10.0 you can add BaseApplicationDisplayExtension in the application development part. This adds the ability to customize a tile everywhere in Workplace.

If you put more than one BaseApplicationDisplayExtension in the application development part, they will be executed in order.

DefaultApplicationDisplayExtension

This is the default class used for process applications (if you declare no extensions).

Build your own extension

Your extension classes must extend “com.moovapps.workplace.sdk.extension.base.BaseApplicationDisplayExtension”.

Method to implement

compute method

The following method ‘compute(ApplicationTile applicationTile)’ must be implement in your extension.

This method allows you to modify the tile by giving you access to the following properties:

  • Title
  • TileColor : The list of available colors is declared in the “tileColor” list in the “Configuration” dataset.
  • Icon : The list of available colors is declared in the file “application-icons.xml”
  • Link
  • TargetBlank
  • TargetName : This property works if TargetBlank = true
  • HelpLinkJS : This property must be declared as follows: “windows.open(‘YOUR_LINK’)”
  • HomepageOrder
  • Keywords
  • Enabled : this property is a new behaviour of tiles. By default, a tile is enabled. If you disable a tile, it still appears in the displayed tiles, but the tile is gray and not clickable.

isVisible method

The following method ‘isVisible()’ must be implement in your extension and must return true or false.

If this method return false, the tile is not displayed and the extension is not apply on it.

To keep the behavior declared in the configuration, the method must return getApplication().isVisible().

Accessible method

getApplication method

The following method ‘getApplication()’ return the application you are working on.

With this method, you have access at every property declared in the configuration, but you can’t change it.

For example, it can be used to have access to the declared parameters in the development part of the application.

getLoggedOnUser method

The following method ‘getLoggedOnUser()’ return the logged on user.

Example

In this example, the declared extension in the configuration is “com.moovapps.workplace.sdk.extension.CustomApplicationTileExtension”.

This extension:

  • Change all available properties;
  • Hide the tile for the sysadmin;
  • Disable the tile for every user named “John”.

The application can be found in the quick launcher search with this keyword : “Test”, “adding”, “keywords”.

package com.moovapps.workplace.sdk.extension;

import com.moovapps.workplace.sdk.beans.IApplicationDisplay;

public class CustomApplicationTileExtension extends BaseApplicationDisplayExtension {

    @Override
    public IApplicationDisplay compute(IApplicationDisplay applicationTile) {
        applicationTile.setTitle("New title");
        applicationTile.setIcon("icon_32_warranty");
        applicationTile.setTileColor("gold");
        applicationTile.setTargetBlank(true);
        applicationTile.setTargetName("planning");
        applicationTile.setLink("http://perdu.com/");
        applicationTile.setHelpLinkJS("window.open('http://perdu.com/')");
        applicationTile.setHomepageOrder(0L);
        applicationTile.setKeywords("test adding keywords");

        if (getLoggedOnUser().getFirstName().equals("John")) {
            applicationTile.setEnabled(false); 
        }

        return applicationTile; 
    }

	@Override
	public boolean isVisible() {
        if(getLoggedOnUser().isSysadmin()){
            return false;
        }
        return true; 
    }
}