Search in sources :

Example 1 with DesignForm

use of org.openntf.domino.design.DesignForm 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);
    }
}
Also used : DesignForm(org.openntf.domino.design.DesignForm) FormField(org.openntf.domino.design.FormField)

Example 2 with DesignForm

use of org.openntf.domino.design.DesignForm 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();
    }
}
Also used : Database(org.openntf.domino.Database) DesignForm(org.openntf.domino.design.DesignForm) FormField(org.openntf.domino.design.FormField) Session(org.openntf.domino.Session)

Example 3 with DesignForm

use of org.openntf.domino.design.DesignForm in project org.openntf.domino by OpenNTF.

the class FormCRUDTest method getFormInfo.

private void getFormInfo(final Database db, final StringBuilder sb) {
    DesignForm form = db.getDesign().getForm("testForm");
    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);
    }
}
Also used : DesignForm(org.openntf.domino.design.DesignForm)

Aggregations

DesignForm (org.openntf.domino.design.DesignForm)3 FormField (org.openntf.domino.design.FormField)2 Database (org.openntf.domino.Database)1 Session (org.openntf.domino.Session)1