import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
-/** Manages {@link Section} in a tab-like structure.*/
+/** Manages {@link Section} in a tab-like structure. */
public class TabbedArea extends Composite {
private static final long serialVersionUID = 8659669229482033444L;
private String tabSelectedStyle;
private Image closeIcon;
- private long openingTimer = 500;
-
public TabbedArea(Composite parent, int style) {
super(parent, style);
emptyHeader.setLayoutData(CmsUiUtils.fillAll());
emptyHeader.setLayout(new GridLayout());
Label lbl = new Label(emptyHeader, SWT.NONE);
- lbl.setText("-");
+ lbl.setText("");
lbl.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
}
currentUiProvider = uiProvider;
section.setNode(context);
section.setLayoutData(CmsUiUtils.coversAll());
- for (Control child : section.getChildren())
- child.dispose();
- uiProvider.createUiPart(section, context);
+ build(section, uiProvider, context);
if (sections.size() == 0)
sections.add(section);
refreshTabHeaders();
}
public void open(CmsUiProvider uiProvider, Node context) {
- try {
- if (openingTimer > 0)
- Thread.sleep(openingTimer);
- } catch (InterruptedException e) {
- // silent
- }
+// try {
+// if (openingTimer > 0)
+// Thread.sleep(openingTimer);
+// } catch (InterruptedException e) {
+// // silent
+// }
// int index = tabIndex(context);
if (previousNode != null && Jcr.getIdentifier(previousNode).equals(Jcr.getIdentifier(context))) {
CmsUiUtils.clear(body);
Section currentSection = getCurrentSection();
int currentIndex = sections.indexOf(currentSection);
- Section nextCurrentSection = new Section(body, SWT.NONE, context);
- nextCurrentSection.setLayoutData(CmsUiUtils.coversAll());
- sections.remove(currentSection);
- sections.add(currentIndex, nextCurrentSection);
- sections.add(currentSection);
- nextCurrentSection.moveAbove(null);
- if (previousNode != null) {
- view(previousUiProvider, previousNode);
- }
+ Section previousSection = new Section(body, SWT.NONE, context);
+ build(previousSection, previousUiProvider, previousNode);
+ previousSection.setLayoutData(CmsUiUtils.coversAll());
+// sections.remove(currentSection);
+ sections.add(currentIndex + 1, previousSection);
+// sections.add(currentSection);
+// nextCurrentSection.moveAbove(null);
+// if (previousNode != null) {
+// view(previousUiProvider, previousNode);
+// }
refreshTabHeaders();
layout(true, true);
}
layout(true, true);
}
+ protected void build(Section section, CmsUiProvider uiProvider, Node context) {
+ for (Control child : section.getChildren())
+ child.dispose();
+ section.setNode(context);
+ uiProvider.createUiPart(section, context);
+
+ }
+
private int tabIndex(Node node) {
for (int i = 0; i < sections.size(); i++) {
Section section = sections.get(i);
public void setCloseIcon(Image closeIcon) {
this.closeIcon = closeIcon;
}
-
- public void setOpeningTimer(long openingTimer) {
- this.openingTimer = openingTimer;
- }
-
}