public AnchorPointClassificationPanel(
      Object displacement, String title, List<QualifiedName> properties) {
    this.title = title;

    fixed = new JRadioButton();
    property = new JRadioButton();

    ButtonGroup bg = new ButtonGroup();
    bg.add(fixed);
    bg.add(property);

    propertyCBx = new JComboBox();
    propertyCBx.setRenderer(new PropertyNameRenderer());
    for (QualifiedName qn : properties) {
      propertyCBx.addItem(new PropertyName(qn));
    }
    propertyCBy = new JComboBox();
    propertyCBy.setRenderer(new PropertyNameRenderer());
    for (QualifiedName qn : properties) {
      propertyCBy.addItem(new PropertyName(qn));
    }

    anchorEditor = new AnchorEditor();

    if (displacement instanceof Pair<?, ?>) {
      property.setSelected(true);
      propertyCBx.setSelectedItem(((Pair<?, ?>) displacement).first);
      propertyCBy.setSelectedItem(((Pair<?, ?>) displacement).second);
    } else if (displacement instanceof Point2d) {
      fixed.setSelected(true);
      anchorEditor.setValue(((Point2d) displacement).x, ((Point2d) displacement).y);
    } else {
      fixed.setSelected(true);
    }
    if (properties == null || properties.isEmpty()) {
      propertyCBx.setEnabled(false);
      propertyCBy.setEnabled(false);
      property.setEnabled(false);
    }

    FormLayout fl =
        new FormLayout(
            "$rgap, 15dlu, left:default:grow(1.0)",
            "$sepheight, center:[20dlu,default], $ug, $sepheight, bottom:10dlu, center:$cpheight, bottom:10dlu,center:$cpheight");
    DefaultFormBuilder builder = new DefaultFormBuilder(fl);
    CellConstraints cc = new CellConstraints();
    builder.addSeparator(get("$MD11713"), cc.xyw(1, 1, 3));
    builder.add(fixed, cc.xy(2, 2));
    builder.add(anchorEditor, cc.xy(3, 2));

    builder.addSeparator(get("$MD11714"), cc.xyw(1, 4, 3));
    builder.add(property, cc.xywh(2, 5, 1, 4));
    builder.addLabel(get("$MD10835"), cc.xy(3, 5));
    builder.add(propertyCBx, cc.xy(3, 6));
    builder.addLabel(get("$MD10836"), cc.xy(3, 7));
    builder.add(propertyCBy, cc.xy(3, 8));
    add(builder.getPanel());
  }
 public Object getValue() {
   if (property.isSelected()) {
     return new Pair<PropertyName, PropertyName>(
         (PropertyName) propertyCBx.getSelectedItem(),
         (PropertyName) propertyCBy.getSelectedItem());
   } else {
     return anchorEditor.getValue();
   }
 }