Examples of ODOMObservable


Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

                    // lazily create the odom change listener.
                    odomChangeListener = new ODOMChangeListener() {
                        // javadoc inherited
                        public void changed(ODOMObservable node,
                                            ODOMChangeEvent event) {
                            final ODOMObservable source = event.getSource();

                            if (source.getParent() == node) {
                                if (DEVICE_NAME.equals(source.getName())) {
                                    designLabel.setText(getDeviceLayoutName(
                                            (String) event.getNewValue()));
                                    designLabel.pack();
                                }
                            }
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

     */
    public String getText(Object o) {
        checkObject(o);

        String label;
        ODOMObservable oo = (ODOMObservable) o;
        if (config == ODOMLabelProviderConfiguration.JUST_OBSERVABLE) {
            label = getLocalizedName(oo);
        } else {
            label = getAttributesLabel(oo, config);
            if (logger.isDebugEnabled()) {
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

     * GridFormatComposite. All forwarded events originate from
     * @param node  the ODOMElement reporting the change
     * @param event the change event
     */
    public void processEvent(ODOMObservable node, ODOMChangeEvent event) {
        ODOMObservable source = event.getSource();
        if (source instanceof Attribute) {
            handleAttributeEvent(event);
        } else if (source instanceof Element) {
            handleElementEvent(event);
        }
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

         * Change events are received from the grid's element or from any of
         * its decendents. We only process attribute insertions, deletions and
         * updates where the attribute in question belongs directly to the
         * grid's element, hence the checks against the grid's element.
         */
        ODOMObservable source = event.getSource();
        Attribute attr = (Attribute) source;
        ChangeQualifier qualifier = event.getChangeQualifier();
        String attrName = attr.getName();
        ODOMElement element = formatComposite.getElement();

        final String attributeName = source.getName();
        final Object newValue = event.getNewValue();

        boolean attributeDeleted =
                qualifier == ChangeQualifier.HIERARCHY &&
                newValue == null;

        boolean attributeChanged =
                (qualifier == ChangeQualifier.
                ATTRIBUTE_VALUE) &&
                (source.getParent() == element);

        if (attributeDeleted || attributeChanged) {
            if (attributeName.equals(FormatComposite.
                    BACKGROUND_COLOUR_ATTR_NAME)) {
                formatComposite.setBackgroundColor((String) newValue);
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

    private void processChangeEvent
            (ODOMObservable node, ODOMChangeEvent event) {

        // Get the event source and node in typesafe form (we know the node
        // is an element because we only listen on sources)
        final ODOMObservable eventSrc = event.getSource();
        final ODOMElement nodeEle = (ODOMElement)node;

        // Switch on change type
        if (event.getChangeQualifier() == ChangeQualifier.HIERARCHY) {

            // Just delegate to attribute or element hierarchy event handler
            if (eventSrc instanceof ODOMElement) {
                processElementHierarchyEvent(nodeEle, event);
            } else if (eventSrc instanceof ODOMAttribute) {
                processAttribHierarchyEvent(event);
            } else if (eventSrc instanceof ODOMText) {
                processTextHierarchyEvent(event);
            }

        } else if (event.getChangeQualifier() == ChangeQualifier.NAME) {

            // If the source is an element, check whether it's a target;
            // otherwise ensure that target attributes can't change
            if (eventSrc instanceof ODOMElement) {
                if (sourceTargetPairs.isTargetElement((Element)eventSrc)) {
                    proxiedElementsUpdated(ProxyElementDetails.ELEMENT_NAMES);
                }
            } else if (eventSrc instanceof ODOMAttribute) {
                // TODO: throw an IllegalStateException if a target attribute
                // has changed name
            }

        } else if (event.getChangeQualifier() ==
                   ChangeQualifier.ATTRIBUTE_VALUE) {

            // Does the attribute belong to a target, and is its name in the
            // list of supported attributes - if so the proxy elements have
            // been updated in a notifiable way
            if (sourceTargetPairs.isTargetElement(eventSrc.getParent()) &&
                    proxyElementDetails.isAttributeName(eventSrc.getName())) {
                proxiedElementsUpdated(ProxyElementDetails.ATTRIB_VALUES);
            }
        } else if (event.getChangeQualifier() ==
                ChangeQualifier.TEXT) {
            if (sourceTargetPairs.isTargetElement(eventSrc.getParent())) {
                proxiedElementsUpdated(ProxyElementDetails.TEXT_VALUE);
            }
        }
    }
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

        verifyObjectState(new ODOMXPath(text, NAMESPACES), xpath, map);

        // Check using ODOMObservable.
        xpath = "/parent/textExample";
        parent = new Element("parent");
        ODOMObservable node = (ODOMElement) factory.element("textExample");
        parent.addContent((Element) node);
        verifyObjectState(new ODOMXPath(node), xpath, emptyMap);
        verifyObjectState(new ODOMXPath(node, namespacesNull), xpath, emptyMap);
        verifyObjectState(new ODOMXPath(node, NAMESPACES), xpath, map);
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

     * Test the creation of an ODOMXPath when node exists.
     */
    public void testCreateNodeExists() throws Exception {
        // Check when element exists
        ODOMXPath path = new ODOMXPath("cd[2]");
        ODOMObservable result = path.create((ODOMElement) root, factory);
        assertNull("Result should be null", result);

        // Check when attribute exists
        path = new ODOMXPath("cd[2]/@country");
        result = path.create((ODOMElement) root, factory);
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

    public void testCreateElementMultiStep() throws Exception {
        ODOMElement context = (ODOMElement) factory.element("root");
        ODOMXPath path = new ODOMXPath("a/b");

        // Test creation of whole path from empty context
        ODOMObservable newNode = path.create(context, factory);

        assertTrue("New node not an element (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Element);

        assertEquals("Created element path not as",
                     "/root/a/b",
                     new ODOMXPath(newNode).getExternalForm());

        // Test creation of single additional step
        path = new ODOMXPath(path, "c");

        newNode = path.create(context, factory);

        assertTrue("New node not an element (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Element);

        assertEquals("Created element path not as",
                     "/root/a/b/c",
                     new ODOMXPath(newNode).getExternalForm());
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

    public void testCreateAttributeMultiStep() throws Exception {
        ODOMElement context = (ODOMElement) factory.element("root");
        ODOMXPath path = new ODOMXPath("a/@b");

        // Test creation of whole path from empty context
        ODOMObservable newNode = path.create(context, factory);

        assertTrue("New node not an attribute (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Attribute);

        assertEquals("Created attribute path not as",
                     "/root/a/@b",
                     new ODOMXPath(newNode).getExternalForm());

        // Test creation of single additional step
        path = new ODOMXPath("a/@c");

        newNode = path.create(context, factory);

        assertTrue("New node not an attribute (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Attribute);

        assertEquals("Created attribute path not as",
                     "/root/a/@c",
                     new ODOMXPath(newNode).getExternalForm());
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.ODOMObservable

    public void testCreateTextMultiStep() throws Exception {
        ODOMElement context = (ODOMElement) factory.element("root");
        ODOMXPath path = new ODOMXPath("a/b/text()");

        // Test creation of whole path from empty context
        ODOMObservable newNode = path.create(context, factory);

        assertTrue("New node not text (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Text);

        assertEquals("Created text path not as",
                     "/root/a/b/text()",
                     new ODOMXPath(newNode).getExternalForm());

        // Test creation of single additional step
        path = new ODOMXPath("a/text()");

        newNode = path.create(context, factory);

        assertTrue("New node not text (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Text);

        assertEquals("Created text path not as",
                     "/root/a/text()",
                     new ODOMXPath(newNode).getExternalForm());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.