Package org.jamesii.core

Examples of org.jamesii.core.Registry


  /**
   * Constructor
   */
  public FormalismListModel() {
    Registry registry = SimSystem.getRegistry();

    List<ModelFactory> factories = null;

    factories =
        registry.getFactoryOrEmptyList(AbstractModelFactory.class, null);

    Collections.sort(factories, new Comparator<ModelFactory>() {

      @Override
      public int compare(ModelFactory o1, ModelFactory o2) {
View Full Code Here


  /**
   * Constructor
   */
  public ExperimentTypeListModel() {
    Registry registry = SimSystem.getRegistry();

    List<ExperimentSetupEditorFactory> factories = null;

    factories =
        registry.getFactoryOrEmptyList(
            AbstractExperimentSetupEditorFactory.class, null);

    final Map<String, ExperimentSetupEditorFactory> experimentEditorFactories =
        new HashMap<>();

View Full Code Here

  @SuppressWarnings("unchecked")
  // The registry does not ensure that getAbstractFactory(...) will
  // actually return an abstract factory for type T
  public <T extends Factory<?>> T getSubAlgoByParams(ParameterBlock params,
      Class<T> baseFactory) {
    Registry reg = SimSystem.getRegistry();
    Class<? extends AbstractFactory<?>> abstFac =
        reg.getAbstractFactoryForBaseFactory(baseFactory);
    return reg.getFactory((Class<? extends AbstractFactory<T>>) abstFac,
        getSubAlgoParams(params, baseFactory));
  }
View Full Code Here

    public PlugInTreeModel() {
      super(new DefaultMutableTreeNode(
          "<html><b>Installed PlugIn types and PlugIns</b></html>"), true);
      root = (DefaultMutableTreeNode) getRoot();

      Registry registry = SimSystem.getRegistry();

      namePTDmapping = new HashMap<>();

      List<Class<? extends Factory<?>>> factories =
          registry.getKnownFactoryClasses();

      for (Class<? extends Factory<?>> c : factories) {
        Class<? extends AbstractFactory<?>> af =
            registry.getAbstractFactoryForBaseFactory(c);

        if (af != null) {
          IPluginTypeData ptd = registry.getPluginType(af);

          if (namePTDmapping.containsKey(ptd.getId().getName())) {
            continue;
          }

          namePTDmapping.put(ptd.getId().getName(), ptd);

          DefaultMutableTreeNode node;
          root.add(node =
              new DefaultMutableTreeNode(String.format(
                  "<html><b>%s</b> <i>(%s)</i></html>", ptd.getId().getName(),
                  ptd.getDescription())));

          List<IPluginData> plugins = registry.getPlugins(af);

          if (plugins != null && plugins.size() > 0) {
            for (IPluginData pd : plugins) {
              DefaultMutableTreeNode node2;
              node.add(node2 = new DefaultMutableTreeNode(pd));
View Full Code Here

  /**
   * Test get registry.
   */
  public void testGetRegistry() {
    Registry r = SimSystem.getRegistry();
    assertTrue("Cannot get registry", r != null);
    Registry r2 = SimSystem.getRegistry();
    assertTrue(r == r2);
  }
View Full Code Here

  /**
   * Test set registry.
   */
  public void testSetRegistry() {

    Registry r = SimSystem.getRegistry();

    Registry r2 = null;

    SimSystem.setRegistry(r2);

    assertEquals(SimSystem.getRegistry(), r);

    r2 = new Registry();
    SimSystem.setRegistry(r2);

    assertEquals(SimSystem.getRegistry(), r);

  }
View Full Code Here

   * <code>synchronized</code> (i.e. a monitor is acquired) but only has to be
   * called once at start-up.
   */
  protected static synchronized void createRegistry() {
    if (registry == null) {
      initializeAndSetRegistry(new Registry());
    }
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    if (reg != null) {
      return;
    }
    reg = new Registry();
    reg.init();
  }
View Full Code Here

   * @return the j panel
   */
  JPanel setupPluginVariable(IVariable<?> expVar) {
    JPanel editPluginVarPanel = new JPanel();

    Registry registry = SimSystem.getRegistry();

    JPanel pluginTypePanel = new JPanel();
    JLabel pluginTypeLabel = new JLabel("Variable based on plugin type: ");
    JComboBox pluginCombo = new JComboBox();

    for (Class<? extends Factory<?>> c : registry.getKnownFactoryClasses()) {
      Class<? extends AbstractFactory<?>> af =
          registry.getAbstractFactoryForBaseFactory(c);
      if (af != null) {
        IPluginTypeData ptd = registry.getPluginType(af);
        // namePTDmapping.put(ptd.getIds().getName(), ptd);
        pluginCombo.addItem(ptd.getId().getName());
      } else {
        pluginCombo.addItem("Error! No AbstractFactory found for " + c);
      }
View Full Code Here

  protected void prepopulatePage(IWizard wizard) {
    // get model
    model = wizard.getValue(FormalismChooser.MODEL);

    // find editors for model TODO use automatic factory filter here
    Registry registry = SimSystem.getRegistry();

    List<ModelParameterSetupWindowFactory> factories =
        registry.getFactories(ModelParameterSetupWindowFactory.class);

    if (factories == null) {
      BasicUtilities.invokeLaterOnEDT(new Runnable() {

        @Override
View Full Code Here

TOP

Related Classes of org.jamesii.core.Registry

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.