Package ca.nengo.ui.models.nodes.widgets

Examples of ca.nengo.ui.models.nodes.widgets.UIOrigin


        LinkedList<UIProjection> projectionsToRemove = new LinkedList<UIProjection>();

        for (UINeoNode nodeUI : getUINodes()) {
            for (UITermination terminationUI : nodeUI.getVisibleTerminations()) {
                if (terminationUI.getConnector() != null) {
                    UIOrigin originUI = terminationUI.getConnector().getOriginUI();

                    Termination termination = terminationUI.getModel();
                    Origin origin = originUI.getModel();

                    Projection projection = projectionMap.get(termination);
                    if (projection != null && projection.getOrigin() == origin) {
                        /*
                         * Projection already exists
                         */
                        projectionsToAdd.remove(projectionMap.get(termination));

                    } else {
                        projectionsToRemove.add(terminationUI.getConnector());
                    }
                }
            }
        }

        /*
         * Destroy unreferenced projections
         */
        for (UIProjection projectionUI : projectionsToRemove) {
            UITermination terminationUI = projectionUI.getTermination();

            projectionUI.destroy();
            if (!isFirstUpdate) {
                terminationUI.showPopupMessage("REMOVED Projection to "
                        + terminationUI.getNodeParent().getName() + "." + terminationUI.getName());
            }
        }

        /*
         * Construct projections
         */
        for (Projection projection : projectionsToAdd) {
            Origin origin = projection.getOrigin();
            Termination term = projection.getTermination();

            UINeoNode nodeOrigin = getUINode(origin.getNode());

            UINeoNode nodeTerm = getUINode(term.getNode());

            if (nodeOrigin != null && nodeTerm != null) {
                UIOrigin originUI = nodeOrigin.showOrigin(origin.getName());
                UITermination termUI = nodeTerm.showTermination(term.getName());

                originUI.connectTo(termUI, false);
                if (!isFirstUpdate) {
                    termUI.showPopupMessage("NEW Projection to " + termUI.getName() + "."
                            + getName());
                }
            } else {
View Full Code Here


  public void showAllOrigins() {

    Origin[] origins = getModel().getOrigins();

    for (Origin element : origins) {
      UIOrigin originUI = showOrigin(element.getName());
      originUI.setWidgetVisible(true);
    }
    layoutChildren();
  }
View Full Code Here

    Origin[] origins = getModel().getOrigins();

    for (Origin element : origins) {
      if (element instanceof DecodedOrigin) {
        UIOrigin originUI = showOrigin(element.getName());
        originUI.setWidgetVisible(true);
      }
    }
    layoutChildren();
  }
View Full Code Here

   *            Name of an Origin on the Node model
   * @return the POrigin shown
   */
  public UIOrigin showOrigin(String originName) {

    UIOrigin originUI;

    // Try to find if the origin has already been created
    originUI = (UIOrigin) getChild(originName, UIOrigin.class);
    if (originUI == null) {
      // try to create it
      try {
        Origin originModel = getModel().getOrigin(originName);
        if (originModel != null) {
          originUI = UIOrigin.createOriginUI(this, originModel);
          addWidget(originUI);
        } else {
          Util.Assert(false, "Could not find origin: " + originName);
        }

      } catch (StructuralException e) {
        UserMessages.showError(e.toString());
      }
    }

    if (originUI != null) {
      originUI.setWidgetVisible(true);
    }
    return originUI;

  }
View Full Code Here

   *            Name of an Origin on the Node model
   * @return the POrigin hidden
   */
  public UIOrigin hideOrigin(String originName) {

    UIOrigin originUI;

    originUI = (UIOrigin) getChild(originName, UIOrigin.class);

    if (originUI != null) {
      originUI.setWidgetVisible(false);
    }
    return originUI;

  }
View Full Code Here

    try {

      Origin origin = (Origin) ModelFactory.constructModel(this, new CDecodedOrigin(
          getModel()));
      UIOrigin originUI = UIOrigin.createOriginUI(this, origin);

      addWidget(originUI);
      showPopupMessage("New decoded ORIGIN added");
      setModelBusy(false);
View Full Code Here

      super("Add decoded origin", null, false);
    }

    @Override
    protected void action() throws ActionException {
      UIOrigin origin = addDecodedOrigin();

      if (origin != null) {
        addedOrigin = origin;
      } else {
        throw new UserCancelledException();
View Full Code Here

TOP

Related Classes of ca.nengo.ui.models.nodes.widgets.UIOrigin

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.