Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.ConstantParameter


    }



    private Parameter toParameter(Object obj) {
        return obj instanceof Parameter ? (Parameter) obj : new ConstantParameter(obj);
    }
View Full Code Here


    private ComponentAdapter registerComponentImplementation(String[] parameterTypesAsString, String[] parameterValuesAsString, Object key, Class componentImplementation) throws ClassNotFoundException {
        Parameter[] parameters = new Parameter[parameterTypesAsString.length];
        for (int i = 0; i < parameters.length; i++) {
            Object value = BeanPropertyComponentAdapter.convert(parameterTypesAsString[i], parameterValuesAsString[i], getComponentClassLoader());
            parameters[i] = new ConstantParameter(value);
        }
        return picoContainer.registerComponentImplementation(key, componentImplementation, parameters);
    }
View Full Code Here

 
  private ContainerPopulator createContainerPopulator(Reader reader, MutablePicoContainer parent)
            throws ClassNotFoundException {
        NanoContainer nano = new DefaultNanoContainer(getClassLoader());
        Parameter[] parameters = new Parameter[] {
                new ConstantParameter(reader),
                new ConstantParameter(getClassLoader()) };
        nano.registerComponentImplementation(containerBuilderClassName,
                containerBuilderClassName, parameters);
        ContainerBuilder containerBuilder = (ContainerBuilder) nano
                .getPico().getComponentInstance(containerBuilderClassName);
        ObjectReference parentRef = new SimpleReference();
View Full Code Here

            ScriptedContainerBuilderFactory scriptedContainerBuilderFactory = new ScriptedContainerBuilderFactory(scriptReader, builderClassName, Thread.currentThread().getContextClassLoader());
            picoConfiguration = buildContainer(scriptedContainerBuilderFactory.getContainerBuilder());
        }
        ComponentAdapter componentAdapter = null;
        if ( picoConfiguration != null ){
            Parameter[] parameters = new Parameter[]{ new ConstantParameter(picoConfiguration) };
            componentAdapter = nanoContainer.registerComponentImplementation(containerComposerClassName, containerComposerClassName, parameters);
        } else {
            componentAdapter = nanoContainer.registerComponentImplementation(containerComposerClassName);           
        }
        return (ContainerComposer) componentAdapter.getComponentInstance(nanoContainer.getPico());       
View Full Code Here

     */
    private ContainerPopulator createContainerPopulator(String containerBuilderClassName, Reader reader, ClassLoader classLoader)
            throws ClassNotFoundException {
        NanoContainer nano = new DefaultNanoContainer(classLoader);
        Parameter[] parameters = new Parameter[] {
                new ConstantParameter(reader),
                new ConstantParameter(classLoader) };
        nano.registerComponentImplementation(containerBuilderClassName,
                containerBuilderClassName, parameters);
        ContainerBuilder containerBuilder = (ContainerBuilder) nano.getPico()
                .getComponentInstance(containerBuilderClassName);
        //containerBuilder.buildContainer(new SimpleReference(), null, null,
View Full Code Here

    // Some "shared" GUI components
    container.registerComponentInstance(Display.getDefault());
    container.registerComponentImplementation("mainShell", Shell.class);
    container.registerComponentImplementation("mainMenu", Menu.class, new Parameter[] {
        new ComponentParameter("mainShell"), new ConstantParameter(SWT.BAR) });
    container.registerComponentImplementation("commandsMenu", CommandsMenu.class);

    container.registerComponentImplementation("feederArea", Composite.class, new Parameter[] {
        new ComponentParameter("mainShell"), new ConstantParameter(SWT.NONE) });
    container.registerComponentImplementation("controlsArea", Composite.class, new Parameter[] {
        new ComponentParameter("mainShell"), new ConstantParameter(SWT.NONE) });
    container.registerComponentImplementation("startStopButton", Button.class, new Parameter[] {
        new ComponentParameter("controlsArea"), new ConstantParameter(SWT.NONE) });
    container.registerComponentImplementation("feederSelectionCombo", Combo.class,
        new Parameter[] { new ComponentParameter("controlsArea"), new ConstantParameter(SWT.READ_ONLY) });

    // GUI Feeders
    container.registerComponentImplementation(FeederGUIRegistry.class);
    Parameter[] feederGUIParameters = new Parameter[] { new ComponentParameter("feederArea") };
    container.registerComponentImplementation(RangeFeederGUI.class, RangeFeederGUI.class, feederGUIParameters);
    container.registerComponentImplementation(RandomFeederGUI.class, RandomFeederGUI.class, feederGUIParameters);
    container.registerComponentImplementation(FileFeederGUI.class, FileFeederGUI.class, feederGUIParameters);

    container.registerComponentImplementation(OpenerLauncher.class);
    container.registerComponentImplementation(MainWindow.class, MainWindow.class, new Parameter[] {
        new ComponentParameter("mainShell"), anyComponentParameter, new ComponentParameter("feederArea"),
        new ComponentParameter("controlsArea"), new ComponentParameter("feederSelectionCombo"),
        new ComponentParameter("startStopButton"), anyComponentParameter, anyComponentParameter,
        anyComponentParameter, anyComponentParameter, anyComponentParameter, anyComponentParameter,
        anyComponentParameter, anyComponentParameter });
    container.registerComponentImplementation(ResultTable.class, ResultTable.class, new Parameter[] {
        new ComponentParameter("mainShell"), anyComponentParameter, anyComponentParameter,
        anyComponentParameter, anyComponentParameter, anyComponentParameter, anyComponentParameter });
    container.registerComponentImplementation(StatusBar.class, StatusBar.class, new Parameter[] {
        new ComponentParameter("mainShell"), anyComponentParameter, anyComponentParameter, anyComponentParameter, anyComponentParameter });

    container.registerComponentImplementation(MainMenu.class, MainMenu.class, new Parameter[] {
        new ComponentParameter("mainShell"), new ComponentParameter("mainMenu"),
        new ComponentParameter("commandsMenu"), anyComponentParameter, new ConstantParameter(container) });
    container.registerComponentImplementation(MainMenu.ColumnsMenu.class, MainMenu.ColumnsMenu.class,
        new Parameter[] { new ComponentParameter("mainShell"), anyComponentParameter, anyComponentParameter, anyComponentParameter });
    if (Platform.MAC_OS)
      container.registerComponentImplementation(MacApplicationMenu.class);
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.ConstantParameter

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.