TabWorkspace Extension

Adds a new tab at top right workspace section ( usually there are shown desktop, search, dashboard and administration tab ).

Methods

methodDescription
getTabText()

Used by OpenKM to get the tab text.

setTab(TabBar tabBar, int tabIndex)

Used by openkm to set tabBar and tab index.

Basic sample

package com.openkm.extension.frontend.client;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.TabBar;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.openkm.frontend.client.extension.widget.tabworkspace.TabWorkspaceExtension;

public class TabWorkspaceExample extends TabWorkspaceExtension {

    private VerticalPanel vPanel;

    /**
     * TabWorkspaceExample
     */
    public TabWorkspaceExample() {
        vPanel = new VerticalPanel();
        vPanel.add(new HTML("new workspace example"));
        vPanel.setStyleName("okm-Input");

        initWidget(vPanel);
    }

    @Override
    public String getTabText() {
        return "tab workspace";
    }

    @Override
    public void setTab(TabBar tabBar, int tabIndex) {
    }
}

Sample with iframe

package com.openkm.extension.frontend.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.TabBar;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.openkm.frontend.client.Main;
import com.openkm.frontend.client.extension.widget.tabworkspace.TabWorkspaceExtension;

public class TabWorkspace extends TabWorkspaceExtension {

    private VerticalPanel vPanel;
    private Frame iframe;
    private String textLabel = "";
    private TabBar tabBar;
    private int tabIndex = 0;

    /**
     * TabWorkspace
     */
    public TabWorkspace() {
        vPanel = new VerticalPanel();
        iframe = new Frame("about:blank");

        DOM.setElementProperty(iframe.getElement(), "frameborder", "0");
        DOM.setElementProperty(iframe.getElement(), "marginwidth", "0");
        DOM.setElementProperty(iframe.getElement(), "marginheight", "0");

        // Commented because on IE show clear if allowtransparency=true
        DOM.setElementProperty(iframe.getElement(), "allowtransparency", "false");
        DOM.setElementProperty(iframe.getElement(), "scrolling", "no");

        iframe.setUrl(Main.CONTEXT + "/sample/index.jsp");
        iframe.setStyleName("okm-Iframe");

        vPanel.add(iframe);
        vPanel.setCellHorizontalAlignment(iframe, HasAlignment.ALIGN_CENTER);

        vPanel.setWidth("100%");
        vPanel.setHeight("100%");

        initWidget(vPanel);
    }

    /**
     * Sets the size on initialization
     *
     * @param width The max width of the widget
     * @param height The max height of the widget
     */
    public void setPixelSize(int width, int height) {
        iframe.setPixelSize(width - 2, height - 2);
    }

    /**
     * setTextLabel
     */
    public void setTextLabel(String textLabel) {
        this.textLabel = textLabel;
    }

    @Override
    public String getTabText() {
        return textLabel;
    }

    @Override
    public void setTab(TabBar tabBar, int tabIndex) {
        this.tabBar = tabBar;
        this.tabIndex = tabIndex;
    }

}