Search in sources :

Example 1 with BrowserHistoryEntry

use of org.eclipse.scout.rt.client.ui.desktop.BrowserHistoryEntry in project scout.rt by eclipse.

the class OutlineDeepLinkHandlerTest method testCreateBrowserHistory.

@Test
public void testCreateBrowserHistory() {
    OutlineDeepLinkHandler handler = new OutlineDeepLinkHandler();
    IOutline outline = new P_OutlineFoo();
    BrowserHistoryEntry entry = handler.createBrowserHistoryEntry(outline);
    assertEquals("outline-04446", entry.getDeepLinkPath());
    // title of outline is added to title of desktop (this string is used for the title in the browser-window)
    assertEquals("Test Environment Application - Foo", entry.getTitle());
    // title of outline is used to create the (i)nfo URL parameter
    assertEquals("./?dl=outline-04446&i=foo", entry.getPath());
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) BrowserHistoryEntry(org.eclipse.scout.rt.client.ui.desktop.BrowserHistoryEntry) Test(org.junit.Test)

Example 2 with BrowserHistoryEntry

use of org.eclipse.scout.rt.client.ui.desktop.BrowserHistoryEntry in project scout.rt by eclipse.

the class DeepLinkUriBuilder method createBrowserHistoryEntry.

public BrowserHistoryEntry createBrowserHistoryEntry() {
    if (m_path == null) {
        throw new IllegalStateException("Cannot create BrowserHistoryEntry without deep-link path");
    }
    IDesktop desktop = ClientSessionProvider.currentSession().getDesktop();
    StringBuilder title = new StringBuilder(desktop.getTitle());
    if (StringUtility.hasText(m_info)) {
        title.append(" - ").append(m_info);
    }
    return new BrowserHistoryEntry(m_builder.createURI(), title.toString(), m_path);
}
Also used : BrowserHistoryEntry(org.eclipse.scout.rt.client.ui.desktop.BrowserHistoryEntry) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop)

Aggregations

BrowserHistoryEntry (org.eclipse.scout.rt.client.ui.desktop.BrowserHistoryEntry)2 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)1 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)1 Test (org.junit.Test)1