Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.ShortcutProperties


                }

                MenuRenderer renderer =
                        rendererSelector.selectMenuRenderer(menu);

                final ShortcutProperties shortcutProperties =
                        menu.getShortcutProperties();
                if (null != shortcutProperties) {
                    // If the device cannot support mixed content in the body
                    // of a link, then update the shortcut properties so that
                    // span elements will not be used.
                    String supportsMixedContent = pageContext.
                            getDevicePolicyValue(DevicePolicyConstants.
                                    X_ELEMENT_A_SUPPORTS_MIXED_CONTENT);
                    if (DevicePolicyConstants.NO_SUPPORT_POLICY_VALUE.equals
                            (supportsMixedContent)) {
                        shortcutProperties.setSupportsSpan(false);
                    }

                    // If the device inserts line breaks before links, then
                    // shortcuts must appear in the active area or the layout
                    // will be incorrect (regardless of the value specified in
                    // the styles).
                    String insertsLineBreaks = pageContext.getDevicePolicyValue(
                            DevicePolicyConstants.X_ELEMENT_A_BREAKS_LINE);
                    if ("before".equals(insertsLineBreaks)) {
                        shortcutProperties.setActive(true);
                    }
                }

                // Process the menu
                renderer.render(menu);
View Full Code Here


                StyleList content = (StyleList) propertyValues.
                        getComputedValue(StylePropertyDetails.CONTENT);

                // if we have a specified seperator then create a ShortcutProperties
                // object and configure it.
                ShortcutProperties shortcutProps = new ShortcutProperties();
                if (content != null) {

                    shortcutProps.setSeparatorStyleValue(content);
                }
                builder.setShortcutProperties(shortcutProps);
            }
        }
    }
View Full Code Here

                    String shortcutTextValue =
                            shortcutValue.getText(TextEncoding.PLAIN);

                    if (shortcutTextValue != null) {
                        // this is never null.
                        ShortcutProperties shortcutProps =
                                menu.getShortcutProperties();

                        ElementDetails elementDetails = menu.getElementDetails();

                        if (elementDetails != null) {

                            SpanAttributes attributes = new SpanAttributes();
                            // Should only render out a surrounding span
                            // element if the device supports it.
                            if (shortcutProps.supportsSpan()) {
                                // Create span attributes from the menu's
                                // attributes. There are two mechanisms used
                                // here to support real css and the css
                                // emulation provided by MCS.  The style class
                                // VE-... is used for devices that support css
                                // and the css renderers need to ensure they
                                // generate appropriate style rules.  The
                                // pseudo element is used by those protocols
                                // that work through css emulation.
                                attributes.setId(elementDetails.getId());

                                // Need to explicitly set the display to inline
                                // (even though the shortcut should use the
                                // menu styles, we know display should always
                                // be inline in this case).
                                final Styles styles =
                                        elementDetails.getStyles().copy();
                                styles.getPropertyValues().setSpecifiedValue(
                                        StylePropertyDetails.DISPLAY,
                                        StyleKeywords.INLINE);

                                // The tag name and style class are
                                // conditionally added into the attributes
                                // because CSS emulation requires the tag name
                                // but no descendent selector in order to work
                                // correctly while real CSS supporting protocols
                                // would create too many style classes on the
                                // shortcut if the tag is specified and would
                                // not generate the required markup without the
                                // style class.
                                if (customisation.supportsStyleSheets()) {
                                    attributes.setTagName(null);
                                    attributes.setStyles(styles);
                                } else {
                                    attributes.setTagName(
                                            elementDetails.getElementName());
                                    attributes.setStyles(styles);
                                }

                                span.openSpan(domBuffer, attributes);
                            }

                            // We explicitly tell MCS not to discard whitespace
                            // in this element, just in case the separator
                            // starts or ends with whitespace (this may be a
                            // work-around for an actual bug in whitespace
                            // handling in the output buffers, but that isn't
                            // clear at the moment).
                            domBuffer.setElementIsPreFormatted(true);

                            domBuffer.writeText(shortcutTextValue);

                            inserter.insertPreservingExistingContent(
                                    domBuffer.getCurrentElement(),
                                    shortcutProps.getSeparatorStyleValue());

                            if (shortcutProps.supportsSpan()) {
                                span.closeSpan(domBuffer, attributes);
                            }
                        }
                    }
                }
View Full Code Here

                getElementDetails().getStyles().getPropertyValues();

        // shortcut properties should never be null but if it is then
        // create a default one.
        if (shortcutProperties == null) {
            shortcutProperties = new ShortcutProperties();


            if (propertyValues != null) {
                StyleValue activeStyle = propertyValues.
                        getComputedValue(StylePropertyDetails.
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.ShortcutProperties

Copyright © 2018 www.massapicom. 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.