Search in sources :

Example 31 with GUIParentNode

use of net.drewke.tdme.gui.nodes.GUIParentNode in project tdme by andreasdr.

the class LevelEditorScreenController method setObjectPresetIds.

/**
	 * Set up object property preset ids
	 * @param object property preset ids
	 */
public void setObjectPresetIds(Collection<String> objectPresetIds) {
    // model properties presets inner
    GUIParentNode objectPropertiesPresetsInnerNode = (GUIParentNode) (objectPropertiesPresets.getScreenNode().getNodeById(objectPropertiesPresets.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 0;
    String objectPropertiesPresetsInnerNodeSubNodesXML = "";
    objectPropertiesPresetsInnerNodeSubNodesXML += "<scrollarea-vertical id=\"" + objectPropertiesPresets.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100\">\n";
    for (String modelPresetId : objectPresetIds) {
        objectPropertiesPresetsInnerNodeSubNodesXML += "<dropdown-option text=\"" + GUIParser.escapeQuotes(modelPresetId) + "\" value=\"" + GUIParser.escapeQuotes(modelPresetId) + "\" " + (idx == 0 ? "selected=\"true\" " : "") + " />\n";
        idx++;
    }
    objectPropertiesPresetsInnerNodeSubNodesXML += "</scrollarea-vertical>\n";
    // inject sub nodes
    try {
        objectPropertiesPresetsInnerNode.replaceSubNodes(objectPropertiesPresetsInnerNodeSubNodesXML, true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Aggregations

GUIParentNode (net.drewke.tdme.gui.nodes.GUIParentNode)31 MutableString (net.drewke.tdme.utils.MutableString)14 GUINode (net.drewke.tdme.gui.nodes.GUINode)13 GUINodeController (net.drewke.tdme.gui.nodes.GUINodeController)13 GUIElementNode (net.drewke.tdme.gui.nodes.GUIElementNode)5 GUIActionListener (net.drewke.tdme.gui.events.GUIActionListener)4 PropertyModelClass (net.drewke.tdme.tools.shared.model.PropertyModelClass)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FilenameFilter (java.io.FilenameFilter)1 IOException (java.io.IOException)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 GUIColorEffect (net.drewke.tdme.gui.effects.GUIColorEffect)1 GUIPositionEffect (net.drewke.tdme.gui.effects.GUIPositionEffect)1 GUIElement (net.drewke.tdme.gui.elements.GUIElement)1 GUITabController (net.drewke.tdme.gui.elements.GUITabController)1 GUIChangeListener (net.drewke.tdme.gui.events.GUIChangeListener)1 GUIColor (net.drewke.tdme.gui.nodes.GUIColor)1 GUIHorizontalScrollbarInternalNode (net.drewke.tdme.gui.nodes.GUIHorizontalScrollbarInternalNode)1 GUIImageNode (net.drewke.tdme.gui.nodes.GUIImageNode)1