Package org.auraframework.instance

Examples of org.auraframework.instance.AttributeSet


        return config;
    }
   
    static void removeAttribute(BaseComponent<?,?> component, String name) throws QuickFixException {
        if (component != null) {
            AttributeSet componentAttributes = component.getAttributes();
            if (componentAttributes.getValue(name) != null) {
                Iterator<Attribute> iterator = componentAttributes.iterator();
                while (iterator.hasNext()) {
                    Attribute attribute = iterator.next();
                    if (attribute.getName().equalsIgnoreCase(name)) {
                        iterator.remove();
                        break;
View Full Code Here


@Provider
public class InputOptionProvider implements ComponentConfigProvider {
    @Override
    public ComponentConfig provide() throws QuickFixException {
        BaseComponent<?, ?> component = Aura.getContextService().getCurrentContext().getCurrentComponent();
        AttributeSet attributes = component.getAttributes();
        ComponentConfig componentConfig = new ComponentConfig();
        DefDescriptor<ComponentDef> defDescriptor = DefDescriptorImpl.getInstance(COMPONENT_UI_OUTPUTTEXT,
                ComponentDef.class);

        String type = (String) attributes.getValue("type");
        if (TYPE_UI_INPUTCHECKBOX.equalsIgnoreCase(type)) {
            defDescriptor = DefDescriptorImpl.getInstance(COMPONENT_UI_INPUTCHECKBOX, ComponentDef.class);
        } else if (TYPE_UI_INPUTRADI.equalsIgnoreCase(type)) {
            defDescriptor = DefDescriptorImpl.getInstance(COMPONENT_UI_INPUTRADIO, ComponentDef.class);
        } else if (TYPE_UI_INPUTSELECTOPTION.equalsIgnoreCase(type)) {
View Full Code Here

    @Override
    public void render(BaseComponent<?, ?> component, Appendable appendable)
            throws IOException, QuickFixException {

        AttributeSet attributes = component.getAttributes();

        String name = (String) attributes.getValue("name");
        Number defaultExpiration = (Number) attributes.getValue("defaultExpiration");
        Number defaultAutoRefreshInterval = (Number) attributes.getValue("defaultAutoRefreshInterval");
        Number maxSize = (Number) attributes.getValue("maxSize");
        Boolean clearStorageOnInit = (Boolean) attributes.getValue("clearStorageOnInit");
        Boolean debugLoggingEnabled = (Boolean) attributes.getValue("debugLoggingEnabled");
        Boolean persistent = (Boolean) attributes.getValue("persistent");
        Boolean secure = (Boolean) attributes.getValue("secure");

        appendable.append("<script>\n");

        String script = String.format(
                "$A.storageService.initStorage('%s', %s, %s, %d, %d, %d, %s, %s);\n",
                name, persistent, secure, maxSize.longValue() * 1024, defaultExpiration, defaultAutoRefreshInterval,
                debugLoggingEnabled, clearStorageOnInit);

        Boolean onlyUseStorageIfRequested = (Boolean) attributes.getValue("requireUseStorageQueryParam");
        if (onlyUseStorageIfRequested != null && onlyUseStorageIfRequested) {
            script = wrapInTestForRequireUseStorageQueryParam(script);
        }

        appendable.append(script);
View Full Code Here

        InstanceStack iStack = context.getInstanceStack();
        Map<String, Object> m = Maps.newHashMapWithExpectedSize(1);
        m.put("body", components);
        cc.setAttributes(m);

        AttributeSet atts = component.getAttributes();
        Iterable<?> value = atts.getValue("items", Iterable.class);
        if (value != null) {
            List<?> items = Lists.newArrayList(value);
            if (!items.isEmpty()) {
                String var = atts.getValue("var", String.class);
                String indexVar = atts.getValue("indexVar", String.class);

                int realstart = 0;
                int realend = items.size();

                ComponentDefRefArrayImpl template = atts.getValue("body", ComponentDefRefArrayImpl.class);
                m.put("template",template);
                Integer start = getIntValue(atts.getValue("start"));
                Integer end = getIntValue(atts.getValue("end"));
                if (start == null && end == null) {
                    // int page = (Integer)atts.getValue("page");
                    // int pageSize = (Integer)atts.getValue("pageSize");
                } else {
                    if (start != null && start > realstart) {
                        realstart = start;
                    }

                    if (end != null && end < realend) {
                        realend = end;
                    }
                }

                // boolean reverse = (Boolean)atts.getValue("reverse");
                iStack.setAttributeName("body");
                for (int i = realstart; i < realend; i++) {
                    iStack.setAttributeIndex(i);
                    iStack.pushInstance(component, component.getDescriptor());
                    iStack.setAttributeName("body");
                    Map<String, Object> providers = Maps.newHashMap();
                    providers.put(var, items.get(i));
                    if (indexVar != null) {
                        providers.put(indexVar, i);
                    }
                    components.addAll(template.newInstance(atts.getValueProvider(), providers));
                    iStack.clearAttributeName("body");
                    iStack.popInstance(component);
                    iStack.clearAttributeIndex(i);
                }
                iStack.clearAttributeName("body");
View Full Code Here

        List<Component> components = new ArrayList<Component>();
        Map<String, Object> m = Maps.newHashMapWithExpectedSize(1);
        m.put("body", components);
        cc.setAttributes(m);

        AttributeSet atts = component.getAttributes();
        m.put("template", atts.getValue("body"));
        Object o = atts.getValue("isTrue");
        Boolean isTrue = (Boolean) o;
        ComponentDefRefArrayImpl facet;
        // get body facet if true, else facet if false
        if (isTrue != null && isTrue.booleanValue()) {
            facet = (ComponentDefRefArrayImpl) atts.getValue("body");
        } else {
            facet = (ComponentDefRefArrayImpl) atts.getValue("else");
        }
        if (facet != null) {
            iStack.setAttributeName("body");
            components.addAll(facet.newInstance(atts.getValueProvider()));
            iStack.clearAttributeName("body");
        }
        return cc;
    }
View Full Code Here

        assertEquals("some other value", cmp.getModel().getValue(propRef));
    }

  private void setAttribute(Component cmp, String name, String value) throws QuickFixException {
    AttributeDefRef adr = vendor.makeAttributeDefRef(name, value, new Location("meh", 0));
        AttributeSet attributes = cmp.getAttributes();
    attributes.set(Collections.singleton(adr));
  }
View Full Code Here

TOP

Related Classes of org.auraframework.instance.AttributeSet

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.