Search in sources :

Example 1 with GUIParentNode

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

the class ParticleSystemScreenController method setParticleSystemEmitters.

/**
	 * Set up emitters
	 * @param emitters
	 */
public void setParticleSystemEmitters(Collection<String> emittersCollection) {
    // particle system emitters inner node
    GUIParentNode particleSystemEmittersInnerNode = (GUIParentNode) (particleSystemEmitters.getScreenNode().getNodeById(particleSystemEmitters.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 0;
    String particleSystemEmittersInnerNodeSubNodesXML = "";
    particleSystemEmittersInnerNodeSubNodesXML += "<scrollarea-vertical id=\"" + particleSystemEmitters.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100\">\n";
    for (String particleSystemEmitter : emittersCollection) {
        particleSystemEmittersInnerNodeSubNodesXML += "<dropdown-option text=\"" + GUIParser.escapeQuotes(particleSystemEmitter) + "\" value=\"" + GUIParser.escapeQuotes(particleSystemEmitter) + "\" " + (idx == 0 ? "selected=\"true\" " : "") + " />\n";
        idx++;
    }
    particleSystemEmittersInnerNodeSubNodesXML += "</scrollarea-vertical>";
    // inject sub nodes
    try {
        particleSystemEmittersInnerNode.replaceSubNodes(particleSystemEmittersInnerNodeSubNodesXML, true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Example 2 with GUIParentNode

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

the class FileDialogScreenController method setupFileDialogListBox.

/**
	 * Set up file dialog list box
	 */
private void setupFileDialogListBox() {
    // set up caption
    {
        String directory = cwd;
        if (directory.length() > 50)
            directory = "..." + directory.substring(directory.length() - 50 + 3);
        caption.getText().set(captionText).append(directory);
    }
    // list files
    String[] fileList = new String[0];
    try {
        String directory = cwd;
        fileList = FileSystem.getInstance().list(directory, new FilenameFilter() {

            public boolean accept(File directory, String file) {
                if (new File(directory, file).isDirectory() == true)
                    return true;
                for (String extension : extensions) {
                    if (file.toLowerCase().endsWith("." + extension))
                        return true;
                }
                return false;
            }
        });
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
    // files inner
    GUIParentNode filesInnerNode = (GUIParentNode) (files.getScreenNode().getNodeById(files.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 1;
    String filesInnerNodeSubNodesXML = "";
    filesInnerNodeSubNodesXML += "<scrollarea width=\"100%\" height=\"100%\">\n";
    filesInnerNodeSubNodesXML += "<selectbox-option text=\"..\" value=\"..\" />\n";
    for (String file : fileList) {
        filesInnerNodeSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(file) + "\" value=\"" + GUIParser.escapeQuotes(file) + "\" />\n";
    }
    filesInnerNodeSubNodesXML += "</scrollarea>\n";
    // inject sub nodes
    try {
        filesInnerNode.replaceSubNodes(filesInnerNodeSubNodesXML, true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : FilenameFilter(java.io.FilenameFilter) GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString) IOException(java.io.IOException) File(java.io.File) IOException(java.io.IOException)

Example 3 with GUIParentNode

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

the class ParticleSystemScreenController method setParticleSystemTypes.

/**
	 * Set up particle system types
	 * @param particle system types
	 */
public void setParticleSystemTypes(Collection<String> particleSystemTypesCollection) {
    // particle system types inner node
    GUIParentNode particleSystemTypesInnerNode = (GUIParentNode) (particleSystemTypes.getScreenNode().getNodeById(particleSystemTypes.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 0;
    String particleSystemTypesInnerNodeSubNodesXML = "";
    particleSystemTypesInnerNodeSubNodesXML += "<scrollarea-vertical id=\"" + particleSystemTypes.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100\">\n";
    for (String particleSystem : particleSystemTypesCollection) {
        particleSystemTypesInnerNodeSubNodesXML += "<dropdown-option text=\"" + GUIParser.escapeQuotes(particleSystem) + "\" value=\"" + GUIParser.escapeQuotes(particleSystem) + "\" " + (idx == 0 ? "selected=\"true\" " : "") + " />\n";
        idx++;
    }
    particleSystemTypesInnerNodeSubNodesXML += "</scrollarea-vertical>";
    // inject sub nodes
    try {
        particleSystemTypesInnerNode.replaceSubNodes(particleSystemTypesInnerNodeSubNodesXML, true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Example 4 with GUIParentNode

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

the class EntityBaseSubScreenController method setEntityProperties.

/**
	 * Set up entity properties
	 * @param model
	 * @param preset id
	 * @param entity properties
	 * @param selected name
	 */
public void setEntityProperties(LevelEditorEntity model, String presetId, Iterable<PropertyModelClass> entityProperties, String selectedName) {
    //
    entityPropertiesPresets.getController().setDisabled(false);
    entityPropertyPresetApply.getController().setDisabled(false);
    entityPropertiesList.getController().setDisabled(false);
    entityPropertyAdd.getController().setDisabled(false);
    entityPropertyRemove.getController().setDisabled(false);
    entityPropertySave.getController().setDisabled(true);
    entityPropertyName.getController().setDisabled(true);
    entityPropertyValue.getController().setDisabled(true);
    // set up preset
    entityPropertiesPresets.getController().setValue(presetId != null ? value.set(presetId) : value.set("none"));
    // model properties list box inner
    GUIParentNode entityPropertiesListBoxInnerNode = (GUIParentNode) (entityPropertiesList.getScreenNode().getNodeById(entityPropertiesList.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 1;
    String entityPropertiesListBoxSubNodesXML = "";
    entityPropertiesListBoxSubNodesXML += "<scrollarea-vertical id=\"" + entityPropertiesList.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100%\">\n";
    for (PropertyModelClass entityProperty : entityProperties) {
        entityPropertiesListBoxSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(entityProperty.getName()) + ": " + GUIParser.escapeQuotes(entityProperty.getValue()) + "\" value=\"" + GUIParser.escapeQuotes(entityProperty.getName()) + "\" " + (selectedName != null && entityProperty.getName().equals(selectedName) ? "selected=\"true\" " : "") + "/>\n";
    }
    entityPropertiesListBoxSubNodesXML += "</scrollarea-vertical>\n";
    // inject sub nodes
    try {
        entityPropertiesListBoxInnerNode.replaceSubNodes(entityPropertiesListBoxSubNodesXML, false);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //
    onEntityPropertiesSelectionChanged(model);
}
Also used : PropertyModelClass(net.drewke.tdme.tools.shared.model.PropertyModelClass) GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Example 5 with GUIParentNode

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

the class EntityBoundingVolumeSubScreenController method setupBoundingVolumeTypes.

/**
	 * Set up bounding volume types
	 * @param idx
	 * @param bounding volume types
	 */
public void setupBoundingVolumeTypes(int idx, String[] boundingVolumeTypes) {
    // bounding volume types drop downs inner
    GUIParentNode boundingVolumeTypeDropDownInnerNode = (GUIParentNode) (boundingVolumeTypeDropDown[idx].getScreenNode().getNodeById(boundingVolumeTypeDropDown[idx].getId() + "_inner"));
    // construct XML for sub nodes
    int bvIdx = 0;
    String boundingVolumeTypeDropDownSubNodesXML = "";
    boundingVolumeTypeDropDownSubNodesXML += "<scrollarea-vertical width=\"100%\" height=\"80\">";
    for (String bvType : boundingVolumeTypes) {
        boundingVolumeTypeDropDownSubNodesXML += "<dropdown-option text=\"" + GUIParser.escapeQuotes(bvType) + "\" value=\"" + +(bvIdx++) + "\" />\n";
    }
    boundingVolumeTypeDropDownSubNodesXML += "</scrollarea-vertical>";
    // inject sub nodes
    try {
        boundingVolumeTypeDropDownInnerNode.replaceSubNodes(boundingVolumeTypeDropDownSubNodesXML, 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