Package org.apache.isis.viewer.wicket.ui

Examples of org.apache.isis.viewer.wicket.ui.ComponentFactory


     * Allows the subclass to remove any built-in factories.
     */
    protected void removeComponentFactories(final List<ComponentFactory> componentFactories,
        final Class<? extends ComponentFactory>... classes) {
        for (final Iterator<ComponentFactory> iterator = componentFactories.iterator(); iterator.hasNext();) {
            final ComponentFactory componentFactory = iterator.next();
            if (isAssignableToAny(componentFactory, classes)) {
                iterator.remove();
            }
        }
    }
View Full Code Here


        return true;
    }

    @Override
    protected void onSelectionChanged(final ComponentFactory newSelection) {
        final ComponentFactory componentFactory = getModel().getObject();
        if (componentFactory != null) {
            container.addOrReplace(componentFactory.createComponent(underlyingId, underlyingModel));
        }
    }
View Full Code Here

        addUnderlyingViews(underlyingId, model, factory);
    }

    private void addUnderlyingViews(final String underlyingId, final T model, final ComponentFactory factory) {
        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
        final ComponentFactory firstComponentFactory = componentFactories.get(0);
        final Model<ComponentFactory> componentFactoryModel = new Model<ComponentFactory>();
        componentFactoryModel.setObject(firstComponentFactory);

        if (componentFactories.size() > 1) {
            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
            final DropDownChoiceComponentFactory viewsDropDown =
                new DropDownChoiceComponentFactory(ID_VIEWS_DROP_DOWN, componentFactoryModel, componentFactories, this,
                    underlyingId, model);
            views.addOrReplace(viewsDropDown);
            addOrReplace(views);
        } else {
            permanentlyHide(ID_VIEWS);
        }
        addOrReplace(firstComponentFactory.createComponent(underlyingId, model));
    }
View Full Code Here

        final OneToOneAssociation property =
            (OneToOneAssociation) adapter.getSpecification().getAssociation(propertyExpression);
        final PropertyMemento pm = new PropertyMemento(property);
        final ScalarModel scalarModel = model.getPropertyModel(pm);

        final ComponentFactory componentFactory =
            findComponentFactory(ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
        final Component component = componentFactory.createComponent(id, scalarModel);
        if (component instanceof ScalarPanelAbstract) {
            final ScalarPanelAbstract scalarPanel = (ScalarPanelAbstract) component;
            scalarPanel.setFormat(Format.COMPACT);
            scalarModel.toViewMode();
        }
View Full Code Here

    }

    private Component createComponent(final String id, final IModel<ObjectAdapter> rowModel) {
        final ObjectAdapter adapter = rowModel.getObject();
        final IModel<?> model = new EntityModel(adapter);
        final ComponentFactory componentFactory = findComponentFactory(ComponentType.ENTITY_LINK, model);
        return componentFactory.createComponent(id, model);
    }
View Full Code Here

                @Override
                protected void populateItem(ListItem<ComponentFactory> item) {
                   
                    final int underlyingViewNum = item.getIndex();
                   
                    final ComponentFactory componentFactory = item.getModelObject();
                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
                        private static final long serialVersionUID = 1L;
                        @Override
                        public void onClick(AjaxRequestTarget target) {
                           
                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
                                final Component component = underlyingViews[i];
                                T dummyModel = dummyOf(model);
                               
                                if(component != null) {
                                    final boolean isSelected = i == underlyingViewNum;
                                    applyCssVisibility(component, isSelected);
                                    component.setDefaultModel(isSelected? model: dummyModel);
                                }
                            }
                            selectorPanel.selectedComponentFactory = componentFactory;
                            target.add(selectorPanel, views);
                        }
                    };
                    String name = nameFor(componentFactory);
                    Label viewTitleLabel = new Label(ID_VIEW_TITLE, name);
                    viewTitleLabel.add(new CssClassAppender(StringExtensions.asLowerDashed(name)));
                    link.add(viewTitleLabel);
                    item.add(link);
                   
                    link.setEnabled(componentFactory != selectorPanel.selectedComponentFactory);
                }

                private String nameFor(final ComponentFactory componentFactory) {
                    return componentFactory instanceof CollectionContentsAsUnresolvedPanelFactory ? "hide" : componentFactory.getName();
                }
            };
            container.add(listView);
            addOrReplace(views);
        }
View Full Code Here

        return component;
    }

    @Override
    public Component createComponent(final ComponentType componentType, final IModel<?> model) {
        final ComponentFactory componentFactory = findComponentFactoryElseFailFast(componentType, model);
        final Component component = componentFactory.createComponent(model);
        return component;
    }
View Full Code Here

        return component;
    }

    @Override
    public Component createComponent(final ComponentType componentType, final String id, final IModel<?> model) {
        final ComponentFactory componentFactory = findComponentFactoryElseFailFast(componentType, model);
        final Component component = componentFactory.createComponent(id, model);
        return component;
    }
View Full Code Here

        return firstOrNull(componentFactories);
    }

    @Override
    public ComponentFactory findComponentFactoryElseFailFast(final ComponentType componentType, final IModel<?> model) {
        final ComponentFactory componentFactory = findComponentFactory(componentType, model);
        if (componentFactory == null) {
            throw new RuntimeException(String.format("could not find component for componentType = '%s'; model object is of type %s", componentType, model.getClass().getName()));
        }
        return componentFactory;
    }
View Full Code Here

        addOrReplaceIconAndTitle();
        buildEntityActionsGui();
    }

    private void addOrReplaceIconAndTitle() {
        final ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_AND_TITLE, getEntityModel());
        final Component component = componentFactory.createComponent(getEntityModel());
        addOrReplace(component);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.wicket.ui.ComponentFactory

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.