From 0245a75ac0cd6813a4f87810e3788a09c4563421 Mon Sep 17 00:00:00 2001 From: kamuru Date: Thu, 31 Oct 2013 15:29:14 +0900 Subject: [PATCH] [Title] navigation button coloring [Desc.] modify navigation button on context state table color when grid item's color is changed [Issue] --- .../ui/opengl/ui/context/GLContextTreeTable.java | 193 ++++++++++++--------- 1 file changed, 110 insertions(+), 83 deletions(-) diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java index 788ec39..545b4a8 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java @@ -41,6 +41,7 @@ import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; @@ -55,6 +56,7 @@ import org.tizen.dynamicanalyzer.common.DASelectionData; import org.tizen.dynamicanalyzer.listeners.TableTooltipListener; import org.tizen.dynamicanalyzer.model.TreeInput; import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.sql.DBTableInfo; import org.tizen.dynamicanalyzer.sql.DBTableManager; import org.tizen.dynamicanalyzer.sql.SqlManager; @@ -105,8 +107,7 @@ public class GLContextTreeTable extends DATreeComposite { private TreeInput nodeProgramObject; private TreeInput nodeShaderObject; - private Point hover = new Point(-1, -1); - private Point push = new Point(-1, -1); + private GridItem gridItem2; private Composite naviButtonLeftComposite; private Composite naviButtonRightComposite; private Button buttonLeftLeft; @@ -162,8 +163,6 @@ public class GLContextTreeTable extends DATreeComposite { if (items == null || items.length <= 0) { return; } - int index = ((GLContextTreeNodeData)items[0].getData()).getDBColumnIndex(); - DASelectionData selData = new DASelectionData(GLContextView.ID, 0, 0, items[0], table); AnalyzerManager.getCurrentPage().updatePage(selData); @@ -176,8 +175,18 @@ public class GLContextTreeTable extends DATreeComposite { makeTreeInput = false; updateTree(); table.setSelection(selectionIndex); + + if (!naviButtonLeftComposite.isDisposed()) { + naviButtonLeftComposite + .setBackground(ColorResources.TABLE_CONTENTS_SELECTED_END); + } + + if (!naviButtonRightComposite.isDisposed()) { + naviButtonRightComposite + .setBackground(ColorResources.TABLE_CONTENTS_SELECTED_END); + } } - + @Override public void widgetDefaultSelected(SelectionEvent e) { } @@ -190,8 +199,6 @@ public class GLContextTreeTable extends DATreeComposite { @Override public void mouseDown(MouseEvent e) { - push.x = e.x; - push.y = e.y; } @Override @@ -217,9 +224,6 @@ public class GLContextTreeTable extends DATreeComposite { @Override public void mouseExit(MouseEvent e) { - hover.x = -1; - hover.y = -1; - // TODO dispose // disposeButtons(); } @@ -232,87 +236,24 @@ public class GLContextTreeTable extends DATreeComposite { table.addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { - hover.x = e.x; - hover.y = e.y; - - disposeButtons(); - GridItem gridItem = table.getItem(new Point(e.x, e.y)); if(gridItem == null) { return; } + + if(gridItem2 == gridItem) { + return; + } else { + disposeNaviButtons(); + gridItem2 = gridItem; + } + final GLContextTreeNodeData treeNodeData = (GLContextTreeNodeData)gridItem.getData(); if(treeNodeData.getDBColumnIndex() == -1) { return; } - naviButtonLeftComposite = new Composite(table, SWT.NONE); - naviButtonLeftComposite.setLayout(new FormLayout()); - naviButtonLeftComposite.setBackground(gridItem.getBackground()); - - buttonLeftLeft = new Button(naviButtonLeftComposite, SWT.NONE); - buttonLeftLeft.setText("<<"); - FormData formData = new FormData(); - formData.top = new FormAttachment(0, 0); - formData.bottom = new FormAttachment(100, 0); - formData.left = new FormAttachment(0, 0); - formData.right = new FormAttachment(0, 27); - buttonLeftLeft.setLayoutData(formData); - - buttonLeft = new Button(naviButtonLeftComposite, SWT.NONE); - buttonLeft.setText("<"); - formData = new FormData(); - formData.top = new FormAttachment(0, 0); - formData.bottom = new FormAttachment(100, 0); - formData.left = new FormAttachment(0, 27); - formData.right = new FormAttachment(0, 54); - buttonLeft.setLayoutData(formData); - naviButtonLeftComposite.pack(); - - GridEditor editor = new GridEditor(table); - editor.minimumWidth = naviButtonLeftComposite.getSize().x; - editor.horizontalAlignment = SWT.LEFT; - editor.setEditor(naviButtonLeftComposite, gridItem, 1); - - naviButtonRightComposite = new Composite(table, SWT.NONE); - naviButtonRightComposite.setLayout(new FormLayout()); - naviButtonRightComposite.setBackground(gridItem.getBackground()); - - buttonRight = new Button(naviButtonRightComposite, SWT.NONE); - buttonRight.setText(">"); - formData = new FormData(); - formData.top = new FormAttachment(0, 0); - formData.bottom = new FormAttachment(100, 0); - formData.left = new FormAttachment(100, -54); - formData.right = new FormAttachment(100, -27); - buttonRight.setLayoutData(formData); - - buttonRightRight = new Button(naviButtonRightComposite, SWT.NONE); - buttonRightRight.setText(">>"); - formData = new FormData(); - formData.top = new FormAttachment(0, 0); - formData.bottom = new FormAttachment(100, 0); - formData.left = new FormAttachment(100, -27); - formData.right = new FormAttachment(100, 0); - buttonRightRight.setLayoutData(formData); - naviButtonRightComposite.pack(); - editor = new GridEditor(table); - editor.minimumWidth = naviButtonRightComposite.getSize().x; - editor.horizontalAlignment = SWT.RIGHT; - editor.setEditor(naviButtonRightComposite, gridItem, 1); - - buttonLeftLeft - .addSelectionListener(new NavigationSelectionListener( - ButtonType.LEFTLEFT, treeNodeData)); - buttonLeft - .addSelectionListener(new NavigationSelectionListener( - ButtonType.LEFT, treeNodeData)); - buttonRight - .addSelectionListener(new NavigationSelectionListener( - ButtonType.RIGHT, treeNodeData)); - buttonRightRight - .addSelectionListener(new NavigationSelectionListener( - ButtonType.RIGHTRIGHT, treeNodeData)); + createNaviButtons(gridItem, treeNodeData); } }); @@ -328,7 +269,7 @@ public class GLContextTreeTable extends DATreeComposite { initContextTree(); } - private void disposeButtons() { + private void disposeNaviButtons() { if(naviButtonLeftComposite != null) { naviButtonLeftComposite.dispose(); } @@ -354,6 +295,87 @@ public class GLContextTreeTable extends DATreeComposite { } } + private void createNaviButtons(GridItem gridItem, + GLContextTreeNodeData treeNodeData) { + System.out.println("create navi button"); + + Color bgColor; + if (table.isSelected(gridItem)) { + bgColor = ColorResources.TABLE_CONTENTS_SELECTED_END; + } else { + bgColor = gridItem.getBackground(); + } + + FormLayout formLayout = new FormLayout(); + formLayout.marginHeight = -1; + formLayout.marginWidth = -1; + + naviButtonLeftComposite = new Composite(table, SWT.NONE); + naviButtonLeftComposite.setLayout(formLayout); + naviButtonLeftComposite.setBackground(bgColor); + + buttonLeftLeft = new Button(naviButtonLeftComposite, SWT.NONE); + buttonLeftLeft.setText("<<"); + FormData formData = new FormData(); + formData.top = new FormAttachment(0, 0); + formData.bottom = new FormAttachment(100, 0); + formData.left = new FormAttachment(0, 0); + formData.right = new FormAttachment(0, 27); + buttonLeftLeft.setLayoutData(formData); + + buttonLeft = new Button(naviButtonLeftComposite, SWT.NONE); + buttonLeft.setText("<"); + formData = new FormData(); + formData.top = new FormAttachment(0, 0); + formData.bottom = new FormAttachment(100, 0); + formData.left = new FormAttachment(0, 27); + formData.right = new FormAttachment(0, 54); + buttonLeft.setLayoutData(formData); + naviButtonLeftComposite.pack(); + + GridEditor editor = new GridEditor(table); + editor.minimumWidth = naviButtonLeftComposite.getSize().x; + editor.horizontalAlignment = SWT.LEFT; + editor.setEditor(naviButtonLeftComposite, gridItem, 1); + + naviButtonRightComposite = new Composite(table, SWT.NONE); + naviButtonRightComposite.setLayout(formLayout); + naviButtonRightComposite.setBackground(bgColor); + + buttonRight = new Button(naviButtonRightComposite, SWT.NONE); + buttonRight.setText(">"); + formData = new FormData(); + formData.top = new FormAttachment(0, 0); + formData.bottom = new FormAttachment(100, 0); + formData.left = new FormAttachment(100, -54); + formData.right = new FormAttachment(100, -27); + buttonRight.setLayoutData(formData); + + buttonRightRight = new Button(naviButtonRightComposite, SWT.NONE); + buttonRightRight.setText(">>"); + formData = new FormData(); + formData.top = new FormAttachment(0, 0); + formData.bottom = new FormAttachment(100, 0); + formData.left = new FormAttachment(100, -27); + formData.right = new FormAttachment(100, 0); + buttonRightRight.setLayoutData(formData); + naviButtonRightComposite.pack(); + + editor = new GridEditor(table); + editor.minimumWidth = naviButtonRightComposite.getSize().x; + editor.horizontalAlignment = SWT.RIGHT; + editor.setEditor(naviButtonRightComposite, gridItem, 1); + + buttonLeftLeft.addSelectionListener(new NavigationSelectionListener( + ButtonType.LEFTLEFT, treeNodeData)); + buttonLeft.addSelectionListener(new NavigationSelectionListener( + ButtonType.LEFT, treeNodeData)); + buttonRight.addSelectionListener(new NavigationSelectionListener( + ButtonType.RIGHT, treeNodeData)); + buttonRightRight.addSelectionListener(new NavigationSelectionListener( + ButtonType.RIGHTRIGHT, treeNodeData)); + } + private void setNodeProperty(TreeInput treeInput) { List textList = new ArrayList(); GLContextTreeNodeData nodeData = (GLContextTreeNodeData) treeInput @@ -1421,6 +1443,11 @@ public class GLContextTreeTable extends DATreeComposite { } } + naviButtonLeftComposite + .setBackground(ColorResources.TABLE_RANGE_COLOR_SECOND_SELECTION); + naviButtonRightComposite + .setBackground(ColorResources.TABLE_RANGE_COLOR_SECOND_SELECTION); + String[] prevChangeInfo = list.get(bSearchedIndex).split( GLDataMaker.DELIMITER); List viewNameList = new ArrayList(); -- 2.7.4