| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include "UIText.h"
- UITextElement::UITextElement()
- : UIElement()
- {}
- void UITextElement::setText(const Framework::Text& text)
- {
- this->text = text;
- }
- const Framework::Text& UITextElement::getText() const
- {
- return text;
- }
- Framework::XML::Element* UITextElement::toUIML(
- Framework::Either<Block*, Entity*> zTarget, Entity* zActor) const
- {
- Framework::XML::Element* result = UIElement::toUIML(zTarget, zActor);
- result->setName("text");
- result->setText(text);
- return result;
- }
- UITextElementFactory::UITextElementFactory()
- : UIElementFactory()
- {}
- JSONObjectValidationBuilder* UITextElementFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return UIElementFactory::addToValidator(builder)
- ->withRequiredString("text")
- ->finishString();
- }
- UITextElement* UITextElementFactory::fromJson(
- Framework::JSON::JSONObject* zJson) const
- {
- UITextElement* result = UIElementFactory::fromJson(zJson);
- result->setText(zJson->zValue("text")->asString()->getString());
- return result;
- }
- Framework::JSON::JSONObject* UITextElementFactory::toJsonObject(
- UITextElement* zObject) const
- {
- Framework::JSON::JSONObject* result
- = UIElementFactory::toJsonObject(zObject);
- result->addValue(
- "text", new Framework::JSON::JSONString(zObject->getText()));
- return result;
- }
- UITextElement* UITextElementFactory::createElement(
- Framework::JSON::JSONObject* zJson) const
- {
- return new UITextElement();
- }
- const char* UITextElementFactory::getTypeToken() const
- {
- return "text";
- }
|