FireWeb application reflects DOM tree of HTML document in browser. The Application class is root of the document and is the body element of HTML. In package fireweb.org.html you can find all HTML elements implementations. You can control view elements as on DHTML, using pure Java objects.
There are several method to control view elements:
Div component = new Div().add(new Paragraph().setText("Pragraph 1")) .add(new Paragraph().setText("Pragraph 2")); application.add(component);
// As above ... component.remove(0); application.remove(component);
Div component = new Div(); component.setParent(application);
Div component = new Div(); component.setParent(application); component.add(new Paragraph().setText("Pragraph 1")) .add(new Paragraph().setText("Pragraph 2")); ... application.removeParent(component);
Div component = new Div().setParent(application); component.add(new Paragraph().setText("Pragraph 2")) .insert(0, new Paragraph().setText("Pragraph 1"));
Div component = new Div().setParent(application); component.add(new Paragraph().setText("Pragraph 2")) .insert(0, new Paragraph().setText("Pragraph 1")); ... component.replace(1, new Span().setText("Span"));
Div component = new Div().setParent(application); component.add(new Paragraph().setText("Pragraph 2")) .add(new Span().setText("Span")); ... List<Element> children = component.getElements();or by given class or interface using getElements(class)
Div component = new Div().setParent(application); component.add(new Paragraph().setText("Pragraph 2")) .add(new Span().setText("Span")); ... List<Span> children = component.getElements(Span.class);
Div component1 = new Div().setParent(application); component1.add(new Paragraph().setText("Pragraph 1")) .add(new Span().setText("Span 1")); Div component2 = new Div().setParent(application); component2.add(new Paragraph().setText("Pragraph 2")) .add(new Span().setText("Span 2")); component1.add(compnent2); ... List<Span> spans = application.findViewElements(Span.class); List<Paragraph> paragraphs = application .findViewElements(Paragraph.class); List<Div> divs = application.findViewElements(Div.class);
Div component = new Div().setParent(application); component.add(new Paragraph().setText("Pragraph 2")) .add(new Span().setText("Span")); ... FireWebApplication app = component.getParent();Similarly as above we can find parent in elements tree by findParent(class).
Span component = new Span().setParent(new Paragraph() .setParent(new Div())); Div parent = component.findParent(Div.class);