source: src/main/java/genius/gui/tree/IssueDiscreteValuePanel.java@ 346

Last change on this file since 346 was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 1.2 KB
Line 
1package genius.gui.tree;
2
3import javax.swing.*;
4
5import genius.core.issue.*;
6import genius.core.utility.EvaluatorDiscrete;
7
8/**
9*
10* @author Richard Noorlandt
11*
12*/
13
14public class IssueDiscreteValuePanel extends IssueValuePanel {
15
16 private static final long serialVersionUID = 5969631611077257684L;
17
18 //Constructors
19 public IssueDiscreteValuePanel(NegotiatorTreeTableModel model, IssueDiscrete issue) {
20 super(model, issue);
21 init(issue);
22 }
23
24 private void init(IssueDiscrete issue) {
25 String values = "";
26 for (int i = 0; i < issue.getNumberOfValues(); i++) {
27 values = values + issue.getStringValue(i);
28 if (model.getUtilitySpace() != null) {
29 EvaluatorDiscrete eval = (EvaluatorDiscrete) model.getUtilitySpace().getEvaluator(issue.getNumber());
30 try {
31 values += " ("+ eval.getEvaluationNotNormalized(issue.getValue(i)) + ")";
32 } catch (Exception e) {
33 }
34 }
35 if (i < issue.getNumberOfValues() - 1) {
36 values = values + ", ";
37 }
38 }
39 this.add(new JLabel(values));
40 this.setToolTipText(values);
41 }
42
43
44
45 public void displayValues(Objective node){
46 this.removeAll();
47 init((IssueDiscrete) node);
48 }
49}
Note: See TracBrowser for help on using the repository browser.