X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=core%2Forg.argeo.suite.ui%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fui%2Fwidgets%2FTabbedArea.java;h=c281904e989d8d4b8b67b47f4c6ce4cb99b0a468;hp=cd0e3cdd9ce37c45ad28d88e4711152b981f90e5;hb=38b1c40accd8da0b5bd791cc2b2257773b69ac56;hpb=283ee4118c8ad50919a0e4fb32419940780b37c9 diff --git a/core/org.argeo.suite.ui/src/org/argeo/suite/ui/widgets/TabbedArea.java b/core/org.argeo.suite.ui/src/org/argeo/suite/ui/widgets/TabbedArea.java index cd0e3cd..c281904 100644 --- a/core/org.argeo.suite.ui/src/org/argeo/suite/ui/widgets/TabbedArea.java +++ b/core/org.argeo.suite.ui/src/org/argeo/suite/ui/widgets/TabbedArea.java @@ -45,7 +45,7 @@ public class TabbedArea extends Composite { private boolean singleTab = false; public TabbedArea(Composite parent, int style) { - super(parent, style); + super(parent, SWT.NONE); CmsUiUtils.style(parent, bodyStyle); setLayout(CmsUiUtils.noSpaceGridLayout()); @@ -91,7 +91,9 @@ public class TabbedArea extends Composite { title.setLayoutData(CmsUiUtils.fillWidth()); title.addSelectionListener((Selected) (e) -> showTab(tabIndex(section.getNode()))); Node node = section.getNode(); - title.setText(Jcr.getTitle(node)); + String titleStr = Jcr.getTitle(node); + // TODO internationalize + title.setText(titleStr); if (!singleTab) { ToolBar toolBar = new ToolBar(sectionHeader, SWT.NONE); ToolItem closeItem = new ToolItem(toolBar, SWT.FLAT); @@ -198,6 +200,16 @@ public class TabbedArea extends Composite { refreshTabHeaders(); showTab(nextIndex); } + + public void closeAllTabs() { + for(Section section:sections) { + section.dispose(); + } + sections.clear(); + emptyState(); + refreshTabHeaders(); + layout(true, true); + } protected void emptyState() { new Section(body, SWT.NONE, null); @@ -209,7 +221,16 @@ public class TabbedArea extends Composite { } protected Section getCurrentSection() { - return (Section) body.getChildren()[0]; + return (Section) stackLayout.topControl; + } + + public Node getCurrentContext() { + Section section = getCurrentSection(); + if (section != null) { + return section.getNode(); + } else { + return null; + } } public void setTabStyle(String tabStyle) {