예제 #1
0
  /** test a prop for existance */
  /*package*/ void test(
      Property prop, TagPath trigger, List<ViewContext> issues, ReportValidate report) {

    // check for property by path1
    Property prop1 = prop.getProperty(path1);
    if (prop1 == null) return;

    // then check for property by path2
    Property prop2 = prop.getProperty(path2);
    if (prop2 != null) return;

    // found path1 but not path2!
    String text =
        report.translate(
            "err.exists.without", Gedcom.getName(prop1.getTag()), Gedcom.getName(path2.getLast()));
    issues.add(new ViewContext(prop1).setText(text));
  }
예제 #2
0
  public NameBean() {

    setLayout(LAYOUT.copy());

    cLast = new ChoiceWidget();
    cLast.addChangeListener(changeSupport);
    cLast.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            String msg = getReplaceAllMsg();
            if (msg != null) {
              cAll.setVisible(true);
              cAll.setToolTipText(msg);
            }
          }
        });
    cLast.setIgnoreCase(true);
    cFirst = new ChoiceWidget();
    cFirst.addChangeListener(changeSupport);
    cFirst.setIgnoreCase(true);
    tSuff = new TextFieldWidget("", 10);
    tSuff.addChangeListener(changeSupport);
    tNick = new TextFieldWidget("", 10);
    tNick.addChangeListener(changeSupport);

    cAll = new JCheckBox();
    cAll.setBorder(new EmptyBorder(1, 1, 1, 1));
    cAll.setVisible(false);
    cAll.setRequestFocusEnabled(false);

    add(new JLabel(PropertyName.getLabelForFirstName()));
    add(cFirst);

    add(new JLabel(PropertyName.getLabelForLastName()));
    add(cLast);
    add(cAll);

    add(new JLabel(PropertyName.getLabelForSuffix()));
    add(tSuff);

    add(new JLabel(Gedcom.getName("NICK")));
    add(tNick);

    // listen to selection of global and ask for confirmation
    cAll.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String msg = getReplaceAllMsg();
            if (msg != null && cAll.isSelected()) {
              int rc =
                  DialogHelper.openDialog(
                      RESOURCES.getString("choice.global.enable"),
                      DialogHelper.QUESTION_MESSAGE,
                      msg,
                      Action2.yesNo(),
                      NameBean.this);
              cAll.setSelected(rc == 0);
            }
          }
        });

    // we're done aside from declaring the default focus
    defaultFocus = cFirst;
  }