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.

getExtensionUUID()

Return the unique extension id

Basic sample

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) {
	}
 
        @Override
	public String getExtensionUUID() {
		return String.valueOf("44f94470-d097-11df-bd3b-0800200c9a66");
	}
}

Sample with iframe

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;
	}
 
        @Override
	public String getExtensionUUID() {
		return String.valueOf("44f94470-d097-11df-bd3b-0800200c9a66");
	}
}