Package com.googlecode.wicketwebbeans.model

Examples of com.googlecode.wicketwebbeans.model.ElementMetaData


     * @param parameterName the parameter name on metaData. The value of this parameter should be the property name to lookup.
     * @param propertyClass the class type the property should resolve to
     * @return ElementMetaData
     */
    protected ElementMetaData getDependentProperty(ElementMetaData metaData, String parameterName, Class propertyClass) {
        ElementMetaData property = null;
        String propStr = metaData.getParameter(parameterName);
        if (propStr != null) {
            property = metaData.getBeanMetaData().findElement(propStr);
            if (property == null) {
                throw new RuntimeException("'" + propStr + "' is not defined on " + metaData.getBeanMetaData().getBeanClass());
            }

            if (!propertyClass.isAssignableFrom( property.getPropertyType() )) {
                throw new RuntimeException(parameterName + "'" + propStr + "' must return a " + propertyClass.getName() + " on "
                                + metaData.getBeanMetaData().getBeanClass() + ". Instead it returns "
                                + property.getPropertyType());
            }
        }
        return property;
    }
View Full Code Here


            super(id, model);
        }

        protected void populateItem(ListItem item)
        {
            ElementMetaData element = (ElementMetaData) item.getModelObject();
            int colspan = element.getIntParameter(PARAM_COLSPAN, 1);
           
            Component component;
            if (element.isAction()) {
                Form form = findParent(Form.class);
                component = new BeanActionButton("c", element, form, bean);
                item.add( new SimpleAttributeModifier("class", "beanActionButtonCell") );
            }
            else {
                component = beanMetaData.getComponentRegistry().getComponent(bean, "c", element);
                if (!(component instanceof UnlabeledField) && showLabels) {
                    component = new LabeledField("c", element.getLabelComponent("l"), component);
                }
            }

            beanMetaData.applyCss(bean, element, component);
View Full Code Here

            super(id, model);
        }

        protected void populateItem(ListItem item)
        {
            ElementMetaData element = (ElementMetaData)item.getModelObject();
           
            if (element.isAction()) {
                Form form = findParent(Form.class);
                item.add( new SimpleAttributeModifier("class", "beanActionButtonCell") );
                item.add( new Label("l", "") );
                item.add( new BeanActionButton("c", element, form, bean) );
            }
            else {
                item.add(showLabels ? element.getLabelComponent("l") : new Label("l", ""));
                item.add( beanMetaData.getComponentRegistry().getComponent(bean, "c", element) );
            }

            beanMetaData.applyCss(bean, element, item);
        }
View Full Code Here

                                lastSortParam == null || // Haven't sorted yet.
                                !lastSortParam.getProperty().equals(sortParam.getProperty()) || // Sort params changed.
                                lastSortParam.isAscending() != sortParam.isAscending()) {

                    lastSortParam = new SortParam(sortParam.getProperty(), sortParam.isAscending());
                    ElementMetaData property = metaData.findElement(sortParam.getProperty());
                    Collections.sort(list, new PropertyComparator(property, sortParam.isAscending()));
                }
            }

            return list.subList(first, first + count).iterator();
View Full Code Here

        List<ElementMetaData> globalActions = beanMetaData.getGlobalActions();
        form.addOrReplace(new ListView<ElementMetaData>("actions", globalActions) {
            private static final long serialVersionUID = 1L;
            protected void populateItem(ListItem item)
            {
                ElementMetaData element = (ElementMetaData)item.getModelObject();
                item.add( new BeanActionButton("action", element, form, bean) );
            }
        });
    }
View Full Code Here

                public Object component(Component component)
                {
                    Object model = component.getDefaultModel();
                    if (model instanceof BeanPropertyModel) {
                        BeanPropertyModel propModel = (BeanPropertyModel)model;
                        ElementMetaData componentMetaData = propModel.getElementMetaData();
                        for (ComponentPropertyMapping mapping : refreshComponents) {
                            if (mapping.elementMetaData == componentMetaData) {
                                refreshComponent(target, component);
                                break;
                            }
View Full Code Here

TOP

Related Classes of com.googlecode.wicketwebbeans.model.ElementMetaData

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.