DashboardHandlerExtension

Any extension that implements ToolBarHandlerExtension will be monitoring events triggered from the toolbar.

Methods

methodDescription

onChange(DashboardEventConstant event)

Each time it'll be some new toolbar event the method onChange it'll be fired by OpenKM .

Sample

package com.openkm.extension.frontend.client;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
import com.openkm.extension.frontend.client.util.OKMExtensionBundleExampleResources;
import com.openkm.frontend.client.extension.event.HasDashboardEvent;
import com.openkm.frontend.client.extension.event.HasToolBarEvent.ToolBarEventConstant;
import com.openkm.frontend.client.extension.event.handler.ToolBarHandlerExtension;
import com.openkm.frontend.client.extension.widget.toolbar.ToolBarBoxExtension;

public class ToolBarBoxExample implements DashboardHandlerExtension {

    public HorizontalPanel hPanel;
    public ToolBarBoxExtension toolBarBoxExtension;

    /**
     * ToolBarBoxExample
     */
    public ToolBarBoxExample() {
        toolBarBoxExtension = new ToolBarBoxExtension(new Image(OKMExtensionBundleExampleResources.INSTANCE.general()),
                "new toolbar") {
            @Override
            public Widget getWidget() {
                return hPanel;
            }
        };

        hPanel = new HorizontalPanel();
        hPanel.add(new HTML("new toolbarbox example"));
    }

    /**
     * ToolBarBoxExtension
     */
    public ToolBarBoxExtension getToolBarBox() {
        return toolBarBoxExtension;
    }

    @Override
    public void onChange(DashboardEventConstant event) {
        if (event.equals(HasDashboardEvent.TOOLBOX_CHANGED)) {
            Window.alert("toolbar changed - " + event.getType());
        }
    }
}