コード例 #1
0
 // NOTE: NOT USED
 private void setSelectedCorrectionToken() {
   if (correctionTokenLabels == null || correctionTokenLabels.isEmpty()) return;
   int index = -1;
   for (CorrectionTokenLabel tokenLabel : correctionTokenLabels) {
     tokenLabel.setBackground(
         ++index == selectedTokenIndex ? selectedLabelBgColour : defaultLabelBgColour);
   }
 }
コード例 #2
0
  // populate version for corrections
  public void showCorrectionTokenUpgrades(MapCorrectionAction action) {
    // activate correctionTokenMode and deactivate standard tokenMode
    correctionTokenMode = true;
    tokenMode = false;

    // activate upgrade panel
    upgradePanel.removeAll();
    GridLayout panelLayout = (GridLayout) upgradePanel.getLayout();
    List<? extends TokenI> tokens = orUIManager.tokenLays;

    if (tokens == null || tokens.size() == 0) {
      // reset to the number of elements
      panelLayout.setRows(defaultNbPanelElements);
      // set to position 0
      scrollPane.getVerticalScrollBar().setValue(0);
    } else {
      Color fgColour = null;
      Color bgColour = null;
      String text = null;
      String description = null;
      TokenIcon icon;
      CorrectionTokenLabel tokenLabel;
      correctionTokenLabels = new ArrayList<CorrectionTokenLabel>();
      for (TokenI token : tokens) {
        if (token instanceof BaseToken) {
          PublicCompanyI comp = ((BaseToken) token).getCompany();
          fgColour = comp.getFgColour();
          bgColour = comp.getBgColour();
          description = text = comp.getName();
        }
        icon = new TokenIcon(25, fgColour, bgColour, text);
        tokenLabel = new CorrectionTokenLabel(icon, token);
        tokenLabel.setName(description);
        tokenLabel.setText(description);
        tokenLabel.setBackground(defaultLabelBgColour);
        tokenLabel.setOpaque(true);
        tokenLabel.setVisible(true);
        tokenLabel.setBorder(border);
        tokenLabel.addMouseListener(this);
        tokenLabel.addPossibleAction(action);
        correctionTokenLabels.add(tokenLabel);
        upgradePanel.add(tokenLabel);
      }
    }
    upgradePanel.add(doneButton);
    upgradePanel.add(cancelButton);

    //      repaint();
    revalidate();
  }