отрисовка StateSummary
This commit is contained in:
@@ -6,6 +6,7 @@ import GlobalData.Tasks.TaskState;
|
||||
import SapforTestingSystem.Json.SapforTasksResults_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
import SapforTestingSystem.SapforTasksPackage.UI.ConfigurationDescription;
|
||||
import SapforTestingSystem.SapforTasksPackage.UI.StateSummary;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
@@ -43,9 +44,10 @@ public class SapforTasksPackageInterface {
|
||||
//--
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(package_in.id);
|
||||
for (TaskState state : sortedTasks.keySet()) {
|
||||
int count = 0;
|
||||
//--
|
||||
DefaultMutableTreeNode stateNode = new DefaultMutableTreeNode(state.getDescription());
|
||||
StateSummary stateSummary = new StateSummary(state);
|
||||
//--
|
||||
DefaultMutableTreeNode stateNode = new DefaultMutableTreeNode(stateSummary);
|
||||
LinkedHashMap<String, LinkedHashMap<String, Vector<SapforTask>>> tasksByConfigurations = sortedTasks.get(state);
|
||||
for (String configuration_id : tasksByConfigurations.keySet()) {
|
||||
//--
|
||||
@@ -55,7 +57,8 @@ public class SapforTasksPackageInterface {
|
||||
for (String group : groups_tasks.keySet()) {
|
||||
DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(group);
|
||||
for (SapforTask task : groups_tasks.get(group)) {
|
||||
count++;
|
||||
//--
|
||||
stateSummary.count++;
|
||||
//--
|
||||
if (configurationNode == null)
|
||||
configurationNode = new DefaultMutableTreeNode(new ConfigurationDescription(configuration_id, task));
|
||||
@@ -66,8 +69,8 @@ public class SapforTasksPackageInterface {
|
||||
}
|
||||
stateNode.add(configurationNode);
|
||||
}
|
||||
if (stateNode.getChildCount() > 0) {
|
||||
stateNode.setUserObject(state.getDescription() + ": " + count);
|
||||
if (stateSummary.count > 0) {
|
||||
stateSummary.refreshText();
|
||||
root.add(stateNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package SapforTestingSystem.SapforTasksPackage.UI;
|
||||
import Common.Current;
|
||||
import Common.UI.Trees.DataTree;
|
||||
import Common.UI.Trees.TreeRenderers;
|
||||
import Common.UI.UI;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
|
||||
@@ -19,12 +20,11 @@ public class SapforTasksPackageTree extends DataTree {
|
||||
@Override
|
||||
public void LeftMouseAction2() {
|
||||
}
|
||||
/*
|
||||
|
||||
@Override
|
||||
public TreeRenderers getRenderer() {
|
||||
return TreeRenderers.RendererSapforVersion;
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public Current getCurrent() {
|
||||
return current;
|
||||
|
||||
@@ -1,32 +1,29 @@
|
||||
package SapforTestingSystem.SapforTasksPackage.UI;
|
||||
import Common.UI.Trees.StyledTreeCellRenderer;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.net.URL;
|
||||
public class SapforVersionsTreeCellRenderer extends StyledTreeCellRenderer {
|
||||
public java.awt.Component getTreeCellRendererComponent(
|
||||
JTree tree, Object value,
|
||||
boolean selected, boolean expanded,
|
||||
boolean leaf, int row, boolean hasFocus) {
|
||||
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
|
||||
URL imageUrl = null;
|
||||
Object o = ((DefaultMutableTreeNode) value).getUserObject();
|
||||
if (o instanceof SapforVersion_json) {
|
||||
SapforVersion_json version_json = (SapforVersion_json) o;
|
||||
if (o instanceof TreeSummary) {
|
||||
TreeSummary summary = (TreeSummary) o;
|
||||
setForeground(tree.getForeground());
|
||||
setFont(getFont().deriveFont((float) 14.0));
|
||||
imageUrl = getClass().getResource("/icons/versions/" +
|
||||
(version_json.success ? "Version" : "BadVersion") +
|
||||
".png");
|
||||
if (imageUrl != null) {
|
||||
setIcon(new ImageIcon(imageUrl));
|
||||
}
|
||||
} else {
|
||||
setIcon(summary.getIcon());
|
||||
}
|
||||
/*
|
||||
else
|
||||
|
||||
{
|
||||
setForeground(tree.getForeground());
|
||||
setFont(getFont().deriveFont((float) 14.0));
|
||||
}
|
||||
*/
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,15 @@ public class StateSummary extends TreeSummary{
|
||||
public void refreshText(){
|
||||
text = state.getDescription()+" : "+count;
|
||||
}
|
||||
@Override
|
||||
public String getImageKey() {
|
||||
switch (state){
|
||||
case Done:
|
||||
return "DoneStateSummary";
|
||||
case DoneWithErrors:
|
||||
return "ErrorsStateSummary";
|
||||
default:
|
||||
return "UnknownStateSummary";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package SapforTestingSystem.SapforTasksPackage.UI;
|
||||
import javax.swing.*;
|
||||
import java.util.Objects;
|
||||
public abstract class TreeSummary {
|
||||
public String text="";
|
||||
public String text = "";
|
||||
public abstract void refreshText();
|
||||
@Override
|
||||
public String toString() {
|
||||
return text;
|
||||
}
|
||||
public ImageIcon getIcon() {
|
||||
return new ImageIcon(Objects.requireNonNull(getClass().getResource("/icons/versions/" + getImageKey() + ".png")));
|
||||
}
|
||||
public abstract String getImageKey();
|
||||
}
|
||||
|
||||
BIN
src/icons/versions/DoneStateSummary.png
Normal file
BIN
src/icons/versions/DoneStateSummary.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 694 B |
BIN
src/icons/versions/ErrorsStateSummary.png
Normal file
BIN
src/icons/versions/ErrorsStateSummary.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 644 B |
BIN
src/icons/versions/UnknownStateSummary.png
Normal file
BIN
src/icons/versions/UnknownStateSummary.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 561 B |
Reference in New Issue
Block a user