We study the dynamics governing space-time filling D-branes on Type II flux backgrounds preserving four-dimensional N = 1 supersymmetry. The four-dimensional superpotentials and D-terms are derived. The analysis is kept on completely general grounds thanks to the use of recently proposed generalized calibrations, which also allow one to show the direct link of the superpotentials and D-terms with BPS domain walls and cosmic strings respectively. In particular, our D-brane setting reproduces the tension of D-term strings found from purely four-dimensional analysis. The holomorphicity of the superpotentials is also studied and a moment map associated to the D-terms is proposed. Among different examples, we discuss an application to the study of D7-branes on SU(3)-structure backgrounds, which reproduces and generalizes some previous results.