Examples of StandardMsgContainer


Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

      // 3. Clone the object
      // 4. Add the cloned object to the dummy process
      // 5. Re-establish the object references (now based on the elements of the dummy process)
      //    If this fails, the object will be removed from the dummy process again.

      StandardMsgContainer msgContainer = ModelConnector.getInstance().getMsgContainer();
      msgContainer.clearMsgs();

      for (FigureEnumeration fe = workspaceView.selectionElements(); fe.hasMoreElements();)
      {
        Figure next = fe.nextFigure();

        if (next instanceof FlowConnection)
        {
          FlowConnection flowConnection = (FlowConnection) next;

          ControlLink link = flowConnection.getControlLink();

          if (! copiedSourceNodes.contains(link.getSourceSocket().getNode())
            || ! copiedSourceNodes.contains(link.getTargetSocket().getNode()))
          {
            // Link source or target has not been copied
            continue;
          }

          flowConnection.encodeGeometry();

          link = (ControlLink) link.clone();
          process.addControlLink(link);

          if (! msgContainer.isEmpty())
          {
            // One of the end points of the link is not present in the copied set,
            // so remove the link from the dummy process again.
            process.removeControlLink(link);
            msgContainer.clearMsgs();
          }
        }

        else if (next instanceof ParamConnection)
        {
          ParamConnection paramConnection = (ParamConnection) next;

          DataLink link = paramConnection.getDataLink();

          Param sourceParam = link.getSourceParam();
          Param targetParam = link.getTargetParam();

          if (sourceParam instanceof NodeParam)
          {
            if (! copiedSourceNodes.contains(((NodeParam) sourceParam).getSocket().getNode()))
            {
              // Link source or target has not been copied
              continue;
            }
          }
          else
          {
            // Don't copy process variable links
            continue;
          }

          if (targetParam instanceof NodeParam)
          {
            if (! copiedSourceNodes.contains(((NodeParam) targetParam).getSocket().getNode()))
            {
              // Link source or target has not been copied
              continue;
            }
          }
          else
          {
            // Don't copy process variable links
            continue;
          }

          paramConnection.encodeGeometry();

          link = (DataLink) link.clone();
          process.addDataLink(link);

          if (! msgContainer.isEmpty())
          {
            // One of the end points of the link is not present in the copied set,
            // so remove the link from the dummy process again.
            process.removeDataLink(link);
            msgContainer.clearMsgs();
          }
        }
      }

      // Re-establish inter-object links and links to other items
View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

   * @param content Content to paste; The transferable object is expected to contain
   * data that was created by the {@link #getCopyData} method.
   */
  public void paste(Transferable content)
  {
    StandardMsgContainer msgContainer = ModelConnector.getInstance().getMsgContainer();
    msgContainer.clearMsgs();

    try
    {
      boolean success = false;

      if (! socketsAndParamsOnly)
      {
        if (! success && content.isDataFlavorSupported(ClientFlavors.MODEL_QUALIFIER))
        {
          // The clipboard contains node socket parameters
          ModelQualifier qualifier = (ModelQualifier) content.getTransferData(ClientFlavors.MODEL_QUALIFIER);
          success = pasteQualifier(qualifier);
        }

        if (! success && content.isDataFlavorSupported(ClientFlavors.PROCESS_ITEM))
        {
          // We need to copy the process from the clipboard, since we are about to modify it.
          ProcessItem source = (ProcessItem) content.getTransferData(ClientFlavors.PROCESS_ITEM);
          success = pasteProcess(source);
        }
      }

      if (! success && content.isDataFlavorSupported(ClientFlavors.NODE_SOCKETS))
      {
        // The clipboard contains node sockets
        ProcessItem source = (ProcessItem) content.getTransferData(ClientFlavors.NODE_SOCKETS);
        success = pasteSockets(source);
      }

      if (! success && content.isDataFlavorSupported(ClientFlavors.NODE_PARAMS))
      {
        // The clipboard contains node socket parameters
        ProcessItem source = (ProcessItem) content.getTransferData(ClientFlavors.NODE_PARAMS);
        success = pasteParams(source);
      }

      workspaceView.repairDamage();

      if (! success)
      {
        String msg = resourceCollection.getRequiredString("messages.paste");
        JMsgBox.show(null, msg, JMsgBox.ICON_INFO);
      }
    }
    catch (CloneNotSupportedException e)
    {
      // Shouldn't happen
      e.printStackTrace();
    }
    catch (UnsupportedFlavorException e)
    {
    }
    catch (IOException e)
    {
    }
    finally
    {
      if (! msgContainer.isEmpty())
      {
        System.err.println(msgContainer.toString());
        msgContainer.clearMsgs();
      }
    }
  }
View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

      try
      {
        settings = (GeneratorSettings) XMLDriver.getInstance().deserializeStream(GeneratorSettings.class, is);

        // Perform post-processing
        StandardMsgContainer msgs = new StandardMsgContainer();
        settings.setModel(item.getModel());
        settings.afterDeserialization(msgs);
        if (!msgs.isEmpty())
        {
          // Report errors that occured during the post-processing
          JMsgBox.show(null, msgs.toString(), JMsgBox.TYPE_OKLATER | JMsgBox.ICON_ERROR);
        }
      }
      catch (XMLDriverException e)
      {
        ExceptionUtil.printTrace(e);
View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

   *    true  The message container is null, does not contain any messages or only warning messages (which have been displayed)
   *    false  The message container contains error messages
   */
  public boolean displayMsgContainer()
  {
    StandardMsgContainer msgContainer = ModelConnector.getInstance().getMsgContainer();

    if (! msgContainer.isEmpty())
    {
      // Show the errors to the user
      boolean ret = true;
      StringBuffer sb = new StringBuffer();

      for (Iterator it = msgContainer.getMsgs(); it.hasNext();)
      {
        MsgItem error = (MsgItem) it.next();

        if (error.getMsgType().equals(LogLevel.ERROR))
        {
          // No warning, so validation failed
          ret = false;
        }

        String errorMsg = error.toString();
        if (sb.length() != 0)
          sb.append("\n");
        sb.append(errorMsg);
      }

      msgContainer.clearMsgs();
      displayErrorMsg(sb.toString());

      return ret;
    }

View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

   */
  public void initialize(CoreModule coreModule)
  {
    modelMgr = coreModule.getModelMgr();

    StandardMsgContainer msgContainer = modelMgr.getMsgContainer();
    msgContainer.clearMsgs();

    // Load all models
    modelMgr.readModels();

    // Initialize the models
    modelMgr.initializeModels();

    // Print any errors to stderr
    String errMsg = msgContainer.toString();
    if (errMsg != null && ! errMsg.equals(""))
    {
      msgContainer.clearMsgs();
      System.err.println(errMsg);
      System.err.println();
    }

    fireEvent(new ModelConnectorEvent(ModelConnectorEvent.MODELS_LOADED));
View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

    // Initialize the models
    getModelMgr().initializeModels();

    // Print any errors to stderr
    StandardMsgContainer msgContainer = getModelMgr().getMsgContainer();
    for (Iterator it = msgContainer.getMsgs(); it.hasNext();)
    {
      MsgItem msgItem = (MsgItem) it.next();
      LogUtil.error(getClass(), msgItem.getFormattedMsgWithSource());
    }
    msgContainer.clearMsgs();

    LogUtil.info(getClass(), "Model load complete.");
  }
View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

  public Object obtainHandlerInstance()
  {
    if (singleInstance != null)
      return singleInstance;

    StandardMsgContainer msgContainer = owner.getModelMgr().getMsgContainer();
    msgContainer.clearMsgs();

    Object handler = createInstance();

    if (! msgContainer.isEmpty())
    {
      String msg = msgContainer.toString();
      LogUtil.error(getClass(), msg);
      throw new OpenBPException("HandlerExecutionFailed", msg);
    }

    return handler;
View Full Code Here

Examples of org.openbp.common.generic.msgcontainer.StandardMsgContainer

      // Just for safety
      return true;

    ModelObject mo = (ModelObject) editedObject;

    StandardMsgContainer msgContainer = ModelConnector.getInstance().getMsgContainer();
    msgContainer.clearMsgs();

    mo.maintainReferences(ModelObject.VALIDATE_BASIC | ModelObject.RESOLVE_GLOBAL_REFS);
    checkNameUniqueness(mo, pb);

    // Print errors and return if any have been found
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.