View Javadoc

1   // %2624369625:hoplugins.teamAnalyzer.ui%
2   package hoplugins.teamAnalyzer.ui;
3   
4   import hoplugins.Commons;
5   
6   import hoplugins.commons.utils.RatingUtil;
7   
8   import hoplugins.teamAnalyzer.SystemManager;
9   
10  import java.awt.Color;
11  import java.awt.Font;
12  
13  import javax.swing.BorderFactory;
14  import javax.swing.JLabel;
15  import javax.swing.JPanel;
16  
17  
18  /***
19   * TODO Missing Class Documentation
20   *
21   * @author TODO Author Name
22   */
23  public class RatingBox extends JPanel {
24      //~ Instance fields ----------------------------------------------------------------------------
25  
26      /*** TODO Missing Parameter Documentation */
27      JLabel arrow = new JLabel();
28  
29      /*** TODO Missing Parameter Documentation */
30      JLabel myValue = new JLabel();
31  
32      /*** TODO Missing Parameter Documentation */
33      JLabel opponentValue = new JLabel();
34  
35      //~ Constructors -------------------------------------------------------------------------------
36  
37      /***
38       * Creates a new RatingBox object.
39       */
40      public RatingBox() {
41          super();
42          jbInit();
43      }
44  
45      /***
46       * Creates a new RatingBox object.
47       *
48       * @param r1 TODO Missing Constructuor Parameter Documentation
49       * @param r2 TODO Missing Constructuor Parameter Documentation
50       */
51      public RatingBox(int r1, int r2) {
52          super();
53          jbInit();
54          reload(r1, r2);
55      }
56  
57      //~ Methods ------------------------------------------------------------------------------------
58  
59      /***
60       * TODO Missing Method Documentation
61       *
62       * @param r1 TODO Missing Method Parameter Documentation
63       * @param r2 TODO Missing Method Parameter Documentation
64       */
65      public void reload(int r1, int r2) {
66          myValue.setText(RatingUtil.getRating(r1, SystemManager.getConfig().isNumericRating(),
67                                               SystemManager.getConfig().isDescriptionRating(),
68                                               Commons.getModel()));
69          opponentValue.setText(RatingUtil.getRating(r2, SystemManager.getConfig().isNumericRating(),
70                                                     SystemManager.getConfig().isDescriptionRating(),
71                                                     Commons.getModel()));
72          arrow.setIcon(Commons.getModel().getHelper().getImageIcon4Veraenderung(r1 - r2));
73      }
74  
75      /***
76       * TODO Missing Method Documentation
77       */
78      private void jbInit() {
79          JPanel mainPanel = Commons.getModel().getGUI().createImagePanel();
80  
81          mainPanel.setBorder(BorderFactory.createRaisedBevelBorder());
82          mainPanel.add(myValue);
83          mainPanel.add(arrow);
84          mainPanel.add(opponentValue);
85          add(mainPanel);
86  
87          myValue.setForeground(Color.BLACK);
88          opponentValue.setForeground(Color.BLACK);
89          setForeground(Color.BLACK);
90          setOpaque(false);
91          setFont(getFont().deriveFont(Font.BOLD, gui.UserParameter.instance().schriftGroesse + 3));
92      }
93  }