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();
}
}
}
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);
}
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();
}
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();
}
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();
}
Aggregations