Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.ComponentParameter


            if (children.item(i) instanceof Element) {
                Element childElement = (Element) children.item(i);
                if (PARAMETER.equals(childElement.getNodeName())) {
                    String key = childElement.getAttribute(KEY);
                    if (key != null && !EMPTY.equals(key)) {
                        parametersList.add(new ComponentParameter(key));
                    } else {
                        parametersList.add(createConstantParameter(container.getPico(), childElement));
                    }
                }
            }
View Full Code Here


                    if (dependencyKey == null || "".equals(dependencyKey)) {
                        dependencyClass = ((Element) child).getAttribute(CLASS);
                        if (dependencyClass == null || "".equals(dependencyClass)) {
                            throw new NanoContainerMarkupException("either key or class must be present for dependency");
                        } else {
                            parameters.add(new ComponentParameter(getClassLoader().loadClass(dependencyClass)));
                        }
                    } else {
                        parameters.add(new ComponentParameter(dependencyKey));
                    }
                }
            }
        }
View Full Code Here

  public ComponentRegistry() {
    MutablePicoContainer container = new DefaultPicoContainer();
    this.container = container;

    ComponentParameter anyComponentParameter = new ComponentParameter();

    // non-GUI
    Config globalConfig = Config.getConfig();
    container.registerComponentInstance(globalConfig);
    container.registerComponentInstance(globalConfig.getPreferences());
    container.registerComponentInstance(globalConfig.forScanner());
    container.registerComponentInstance(globalConfig.forGUI());
    container.registerComponentInstance(globalConfig.forOpeners());
    container.registerComponentInstance(globalConfig.forFavorites());
    container.registerComponentInstance(Labels.getInstance());
    container.registerComponentImplementation(CommentsConfig.class);
    container.registerComponentImplementation(ConfigDetector.class);

    container.registerComponentImplementation(ExporterRegistry.class);
    container.registerComponentImplementation(TXTExporter.class);
    container.registerComponentImplementation(CSVExporter.class);
    container.registerComponentImplementation(XMLExporter.class);
    container.registerComponentImplementation(IPListExporter.class);

    container.registerComponentImplementation(FetcherRegistry.class, FetcherRegistry.class);
    container.registerComponentImplementation(IPFetcher.class);
    container.registerComponentImplementation(PingFetcher.class);
    container.registerComponentImplementation(PingTTLFetcher.class);
    container.registerComponentImplementation(HostnameFetcher.class);
    container.registerComponentImplementation(PortsFetcher.class);
    container.registerComponentImplementation(FilteredPortsFetcher.class);
    container.registerComponentImplementation(WebDetectFetcher.class);
    container.registerComponentImplementation(HTTPSenderFetcher.class);
    container.registerComponentImplementation(CommentFetcher.class);
    container.registerComponentImplementation(NetBIOSInfoFetcher.class);
    if (Platform.WINDOWS) container.registerComponentImplementation(WinMACFetcher.class);
    else container.registerComponentImplementation(UnixMACFetcher.class);
    container.registerComponentImplementation(MACVendorFetcher.class);

    container.registerComponentImplementation(PingerRegistry.class, PingerRegistry.class);
    container.registerComponentImplementation(ScanningResultList.class);
    container.registerComponentImplementation(Scanner.class);
    container.registerComponentImplementation(SWTAwareStateMachine.class);
    container.registerComponentImplementation(ScannerDispatcherThreadFactory.class);
    container.registerComponentImplementation(CommandLineProcessor.class);

    // GUI follows (TODO: move GUI to a separate place)

    // 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);

    container.registerComponentImplementation(AboutDialog.class);
    container.registerComponentImplementation(PreferencesDialog.class);
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.ComponentParameter

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.