summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStas Negara <snegara@google.com>2015-06-22 14:20:59 -0700
committerStas Negara <snegara@google.com>2015-06-25 16:13:54 -0700
commitb8dd1bdfbe56ebdfc3df3aed42e38ed6d776ffb3 (patch)
tree25223d401e628699f5406bee2e390bd8e2671628
parenteb276b62427e3124220d7ea2e0a920728af3dcd1 (diff)
downloadtesting-b8dd1bdfbe56ebdfc3df3aed42e38ed6d776ffb3.tar.gz
Do not count physical devices when they are not shown.
Physical devices are not shown in a single cloud device configuraiton dialog, and thus, should not be considered for the total count of values in the devices dimension. Change-Id: I1ffca334e9514fa76b10cbb6bb0457f0386458a1
-rw-r--r--src/com/google/gct/testing/TwoPanelTree.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/google/gct/testing/TwoPanelTree.java b/src/com/google/gct/testing/TwoPanelTree.java
index 60a316c..7a282f8 100644
--- a/src/com/google/gct/testing/TwoPanelTree.java
+++ b/src/com/google/gct/testing/TwoPanelTree.java
@@ -15,13 +15,16 @@
*/
package com.google.gct.testing;
-import com.android.tools.idea.run.CloudConfiguration;
import com.google.api.client.util.Maps;
import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
import com.google.gct.testing.dimension.CloudConfigurationDimension;
import com.google.gct.testing.dimension.CloudTestingType;
import com.google.gct.testing.dimension.CloudTestingTypeGroup;
import com.google.gct.testing.dimension.DeviceDimension;
+import com.google.gct.testing.dimension.DeviceDimension.Device;
import com.intellij.openapi.ui.Splitter;
import com.intellij.ui.CheckboxTree;
import com.intellij.ui.CheckboxTreeBase.CheckPolicy;
@@ -701,7 +704,7 @@ public class TwoPanelTree extends MouseAdapter implements ListSelectionListener,
}
- private static class EnhancedCellRenderer implements ListCellRenderer {
+ private class EnhancedCellRenderer implements ListCellRenderer {
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
public Component getListCellRendererComponent(JList list, Object value, int index,
@@ -712,8 +715,15 @@ public class TwoPanelTree extends MouseAdapter implements ListSelectionListener,
CloudConfigurationDimension dimension = (CloudConfigurationDimension) value;
renderer.setIcon(dimension.getIcon());
- renderer.setText(dimension.getDisplayName() +
- " (" + dimension.getEnabledTypes().size() + "/" + dimension.getSupportedDomain().size() + ")");
+
+ int totalCount = 0;
+ for (CloudTestingType testingType : dimension.getSupportedDomain()) {
+ if (configuration.getKind() != SINGLE_DEVICE || !(testingType instanceof Device) || ((Device)testingType).isVirtual()) {
+ totalCount++;
+ }
+ }
+
+ renderer.setText(dimension.getDisplayName() + " (" + dimension.getEnabledTypes().size() + "/" + totalCount + ")");
if (dimension.getEnabledTypes().isEmpty()) {
renderer.setForeground(JBColor.RED);