use of org.openntf.domino.design.FormField in project org.openntf.domino by OpenNTF.
the class FormTest method getFormInfo.
private void getFormInfo(final Database db, final StringBuilder sb) {
DesignForm form = db.getDesign().getForm("testForm");
FormField field = form.addField();
field.setName("EclipseTest");
field.setKind(Kind.COMPUTED);
field.setDefaultValueFormula("@Today");
field.setFieldType(Type.DATETIME);
FormField field2 = form.addField();
field2.setName("EclipseTest2");
field2.setKind(Kind.EDITABLE);
field2.setDefaultValueFormula("Hello");
field2.setAllowMultiValues(true);
sb.append("Outputting explicit subforms for testForm");
addNewLine(sb);
List<String> subforms = form.getExplicitSubforms();
for (String subformName : subforms) {
sb.append(subformName);
addNewLine(sb);
}
sb.append("Outputting computed subforms for testForm");
addNewLine(sb);
subforms = form.getComputedSubforms();
for (String subformName : subforms) {
sb.append(subformName);
addNewLine(sb);
}
}
use of org.openntf.domino.design.FormField in project org.openntf.domino by OpenNTF.
the class FormCRUDTest method run.
@SuppressWarnings("unchecked")
@Override
public void run() {
try {
Session sess = Factory.getSession(SessionType.NATIVE);
Database db = sess.getDatabase("PrivateTest.nsf");
DesignForm form = db.getDesign().createForm();
form.setName("EclipseTest");
FormField field = form.addField();
field.setName("EclipseTest");
field.setKind(Kind.COMPUTED);
field.setDefaultValueFormula("@Today");
field.setFieldType(Type.DATETIME);
FormField field2 = form.addField();
field2.setName("EclipseTest2");
field2.setKind(Kind.EDITABLE);
field2.setDefaultValueFormula("Hello");
field2.setAllowMultiValues(true);
form.save();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.openntf.domino.design.FormField in project org.openntf.domino by OpenNTF.
the class Subform method addField.
@Override
public FormField addField() {
XMLNode body = getBody();
// Create an appropriate paragraph definition
// $NON-NLS-1$
XMLNode finalPardef = getDxl().selectSingleNode("//pardef[last()]");
// $NON-NLS-1$
int nextId = Integer.valueOf(finalPardef.getAttribute("id")) + 1;
// $NON-NLS-1$
XMLNode pardef = body.addChildElement("pardef");
// $NON-NLS-1$
pardef.setAttribute("id", String.valueOf(nextId));
// Now create the par and the field
// $NON-NLS-1$
XMLNode par = body.addChildElement("par");
// $NON-NLS-1$ //$NON-NLS-2$
par.setAttribute("def", pardef.getAttribute("id"));
// Now add the field
// $NON-NLS-1$
XMLNode field = par.addChildElement("field");
// $NON-NLS-1$ //$NON-NLS-2$
field.setAttribute("kind", "editable");
// $NON-NLS-1$ //$NON-NLS-2$
field.setAttribute("name", "");
// $NON-NLS-1$ //$NON-NLS-2$
field.setAttribute("type", "text");
return new org.openntf.domino.design.impl.FormField(field);
}
Aggregations