Search in sources :

Example 1 with Element

use of org.whole.lang.xml.model.Element in project whole by wholeplatform.

the class ElementOutlinePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    Element entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(3);
    list.add(entity.getTag());
    list.add(entity.getAttributes());
    list.add(entity.getContent());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) Element(org.whole.lang.xml.model.Element) ArrayList(java.util.ArrayList)

Example 2 with Element

use of org.whole.lang.xml.model.Element in project whole by wholeplatform.

the class ElementOutlinePart method createFigure.

protected IFigure createFigure() {
    Element entity = getModelEntity();
    IContent content = entity.getContent();
    boolean startOpened = !EntityUtils.isResolver(content) && !(EntityUtils.isComposite(content) && content.wIsEmpty());
    return new ElementOutlineFigure(startOpened);
}
Also used : IContent(org.whole.lang.xml.model.IContent) Element(org.whole.lang.xml.model.Element) ElementOutlineFigure(org.whole.lang.xml.ui.figures.ElementOutlineFigure)

Example 3 with Element

use of org.whole.lang.xml.model.Element in project whole by wholeplatform.

the class ElementPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    List<IEntity> list = new ArrayList<IEntity>(4);
    Element element = getModelEntity();
    list.add(element.getTag());
    list.add(element.getAttributes());
    list.add(element.getContent());
    // FIXME
    list.add(element.getTag());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) Element(org.whole.lang.xml.model.Element) ArrayList(java.util.ArrayList)

Example 4 with Element

use of org.whole.lang.xml.model.Element in project whole by wholeplatform.

the class GrammarsUtilsTest method testUnparseXmlElement.

@Test
public void testUnparseXmlElement() {
    XmlEntityFactory xf = XmlEntityFactory.instance;
    Element e = xf.createElement(xf.createQualifiedName(xf.createNameSpace("ns"), xf.createName("tag")), xf.createAttributes(xf.createAttribute(xf.createName("attr"), xf.createValue("val")), xf.createAttribute(xf.createName("attr2"), xf.createValue("val2"))), xf.createCharData("test"));
    StringBuilder sb = new StringBuilder();
    GrammarsUtils.unparse(e, sb, xmlGrammarURI);
    Assert.assertEquals("<ns:tag attr=\"val\" attr2=\"val2\">test</ns:tag>", sb.toString());
}
Also used : Element(org.whole.lang.xml.model.Element) XmlEntityFactory(org.whole.lang.xml.factories.XmlEntityFactory) Test(org.junit.Test)

Aggregations

Element (org.whole.lang.xml.model.Element)4 ArrayList (java.util.ArrayList)2 IEntity (org.whole.lang.model.IEntity)2 Test (org.junit.Test)1 XmlEntityFactory (org.whole.lang.xml.factories.XmlEntityFactory)1 IContent (org.whole.lang.xml.model.IContent)1 ElementOutlineFigure (org.whole.lang.xml.ui.figures.ElementOutlineFigure)1