From: hyeran74.kim Date: Fri, 30 May 2014 08:55:25 +0000 (+0900) Subject: BaseView : added an interface for adding view pages dinamically X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b453c58b60973d89b4f33b5273c11aa5cd9fc72b;p=sdk%2Ftools%2Fdynamic-analyzer.git BaseView : added an interface for adding view pages dinamically Change-Id: Id0e8e9b29a5baaaa99c6812c6a451d08085b582c Signed-off-by: hyeran74.kim --- diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/DATabComposite.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/DATabComposite.java index acf0274..a7f883e 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/DATabComposite.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/DATabComposite.java @@ -26,6 +26,7 @@ package org.tizen.dynamicanalyzer.widgets.da.view; +import java.awt.Button; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -77,7 +78,6 @@ public class DATabComposite extends DABaseComposite { private boolean isImageTab = false; private int tabWidth = LONG_TAB_WIDTH; - { ID = DATabComposite.class.getName(); } @@ -158,6 +158,7 @@ public class DATabComposite extends DABaseComposite { } else { ID = childId; } + child.setID(ID); String title = child.getTitle(); @@ -457,6 +458,19 @@ public class DATabComposite extends DABaseComposite { contentsComposite.layout(); } } + + /** + * remove all pages + */ + public void removeAll() { + // remove all buttons on display + for (int i = 0; i < buttons.size(); i++) { + FormData data = (FormData) buttons.get(i).getLayoutData(); + data.width = 0; + } + children.clear(); + buttons.clear(); + } public Composite getContentComposite() { return contentsComposite; @@ -477,7 +491,7 @@ public class DATabComposite extends DABaseComposite { tab.updateView(); contentsComposite.layout(); } - + @Override public void clear() { int size = children.size(); diff --git a/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/constant/CommonConstants.java b/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/constant/CommonConstants.java index 43afc97..62e9eb4 100644 --- a/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/constant/CommonConstants.java +++ b/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/constant/CommonConstants.java @@ -89,5 +89,16 @@ public class CommonConstants { public final static int LONG_SIZE = Long.SIZE / Byte.SIZE; public final static int FLOAT_SIZE = Float.SIZE / Byte.SIZE; public final static int DOUBLE_SIZE = Double.SIZE / Byte.SIZE; + + /* Tab Page */ + public static final int PAGE_TIME_LINE = 0; + public static final int PAGE_THREAD = 1; + public static final int PAGE_NETWORK = 2; + public static final int PAGE_FILE = 3; + public static final int PAGE_GRAPHICS = 4; + public static final int PAGE_UI = 5; + public static final int PAGE_KERNEL = 6; + public static final int PAGE_SUMMARY = 7; + public static final int PAGE_RANGE = 8; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java index 2f8fb0c..f68f4e8 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java @@ -26,10 +26,14 @@ package org.tizen.dynamicanalyzer.ui.page; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.part.ViewPart; +import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.ui.file.FilePage; import org.tizen.dynamicanalyzer.ui.kernel.KernelPage; import org.tizen.dynamicanalyzer.ui.network.NetworkPage; @@ -75,12 +79,12 @@ public class BaseView extends ViewPart { tabView.getContentComposite(), SWT.NONE); tabView.addView(networkPage, false); - DABaseComposite filePage = new FilePage(tabView.getContentComposite(), - SWT.NONE); + DABaseComposite filePage = new FilePage( + tabView.getContentComposite(), SWT.NONE); tabView.addView(filePage, false); - DABaseComposite graphicsPage = new GLPage(tabView.getContentComposite(), - SWT.NONE); + DABaseComposite graphicsPage = new GLPage( + tabView.getContentComposite(), SWT.NONE); tabView.addView(graphicsPage, false); // DABaseComposite uiPage = new UIPage(tabView.getContentComposite(), @@ -107,6 +111,65 @@ public class BaseView extends ViewPart { return tabView; } + /** + * add tab pages dynamically + * @param tabViewList : selected tab pages for adding + */ + public void addTabViewPage(List tabViewList) { + tabView.removeAll(); // remove existing pages + if(tabViewList != null && tabViewList.size() > 0) { + for(int id : tabViewList) { + switch(id){ + case CommonConstants.PAGE_FILE: + DABaseComposite filePage = new FilePage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(filePage, false); + break; + case CommonConstants.PAGE_GRAPHICS: + DABaseComposite graphicsPage = new GLPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(graphicsPage, false); + break; + case CommonConstants.PAGE_KERNEL: + DABaseComposite kernelPage = new KernelPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(kernelPage, false); + break; + case CommonConstants.PAGE_NETWORK: + DABaseComposite networkPage = new NetworkPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(networkPage, false); + break; + case CommonConstants.PAGE_SUMMARY: + DABaseComposite summaryPage = new SummaryPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(summaryPage, false); + break; + case CommonConstants.PAGE_THREAD: + DABaseComposite threadPage = new ThreadPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(threadPage, false); + break; + case CommonConstants.PAGE_TIME_LINE: + DABaseComposite timelinePage = new TimelinePage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(timelinePage, false); + break; + case CommonConstants.PAGE_UI: + DABaseComposite uiPage = new UIPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(uiPage, false); + break; + default: + DA_LOG.debug("No Selected View Pages"); + break; + } + } + } else { + DA_LOG.error("Veiw Page List is Null"); + } + } + public DAPageComposite getTopComposite() { Display.getDefault().syncExec(new Runnable() { @Override