When changing mode type reloading tab names
This commit is contained in:
parent
14e2676cc3
commit
cf75d07807
2 changed files with 18 additions and 0 deletions
|
|
@ -57,6 +57,13 @@ public class TabsRegistry {
|
|||
activateMenuIfRegistered(tab);
|
||||
}
|
||||
|
||||
public void loadNewName(ITab tab) {
|
||||
if (fromTabToMenuKey.containsKey(tab)) {
|
||||
Object key = fromTabToMenuKey.get(tab);
|
||||
menu.renameMenuItem(key, tab.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private void activateMenuIfRegistered(ITab tab) {
|
||||
if (fromTabToMenuKey.containsKey(tab)) {
|
||||
menu.activateMenuItem(fromTabToMenuKey.get(tab));
|
||||
|
|
@ -90,4 +97,5 @@ public class TabsRegistry {
|
|||
fromTabToMenuKey.put(t, key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.navalplanner.web.planner.CompanyPlanningController;
|
|||
import org.navalplanner.web.planner.IOrderPlanningGate;
|
||||
import org.navalplanner.web.planner.OrderPlanningController;
|
||||
import org.navalplanner.web.planner.tabs.CreatedOnDemandTab.IComponentCreator;
|
||||
import org.navalplanner.web.planner.tabs.Mode.ModeTypeChangedListener;
|
||||
import org.navalplanner.web.resourceload.ResourceLoadController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
|
@ -143,6 +144,15 @@ public class MultipleTabsPlannerController implements Composer {
|
|||
public TabsConfiguration getTabs() {
|
||||
if (tabsConfiguration == null) {
|
||||
tabsConfiguration = buildTabsConfiguration();
|
||||
mode.addListener(new ModeTypeChangedListener() {
|
||||
|
||||
@Override
|
||||
public void typeChanged(ModeType oldType, ModeType newType) {
|
||||
for (ITab tab : tabsConfiguration.getTabs()) {
|
||||
tabsSwitcher.getTabsRegistry().loadNewName(tab);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return tabsConfiguration;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue