@Override public Point computeSize(int wHint, int hHint, boolean changed) { return ((PageBookLayout) getLayout()).computeSize(this, wHint, hHint, changed); } }
/** * Creates a new empty pagebook. * * @param parent * the parent composite * @param style * the SWT style bits */ public WrappedPageBook(Composite parent, int style) { super(parent, style); setLayout(new PageBookLayout()); }
/** * Shows a page with no children to be used if the desire is to not show * any registered page. */ public void showEmptyPage() { if (emptyPage == null) { emptyPage = createPage(); emptyPage.setLayout(new GridLayout()); } pageBook.showPage(emptyPage); currentPage = emptyPage; reflow(true); } /**
private Composite createPage() { Composite page = new Composite(pageBook, SWT.NULL); page.setBackground(getBackground()); page.setForeground(getForeground()); page.setMenu(pageBook.getMenu()); return page; } }
/** * Shows the given page. This method has no effect if the given page is not * contained in this pagebook. * * @param page * the page to show */ public void showPage(Control page) { if (page == currentPage) return; if (page.getParent() != this) return; Control oldPage = currentPage; currentPage = page; // show new page if (page != null) { if (!page.isDisposed()) { //page.setVisible(true); layout(true); page.setVisible(true); } } // hide old *after* new page has been made visible in order to avoid // flashing if (oldPage != null && !oldPage.isDisposed()) oldPage.setVisible(false); }
/** * Creates a new instance in the provided parent and with the provided * style. * * @param parent * the control parent * @param style * the style to use */ public ScrolledPageBook(Composite parent, int style) { super(parent, style); pageBook = new WrappedPageBook(this, SWT.NULL); setContent(pageBook); pages = new Hashtable<>(); setExpandHorizontal(true); setExpandVertical(true); this.addListener(SWT.Traverse, e -> { switch (e.detail) { case SWT.TRAVERSE_ESCAPE: case SWT.TRAVERSE_RETURN: case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: e.doit = true; break; } }); } /**
private Composite createPage() { Composite page = new LayoutComposite(pageBook, SWT.NULL); page.setBackground(getBackground()); page.setForeground(getForeground()); page.setMenu(pageBook.getMenu()); return page; } }
/** * Shows the given page. This method has no effect if the given page is not * contained in this pagebook. * * @param page * the page to show */ public void showPage(Control page) { if (page == currentPage) return; if (page.getParent() != this) return; Control oldPage = currentPage; currentPage = page; // show new page if (page != null) { if (!page.isDisposed()) { //page.setVisible(true); layout(true); page.setVisible(true); } } // hide old *after* new page has been made visible in order to avoid // flashing if (oldPage != null && !oldPage.isDisposed()) oldPage.setVisible(false); }
pageBook = new WrappedPageBook(this, SWT.NULL); setContent(pageBook); pages = new Hashtable<>();
/** * Shows a page with no children to be used if the desire is to not show * any registered page. */ public void showEmptyPage() { if (emptyPage == null) { emptyPage = createPage(); emptyPage.setLayout(new GridLayout()); } pageBook.showPage(emptyPage); currentPage = emptyPage; reflow(true); } /**
/** * Creates a new empty pagebook. * * @param parent * the parent composite * @param style * the SWT style bits */ public WrappedPageBook(Composite parent, int style) { super(parent, style); setLayout(new PageBookLayout()); }
@Override public Point computeSize(int wHint, int hHint, boolean changed) { return ((PageBookLayout) getLayout()).computeSize(this, wHint, hHint, changed); } }
/** * Shows the page with the provided key and hides the page previously * showing. Does nothing if the page with that key does not exist. * * @param key * the page key */ public void showPage(Object key) { Control page = pages.get(key); if (page != null) { pageBook.showPage(page); if (currentPage != null && currentPage != page) { // switching pages - force layout if (page instanceof Composite) ((Composite) page).layout(false); } currentPage = page; } else { showEmptyPage(); } reflow(true); } /**
/** * Shows the page with the provided key and hides the page previously * showing. Does nothing if the page with that key does not exist. * * @param key * the page key */ public void showPage(Object key) { Control page = pages.get(key); if (page != null) { pageBook.showPage(page); if (currentPage != null && currentPage != page) { // switching pages - force layout if (page instanceof Composite) ((Composite) page).layout(false); } currentPage = page; } else { showEmptyPage(); } reflow(true); } /**