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