
package de.ivu.elect.presentation.geodata.form;

import java.io.Serializable;

import javax.inject.Inject;

import de.ivu.elect.business.geodata.entity.GeodataOrt;
import de.ivu.elect.business.geodata.entity.GeodataOrtProperties;
import de.ivu.elect.jee.presentation.dynamicform.FormBuilder;

public class GeodataOrtViewFormBuilder implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private GeodataOrtGeodataPlzAutoCompleteOptionsProvider geodataOrtGeodataPlzAutoCompletePropertyOptionsProvider;

  public GeodataOrtViewFormBuilder() {
    super();
  }

  public void addProperties(FormBuilder formBuilder, GeodataOrt geodataOrt) {
    addProperties(formBuilder, geodataOrt, false);
  }

  public void addProperties(FormBuilder formBuilder, GeodataOrt geodataOrt, boolean readonly) {
    GeodataOrtProperties geodataOrtProperties = geodataOrt.getProperties();

    GeodataOrtGeodataPlzAutoCompleteProperty geodataOrtGeodataPlzAutoCompleteProperty = new GeodataOrtGeodataPlzAutoCompleteProperty(geodataOrt,
        geodataOrtGeodataPlzAutoCompletePropertyOptionsProvider);

    formBuilder.addProperty(geodataOrtProperties.getOrtsnameProperty()).withReadonly(readonly);
    formBuilder.addProperty(geodataOrtProperties.getOrtsteilnameProperty()).withReadonly(readonly);
    formBuilder.addProperty(geodataOrtGeodataPlzAutoCompleteProperty).withReadonly(readonly);
  }
}
