Search in sources :

Example 1 with EventDispatcher

use of com.intellij.util.EventDispatcher in project android by JetBrains.

the class NetworkProfilerVisualTest method createComponentsList.

@Override
protected List<Animatable> createComponentsList() {
    long startTimeUs = myDataStore.getLatestTimeUs();
    Range timeCurrentRangeUs = new Range(startTimeUs - RangeScrollbar.DEFAULT_VIEW_LENGTH_US, startTimeUs);
    AnimatedTimeRange animatedTimeRange = new AnimatedTimeRange(timeCurrentRangeUs, 0);
    EventDispatcher<ProfilerEventListener> dummyDispatcher = EventDispatcher.create(ProfilerEventListener.class);
    mySegment = new NetworkSegment(timeCurrentRangeUs, myDataStore, dummyDispatcher);
    myDetailedView = new NetworkDetailedView();
    myDetailedView.setVisible(false);
    generateNetworkCaptureData(startTimeUs);
    myCaptureSegment = new NetworkCaptureSegment(timeCurrentRangeUs, new TestNetworkCaptureModel(), httpData -> myDetailedView.setVisible(true), dummyDispatcher);
    myRadioSegment = new NetworkRadioSegment(timeCurrentRangeUs, myDataStore, dummyDispatcher);
    List<Animatable> animatables = new ArrayList<>();
    animatables.add(animatedTimeRange);
    mySegment.createComponentsList(animatables);
    myCaptureSegment.createComponentsList(animatables);
    myRadioSegment.createComponentsList(animatables);
    animatables.add(myCaptureSegment);
    return animatables;
}
Also used : AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) NetworkCaptureModel(com.android.tools.idea.monitor.ui.network.model.NetworkCaptureModel) Range(com.android.tools.adtui.model.Range) NetworkSegment(com.android.tools.idea.monitor.ui.network.view.NetworkSegment) EventDispatcher(com.intellij.util.EventDispatcher) Animatable(com.android.tools.adtui.Animatable) AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) ProfilerEventListener(com.android.tools.idea.monitor.tool.ProfilerEventListener) RangeScrollbar(com.android.tools.adtui.RangeScrollbar) NetworkDetailedView(com.android.tools.idea.monitor.ui.network.view.NetworkDetailedView) ArrayList(java.util.ArrayList) java.awt(java.awt) VisualTest(com.android.tools.adtui.visualtests.VisualTest) HttpData(com.android.tools.idea.monitor.ui.network.model.HttpData) List(java.util.List) NonNull(com.android.annotations.NonNull) NetworkRadioSegment(com.android.tools.idea.monitor.ui.network.view.NetworkRadioSegment) NotNull(org.jetbrains.annotations.NotNull) SeriesDataStore(com.android.tools.datastore.SeriesDataStore) NetworkCaptureSegment(com.android.tools.idea.monitor.ui.network.view.NetworkCaptureSegment) javax.swing(javax.swing) ArrayList(java.util.ArrayList) NetworkCaptureSegment(com.android.tools.idea.monitor.ui.network.view.NetworkCaptureSegment) NetworkDetailedView(com.android.tools.idea.monitor.ui.network.view.NetworkDetailedView) Range(com.android.tools.adtui.model.Range) AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) Animatable(com.android.tools.adtui.Animatable) NetworkSegment(com.android.tools.idea.monitor.ui.network.view.NetworkSegment) ProfilerEventListener(com.android.tools.idea.monitor.tool.ProfilerEventListener) NetworkRadioSegment(com.android.tools.idea.monitor.ui.network.view.NetworkRadioSegment)

Example 2 with EventDispatcher

use of com.intellij.util.EventDispatcher in project android by JetBrains.

the class CpuProfilerVisualTest method createComponentsList.

@Override
protected List<Animatable> createComponentsList() {
    long startTimeUs = mDataStore.getLatestTimeUs();
    Range timeCurrentRangeUs = new Range(startTimeUs - RangeScrollbar.DEFAULT_VIEW_LENGTH_US, startTimeUs);
    AnimatedTimeRange animatedTimeRange = new AnimatedTimeRange(timeCurrentRangeUs, 0);
    //TODO Update test data for CpuUsageSegment to be exactly what it was.
    EventDispatcher<ProfilerEventListener> dummyDispatcher = EventDispatcher.create(ProfilerEventListener.class);
    mCPULevel2Segment = new CpuUsageSegment(timeCurrentRangeUs, mDataStore, dummyDispatcher);
    mThreadsSegment = new ThreadsSegment(timeCurrentRangeUs, mDataStore, dummyDispatcher, (threads) -> {
    // TODO: show L3 segment with the charts corresponding to threads selected.
    // Hide any charts corresponding to unselected threads and hide L3 segment in case no threads are selected
    });
    List<Animatable> animatables = new ArrayList<>();
    animatables.add(animatedTimeRange);
    animatables.add(mThreadsSegment);
    mCPULevel2Segment.createComponentsList(animatables);
    mThreadsSegment.createComponentsList(animatables);
    return animatables;
}
Also used : AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) ThreadsSegment(com.android.tools.idea.monitor.ui.cpu.view.ThreadsSegment) ThreadStateDataSeries(com.android.tools.profilers.cpu.ThreadStateDataSeries) Range(com.android.tools.adtui.model.Range) CpuUsageSegment(com.android.tools.idea.monitor.ui.cpu.view.CpuUsageSegment) EventDispatcher(com.intellij.util.EventDispatcher) Animatable(com.android.tools.adtui.Animatable) AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) ProfilerEventListener(com.android.tools.idea.monitor.tool.ProfilerEventListener) RangeScrollbar(com.android.tools.adtui.RangeScrollbar) ArrayList(java.util.ArrayList) java.awt(java.awt) TimeUnit(java.util.concurrent.TimeUnit) VisualTest(com.android.tools.adtui.visualtests.VisualTest) List(java.util.List) SeriesData(com.android.tools.adtui.model.SeriesData) ThreadsSegment(com.android.tools.idea.monitor.ui.cpu.view.ThreadsSegment) TestDataGenerator(com.android.tools.idea.monitor.ui.visual.data.TestDataGenerator) CpuProfiler(com.android.tools.profiler.proto.CpuProfiler) SeriesDataType(com.android.tools.datastore.SeriesDataType) NotNull(org.jetbrains.annotations.NotNull) SeriesDataStore(com.android.tools.datastore.SeriesDataStore) javax.swing(javax.swing) CpuUsageSegment(com.android.tools.idea.monitor.ui.cpu.view.CpuUsageSegment) ArrayList(java.util.ArrayList) Animatable(com.android.tools.adtui.Animatable) ProfilerEventListener(com.android.tools.idea.monitor.tool.ProfilerEventListener) Range(com.android.tools.adtui.model.Range) AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange)

Aggregations

Animatable (com.android.tools.adtui.Animatable)2 AnimatedTimeRange (com.android.tools.adtui.AnimatedTimeRange)2 RangeScrollbar (com.android.tools.adtui.RangeScrollbar)2 Range (com.android.tools.adtui.model.Range)2 VisualTest (com.android.tools.adtui.visualtests.VisualTest)2 SeriesDataStore (com.android.tools.datastore.SeriesDataStore)2 ProfilerEventListener (com.android.tools.idea.monitor.tool.ProfilerEventListener)2 EventDispatcher (com.intellij.util.EventDispatcher)2 java.awt (java.awt)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 javax.swing (javax.swing)2 NotNull (org.jetbrains.annotations.NotNull)2 NonNull (com.android.annotations.NonNull)1 SeriesData (com.android.tools.adtui.model.SeriesData)1 SeriesDataType (com.android.tools.datastore.SeriesDataType)1 CpuUsageSegment (com.android.tools.idea.monitor.ui.cpu.view.CpuUsageSegment)1 ThreadsSegment (com.android.tools.idea.monitor.ui.cpu.view.ThreadsSegment)1 HttpData (com.android.tools.idea.monitor.ui.network.model.HttpData)1 NetworkCaptureModel (com.android.tools.idea.monitor.ui.network.model.NetworkCaptureModel)1