Skip to content
Snippets Groups Projects
Commit 3a613302 authored by buczekp's avatar buczekp
Browse files

[LMS-1597] use tab onActivate method to invoke changing title also in aplication mode

SVN: 17877
parent ca39bb1f
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,9 @@ public abstract class AbstractTabItemFactory ...@@ -48,6 +48,9 @@ public abstract class AbstractTabItemFactory
/** /**
* Returns a short description of contents of the tab that can be used in tab or page title. * Returns a short description of contents of the tab that can be used in tab or page title.
* <p>
* NOTE: implementation has been changed such that it is used only internally and page title is
* always exactly the same as the tab title.
*/ */
public abstract String getTabTitle(); public abstract String getTabTitle();
......
...@@ -114,7 +114,7 @@ public final class ComponentProvider ...@@ -114,7 +114,7 @@ public final class ComponentProvider
IDisposableComponent browser = IDisposableComponent browser =
SampleBrowserGrid.create(viewContext, initialGroupOrNull, SampleBrowserGrid.create(viewContext, initialGroupOrNull,
initialSampleTypeOrNull); initialSampleTypeOrNull);
return createTab(getMessage(Dict.SAMPLE_BROWSER), browser); return createTab(getTabTitle(), browser);
} }
@Override @Override
...@@ -132,16 +132,8 @@ public final class ComponentProvider ...@@ -132,16 +132,8 @@ public final class ComponentProvider
@Override @Override
public String getTabTitle() public String getTabTitle()
{ {
StringBuilder sb = new StringBuilder();
if (initialGroupOrNull != null) return getMessage(Dict.SAMPLE_BROWSER);
{
sb.append(getMessage(Dict.GROUP) + "=" + initialGroupOrNull);
}
if (initialSampleTypeOrNull != null)
{
sb.append("type=" + initialSampleTypeOrNull);
}
return getMessage(Dict.SAMPLE_BROWSER) + " " + sb.toString();
} }
}; };
} }
...@@ -166,7 +158,7 @@ public final class ComponentProvider ...@@ -166,7 +158,7 @@ public final class ComponentProvider
IDisposableComponent browser = IDisposableComponent browser =
MaterialBrowserGrid.createWithTypeChooser(viewContext, MaterialBrowserGrid.createWithTypeChooser(viewContext,
initialMaterialTypeOrNull); initialMaterialTypeOrNull);
return createTab(getMessage(Dict.MATERIAL_BROWSER), browser); return createTab(getTabTitle(), browser);
} }
@Override @Override
...@@ -184,12 +176,7 @@ public final class ComponentProvider ...@@ -184,12 +176,7 @@ public final class ComponentProvider
@Override @Override
public String getTabTitle() public String getTabTitle()
{ {
StringBuilder sb = new StringBuilder(); return getMessage(Dict.MATERIAL_BROWSER);
if (initialMaterialTypeOrNull != null)
{
sb.append("type=" + initialMaterialTypeOrNull);
}
return getMessage(Dict.MATERIAL_BROWSER) + " " + sb.toString();
} }
}; };
...@@ -680,7 +667,6 @@ public final class ComponentProvider ...@@ -680,7 +667,6 @@ public final class ComponentProvider
return new HelpPageIdentifier(HelpPageDomain.EXPERIMENT, HelpPageAction.BROWSE); return new HelpPageIdentifier(HelpPageDomain.EXPERIMENT, HelpPageAction.BROWSE);
} }
// FIXME
@Override @Override
public String getTabTitle() public String getTabTitle()
{ {
...@@ -870,7 +856,6 @@ public final class ComponentProvider ...@@ -870,7 +856,6 @@ public final class ComponentProvider
return new HelpPageIdentifier(HelpPageDomain.DATA_SET, HelpPageAction.SEARCH); return new HelpPageIdentifier(HelpPageDomain.DATA_SET, HelpPageAction.SEARCH);
} }
// FIXME
@Override @Override
public String getTabTitle() public String getTabTitle()
{ {
...@@ -902,7 +887,6 @@ public final class ComponentProvider ...@@ -902,7 +887,6 @@ public final class ComponentProvider
return new HelpPageIdentifier(HelpPageDomain.SAMPLE, HelpPageAction.SEARCH); return new HelpPageIdentifier(HelpPageDomain.SAMPLE, HelpPageAction.SEARCH);
} }
// FIXME
@Override @Override
public String getTabTitle() public String getTabTitle()
{ {
......
...@@ -19,7 +19,9 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.framework ...@@ -19,7 +19,9 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.framework
import com.extjs.gxt.ui.client.widget.Component; import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Header; import com.extjs.gxt.ui.client.widget.Header;
import com.google.gwt.user.client.Window;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.CommonViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
...@@ -150,6 +152,8 @@ public class DefaultTabItem implements ITabItem ...@@ -150,6 +152,8 @@ public class DefaultTabItem implements ITabItem
{ {
lastModificationStateUpdaterOrNull.update(); lastModificationStateUpdaterOrNull.update();
} }
Window.setTitle(getTabTitleUpdater().getCurrentTitle() + " - "
+ CommonViewContext.ClientStaticState.getPageTitleSuffix());
} }
public void onClose() public void onClose()
......
...@@ -19,9 +19,6 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.framework ...@@ -19,9 +19,6 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.framework
import com.extjs.gxt.ui.client.event.EventType; import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.mvc.AppEvent; import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Dispatcher; import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.google.gwt.user.client.Window;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.CommonViewContext;
/** /**
* A helper for using {@link Dispatcher}. * A helper for using {@link Dispatcher}.
...@@ -52,8 +49,6 @@ public final class DispatcherHelper ...@@ -52,8 +49,6 @@ public final class DispatcherHelper
{ {
AppEvent event = createEvent(AppEvents.NAVI_EVENT, tabItemFactory); AppEvent event = createEvent(AppEvents.NAVI_EVENT, tabItemFactory);
Dispatcher.get().dispatch(event); Dispatcher.get().dispatch(event);
Window.setTitle(tabItemFactory.getTabTitle() + " "
+ CommonViewContext.ClientStaticState.getPageTitleSuffix());
} }
private final static AppEvent createEvent(EventType eventType, Object data) private final static AppEvent createEvent(EventType eventType, Object data)
......
...@@ -18,6 +18,14 @@ public class TabTitleUpdater ...@@ -18,6 +18,14 @@ public class TabTitleUpdater
this.title = initialTitle; this.title = initialTitle;
} }
/**
* Returns current title of the tab.
*/
String getCurrentTitle()
{
return title;
}
/** /**
* Updates the tab title if binded, stores the title value otherwise. * Updates the tab title if binded, stores the title value otherwise.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment