Search in sources :

Example 1 with FormatXml

use of com.qwest.mbeng.FormatXml in project mdw-designer by CenturyLinkCloud.

the class AttributesTableContainer method createTableEditor.

private void createTableEditor(Composite parent) {
    FormatXml fmter = new FormatXml();
    MbengDocument mbengDocument = new MbengDocumentClass();
    try {
        fmter.load(mbengDocument, pageletTable.xmlText());
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    tableEditor = new TableEditor(null, mbengDocument.getRootNode());
    // label was already rendered
    tableEditor.setLabel(null);
    tableEditor.setModelUpdater(new TableModelUpdater() {

        public Object create() {
            int i = 1;
            String attrName = "New Field";
            while (getAttribute(attrName) != null) attrName = "New Field (" + i++ + ")";
            return new AttributeVO(attrName, null);
        }

        @SuppressWarnings("rawtypes")
        public void updateModelValue(List tableValue) {
            fireDirtyStateChange(true);
        }
    });
    tableEditor.setCellModifier(new AttributeCellModifier());
    tableEditor.setContentProvider(new AttributeContentProvider());
    tableEditor.setLabelProvider(new AttributeLabelProvider());
    tableEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
        // value changed
        }
    });
    tableEditor.render(parent, true);
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) TableModelUpdater(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater) FormatXml(com.qwest.mbeng.FormatXml) MbengDocument(com.qwest.mbeng.MbengDocument) ArrayList(java.util.ArrayList) List(java.util.List) MbengDocumentClass(com.qwest.mbeng.MbengDocumentClass)

Example 2 with FormatXml

use of com.qwest.mbeng.FormatXml in project mdw-designer by CenturyLinkCloud.

the class BindingsSection method findBindingsNode.

private MbengNode findBindingsNode(Activity activity) {
    String attrXml = activity.getActivityImpl().getAttrDescriptionXml();
    FormatXml formatter = new FormatXml();
    MbengDocumentClass mbengDocument = new MbengDocumentClass();
    try {
        formatter.load(mbengDocument, attrXml);
        for (MbengNode currentNode = mbengDocument.getRootNode().getFirstChild(); currentNode != null; currentNode = currentNode.getNextSibling()) {
            if (MappingEditor.TYPE_MAPPING.equals(currentNode.getName()) && PropertyEditor.SECTION_BINDINGS.equals(currentNode.getAttribute("SECTION")))
                return currentNode;
        }
    } catch (MbengException ex) {
        PluginMessages.uiError(getShell(), ex, "Parse Attr XML");
    }
    return null;
}
Also used : MbengException(com.qwest.mbeng.MbengException) MbengNode(com.qwest.mbeng.MbengNode) FormatXml(com.qwest.mbeng.FormatXml) MbengDocumentClass(com.qwest.mbeng.MbengDocumentClass)

Aggregations

FormatXml (com.qwest.mbeng.FormatXml)2 MbengDocumentClass (com.qwest.mbeng.MbengDocumentClass)2 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)1 TableModelUpdater (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater)1 MbengDocument (com.qwest.mbeng.MbengDocument)1 MbengException (com.qwest.mbeng.MbengException)1 MbengNode (com.qwest.mbeng.MbengNode)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1