Exemple #1
0
  void NameButtonActionPerformed(ActionEvent evt) {
    try {
      NameButton nb = (NameButton) evt.getSource();
      DataElement element = nb.getDataElement();
      element.getData();

      Rule rule = this.lastRule;

      if (rule == null) {
        if (chkStructure.isSelected()) {
          RuleSet rs = (RuleSet) cbCatalog.getSelectedItem();
          rule = rs.getLastRule();
        } else {
          rule = (Rule) cbStructure.getSelectedItem();
        }

        this.lastRule = rule;
      }

      ArrayList<DataValue> aName = rule.getLastData();

      setNameText(aName);
      setMeaningText(aName);
      setPronounciationText(aName);
    } catch (Exception e) {
      Logging.errorPrint(e.getMessage(), e);
    }
  }
Exemple #2
0
  private void displayButtons(Rule rule) {
    clearButtons();

    for (String key : rule) {
      try {
        DataElement ele = allVars.getDataElement(key);

        if (ele.getTitle() != null) {
          NameButton nb = new NameButton(ele);
          nb.addActionListener(this::NameButtonActionPerformed);
          buttonPanel.add(nb);
        }
      } catch (Exception e) {
        Logging.errorPrint(e.getMessage(), e);
      }
    }

    buttonPanel.repaint();
  }