Package org.apache.slide.projector.descriptor

Examples of org.apache.slide.projector.descriptor.ParameterDescriptor


    public void configure(StreamableValue config) throws ConfigurationException {
        super.configure(config);
        parameterDescriptors = new ParameterDescriptor[parameterDescriptions.size()];
        int counter = 0;
        for ( Iterator i = parameterDescriptions.iterator(); i.hasNext(); ) {
            ParameterDescriptor entryDescriptor = (ParameterDescriptor)i.next();
            if ( entryDescriptor.getName() == FRAGMENT ) {
                parameterDescriptors[counter] = entryDescriptor;
            } else {
                parameterDescriptors[counter] = new ParameterDescriptor(entryDescriptor.getName(), new ParameterMessage("templateArrayRenderer/parameter"), new ArrayValueDescriptor(entryDescriptor.getValueDescriptor()));
            }
            counter++;
        }
    }
View Full Code Here


    public void configure(StreamableValue config) throws ConfigurationException {
        super.configure(config);
        MapValueDescriptor mapValueDescriptor = new MapValueDescriptor();
        List parameterDescriptorList = new ArrayList();
        for ( Iterator i = parameterDescriptions.iterator(); i.hasNext(); ) {
            ParameterDescriptor entryDescriptor = (ParameterDescriptor)i.next();
            // add all map parameters to optional parameters
            if ( entryDescriptor.getName() == FRAGMENT ) {
                parameterDescriptorList.add(entryDescriptor);
            } else {
                if ( entryDescriptor.isRequired() ) {
                    mapValueDescriptor.addEntryDescriptor(new ParameterDescriptor(entryDescriptor.getName(), new ParameterMessage("templateMapRenderer/mapEntry"), entryDescriptor.getValueDescriptor()));
                } else {
                    mapValueDescriptor.addEntryDescriptor(new ParameterDescriptor(entryDescriptor.getName(), new ParameterMessage("templateMapRenderer/mapEntry"), entryDescriptor.getValueDescriptor(), entryDescriptor.getDefaultValue() ));
                    parameterDescriptorList.add(new ParameterDescriptor(entryDescriptor.getName(), entryDescriptor.getDescription(), entryDescriptor.getValueDescriptor(), NullValue.NULL));
                }
            }
        }
        parameterDescriptorList.add(new ParameterDescriptor(SimpleProcessor.INPUT, new ParameterMessage("templateMapRenderer/input"), mapValueDescriptor));
        parameterDescriptors = (ParameterDescriptor[])parameterDescriptorList.toArray(new ParameterDescriptor[parameterDescriptorList.size()]);
    }
View Full Code Here

                    if ( !requiredFragmentDefined ) {
                        throw new ConfigurationException(new ErrorMessage("templateRenderer/requiredFragmentMissing", new String[] { requiredFragments[i] }));
                    }
                }
            }
            parameterDescriptions.add(new ParameterDescriptor(FRAGMENT, new ParameterMessage("templateRenderer/fragment"), new StringValueDescriptor((String [])templates.keySet().toArray(new String[0])), new StringValue(DEFAULT_FRAGMENT)));
            if ( fragments ) {
                if ( requiredFragments != null ) {
                    templates.put(DEFAULT_FRAGMENT, templates.get(requiredFragments[0]));
                } else if ( optionalFragments != null ) {
                    templates.put(DEFAULT_FRAGMENT, templates.get(optionalFragments[0]));
View Full Code Here

        super.configure(config);
        ParameterDescriptor []parentParameterDescriptors = super.getParameterDescriptors();
        // remove fragment parameter
        List parameterDescriptorList = new ArrayList();
        for ( int i = 0; i < parentParameterDescriptors.length; i++ ) {
            ParameterDescriptor descriptor = parentParameterDescriptors[i];
            if ( descriptor.getName() != FRAGMENT ) {
              if ( descriptor.getName().equals(SimpleProcessor.INPUT) ) {
                // check if entry descriptor is caused by repeated fragments
                List entryDescriptors = ((MapValueDescriptor)descriptor.getValueDescriptor()).getEntryDescriptors();
                for ( Iterator j = entryDescriptors.iterator(); j.hasNext(); ) {
                  ParameterDescriptor entryDescriptor = (ParameterDescriptor)j.next();
                    if ( !repeatedParameterDescriptor(entryDescriptor) ) {
                      parameterDescriptorList.add(entryDescriptor);
                      j.remove();
                        }
                }
                parameterDescriptorList.add(new ParameterDescriptor(SimpleProcessor.INPUT, new ParameterMessage("tableMapRenderer/input"), new ArrayValueDescriptor(parentParameterDescriptors[i].getValueDescriptor())));
              } else {
                parameterDescriptorList.add(descriptor);
              }
            }
        }
        parameterDescriptorList.add(new ParameterDescriptor(OFFSET, new ParameterMessage("tableRenderer/offset"), new NumberValueDescriptor(), new NumberValue(new Integer(0))));
        parameterDescriptorList.add(new ParameterDescriptor(ITEMS_PER_PAGE, new ParameterMessage("tableRenderer/length"), new NumberValueDescriptor(), new NumberValue(new Integer(-10))));
        parameterDescriptorList.add(new ParameterDescriptor(TableHandler.ID, new ParameterMessage("tableRenderer/id"), new StringValueDescriptor(), new StringValue("table")));
        parameterDescriptorList.add(new ParameterDescriptor(TableHandler.STORE, new ParameterMessage("tableRenderer/store"), new StringValueDescriptor(Store.stores), new StringValue(Store.stores[Store.SESSION])));
        parameterDescriptorList.add(new ParameterDescriptor(TableHandler.SORTED_BY, new ParameterMessage("tableHandler/sortedBy"), new StringValueDescriptor(), NullValue.NULL));
        parameterDescriptorList.add(new ParameterDescriptor(TableHandler.ORDER, new ParameterMessage("tableHandler/order"), new StringValueDescriptor(new String[] {TableHandler.ASCENDING, TableHandler.DESCENDING}), NullValue.NULL));
        parameterDescriptors = (ParameterDescriptor[] )parameterDescriptorList.toArray(new ParameterDescriptor[parameterDescriptorList.size()]);
       
        headerTemplate = getOptionalFragment(HEADER_FRAGMENT);
        footerTemplate = getOptionalFragment(FOOTER_FRAGMENT);
        firstTemplate = getOptionalFragment(FIRST_FRAGMENT);
View Full Code Here

        return new Result(LOGIN_OK);
    }

    public ParameterDescriptor[] getParameterDescriptors() {
        return new ParameterDescriptor[] {
            new ParameterDescriptor(USERNAME, new ParameterMessage("login/user"), new StringValueDescriptor(1,20)),
            new ParameterDescriptor(PASSWORD, new ParameterMessage("login/password"), new StringValueDescriptor(4,12)),
        };
    }
View Full Code Here

                        compiledTemplate.addNestedTemplateFragment(new Variable(variableName, resourceValueDescriptor.getAllowedContentTypes(), required));
                    } else {
//                        resourceValueDescriptor.addAllowedContentType(ContentType.ANY_TEXT);
                        compiledTemplate.addNestedTemplateFragment(new Variable(variableName, required));
                    }
                    ParameterDescriptor parameterDescriptor;
                    if ( required ) {
                        parameterDescriptor = new ParameterDescriptor(variableName, new ParameterMessage("templateVariable", new String[] { variableName }), resourceValueDescriptor);
                    } else {
                        parameterDescriptor = new ParameterDescriptor(variableName, new ParameterMessage("templateVariable", new String[] { variableName }), resourceValueDescriptor, new NullValue());
                    }
                    if ( !parameterDescriptions.contains(parameterDescriptor) ) {
                      parameterDescriptions.add(parameterDescriptor);
                    }
                    templateParameterDescriptors.put(variableName, parameterDescriptor);
View Full Code Here

        if ( throwable.getCause() != null ) appendNestedDetails(details, throwable.getCause(), locale);
    }

    public ParameterDescriptor[] getParameterDescriptors() {
        return new ParameterDescriptor[]{
            new ParameterDescriptor(EXCEPTION, new ParameterMessage("exceptionRenderer/exception"), new AnyValueDescriptor()),
            new ParameterDescriptor(LOCALE, new ParameterMessage("exceptionRenderer/locale"), new LocaleValueDescriptor(), new LocaleValue(Locale.getDefault()))
        };
    }
View Full Code Here

                                            REQUIRED_VALID_CONTROL+getName(), REQUIRED_INVALID_CONTROL+getName(), REQUIRED_VALID_CONTROL+getName()+ENTRY_POSTFIX, REQUIRED_INVALID_CONTROL+getName()+ENTRY_POSTFIX,
                                            REQUIRED_VALID_CONTROL+getName()+SELECTED_ENTRY_POSTFIX, REQUIRED_INVALID_CONTROL+getName()+SELECTED_ENTRY_POSTFIX});
    }

    public Result process(Map parameter, Context context) throws Exception {
        ParameterDescriptor parameterDescriptor = getParameterDescriptor(parameter, context);
        String state = parameter.get(STATE).toString();
        Object value = parameter.get(VALUE);
        String[] options = getOptions(parameterDescriptor.getValueDescriptor());
        StringBuffer renderedEntries = new StringBuffer();
        Template template = optionalEntryFragment;
        for (int j = 0; j < options.length; j++) {
            if (valueMatches(options[j], value)) {
                if ( state.equals(OPTIONAL_CONTROL) ) {
View Full Code Here

                parameterDescriptors[counter] = parentParameterDescriptors[i];
                counter++;
            }
        }
        parameterDescriptors[parentParameterDescriptors.length - 1] =
                new ParameterDescriptor(ACTION, new ParameterMessage("control/action"), new URIValueDescriptor());
        parameterDescriptors[parentParameterDescriptors.length ] =
                new ParameterDescriptor(PARAMETER, new ParameterMessage("control/parameter"), new URIValueDescriptor());
        parameterDescriptors[parentParameterDescriptors.length + 1] =
                new ParameterDescriptor(VALUE, new ParameterMessage("control/value"), new AnyValueDescriptor(), new NullValue());
        parameterDescriptors[parentParameterDescriptors.length + 2] =
                new ParameterDescriptor(STATE, new ParameterMessage("control/state"), new StringValueDescriptor(new String[] {OPTIONAL_VALID_CONTROL, OPTIONAL_INVALID_CONTROL, OPTIONAL_CONTROL, REQUIRED_CONTROL, REQUIRED_VALID_CONTROL, REQUIRED_INVALID_CONTROL}), new StringValue(OPTIONAL));

        try {
            optionalFragment = getRequiredFragment(OPTIONAL_CONTROL + getName());
            requiredFragment = getRequiredFragment(REQUIRED_CONTROL + getName());
        } catch ( ProcessException exception ) {
View Full Code Here

    static ParameterDescriptor getParameterDescriptor(Map parameter, Context context) throws ProcessException {
        URI actionUri = (URIValue)parameter.get(ACTION);
        Processor action = ProcessorManager.getInstance().getProcessor(actionUri);
        String parameterName = parameter.get(PARAMETER).toString();
        ParameterDescriptor parameterDescriptor = ProcessorHelper.getParameterDescriptor(action, parameterName);
        if ( parameterDescriptor == null ) throw new ProcessException(new ErrorMessage("control/actionParameterNotFound", new Object[] { parameterName, actionUri }));
        return parameterDescriptor;
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.descriptor.ParameterDescriptor

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.