sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/visual/GraphComposite.java
author Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
Wed, 23 Jun 2010 15:05:09 +0300
changeset 12 ae255c9aa552
parent 5 844b047e260d
permissions -rw-r--r--
Performance Investigator Carbide extension 2.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
 * Contributors:
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
 * Description: 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
package com.nokia.carbide.cpp.internal.pi.visual;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    20
import java.net.URL;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    21
import java.util.ArrayList;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    22
import java.util.List;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    23
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    24
import org.eclipse.core.runtime.FileLocator;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    25
import org.eclipse.core.runtime.Path;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    26
import org.eclipse.core.runtime.Platform;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
import org.eclipse.draw2d.FigureCanvas;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    28
import org.eclipse.jface.action.Action;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    29
import org.eclipse.jface.resource.ImageDescriptor;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
import org.eclipse.swt.SWT;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    31
import org.eclipse.swt.events.ControlEvent;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    32
import org.eclipse.swt.events.ControlListener;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    33
import org.eclipse.swt.events.SelectionEvent;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    34
import org.eclipse.swt.events.SelectionListener;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    35
import org.eclipse.swt.graphics.Color;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    36
import org.eclipse.swt.graphics.Image;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
import org.eclipse.swt.layout.FormAttachment;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
import org.eclipse.swt.layout.FormData;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
import org.eclipse.swt.layout.FormLayout;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    40
import org.eclipse.swt.layout.GridData;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    41
import org.eclipse.swt.layout.GridLayout;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    42
import org.eclipse.swt.widgets.Button;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    43
import org.eclipse.swt.widgets.Combo;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
import org.eclipse.swt.widgets.Composite;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    45
import org.eclipse.swt.widgets.Control;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    46
import org.eclipse.swt.widgets.Display;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
import org.eclipse.swt.widgets.Label;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    48
import org.eclipse.ui.PlatformUI;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    49
import org.osgi.framework.Bundle;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    51
import com.nokia.carbide.cpp.internal.pi.plugin.model.ITitleBarMenu;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    52
import com.nokia.carbide.cpp.internal.pi.visual.PICompositePanel.GraphComponentWrapper;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    53
import com.nokia.carbide.cpp.pi.PiPlugin;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    54
import com.nokia.carbide.cpp.pi.editors.Messages;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    56
import com.nokia.carbide.cpp.pi.visual.IGenericTraceGraph;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    57
import com.nokia.carbide.cpp.pi.visual.IGraphChangeListener;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
/**
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    60
 * 
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
 * A GraphComposite is added to the SashForm for a tab.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
 * 
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    63
 * A GraphComposite has an option centered title, a left area to contain the
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    64
 * y-axis legend, and a scrollable area containing the graph and the x-axis
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    65
 * legend.
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
 */
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    67
public class GraphComposite extends Composite implements SelectionListener,
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    68
		ControlListener, IGraphChangeListener {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    69
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    70
	// Strings for tooltips
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    71
	private static final String TOOLTIP_MAXIMIZE = "Maximize graph";
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    72
	private static final String TOOLTIP_MAXIMIZE_RESTORE = "Restore graph";
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    73
	private static final String TOOLTIP_MINIMIZE = "Minimize graph";
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    74
	private static final String TOOLTIP_MINIMIZE_RESTORE = "Restore graph";
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    75
	private static final String TOOLTIP_MOVE_UP = "Move graph up";
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    76
	private static final String TOOLTIP_MOVE_DOWN = "Move graph down";
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    77
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    78
	// size of the titlebar
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    79
	private static final int TITLESIZE = 20;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    80
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    81
	private static final int TOTAL_SASH_WEIGHT = 1000;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    82
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    83
	// UI components
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    84
	public FigureCanvas leftLegend;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    85
	public FigureCanvas figureCanvas;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    86
	private PICompositePanel compositePanel;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    87
	private Button buttonMinimize = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    88
	private Button buttonMaximize = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    89
	private Label labelTitle = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    90
	private Button buttonMoveGraphUp = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    91
	private Button buttonMoveGraphDown = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    92
	private Composite compositeTitleBar = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    93
	private Combo comboGraphType = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    94
	private Button buttonHelp;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    95
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    96
	// Images for title buttons
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    97
	private Image imageMoveGraphUp = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    98
	private Image imageMoveGraphDown = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    99
	private Image imageMinimizeGraph = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   100
	private Image imageMinimizeRestoreGraph = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   101
	private Image imageMaximizeGraph = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   102
	private Image imageMaximizeRestoreGraph = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   103
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   104
	// PreviousWight variable that is used for saving graph's size when
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   105
	// minimizing/restoring
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   106
	private double previousWeight = 0.0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   107
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   108
	// State of graph(minimized/maximized)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   109
	private boolean isMaximized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   110
	private boolean isMinimized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   111
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   112
	// Is view initialized completely
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   113
	private boolean isViewInitialized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   114
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   115
	// Title Bar actions
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   116
	private Action[] titleBarActions = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   117
	private String contextHelpId;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   118
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   119
	private GraphComponentWrapper graphComponent;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   120
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   121
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   122
	 * Constructor
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   123
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   124
	 * @param parent
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   125
	 *            Parent where UI components are placed
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   126
	 * @param style
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   127
	 *            that is used
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   128
	 * @param titleString
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   129
	 *            String for titlebar
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   130
	 * @param compositePanel
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   131
	 *            panel that is using this component
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   132
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   133
	public GraphComposite(Composite parent, int style, String titleString,
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   134
			final PICompositePanel compositePanel, ITitleBarMenu titleBar, 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   135
			GraphComponentWrapper graphComponent) {
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   136
		super(parent, style);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   137
		this.setLayout(new FormLayout());
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   138
		this.compositePanel = compositePanel;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   139
		this.graphComponent = graphComponent;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   140
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   141
		// Create TitleBar if needed
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   142
		if (titleString != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   143
			createTitleBarUIComponents(parent, titleString, titleBar);
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   144
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   145
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   146
		// Create left legend and canvas where graph is drawn
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   147
		leftLegend = new FigureCanvas(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   148
		figureCanvas = new FigureCanvas(this);
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   149
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   150
		// Set layouts for canvases and title bar
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   151
		FormData formData;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   152
		formData = new FormData();
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   153
		if (compositeTitleBar != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   154
			formData.top = new FormAttachment(compositeTitleBar, 0, SWT.BOTTOM);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   155
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   156
		} else {
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   157
			formData.top = new FormAttachment(0);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   158
		}
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   159
		formData.bottom = new FormAttachment(100);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   160
		formData.left = new FormAttachment(0);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   161
		formData.width = IGenericTraceGraph.Y_LEGEND_WIDTH;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   162
		leftLegend.setLayoutData(formData);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   163
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   164
		formData = new FormData();
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   165
		if (compositeTitleBar != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   166
			formData.top = new FormAttachment(compositeTitleBar, 0, SWT.BOTTOM);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   167
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   168
		} else {
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   169
			formData.top = new FormAttachment(0);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   170
		}
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   171
		formData.bottom = new FormAttachment(100);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   172
		formData.left = new FormAttachment(leftLegend, 0, SWT.RIGHT);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   173
		formData.right = new FormAttachment(100);
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   174
		figureCanvas.setLayoutData(formData);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   175
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   176
		// Enable/disable needed UI Components
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   177
		updateTitleBarButtonsStatus();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   178
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   179
		// add listener for resizing the view
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   180
		figureCanvas.addControlListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   181
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   182
	}
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   183
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   184
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   185
	 * @return returns index if this graph in sashform
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   186
	 * @throws IllegalStateException
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   187
	 *             if component not found in sashform
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   188
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   189
	private int getIndexOfThisComponentInSashForm() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   190
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   191
		Control[] array = compositePanel.getSashForm().getChildren();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   192
		for (int i = 0; i < array.length; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   193
			if (array[i].getClass() == this.getClass()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   194
				GraphComposite composite = (GraphComposite) array[i];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   195
				if (composite.equals(this)) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   196
					return i;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   197
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   198
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   199
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   200
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   201
		// if not found return error value
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   202
		throw new IllegalStateException();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   203
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   204
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   205
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   206
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   207
	 * @return returns control above this component in the sashform
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   208
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   209
	private Control getFormAbove() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   210
		GraphComposite graphAbove = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   211
		GraphComposite[] graphs = getVisibleGraphs();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   212
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   213
		for (int i = 0; i < graphs.length; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   214
			if (graphs[i] == this) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   215
				if (i > 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   216
					graphAbove = graphs[i - 1];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   217
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   218
				break;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   219
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   220
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   221
		return graphAbove;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   222
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   223
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   224
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   225
	 * @return returns control below this component in the sashform
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   226
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   227
	private Control getFormBelow() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   228
		GraphComposite graphBelow = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   229
		GraphComposite[] graphs = getVisibleGraphs();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   230
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   231
		for (int i = 0; i < graphs.length; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   232
			if (graphs[i] == this) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   233
				if (i != graphs.length - 1) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   234
					graphBelow = graphs[i + 1];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   235
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   236
				break;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   237
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   238
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   239
		return graphBelow;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   240
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   241
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   242
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   243
	 * Updates titlebar buttons status. Updates images and tooltips and
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   244
	 * enables/disables needed component according to status
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   245
	 * (minimized/maximized) and place of this graph.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   246
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   247
	public void updateTitleBarButtonsStatus() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   248
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   249
		// Ensure that buttons are created.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   250
		if (buttonMinimize == null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   251
			return;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   252
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   253
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   254
		// If graph is maximized, only maximize button needs to be updated
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   255
		if (this.isMaximized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   256
			buttonMaximize.setImage(imageMaximizeRestoreGraph);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   257
			buttonMaximize.setToolTipText(TOOLTIP_MAXIMIZE_RESTORE);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   258
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   259
			// Disable move and minimize buttons if maximized
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   260
			buttonMoveGraphUp.setEnabled(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   261
			buttonMoveGraphDown.setEnabled(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   262
			buttonMinimize.setEnabled(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   263
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   264
		} else {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   265
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   266
			// Minimize/restore button
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   267
			if (this.isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   268
				buttonMinimize.setImage(imageMinimizeRestoreGraph);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   269
				buttonMinimize.setToolTipText(TOOLTIP_MINIMIZE_RESTORE);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   270
				buttonMaximize.setEnabled(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   271
			} else {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   272
				buttonMinimize.setImage(imageMinimizeGraph);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   273
				buttonMinimize.setToolTipText(TOOLTIP_MINIMIZE);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   274
				buttonMaximize.setEnabled(true);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   275
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   276
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   277
			buttonMaximize.setImage(imageMaximizeGraph);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   278
			buttonMaximize.setToolTipText(TOOLTIP_MAXIMIZE);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   279
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   280
			GraphComposite[] children = getVisibleGraphs();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   281
			int childCnt = children.length;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   282
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   283
			// Enable minimize button if more than one graph
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   284
			buttonMinimize.setEnabled(childCnt > 1);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   285
			buttonMaximize.setEnabled(childCnt > 1);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   286
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   287
			int index = -1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   288
			for (int i = 0; i < childCnt; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   289
				if (children[i] == this) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   290
					index = i;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   291
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   292
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   293
			// if index number is illegal do nothing.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   294
			if (index < 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   295
				return;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   296
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   297
			// disable up arrow if already on the top of the form or only one
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   298
			// graph exists on page
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   299
			buttonMoveGraphUp.setEnabled(index > 0 && childCnt > 1);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   300
			// disable down arrow if already on the bottom of the form
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   301
			buttonMoveGraphDown
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   302
					.setEnabled(index < childCnt - 1 && childCnt > 1);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   303
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   304
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   305
		compositePanel.getSashForm().layout();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   306
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   307
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   308
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   309
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   310
	 * Updates all graphs titlebar buttons status if graph is visible
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   311
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   312
	public void updateAllGraphsButtons() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   313
		if(!this.isDisposed() && this.isVisible()){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   314
			GraphComposite[] controlArray = getVisibleGraphs();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   315
			for (GraphComposite item : controlArray) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   316
				GraphComposite graph = (GraphComposite) item;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   317
				graph.updateTitleBarButtonsStatus();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   318
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   319
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   320
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   321
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   322
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   323
	 * Initializes images for titlebar buttons
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   324
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   325
	private void createImagesForTitleBar() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   326
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   327
		// Get budle's location in file system
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   328
		URL url;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   329
		ImageDescriptor createFromURL;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   330
		Bundle piBundle = Platform.getBundle("com.nokia.carbide.cpp.pi"); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   331
		if (piBundle == null)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   332
			return;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   333
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   334
		// Maximize
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   335
		url = FileLocator.find(piBundle, new Path(Messages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   336
				.getString("PIPageEditorContributor.maximizeGraphIcon")), null); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   337
		if (url != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   338
			createFromURL = ImageDescriptor.createFromURL(url);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   339
			imageMaximizeGraph = createFromURL.createImage();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   340
			buttonMaximize.setImage(imageMaximizeGraph);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   341
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   342
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   343
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   344
		// Maximize restore
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   345
		url = FileLocator
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   346
				.find(
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   347
						piBundle,
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   348
						new Path(
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   349
								Messages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   350
										.getString("PIPageEditorContributor.maximizeRestoreGraphIcon")), null); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   351
		if (url != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   352
			createFromURL = ImageDescriptor.createFromURL(url);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   353
			imageMaximizeRestoreGraph = createFromURL.createImage();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   354
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   355
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   356
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   357
		// Minimize
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   358
		url = FileLocator.find(piBundle, new Path(Messages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   359
				.getString("PIPageEditorContributor.minimizeGraphIcon")), null); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   360
		if (url != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   361
			createFromURL = ImageDescriptor.createFromURL(url);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   362
			imageMinimizeGraph = createFromURL.createImage();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   363
			buttonMinimize.setImage(imageMinimizeGraph);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   364
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   365
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   366
		// Minimize restore
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   367
		url = FileLocator
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   368
				.find(
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   369
						piBundle,
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   370
						new Path(
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   371
								Messages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   372
										.getString("PIPageEditorContributor.minimizeRestoreGraphIcon")), null); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   373
		if (url != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   374
			createFromURL = ImageDescriptor.createFromURL(url);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   375
			imageMinimizeRestoreGraph = createFromURL.createImage();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   376
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   377
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   378
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   379
		// Move down
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   380
		url = FileLocator.find(piBundle, new Path(Messages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   381
				.getString("PIPageEditorContributor.moveGraphDown")), null); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   382
		if (url != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   383
			createFromURL = ImageDescriptor.createFromURL(url);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   384
			imageMoveGraphDown = createFromURL.createImage();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   385
			buttonMoveGraphDown.setImage(imageMoveGraphDown);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   386
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   387
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   388
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   389
		// Move Up
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   390
		url = FileLocator.find(piBundle, new Path(Messages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   391
				.getString("PIPageEditorContributor.moveGraphUp")), null); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   392
		if (url != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   393
			createFromURL = ImageDescriptor.createFromURL(url);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   394
			imageMoveGraphUp = createFromURL.createImage();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   395
			buttonMoveGraphUp.setImage(imageMoveGraphUp);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   396
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   397
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   398
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   399
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   400
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   401
	 * Creates ui components located int titlebar
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   402
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   403
	 * @param parent
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   404
	 *            parent component where components are placed
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   405
	 * @param titleString
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   406
	 *            title text
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   407
	 * @param titleBar object implementing ITitleBarMenu (actions and help for title bar)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   408
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   409
	private void createTitleBarUIComponents(Composite parent,
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   410
			String titleString, ITitleBarMenu titleBar) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   411
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   412
		FormData formData;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   413
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   414
		// Create composite where all components are placed
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   415
		compositeTitleBar = new Composite(this, SWT.NONE);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   416
		GridLayout layoutComposite = new GridLayout();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   417
		layoutComposite.numColumns = titleBar != null && titleBar.getContextHelpId() != null ? 7 : 6;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   418
		layoutComposite.marginWidth = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   419
		layoutComposite.marginHeight = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   420
		layoutComposite.horizontalSpacing = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   421
		compositeTitleBar.setLayout(layoutComposite);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   422
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   423
		// Minimize/restore button
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   424
		buttonMinimize = new Button(compositeTitleBar, SWT.PUSH);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   425
		buttonMinimize.setFont(PIPageEditor.helvetica_7);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   426
		buttonMinimize.setLayoutData(new GridData(GridData.FILL_VERTICAL));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   427
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   428
		// Create drop-down list if action array is not null
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   429
		if (titleBar != null && titleBar.addTitleBarMenuItems() != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   430
			// graph type Combo box
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   431
			comboGraphType = new Combo(compositeTitleBar, SWT.READ_ONLY);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   432
			GridData gridData = new GridData(GridData.FILL_VERTICAL);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   433
			comboGraphType.setLayoutData(gridData);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   434
			this.titleBarActions = titleBar.addTitleBarMenuItems();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   435
			int checkedItemIndex = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   436
			for (int i = 0; i < titleBarActions.length; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   437
				comboGraphType.add(titleBarActions[i].getText());
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   438
				if (titleBarActions[i].isChecked()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   439
					checkedItemIndex = i;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   440
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   441
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   442
			comboGraphType.select(checkedItemIndex);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   443
			comboGraphType.setFont(PIPageEditor.helvetica_7);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   444
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   445
		// title label
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   446
		labelTitle = new Label(compositeTitleBar, SWT.CENTER);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   447
		labelTitle.setFont(PIPageEditor.helvetica_8);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   448
		labelTitle.setText(titleString);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   449
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   450
		if (titleBar != null && titleBar.getContextHelpId() != null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   451
			this.contextHelpId = titleBar.getContextHelpId();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   452
			PlatformUI.getWorkbench().getHelpSystem().setHelp(this, this.contextHelpId);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   453
			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   454
			buttonHelp = new Button(compositeTitleBar, SWT.PUSH);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   455
			buttonHelp.setToolTipText("Help");
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   456
			buttonHelp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   457
			Image helpImage = PiPlugin.getImage("icons/linkto_help.gif"); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   458
			if (helpImage != null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   459
				buttonHelp.setImage(helpImage);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   460
			}			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   461
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   462
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   463
		// move down button
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   464
		buttonMoveGraphDown = new Button(compositeTitleBar, SWT.PUSH);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   465
		buttonMoveGraphDown.setToolTipText(TOOLTIP_MOVE_DOWN);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   466
		buttonMoveGraphDown.setLayoutData(new GridData(GridData.FILL_VERTICAL));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   467
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   468
		// mode graph up
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   469
		buttonMoveGraphUp = new Button(compositeTitleBar, SWT.PUSH);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   470
		buttonMoveGraphUp.setToolTipText(TOOLTIP_MOVE_UP);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   471
		buttonMoveGraphUp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   472
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   473
		// maximize/restore button
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   474
		buttonMaximize = new Button(compositeTitleBar, SWT.PUSH);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   475
		buttonMaximize.setFont(PIPageEditor.helvetica_7);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   476
		buttonMaximize.setLayoutData(new GridData(GridData.FILL_VERTICAL));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   477
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   478
		createImagesForTitleBar();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   479
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   480
		// calculate what intent should be used so that title label is in the
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   481
		// center of the view
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   482
		int indent = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   483
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   484
		// increase intent value by all components that are left from the title
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   485
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   486
		// get size of the combobox
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   487
		if (comboGraphType != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   488
			indent -= comboGraphType.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   489
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   490
		indent -= buttonMinimize.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   491
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   492
		// decrease intent value by all components that are right from the title
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   493
		if (buttonHelp != null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   494
			indent += buttonHelp.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   495
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   496
		indent += buttonMaximize.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   497
		indent += buttonMoveGraphDown.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   498
		indent += buttonMoveGraphDown.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   499
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   500
		GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   501
		gridData.horizontalIndent = indent;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   502
		labelTitle.setLayoutData(gridData);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   503
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   504
		// Set layouts for composite
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   505
		formData = new FormData();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   506
		formData.top = new FormAttachment(0);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   507
		formData.left = new FormAttachment(0);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   508
		formData.right = new FormAttachment(100);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   509
		formData.height = TITLESIZE;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   510
		compositeTitleBar.setLayoutData(formData);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   511
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   512
		// Set background color for all components
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   513
		Color BgColor = parent.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   514
		compositeTitleBar.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   515
		buttonMinimize.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   516
		/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   517
		 * if (comboGraphType != null) { comboGraphType.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   518
		 * }
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   519
		 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   520
		labelTitle.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   521
		buttonMoveGraphUp.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   522
		buttonMoveGraphDown.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   523
		buttonMaximize.setBackground(BgColor);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   524
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   525
		// Add selection listeners for buttons
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   526
		buttonMoveGraphDown.addSelectionListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   527
		buttonMoveGraphUp.addSelectionListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   528
		buttonMaximize.addSelectionListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   529
		buttonMinimize.addSelectionListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   530
		if (comboGraphType != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   531
			comboGraphType.addSelectionListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   532
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   533
		if (buttonHelp != null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   534
			buttonHelp.addSelectionListener(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   535
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   536
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   537
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   538
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   539
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   540
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   541
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   542
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   543
	 * @see
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   544
	 * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   545
	 * .swt.events.SelectionEvent)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   546
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   547
	public void widgetDefaultSelected(SelectionEvent e) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   548
		// No actions needed here
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   549
	}
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   550
	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   551
	public Combo getTitleBarCombo(){
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   552
		return comboGraphType;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   553
	}
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   554
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   555
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   556
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   557
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   558
	 * @see
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   559
	 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   560
	 * .events.SelectionEvent)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   561
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   562
	public void widgetSelected(SelectionEvent e) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   563
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   564
		if (e.widget == comboGraphType) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   565
			if (titleBarActions == null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   566
				return;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   567
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   568
			titleBarActions[comboGraphType.getSelectionIndex()].run();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   569
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   570
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   571
		else {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   572
			if (e.widget == buttonMoveGraphDown) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   573
				this.moveGraphDown();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   574
			} else if (e.widget == buttonMoveGraphUp) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   575
				this.moveGraphUp();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   576
			} else if (e.widget == buttonMinimize) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   577
				this.minimizeOrRestoreGraph();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   578
			} else if (e.widget == buttonMaximize) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   579
				if (this.isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   580
					this.minimizeOrRestoreGraph();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   581
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   582
				this.maximizeOrRestoreGraph();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   583
			} else if (e.widget == buttonHelp){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   584
				PlatformUI.getWorkbench().getHelpSystem().displayHelp(this.contextHelpId);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   585
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   586
			this.updateAllGraphsButtons();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   587
			compositePanel.getSashForm().layout();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   588
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   589
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   590
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   591
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   592
	 * moves this graph down in the form
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   593
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   594
	private void moveGraphDown() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   595
		Control control = getFormBelow();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   596
		if (control != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   597
			moveBelow(control);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   598
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   599
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   600
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   601
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   602
	 * moves this graph up in the form
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   603
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   604
	private void moveGraphUp() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   605
		Control control = getFormAbove();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   606
		if (control != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   607
			moveAbove(control);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   608
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   609
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   610
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   611
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   612
	 * minimizes or maximizes graph according to its current state
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   613
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   614
	private void minimizeOrRestoreGraph() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   615
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   616
		// Since minimizing and restoring forms in SashForm is not very
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   617
		// handy this algorithm is pretty complex...
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   618
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   619
		int graphIndex = getIndexOfThisComponentInSashForm();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   620
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   621
		// Set none of the forms in SashForm maximised
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   622
		this.compositePanel.getSashForm().setMaximizedControl(null);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   623
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   624
		int[] weights = getWeightOfGraphs(true, false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   625
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   626
		// if index not found or it is greater than size of sash
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   627
		// do nothing(this should not happen)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   628
		if (graphIndex < 0 || graphIndex >= weights.length) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   629
			return;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   630
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   631
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   632
		// count sum of weight values in array
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   633
		int weightSum = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   634
		for (int item : weights) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   635
			weightSum += item;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   636
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   637
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   638
		// get other(other than the one minimized/restored) graphs
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   639
		// combined weight
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   640
		double otherGraphsWeight = weightSum - weights[graphIndex];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   641
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   642
		int restoredGraphSize = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   643
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   644
		if (this.isMinimized && weights[graphIndex] < 100) { // Restore graph
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   645
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   646
			this.isMinimized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   647
			// calculate restored size based on graphs previous size
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   648
			double multiplier = (double) previousWeight * 2;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   649
			restoredGraphSize = (int) (multiplier * otherGraphsWeight);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   650
			weights[graphIndex] = restoredGraphSize;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   651
			graphComponent.graphComponent.graphVisibilityChanged(true);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   652
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   653
			// update legend counts in case selection area has changed.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   654
			graphComponent.graphComponent.updateSelectionArea(PIPageEditor
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   655
					.currentPageEditor().getStartTime(), PIPageEditor
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   656
					.currentPageEditor().getEndTime());
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   657
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   658
		} else { // minimize
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   659
			this.isMinimized = true;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   660
			graphComponent.graphComponent.graphVisibilityChanged(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   661
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   662
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   663
		compositePanel.getSashForm().layout();// after revealing or hiding
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   664
												// legend tables
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   665
		compositePanel.getVisualiser().getBottomComposite().layout();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   666
		// After graph is restored or marked as minimized, we need calculate
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   667
		// size of minimized graphs again.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   668
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   669
		// Add restored graphs size to othergraphsSize
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   670
		otherGraphsWeight += restoredGraphSize;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   671
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   672
		Control[] controlArray = compositePanel.getSashForm().getChildren();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   673
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   674
		// calculate percent value of title size(the size which is used for
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   675
		// minimizing)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   676
		int xSize = compositePanel.getSashForm().getSize().y;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   677
		double percentValue = (double) TITLESIZE / (double) xSize;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   678
		previousWeight = (double) weights[graphIndex] / (double) weightSum;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   679
		int minimizedSize = (int) ((double) otherGraphsWeight * percentValue);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   680
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   681
		// Go through array of form items and set all minimized forms size to
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   682
		// calculated minimizedSize
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   683
		for (int i = 0; i < controlArray.length; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   684
			if (controlArray[i].getClass() == this.getClass()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   685
				GraphComposite graph = (GraphComposite) controlArray[i];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   686
				if (graph.isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   687
					weights[i] = minimizedSize;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   688
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   689
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   690
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   691
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   692
		// set calculated weights to sashform
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   693
		try {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   694
			compositePanel.getSashForm().setWeights(weights);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   695
		} catch (Exception e2) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   696
			// do nothing
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   697
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   698
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   699
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   700
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   701
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   702
	 * Returns the weight of the children controls.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   703
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   704
	 * @param zerohidden
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   705
	 *            : if true, zero out values for currently hidden controls in
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   706
	 *            return array
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   707
	 * @param onlyHidden
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   708
	 *            : if true, only return weights of currently hidden controls
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   709
	 *            (all others zeroed out)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   710
	 * @return
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   711
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   712
	private int[] getWeightOfGraphs(boolean zeroHidden, boolean onlyHidden) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   713
		int[] weights = this.compositePanel.getSashForm().getWeights();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   714
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   715
		// ignore the weight of currently hidden controls
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   716
		Control[] children = this.compositePanel.getSashForm().getChildren();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   717
		int j = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   718
		for (int i = 0; i < weights.length; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   719
			while (children[j].getClass() != this.getClass()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   720
				j++;// skip any children that are not graphs
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   721
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   722
			if (children[j].isVisible() && onlyHidden
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   723
					|| !children[j].isVisible() && zeroHidden) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   724
				weights[i] = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   725
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   726
			j++;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   727
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   728
		return weights;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   729
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   730
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   731
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   732
	 * @return GraphComposite[] of all currently visible graphs on the current
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   733
	 *         page.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   734
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   735
	private GraphComposite[] getVisibleGraphs() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   736
		List<GraphComposite> graphs = new ArrayList<GraphComposite>();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   737
		for (Control control : this.compositePanel.getSashForm().getChildren()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   738
			if (control.getClass() == this.getClass() && control.isVisible()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   739
				graphs.add((GraphComposite) control);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   740
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   741
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   742
		return graphs.toArray(new GraphComposite[graphs.size()]);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   743
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   744
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   745
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   746
	 * Maximizes or restores graph according to its current state
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   747
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   748
	private void maximizeOrRestoreGraph() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   749
		if (compositePanel.getSashForm().getMaximizedControl() != this) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   750
			isMaximized = true;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   751
			compositePanel.getSashForm().setMaximizedControl(this);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   752
			graphComponent.graphComponent.graphMaximized(true);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   753
			if (isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   754
				graphComponent.graphComponent.graphVisibilityChanged(true);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   755
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   756
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   757
		} else {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   758
			isMaximized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   759
			compositePanel.getSashForm().setMaximizedControl(null);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   760
			graphComponent.graphComponent.graphMaximized(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   761
			if (isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   762
				graphComponent.graphComponent.graphVisibilityChanged(false);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   763
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   764
			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   765
			// update selection area to all visible graphs
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   766
			for (GraphComposite graph : getVisibleGraphs()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   767
				graph.graphComponent.graphComponent.updateSelectionArea(
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   768
						PIPageEditor.currentPageEditor().getStartTime(),
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   769
						PIPageEditor.currentPageEditor().getEndTime());
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   770
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   771
			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   772
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   773
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   774
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   775
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   776
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   777
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   778
	 * @see
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   779
	 * org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   780
	 * .ControlEvent)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   781
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   782
	public void controlMoved(ControlEvent e) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   783
		updateTitleBarButtonsStatus();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   784
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   785
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   786
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   787
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   788
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   789
	 * @see
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   790
	 * org.eclipse.swt.events.ControlListener#controlResized(org.eclipse.swt
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   791
	 * .events.ControlEvent)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   792
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   793
	public void controlResized(ControlEvent e) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   794
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   795
		// update minimize button status if size of the form is changed
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   796
		// manually.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   797
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   798
		// exclude status update when graph is maximized
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   799
		// (so that graph remembers if it was minimized previously)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   800
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   801
		this.getParent().layout();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   802
		if (this.isMaximized == false) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   803
			if (this.isMinimized
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   804
					&& (double) this.getSize().y
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   805
							/ (double) compositePanel.getSashForm().getSize().y > 0.1) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   806
				this.isMinimized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   807
				graphComponent.graphComponent.graphVisibilityChanged(true);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   808
				compositePanel.getSashForm().layout();// after revealing or
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   809
														// hiding legend tables
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   810
				updateTitleBarButtonsStatus();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   811
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   812
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   813
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   814
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   815
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   816
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   817
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   818
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   819
	 * @see
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   820
	 * com.nokia.carbide.cpp.pi.visual.IVisibilityListener#onVisiblityChanged
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   821
	 * (boolean)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   822
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   823
	public void onVisiblityChanged(boolean visible) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   824
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   825
		// change the visibility of this graph composite
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   826
		// and reset to default layout
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   827
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   828
		if (visible) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   829
			// check the newly made visible control has a weight
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   830
			// if not, set an arbitrary weight to prevent an exception in the
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   831
			// sashForm
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   832
			int[] weights = this.compositePanel.getSashForm().getWeights();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   833
			int idx = getIndexOfThisComponentInSashForm();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   834
			if (weights[idx] == 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   835
				weights[idx] = 100;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   836
				compositePanel.getSashForm().setWeights(weights);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   837
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   838
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   839
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   840
		// we need to reset maximised controls, because if they are now
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   841
		// invisible, they
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   842
		// prevent other graphs from showing
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   843
		if (compositePanel.getSashForm().getMaximizedControl() != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   844
			((GraphComposite) compositePanel.getSashForm()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   845
					.getMaximizedControl()).isMaximized = false;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   846
			compositePanel.getSashForm().setMaximizedControl(null);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   847
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   848
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   849
		this.setVisible(visible);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   850
		// deal with the legend as well
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   851
		graphComponent.graphComponent.graphVisibilityChanged(visible
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   852
				&& isMinimized ? false : visible);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   853
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   854
		resetLayoutToDefault();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   855
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   856
		// button status needs to be updated for all graphs
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   857
		for (GraphComposite graph : getVisibleGraphs()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   858
			graph.updateTitleBarButtonsStatus();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   859
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   860
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   861
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   862
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   863
	 * Resets the layout of all visible component to a default layout. Minimised
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   864
	 * components stay minimised (just toolbar visible), all other components
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   865
	 * are equally sized.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   866
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   867
	private void resetLayoutToDefault() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   868
		int xSize = compositePanel.getSashForm().getSize().y;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   869
		if (xSize == 0) {// not yet initialised
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   870
			return;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   871
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   872
		double pixelWeight = (double) TOTAL_SASH_WEIGHT / xSize;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   873
		int minCount = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   874
		GraphComposite[] visibleGraphs = getVisibleGraphs();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   875
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   876
		if (visibleGraphs.length > 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   877
			int minimisedWeight = (int) (TITLESIZE * pixelWeight);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   878
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   879
			for (GraphComposite cmp : visibleGraphs) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   880
				if (cmp.isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   881
					minCount++;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   882
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   883
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   884
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   885
			double defaultWeight = TOTAL_SASH_WEIGHT
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   886
					- (minCount * minimisedWeight);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   887
			if (minCount < visibleGraphs.length - 1) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   888
				defaultWeight /= (visibleGraphs.length - minCount);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   889
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   890
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   891
			int[] weights = compositePanel.getSashForm().getWeights();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   892
			int i = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   893
			for (Control control : this.compositePanel.getSashForm()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   894
					.getChildren()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   895
				if (control.getClass() == this.getClass()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   896
						&& control.isVisible()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   897
					if (((GraphComposite) control).isMinimized) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   898
						weights[i] = minimisedWeight;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   899
					} else {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   900
						weights[i] = (int) defaultWeight;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   901
					}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   902
				}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   903
				i++;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   904
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   905
			this.compositePanel.getSashForm().setWeights(weights);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   906
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   907
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   908
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   909
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   910
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   911
	 * 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   912
	 * @see
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   913
	 * com.nokia.carbide.cpp.pi.visual.IGraphChangeListener#onTitleChange(java
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   914
	 * .lang.String, java.lang.String)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   915
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   916
	public void onTitleChange(final String newTitle) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   917
		Display.getDefault().syncExec(new Runnable() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   918
			public void run() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   919
				labelTitle.setText(newTitle);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   920
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   921
		});
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   922
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   923
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   924
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   925
	 * Initialisation code for all graphs should go here. This method is called
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   926
	 * on editor part activation
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   927
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   928
	public void initialiseGraphs() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   929
		// minimize other than Memory and Thread Load graphs when the view is
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   930
		// opened
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   931
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   932
		// this code can only be executed once the sashform is visible
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   933
		// otherwise the weights of controls on the sashform are zero and the
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   934
		// minimise code doesn't work.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   935
		if (this.isViewInitialized == false
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   936
				&& compositePanel.getSashForm().isVisible()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   937
			this.isViewInitialized = true;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   938
			if (graphComponent.graphComponent.isGraphMinimizedWhenOpened()) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   939
				this.minimizeOrRestoreGraph();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   940
				updateTitleBarButtonsStatus();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   941
				compositePanel.getSashForm().layout();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   942
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   943
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   944
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   945
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   946
}