Search in sources :

Example 1 with GUIElementNode

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

the class GUIParser method parseGUINode.

/**
	 * Parse GUI node
	 * @param gui parent node
	 * @param xml parent node
	 * @param gui element
	 * @throws Exception
	 */
private static void parseGUINode(GUIParentNode guiParentNode, Element xmlParentNode, GUIElement guiElement) throws Exception {
    //
    GUINodeController guiElementController = null;
    boolean guiElementControllerInstalled = false;
    // parse sub nodes
    for (Element node : getChildrenTags(xmlParentNode)) {
        if (node.getNodeName().equals("panel")) {
            // TODO: validate root node
            GUIPanelNode guiPanelNode = new GUIPanelNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUIParentNode.createOverflow(node.getAttribute("overflow-x")), GUIParentNode.createOverflow(node.getAttribute("overflow-y")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUIParentNode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), new GUIColor("#F0F0F0")), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), GUILayoutNode.createAlignment(node.getAttribute("alignment")));
            guiParentNode.addSubNode(guiPanelNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiPanelNode);
                if (guiElementController != null) {
                    guiPanelNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
            // parse child nodes
            parseGUINode(guiPanelNode, node, null);
        } else if (node.getNodeName().equals("layout")) {
            // TODO: validate root node
            GUILayoutNode guiLayoutNode = new GUILayoutNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUIParentNode.createOverflow(node.getAttribute("overflow-x")), GUIParentNode.createOverflow(node.getAttribute("overflow-y")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUIParentNode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), GUILayoutNode.createAlignment(node.getAttribute("alignment")));
            guiParentNode.addSubNode(guiLayoutNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiLayoutNode);
                if (guiElementController != null) {
                    guiLayoutNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
            // parse child nodes
            parseGUINode(guiLayoutNode, node, null);
        } else if (node.getNodeName().equals("space")) {
            // TODO: validate root node
            GUISpaceNode guiSpaceNode = new GUISpaceNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUISpaceNode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")));
            guiParentNode.addSubNode(guiSpaceNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiSpaceNode);
                if (guiElementController != null) {
                    guiSpaceNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
        } else if (node.getNodeName().equals("element")) {
            // TODO: validate root node
            GUIElementNode guiElementNode = new GUIElementNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUIParentNode.createOverflow(node.getAttribute("overflow-x")), GUIParentNode.createOverflow(node.getAttribute("overflow-y")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUINode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), unescapeQuotes(node.getAttribute("name")), unescapeQuotes(node.getAttribute("value")), node.getAttribute("selected").trim().equalsIgnoreCase("true"), node.getAttribute("disabled").trim().equalsIgnoreCase("true"), node.getAttribute("focusable").trim().equalsIgnoreCase("true"), node.getAttribute("ignore-events").trim().equalsIgnoreCase("true"));
            guiParentNode.addSubNode(guiElementNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiElementNode);
                if (guiElementController != null) {
                    guiElementNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
            // parse child nodes
            parseGUINode(guiElementNode, node, null);
        } else if (node.getNodeName().equals("image")) {
            // TODO: validate root node
            GUIImageNode guiImageNode = new GUIImageNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUINode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), unescapeQuotes(node.getAttribute("src")), GUINode.getRequestedColor(node.getAttribute("effect-color-mul"), GUIColor.EFFECT_COLOR_MUL), GUINode.getRequestedColor(node.getAttribute("effect-color-add"), GUIColor.EFFECT_COLOR_ADD));
            guiParentNode.addSubNode(guiImageNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiImageNode);
                if (guiElementController != null) {
                    guiImageNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
        } else if (node.getNodeName().equals("text")) {
            // TODO: validate root node
            GUITextNode guiTextNode = new GUITextNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUINode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), node.getAttribute("font"), node.getAttribute("color"), new MutableString(unescapeQuotes(node.getAttribute("text"))));
            guiParentNode.addSubNode(guiTextNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiTextNode);
                if (guiElementController != null) {
                    guiTextNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
        } else if (node.getNodeName().equals("input-internal")) {
            // TODO: validate root node
            GUIInputInternalNode guiInputInternalNode = new GUIInputInternalNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUINode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), node.getAttribute("font"), node.getAttribute("color"), node.getAttribute("color-disabled"), new MutableString(unescapeQuotes(node.getAttribute("text"))), GUIInputInternalNode.createMaxLength(node.getAttribute("maxlength")));
            guiParentNode.addSubNode(guiInputInternalNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiInputInternalNode);
                if (guiElementController != null) {
                    guiInputInternalNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
        } else if (node.getNodeName().equals("vertical-scrollbar-internal")) {
            // TODO: validate root node
            GUIVerticalScrollbarInternalNode guiVerticalScrollbarInternalNode = new GUIVerticalScrollbarInternalNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUINode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), GUINode.getRequestedColor(node.getAttribute("color-none"), GUIColor.BLACK), GUINode.getRequestedColor(node.getAttribute("color-mouseover"), GUIColor.BLACK), GUINode.getRequestedColor(node.getAttribute("color-dragging"), GUIColor.BLACK));
            guiParentNode.addSubNode(guiVerticalScrollbarInternalNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiVerticalScrollbarInternalNode);
                if (guiElementController != null) {
                    guiVerticalScrollbarInternalNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
        } else if (node.getNodeName().equals("horizontal-scrollbar-internal")) {
            // TODO: validate root node
            GUIHorizontalScrollbarInternalNode guiHorizontalScrollbarInternalNode = new GUIHorizontalScrollbarInternalNode(guiParentNode.getScreenNode(), guiParentNode, node.getAttribute("id"), GUINode.createFlow(node.getAttribute("flow")), GUINode.createAlignments(node.getAttribute("horizontal-align"), node.getAttribute("vertical-align")), GUINode.createRequestedConstraints(node.getAttribute("left"), node.getAttribute("top"), node.getAttribute("width"), node.getAttribute("height")), GUINode.getRequestedColor(node.getAttribute("background-color"), GUIColor.TRANSPARENT), GUINode.createBorder(node.getAttribute("border"), node.getAttribute("border-left"), node.getAttribute("border-top"), node.getAttribute("border-right"), node.getAttribute("border-bottom"), node.getAttribute("border-color"), node.getAttribute("border-color-left"), node.getAttribute("border-color-top"), node.getAttribute("border-color-right"), node.getAttribute("border-color-bottom")), GUINode.createPadding(node.getAttribute("padding"), node.getAttribute("padding-left"), node.getAttribute("padding-top"), node.getAttribute("padding-right"), node.getAttribute("padding-bottom")), GUINode.createConditions(node.getAttribute("show-on")), GUINode.createConditions(node.getAttribute("hide-on")), GUINode.getRequestedColor(node.getAttribute("color-none"), GUIColor.BLACK), GUINode.getRequestedColor(node.getAttribute("color-mouseover"), GUIColor.BLACK), GUINode.getRequestedColor(node.getAttribute("color-dragging"), GUIColor.BLACK));
            guiParentNode.addSubNode(guiHorizontalScrollbarInternalNode);
            // install gui element controller if not yet done
            if (guiElement != null && guiElementControllerInstalled == false) {
                guiElementController = guiElement.createController(guiHorizontalScrollbarInternalNode);
                if (guiElementController != null) {
                    guiHorizontalScrollbarInternalNode.setController(guiElementController);
                }
                guiElementControllerInstalled = true;
            }
        } else {
            // Try to load from GUI elements
            GUIElement newGuiElement = elements.get(node.getNodeName());
            if (newGuiElement == null) {
                throw new GUIParserException("Unknown element '" + node.getNodeName() + "'");
            }
            // create final template, replace attributes
            String newGuiElementTemplate = newGuiElement.getTemplate();
            for (int i = 0; i < node.getAttributes().getLength(); i++) {
                Node attribute = node.getAttributes().item(i);
                newGuiElementTemplate = newGuiElementTemplate.replace("{$" + attribute.getNodeName() + "}", escapeQuotes(attribute.getNodeValue()));
            }
            HashMap<String, String> newGuiElementAttributes = newGuiElement.getAttributes(guiParentNode.getScreenNode());
            for (String newGuiElementAttributeKey : newGuiElementAttributes.getKeysIterator()) {
                String guiElementAttributeValue = escapeQuotes(newGuiElementAttributes.get(newGuiElementAttributeKey));
                newGuiElementTemplate = newGuiElementTemplate.replace("{$" + newGuiElementAttributeKey + "}", guiElementAttributeValue);
            }
            newGuiElementTemplate = newGuiElementTemplate.replace("{$innerXml}", getInnerXml(node));
            // create xml document and parse
            DocumentBuilder newGuiElementBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document newGuiElementDocument = newGuiElementBuilder.parse(new ByteArrayInputStream(new String("<gui-element>\n" + newGuiElementTemplate + "</gui-element>\n").getBytes()));
            parseGUINode(guiParentNode, newGuiElementDocument.getDocumentElement(), newGuiElement);
        }
    }
    // if we have a GUI element controller just init it, after element has been loaded
    if (guiElementController != null) {
        guiElementController.init();
    }
}
Also used : GUIInputInternalNode(net.drewke.tdme.gui.nodes.GUIInputInternalNode) GUIVerticalScrollbarInternalNode(net.drewke.tdme.gui.nodes.GUIVerticalScrollbarInternalNode) GUIElement(net.drewke.tdme.gui.elements.GUIElement) Element(org.w3c.dom.Element) GUIHorizontalScrollbarInternalNode(net.drewke.tdme.gui.nodes.GUIHorizontalScrollbarInternalNode) GUIVerticalScrollbarInternalNode(net.drewke.tdme.gui.nodes.GUIVerticalScrollbarInternalNode) GUIScreenNode(net.drewke.tdme.gui.nodes.GUIScreenNode) GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) GUILayoutNode(net.drewke.tdme.gui.nodes.GUILayoutNode) GUISpaceNode(net.drewke.tdme.gui.nodes.GUISpaceNode) GUITextNode(net.drewke.tdme.gui.nodes.GUITextNode) GUIPanelNode(net.drewke.tdme.gui.nodes.GUIPanelNode) Node(org.w3c.dom.Node) GUINode(net.drewke.tdme.gui.nodes.GUINode) GUIElementNode(net.drewke.tdme.gui.nodes.GUIElementNode) GUIInputInternalNode(net.drewke.tdme.gui.nodes.GUIInputInternalNode) GUIImageNode(net.drewke.tdme.gui.nodes.GUIImageNode) GUIElement(net.drewke.tdme.gui.elements.GUIElement) MutableString(net.drewke.tdme.utils.MutableString) Document(org.w3c.dom.Document) GUIHorizontalScrollbarInternalNode(net.drewke.tdme.gui.nodes.GUIHorizontalScrollbarInternalNode) GUILayoutNode(net.drewke.tdme.gui.nodes.GUILayoutNode) GUIPanelNode(net.drewke.tdme.gui.nodes.GUIPanelNode) GUIColor(net.drewke.tdme.gui.nodes.GUIColor) GUITextNode(net.drewke.tdme.gui.nodes.GUITextNode) GUISpaceNode(net.drewke.tdme.gui.nodes.GUISpaceNode) DocumentBuilder(javax.xml.parsers.DocumentBuilder) ByteArrayInputStream(java.io.ByteArrayInputStream) GUINodeController(net.drewke.tdme.gui.nodes.GUINodeController) MutableString(net.drewke.tdme.utils.MutableString) GUIElementNode(net.drewke.tdme.gui.nodes.GUIElementNode) GUIImageNode(net.drewke.tdme.gui.nodes.GUIImageNode)

Example 2 with GUIElementNode

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

the class GUIDropDownController method setValue.

/*
	 * (non-Javadoc)
	 * @see net.drewke.tdme.gui.nodes.GUINodeController#setValue(net.drewke.tdme.utils.MutableString)
	 */
public void setValue(MutableString value) {
    // determine select box option controllers
    determineDropDownOptionControllers();
    // unselect all selections
    unselect();
    // determine new selection
    for (int i = 0; i < dropDownOptionControllers.size(); i++) {
        GUIDropDownOptionController dropDownOptionController = dropDownOptionControllers.get(i);
        GUIElementNode dropDownOptionNode = ((GUIElementNode) dropDownOptionController.getNode());
        if (value.equals(dropDownOptionNode.getValue())) {
            dropDownOptionController.select();
            dropDownOptionNode.scrollToNodeX(dropDownNode);
            dropDownOptionNode.scrollToNodeY(dropDownNode);
            break;
        }
    }
}
Also used : GUIElementNode(net.drewke.tdme.gui.nodes.GUIElementNode)

Example 3 with GUIElementNode

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

the class GUIDropDownOptionController method select.

/**
	 * Select
	 */
protected void select() {
    // select current
    GUINodeConditions nodeConditions = ((GUIElementNode) node).getActiveConditions();
    nodeConditions.remove(this.selected == true ? CONDITION_SELECTED : CONDITION_UNSELECTED);
    this.selected = true;
    nodeConditions.add(this.selected == true ? CONDITION_SELECTED : CONDITION_UNSELECTED);
    // set text from option to heading text
    GUITextNode dropDownOptionTextNode = (GUITextNode) node.getScreenNode().getNodeById(node.getId() + "_unselected");
    GUITextNode dropDownTextNodeEnabled = (GUITextNode) node.getScreenNode().getNodeById(dropDownNode.getId() + "_text_enabled");
    dropDownTextNodeEnabled.getText().reset();
    dropDownTextNodeEnabled.getText().append(dropDownOptionTextNode.getText());
    GUITextNode dropDownTextNodeDisabled = (GUITextNode) node.getScreenNode().getNodeById(dropDownNode.getId() + "_text_disabled");
    dropDownTextNodeDisabled.getText().reset();
    dropDownTextNodeDisabled.getText().append(dropDownOptionTextNode.getText());
}
Also used : GUINodeConditions(net.drewke.tdme.gui.nodes.GUINodeConditions) GUITextNode(net.drewke.tdme.gui.nodes.GUITextNode) GUIElementNode(net.drewke.tdme.gui.nodes.GUIElementNode)

Example 4 with GUIElementNode

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

the class GUISelectBoxMultipleOptionController method unselect.

/**
	 * Unselect
	 * @param checked
	 */
protected void unselect() {
    // unselect current
    GUINodeConditions nodeConditions = ((GUIElementNode) node).getActiveConditions();
    nodeConditions.remove(this.selected == true ? CONDITION_SELECTED : CONDITION_UNSELECTED);
    this.selected = false;
    nodeConditions.add(this.selected == true ? CONDITION_SELECTED : CONDITION_UNSELECTED);
    // disabled
    boolean disabled = ((GUISelectBoxMultipleController) selectBoxMultipleNode.getController()).isDisabled();
    nodeConditions.remove(CONDITION_DISABLED);
    nodeConditions.remove(CONDITION_ENABLED);
    nodeConditions.add(disabled == true ? CONDITION_DISABLED : CONDITION_ENABLED);
}
Also used : GUINodeConditions(net.drewke.tdme.gui.nodes.GUINodeConditions) GUIElementNode(net.drewke.tdme.gui.nodes.GUIElementNode)

Example 5 with GUIElementNode

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

the class GUISelectBoxMultipleOptionController method unfocus.

/**
	 * Unfocus
	 * @param checked
	 */
protected void unfocus() {
    // unselect current
    GUINodeConditions nodeConditions = ((GUIElementNode) node).getActiveConditions();
    nodeConditions.remove(this.focussed == true ? CONDITION_FOCUSSED : CONDITION_UNFOCUSSED);
    this.focussed = false;
    nodeConditions.add(this.focussed == true ? CONDITION_FOCUSSED : CONDITION_UNFOCUSSED);
}
Also used : GUINodeConditions(net.drewke.tdme.gui.nodes.GUINodeConditions) GUIElementNode(net.drewke.tdme.gui.nodes.GUIElementNode)

Aggregations

GUIElementNode (net.drewke.tdme.gui.nodes.GUIElementNode)28 GUINodeConditions (net.drewke.tdme.gui.nodes.GUINodeConditions)20 GUIParentNode (net.drewke.tdme.gui.nodes.GUIParentNode)5 GUIActionListener (net.drewke.tdme.gui.events.GUIActionListener)4 GUIColor (net.drewke.tdme.gui.nodes.GUIColor)2 GUINode (net.drewke.tdme.gui.nodes.GUINode)2 GUITextNode (net.drewke.tdme.gui.nodes.GUITextNode)2 MutableString (net.drewke.tdme.utils.MutableString)2 ByteArrayInputStream (java.io.ByteArrayInputStream)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 GUIHorizontalScrollbarInternalNode (net.drewke.tdme.gui.nodes.GUIHorizontalScrollbarInternalNode)1 GUIImageNode (net.drewke.tdme.gui.nodes.GUIImageNode)1 GUIInputInternalNode (net.drewke.tdme.gui.nodes.GUIInputInternalNode)1 GUILayoutNode (net.drewke.tdme.gui.nodes.GUILayoutNode)1 GUINodeController (net.drewke.tdme.gui.nodes.GUINodeController)1