Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I 423, I 765 dynamically update shadow compare runs table, show only missmatched runs #958

4 changes: 2 additions & 2 deletions src/edu/csus/ecs/pc2/shadow/ShadowController.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public String getLabel() {
}
public enum FILTERS {
NONE,
ONLY_MISSMATCH
ONLY_MISMATCH
}

private SHADOW_CONTROLLER_STATUS controllerStatus = null ;
Expand Down Expand Up @@ -1047,7 +1047,7 @@ public void setFilter(FILTERS filter) {
* @return currentJudgementMap but judgements that shouldnt be shown is removed.
*/
public Map<String, ShadowJudgementInfo> filterJudgmenentMap(Map<String, ShadowJudgementInfo> currentJudgementMap) {
if (getFilter().equals(FILTERS.ONLY_MISSMATCH)) {
if (getFilter().equals(FILTERS.ONLY_MISMATCH)) {
Map<String, ShadowJudgementInfo> newJudgementMap = new HashMap<String, ShadowJudgementInfo>();
for (String key : currentJudgementMap.keySet()) {

Expand Down
27 changes: 20 additions & 7 deletions src/edu/csus/ecs/pc2/ui/ShadowCompareRunsPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Map;

import javax.swing.Box;
//import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
Expand Down Expand Up @@ -101,6 +100,8 @@ public class ShadowCompareRunsPane extends JPanePlugin {
private boolean serverHasUpdatedOurRun;

private JPanel dynamicallyRefreshPanel;

private String defaultDuration = "5";

@Override
public String getPluginTitle() {
Expand Down Expand Up @@ -357,7 +358,7 @@ private JPanel getdynamicallyRefreshPanel() {
dynamicallyRefreshPanel.add(checkbox);


JTextField textField = new JTextField("5",2);
JTextField textField = new JTextField(defaultDuration,2);
((AbstractDocument) textField.getDocument()).setDocumentFilter(new DocumentFilter() { //Makes the textfield so that user is not allowed to enter illegal numbers.
@Override
public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
Expand Down Expand Up @@ -445,21 +446,33 @@ public void run() {
Component horizontalStrut2 = Box.createHorizontalStrut(40);
dynamicallyRefreshPanel.add(horizontalStrut2);

JCheckBox missMatchCheckBox = new JCheckBox("Only Missmatched");
missMatchCheckBox.setToolTipText("When toggled, table will only display when pc2 and remote ccs' judgements do not match");
JCheckBox mismatchCheckBox = new JCheckBox("Only Mismatched");
mismatchCheckBox.setToolTipText("When toggled, table will only display when pc2 and remote ccs' judgements do not match");

missMatchCheckBox.addItemListener(new ItemListener() {
mismatchCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
shadowController.setFilter(FILTERS.ONLY_MISSMATCH);

shadowController.setFilter(FILTERS.ONLY_MISMATCH);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
refreshResultsTable();
}
});
}
else {

shadowController.setFilter(FILTERS.NONE);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
refreshResultsTable();
}
});
}
}
});
dynamicallyRefreshPanel.add(missMatchCheckBox);
dynamicallyRefreshPanel.add(mismatchCheckBox);
}
return dynamicallyRefreshPanel;
}
Expand Down