Package org.apache.wicket

Examples of org.apache.wicket.Component$ComponentModelChange


   */
  final static DragSource read(Page page, Request request)
  {
    String path = request.getRequestParameters().getParameterValue("source").toString();

    Component component = page.get(path);

    if (component != null)
    {
      for (Behavior behavior : component.getBehaviors())
      {
        if (behavior instanceof DragSource)
        {
          return (DragSource)behavior;
        }
View Full Code Here


    final NestedTree<Foo> tree = new DefaultNestedTree<Foo>("tree", provider)
    {
      @Override
      protected Component newContentComponent(String arg0, IModel<Foo> arg1)
      {
        Component component = super.newContentComponent(arg0, arg1);
        component.setOutputMarkupId(true);
        return component;
      }
    };
    tree.add(new DragSource()
    {
View Full Code Here

    {
        super(id, model, metaData, viewOnly);
       
        type = metaData.getPropertyType();
        boolean displayTz = false;
        Component metaDataComponent = metaData.getBeanMetaData().getComponent();
        Localizer localizer = metaDataComponent.getLocalizer();
        if (Time.class.isAssignableFrom(type) ||
            java.sql.Date.class.isAssignableFrom(type) ||
            Date.class.isAssignableFrom(type) ||
            Timestamp.class.isAssignableFrom(type)) {
            fmt = localizer.getString(DATE_TIME_FIELD_PREFIX + "date" + FORMAT_SUFFIX, metaDataComponent, DATE_FMT_STR);
View Full Code Here

    {
        super(id, model, metaData, viewOnly);
       
        type = metaData.getPropertyType();
        boolean displayTz = false;
        Component metaDataComponent = metaData.getBeanMetaData().getComponent();
        Localizer localizer = metaDataComponent.getLocalizer();
        if (Time.class.isAssignableFrom(type)) {
            fmt = localizer.getString(DATE_TIME_FIELD_PREFIX + "time" + FORMAT_SUFFIX, metaDataComponent, TIME_FMT_STR);
        }
        else if (java.sql.Date.class.isAssignableFrom(type)) {
            fmt = localizer.getString(DATE_TIME_FIELD_PREFIX + "date" + FORMAT_SUFFIX, metaDataComponent, DATE_FMT_STR);
View Full Code Here

        String namePath = firstRowPath + ":c:0:c";
        String nameFieldPath = namePath + ":c";
       
        tester.assertLabel(namePath + ":l", "Name");
        tester.assertComponent(nameFieldPath, InputField.class);
        Component nameField = tester.getComponentFromLastRenderedPage(nameFieldPath);

        String serialNumPath = firstRowPath + ":c:1:c";
        String serialNumFieldPath = serialNumPath + ":c";
        tester.assertLabel(serialNumPath + ":l", "Serial Number");
        tester.assertComponent(serialNumFieldPath, InputField.class);
        Component serialNumField = tester.getComponentFromLastRenderedPage(serialNumFieldPath);
       
        // Check attaching/detaching component's model (BeanPropertyModel).
        BeanPropertyModel nameFieldModel = (BeanPropertyModel) nameField.getDefaultModel();
       
        assertFalse(nestedModel.isAttached());
View Full Code Here

            String rowPath = tablePath + ":" + i;
            tester.assertComponent(rowPath, OddEvenItem.class);

            String firstCellPath = rowPath + ":cells:1:cell";
            tester.assertComponent(firstCellPath, InputField.class);
            Component nameField = tester.getComponentFromLastRenderedPage(firstCellPath);
            assertEquals(beans[i - 1].getName(), nameField.getDefaultModel().getObject());

            String secondCellPath = rowPath + ":cells:2:cell";
            tester.assertComponent(secondCellPath, InputField.class);
            Component serailNumField = tester.getComponentFromLastRenderedPage(secondCellPath);
            assertEquals(beans[i - 1].getSerialNumber(), serailNumField.getDefaultModel().getObject());
        }
    }
View Full Code Here

            try {
                Class<?> componentClass = Class.forName(componentClassName);
                Constructor<?> xtor = componentClass.getConstructor(constructorArgs);
               
                IModel model = new BeanPropertyModel(bean, propertyMeta);
                Component component = (Component)xtor.newInstance( new Object[] { wicketId, model, propertyMeta, viewOnly } );
                associateLabelToFormComponents(propertyMeta, component);
                return component;
            }
            catch (ClassNotFoundException e) {
                throw new RuntimeException("Component class not found", e);
View Full Code Here

    {
        if (bean instanceof IModel) {
            bean = ((IModel)bean).getObject();
        }
       
        Component component = element.getBeanMetaData().getComponent();
        String methodName = element.getActionMethodName();
       
        try {
            // Try first to find a bean-specific method.
            Method method;
            try {
                method = component.getClass().getMethod(methodName, new Class[] { AjaxRequestTarget.class, Form.class, bean.getClass() } );
            }
            catch (Exception e) {
                // Ignore and try generic parameters.
                method = component.getClass().getMethod(methodName, GENERIC_ACTION_PARAMS);
            }
           
            method.invoke(component, new Object[] { target, form, bean });
        }
        catch (NoSuchMethodException e) {
            throw new RuntimeException("Action method " + methodName + "(AjaxRequestTarget, Form, " + bean.getClass().getName() + "/Object) is not defined in " + component.getClass());
        }
        catch (IllegalAccessException e) {
            throw new RuntimeException("Action method " + methodName + " defined in " + component.getClass() + " must be declared public");
        }
        catch (InvocationTargetException e) {
            throw new RuntimeException("Error invoking action " + methodName + " defined in " + component.getClass(), e.getCause());
        }
    }
View Full Code Here

        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") );
            }
View Full Code Here

     * @return the Component used to render the label. If a label image was specified, this is the
     *  image, otherwise a plain-text label.
     */
    public Component getLabelComponent(String wicketId)
    {
        Component component;
        if (getLabelImage() == null) {
            component = new Label(wicketId, getLabel());
        }
        else {
            component = new ImageLabel(wicketId, getBeanMetaData().getComponent().getClass(), getLabelImage(), getLabel());
        }
       
        if (isRequired()) {
            component.add( new AttributeAppender("class", new Model<String>(CSS_REQUIRED_FIELD_CLASS), " ") );
        }
       
        return component;
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.Component$ComponentModelChange

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.