Examples of ComponentFactory


Examples of com.cburch.logisim.comp.ComponentFactory

    }
    if (toReplace != null) {
      CircuitMutation xn = new CircuitMutation(circuit);
      for (Component comp : toReplace) {
        xn.remove(comp);
        ComponentFactory factory = compMap.get(comp.getFactory());
        if (factory != null) {
          AttributeSet newAttrs = createAttributes(factory, comp.getAttributeSet());
          xn.add(factory.createComponent(comp.getLocation(), newAttrs));
        }
      }
      xn.execute();
    }
  }
View Full Code Here

Examples of com.cburch.logisim.comp.ComponentFactory

        throw new XmlReaderException(Strings.get("compUnknownError", name));
      } else {
        throw new XmlReaderException(Strings.get("compAbsentError", name, libName));
      }
    }
    ComponentFactory source = ((AddTool) tool).getFactory();

    // Determine attributes
    String loc_str = elt.getAttribute("loc");
    AttributeSet attrs = source.createAttributeSet();
    reader.initAttributeSet(elt, attrs, source);

    // Create component if location known
    if (loc_str == null || loc_str.equals("")) {
      throw new XmlReaderException(Strings.get("compLocMissingError", source.getName()));
    } else {
      try {
        Location loc = Location.parse(loc_str);
        return source.createComponent(loc, attrs);
      } catch (NumberFormatException e) {
        throw new XmlReaderException(Strings.get("compLocInvalidError",
          source.getName(), loc_str));
      }
    }
  }
View Full Code Here

Examples of com.cburch.logisim.comp.ComponentFactory

      if (inputs.size() <= 2) {
        for (CircuitDetermination a : inputs) {
          a.convertToTwoInputs();
        }
      } else {
        ComponentFactory subFactory;
        if (factory == NorGate.FACTORY) subFactory = OrGate.FACTORY;
        else if (factory == NandGate.FACTORY) subFactory = AndGate.FACTORY;
        else subFactory = factory;
         
        int split = (inputs.size() + 1) / 2;
View Full Code Here

Examples of com.cburch.logisim.comp.ComponentFactory

      if (num > GateAttributes.MAX_INPUTS) {
        int newNum = (num + GateAttributes.MAX_INPUTS - 1) / GateAttributes.MAX_INPUTS;
        ArrayList<CircuitDetermination> oldInputs = inputs;
        inputs = new ArrayList<CircuitDetermination>();
       
        ComponentFactory subFactory = factory;
        if (subFactory == NandGate.FACTORY) subFactory = AndGate.FACTORY;
        if (subFactory == NorGate.FACTORY) subFactory = OrGate.FACTORY;
       
        int per = num / newNum;
        int numExtra = num - per * newNum;
 
View Full Code Here

Examples of com.jgoodies.forms.factories.ComponentFactory

     * @see ComponentFactory2
     *
     * @since 1.3
     */
    public final JLabel addROLabel(String textWithMnemonic, CellConstraints constraints) {
        ComponentFactory factory = getComponentFactory();
        ComponentFactory2 factory2;
        if (factory instanceof ComponentFactory2) {
            factory2 = (ComponentFactory2) factory;
        } else {
            factory2 = DefaultComponentFactory.getInstance();
View Full Code Here

Examples of com.qspin.qtaste.kernel.testapi.ComponentFactory

                Collection<String> hashComponents = testAPI.getRegisteredComponents();
                TreeSet<String> sortedComponents = new TreeSet<String>(hashComponents);
                TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
                for (String componentName: sortedComponents) {
                    boolean componentPresentInTestbed = true;
                    ComponentFactory componentFactory = testAPI.getComponentFactory(componentName);
                    if (componentFactory instanceof SingletonComponentFactory) {
                        componentPresentInTestbed = !testbedConfig.configurationsAt("singleton_components." + componentName).isEmpty();
                    } else if (componentFactory instanceof MultipleInstancesComponentFactory) {
                        componentPresentInTestbed = !testbedConfig.configurationsAt("multiple_instances_components." + componentName).isEmpty();
                    }
View Full Code Here

Examples of com.sun.jsftemplating.component.factory.ComponentFactory

     *
     *  @return The new {@link ComponentFactory}.
     */
    protected ComponentFactory createFactory() {
  // Create it...
  ComponentFactory factory = null;
  try {
      Class cls = Util.loadClass(_factoryClass, this);
      factory = (ComponentFactory) cls.newInstance();
  } catch (ClassNotFoundException ex) {
      throw new RuntimeException(ex);
  } catch (InstantiationException ex) {
      throw new RuntimeException(ex);
  } catch (IllegalAccessException ex) {
      throw new RuntimeException(ex);
  }

  // Set the extraInfo if any...
  if (_extraInfo != null) {
      factory.setExtraInfo(_extraInfo);
  }

  // Return the new ComponentFactory
  return factory;
    }
View Full Code Here

Examples of fitnesse.ComponentFactory

  private static FitNesseContext loadContext(Arguments arguments)
      throws Exception {
    Builder builder = new Builder();
    WikiPageFactory wikiPageFactory = new WikiPageFactory();
    ComponentFactory componentFactory = new ComponentFactory(
        arguments.getRootPath());

    builder.port = arguments.getPort();
    builder.rootPath = arguments.getRootPath();
    builder.rootDirectoryName = arguments.getRootDirectory();

    builder.pageTheme = componentFactory
        .getProperty(ComponentFactory.THEME);
    builder.defaultNewPageContent = componentFactory
        .getProperty(ComponentFactory.DEFAULT_NEWPAGE_CONTENT);

    builder.root = wikiPageFactory.makeRootPage(builder.rootPath,
        builder.rootDirectoryName, componentFactory);

    builder.logger = makeLogger(arguments);
    builder.authenticator = makeAuthenticator(arguments.getUserpass(),
        componentFactory);

    FitNesseContext context = builder.createFitNesseContext();

    extraOutput = componentFactory.loadPlugins(context.responderFactory,
        wikiPageFactory);
    extraOutput += componentFactory.loadWikiPage(wikiPageFactory);
    extraOutput += componentFactory
        .loadResponders(context.responderFactory);
    extraOutput += componentFactory.loadSymbolTypes();
    extraOutput += componentFactory.loadContentFilter();
    extraOutput += componentFactory.loadSlimTables();

    WikiImportTestEventListener.register();

    return context;
  }
View Full Code Here

Examples of fitnesse.components.ComponentFactory

  @Test
  public void canCreateVersionsControllerThroughComponentFactory() {
    Properties properties = new Properties();
    properties.put("VersionsController", "fitnesse.wiki.fs.SimpleFileVersionsController");
    ComponentFactory componentFactory = new ComponentFactory(properties);
    Object versionsController = componentFactory.createComponent("VersionsController", null);

    assertThat(versionsController, instanceOf(SimpleFileVersionsController.class));
  }
View Full Code Here

Examples of javax.webbeans.ComponentFactory

      key = pair.getKey();
    }

    if (key instanceof Class) {
      Class clazz = (Class) key;
      ComponentFactory component = null;

      if (log.isLoggable(Level.FINE))
        log.fine("Creating new instance from " + clazz);

      synchronized (_componentMap) {
        component = _componentMap.get(clazz);

        if (component == null) {
          component = _webBeans.resolveByType(clazz);

          if (component == null)
            component = _webBeans.createTransient(clazz);

          _componentMap.put(clazz, component);
        }
      }

      return component.get();
    }
    else if (key instanceof String) {
      ComponentFactory component = _webBeans.findByName((String) key);

      if (component == null) {
        throw new ObjectNotFoundException(L.l("Cannot find component with name '{0}'", key));
      }

      return component.get();
    }
    else {
      throw new ObjectNotFoundException(L.l("Component keys of type {0} are not understood", key.getClass().getName()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.