// 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(); }
// returns the current value pair contained in the panelgroup public String getCurrentPanelChildValue(int childIndex) { Object obj = currentPanel.getChildren().get(childIndex); String returnStr = ""; if (obj instanceof HtmlSelectOneMenu) { HtmlSelectOneMenu menu = (HtmlSelectOneMenu) obj; returnStr = menu.getValue().toString(); } else if (obj instanceof HtmlInputText) { HtmlInputText text = (HtmlInputText) obj; returnStr = text.getValue().toString(); } else if (obj instanceof HtmlOutputText) { HtmlOutputText text = (HtmlOutputText) obj; returnStr = text.getValue().toString(); } return returnStr; }
public void put(String id, HtmlPanelGroup uiComponent, FacesContext context) { dragValues.put(id, uiComponent.getDragValue()); dropValues.put(id, uiComponent.getDropValue()); }