Package org.odftoolkit.odfdom.dom.element.form

Examples of org.odftoolkit.odfdom.dom.element.form.FormFormElement


  public boolean removeForm(Form form) {
    if (form == null)
      return true;
    OdfElement containerElement = getFormContainerElement();
    FormFormElement formElement = form.getOdfElement();
    try {
      containerElement.removeChild(formElement);
    } catch (DOMException exception) {
      Logger.getLogger(AbstractFormContainer.class.getName()).log(
          Level.WARNING, exception.getMessage());
View Full Code Here


  public Form getFormByName(String name) {
    if (name == null)
      return null;

    OdfElement container = getFormContainerElement();
    FormFormElement element = OdfElement.findFirstChildNode(
        FormFormElement.class, container);
    while (element != null) {
      if (name.equals(element.getFormNameAttribute())) {
        Form form = getProvider().getInstanceOf(element);
        return form;
      }
      element = OdfElement.findNextChildNode(FormFormElement.class,
          element);
View Full Code Here

      }
      containerElement.removeChild(nextElement.getOdfElement());
    }

    private Form findNext(Form thisForm) {
      FormFormElement nextForm = null;
      if (thisForm == null) {
        nextForm = OdfElement.findFirstChildNode(FormFormElement.class,
            containerElement);
      } else {
        nextForm = OdfElement.findNextChildNode(FormFormElement.class,
View Full Code Here

  }

  static OOForm createForm(String name, OfficeFormsElement parent) {
    OOForm form = null;
    if (parent != null) {
      FormFormElement element = parent.newFormFormElement();
      form = new OOForm(element);
      form.setFormName(name);
      form
          .setControlImplementation(OOFormProvider.OO_CONTROL_IMPLEMENTATION_FORM);
      Component.registerComponent(form, element);
View Full Code Here

  @Test
  public void testCreatChildrenForForm() {
    try {
      OdfTextDocument doc = OdfTextDocument.newTextDocument();
      OfficeTextElement text = doc.getContentRoot();
      FormFormElement form = text.newOfficeFormsElement().newFormFormElement();
      form.setFormNameAttribute("NewFrom");
      OdfFileDom contentDom = doc.getContentDom();
      XPath xpath = contentDom.getXPath();
      FormFormElement formTest = (FormFormElement) xpath.evaluate("//form:form[last()]", contentDom, XPathConstants.NODE);
      Assert.assertEquals(formTest, form);
      doc.getContentDom().getDocument().save(ResourceUtilities.newTestOutputFile("CreatChildrenForForm.odt"));

    } catch (Exception e) {
      Logger.getLogger(CreateChildrenElementsTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

   * Create child element {@odf.element form:form}.
   *
   * @return the element {@odf.element form:form}
   */
  public FormFormElement newFormFormElement() {
    FormFormElement formForm = ((OdfFileDom) this.ownerDocument).newOdfElement(FormFormElement.class);
    this.appendChild(formForm);
    return formForm;
  }
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.form.FormFormElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.