private void initializeInterface() { ElementMold[] rootNodes = interfaceModelBuilder.getRootNodes(); for (int a = 0; a < rootNodes.length; a++) { if (rootNodes[a].getInputType().equals("button")) { CustomButtonNode nodeToAdd = buildButtonNode(rootNodes[a].getName(), null); nodeToAdd.setLoaded(false); nodeToAdd.setExpanded(false); treeStructure.getChildren().add(nodeToAdd); updateInterface(); } } }
// expands a node, updates its expansion state. updates its loaded state if // applicable and updates the panelGrid private void expandNode(CustomButtonNode button) { // TODO: add an ordering attribute to the RDF file so the model returns the items // in proper order if (!button.isLoaded()) { int index = treeStructure.getChildren().indexOf(button); ElementMold[] fields = interfaceModelBuilder.getChildrenOf(button.getValue().toString()); HtmlPanelGroup childrenContainer = new HtmlPanelGroup(); for (int a = 0; a < fields.length; a++) { if (fields[a].getInputType().equals("button")) { CustomButtonNode newNode = this.buildButtonNode(fields[a].getName(), button); button.getChildren().add(newNode); } } for (int a = 0; a < fields.length; a++) { if (fields[a].getInputType().equals("outputText")) { HtmlOutputText newText = this.buildOutputTextField(fields[a].getText(), button); childrenContainer.getChildren().add(newText); } } for (int a = 0; a < fields.length; a++) { if (fields[a].getInputType().equals("selectInput")) { HtmlSelectOneMenu newSelector = this.buildSelectBox(fields[a].getOptions(), button); childrenContainer.getChildren().add(newSelector); } } for (int a = 0; a < fields.length; a++) { if (fields[a].getInputType().equals("inputText")) { HtmlInputText newText = this.buildInputTextField(button); childrenContainer.getChildren().add(newText); } } if (childrenContainer.getChildCount() > 0) { button.getChildren().add(childrenContainer); } button.setLoaded(true); treeStructure.getChildren().addAll(index + 1, button.getChildren()); } else { expandChildrenOf(button); } button.setExpanded(true); updateInterface(); }