Search in sources :

Example 26 with GUIParentNode

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

the class GUISelectBoxController method unselect.

/**
	 * Unselect all nodes
	 */
protected void unselect() {
    ((GUIParentNode) node).getChildControllerNodes(childControllerNodes);
    for (int i = 0; i < childControllerNodes.size(); i++) {
        GUINode childControllerNode = childControllerNodes.get(i);
        GUINodeController childController = childControllerNode.getController();
        if (childController instanceof GUISelectBoxOptionController) {
            ((GUISelectBoxOptionController) childController).unselect();
        }
    }
}
Also used : GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) GUINodeController(net.drewke.tdme.gui.nodes.GUINodeController) GUINode(net.drewke.tdme.gui.nodes.GUINode)

Example 27 with GUIParentNode

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

the class LevelEditorEntityLibraryScreenController method setEntityLibrary.

/**
	 * Set up complete entity library
	 */
public void setEntityLibrary() {
    // model library
    LevelEditorEntityLibrary entityLibrary = TDMELevelEditor.getInstance().getEntityLibrary();
    // store selection
    entityLibraryListBoxSelection.set(entityLibraryListBox.getController().getValue());
    // entity library list box inner
    GUIParentNode entityLibraryListBoxInnerNode = (GUIParentNode) (entityLibraryListBox.getScreenNode().getNodeById(entityLibraryListBox.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 1;
    String entityLibraryListBoxSubNodesXML = "";
    entityLibraryListBoxSubNodesXML += "<scrollarea-vertical id=\"" + entityLibraryListBox.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100%\">\n";
    for (int i = 0; i < entityLibrary.getEntityCount(); i++) {
        int objectId = entityLibrary.getEntityAt(i).getId();
        String objectName = entityLibrary.getEntityAt(i).getName();
        entityLibraryListBoxSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(objectName) + "\" value=\"" + objectId + "\" " + (i == 0 ? "selected=\"true\" " : "") + "/>\n";
    }
    entityLibraryListBoxSubNodesXML += "</scrollarea-vertical>\n";
    // inject sub nodes
    try {
        entityLibraryListBoxInnerNode.replaceSubNodes(entityLibraryListBoxSubNodesXML, false);
    } catch (Exception e) {
        e.printStackTrace();
    }
    // reset selection
    if (entityLibraryListBoxSelection.length() > 0) {
        entityLibraryListBox.getController().setValue(entityLibraryListBoxSelection);
    }
    //
    onEntitySelectionChanged();
    //
    buttonEntityPlace.getController().setDisabled(entityLibrary.getEntityCount() == 0);
}
Also used : LevelEditorEntityLibrary(net.drewke.tdme.tools.shared.model.LevelEditorEntityLibrary) GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Example 28 with GUIParentNode

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

the class LevelEditorScreenController method unsetObjectProperties.

/**
	 * Unset object properties
	 */
public void unsetObjectProperties() {
    objectPropertiesPresets.getController().setValue(value.set("none"));
    objectPropertiesPresets.getController().setDisabled(true);
    btnObjectPropertyPresetApply.getController().setDisabled(true);
    objectPropertiesListBox.getController().setDisabled(true);
    btnObjectPropertyAdd.getController().setDisabled(true);
    btnObjectPropertyRemove.getController().setDisabled(true);
    btnObjectPropertySave.getController().setDisabled(true);
    objectPropertyName.getController().setValue(TEXT_EMPTY);
    objectPropertyName.getController().setDisabled(true);
    objectPropertyValue.getController().setValue(TEXT_EMPTY);
    objectPropertyValue.getController().setDisabled(true);
    // object properties list box inner
    GUIParentNode objectPropertiesListBoxInnerNode = (GUIParentNode) (objectPropertiesListBox.getScreenNode().getNodeById(objectPropertiesListBox.getId() + "_inner"));
    // 	clear sub nodes
    objectPropertiesListBoxInnerNode.clearSubNodes();
}
Also used : GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode)

Example 29 with GUIParentNode

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

the class LevelEditorScreenController method setObjectProperties.

/**
	 * Set up object properties
	 * @param preset id
	 * @param object properties
	 * @param selected name
	 */
public void setObjectProperties(String presetId, Iterable<PropertyModelClass> objectProperties, String selectedName) {
    objectPropertiesPresets.getController().setDisabled(false);
    btnObjectPropertyPresetApply.getController().setDisabled(false);
    objectPropertiesListBox.getController().setDisabled(false);
    btnObjectPropertyAdd.getController().setDisabled(false);
    btnObjectPropertyRemove.getController().setDisabled(false);
    btnObjectPropertySave.getController().setDisabled(true);
    objectPropertyName.getController().setDisabled(true);
    objectPropertyValue.getController().setDisabled(true);
    // set up preset
    objectPropertiesPresets.getController().setValue(presetId != null ? value.set(presetId) : value.set("none"));
    // object properties list box inner
    GUIParentNode objectPropertiesListBoxInnerNode = (GUIParentNode) (objectPropertiesListBox.getScreenNode().getNodeById(objectPropertiesListBox.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 1;
    String objectPropertiesListBoxSubNodesXML = "";
    objectPropertiesListBoxSubNodesXML += "<scrollarea-vertical id=\"" + objectPropertiesListBox.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100%\">\n";
    for (PropertyModelClass objectProperty : objectProperties) {
        objectPropertiesListBoxSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(objectProperty.getName()) + ": " + GUIParser.escapeQuotes(objectProperty.getValue()) + "\" value=\"" + GUIParser.escapeQuotes(objectProperty.getName()) + "\" " + (selectedName != null && objectProperty.getName().equals(selectedName) ? "selected=\"true\" " : "") + "/>\n";
    }
    objectPropertiesListBoxSubNodesXML += "</scrollarea-vertical>\n";
    // inject sub nodes
    try {
        objectPropertiesListBoxInnerNode.replaceSubNodes(objectPropertiesListBoxSubNodesXML, false);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //
    onObjectPropertiesSelectionChanged();
}
Also used : PropertyModelClass(net.drewke.tdme.tools.shared.model.PropertyModelClass) GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Example 30 with GUIParentNode

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

the class LevelEditorScreenController method setMapProperties.

/**
	 * Set up map properties
	 * @param map properties
	 */
public void setMapProperties(Iterable<PropertyModelClass> mapProperties, String selectedName) {
    //
    mapPropertyName.getController().setDisabled(true);
    mapPropertyValue.getController().setDisabled(true);
    mapPropertySave.getController().setDisabled(true);
    // map properties list box inner
    GUIParentNode mapPropertiesListBoxInnerNode = (GUIParentNode) (mapPropertiesListBox.getScreenNode().getNodeById(mapPropertiesListBox.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 1;
    String mapPropertiesListBoxSubNodesXML = "";
    mapPropertiesListBoxSubNodesXML += "<scrollarea-vertical id=\"" + mapPropertiesListBox.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100%\">\n";
    for (PropertyModelClass mapProperty : mapProperties) {
        mapPropertiesListBoxSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(mapProperty.getName()) + ": " + GUIParser.escapeQuotes(mapProperty.getValue()) + "\" value=\"" + GUIParser.escapeQuotes(mapProperty.getName()) + "\" " + (selectedName != null && mapProperty.getName().equals(selectedName) ? "selected=\"true\" " : "") + "/>\n";
    }
    mapPropertiesListBoxSubNodesXML += "</scrollarea-vertical>\n";
    // inject sub nodes
    try {
        mapPropertiesListBoxInnerNode.replaceSubNodes(mapPropertiesListBoxSubNodesXML, false);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //
    onMapPropertiesSelectionChanged();
}
Also used : PropertyModelClass(net.drewke.tdme.tools.shared.model.PropertyModelClass) 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