Package org.openbp.core.model

Examples of org.openbp.core.model.ModelObject


          dlg.setVisible(true);

          List selection = dlg.getSelectedObjects();
          if (selection != null)
          {
            ModelObject selectedObject = (ModelObject) selection.get(0);
            assignPlaceholderReference(selectedObject);
          }
        }

        return true;
View Full Code Here


      if (data.isDataFlavorSupported(ClientFlavors.PROCESS_ITEM)
        || data.isDataFlavorSupported(ClientFlavors.NODE))
      {
        // This is a placeholder node;
        // dragging a process or process node to the node means creating a reference to it.
        ModelObject mo = (ModelObject) data.getTransferData(StandardFlavors.OBJECT);
        assignPlaceholderReference(mo);
        getDrawing().getEditor().focusPlugin();
        return true;
      }
      else if (data.isDataFlavorSupported(ClientFlavors.MODEL_QUALIFIER))
View Full Code Here

        contextModelObject = (Item) ie.getSafeTransferData(ClientFlavors.ITEM);
      }
      else
      {
        // Use only model objects that have an underlying item.
        ModelObject core = (ModelObject) ie.getSafeTransferData(ClientFlavors.MODEL_OBJECT);
        extractModelObject(core);
      }

      if (contextModelObject != null)
      {
View Full Code Here

   * @return The new handler
   */
  public Object createHandler(HandlerDefinition hd)
  {
    String handlerClassName = hd.getHandlerClassName();
    ModelObject owner = hd.getOwner();

    Object instance = null;
    if (handlerClassName != null)
    {
      try
      {
        // Use the model's class loader to load it
        ClassLoader cl = owner.getOwningModel().getClassLoader();
        instance = ReflectUtil.instantiate(handlerClassName, cl, null, "handler implementation");
      }
      catch (ReflectException e)
      {
        owner.getModelMgr().getMsgContainer().addMsg(owner, "Error instantiating handler $0.", new Object[]
        {
          owner.getQualifier(), e
        });
      }
      catch (Exception e)
      {
        // Catch any exceptions, so the server won't be confused by errors in handers
        owner.getModelMgr().getMsgContainer().addMsg(owner, "The handler class $0 could not be initialized.", new Object[]
        {
          handlerClassName, e
        });
      }
      catch (NoClassDefFoundError e)
      {
        // Catch any exceptions, so the server won't be confused by errors in handers
        owner.getModelMgr().getMsgContainer().addMsg(owner, "Error instantiating handler $0: No class definition found", new Object[]
        {
          owner.getQualifier(), e
        });
      }
    }
    return instance;
  }
View Full Code Here

      // not just a ProcessObject (the WorkspaceDrawingView will show the underlying activity
      // in the property browser if the node was clicked instead of the activity node)
      if (!(oee.original instanceof ModelObject))
        return EVENT_IGNORED;

      ModelObject orig = (ModelObject) oee.original;

      try
      {
        orig.copyFrom(oee.getObject(), ModelObject.COPY_SHALLOW);
      }
      catch (CloneNotSupportedException e)
      {
        ExceptionUtil.printTrace(e);
        return EVENT_CONSUMED;
      }

      // Make sure all subordinate objects refer to this object
      orig.maintainReferences(0);

      drawing.updateFigure();
      drawing.invalidate();
      workspaceView.checkDamage();
View Full Code Here

          if (transferable.isDataFlavorSupported(ClientFlavors.MODEL_OBJECT))
          {
            try
            {
              ModelObject mo = (ModelObject) transferable.getTransferData(ClientFlavors.MODEL_OBJECT);

              List associations = mo.getAssociations();
              if (associations != null)
              {
                int n = associations.size();
                for (int i = 0; i < n; ++i)
                {
View Full Code Here

      {
        Transferable transferable = (Transferable) o;

        if (transferable.isDataFlavorSupported(ClientFlavors.MODEL_OBJECT))
        {
          ModelObject mo = null;
          try
          {
            mo = (ModelObject) transferable.getTransferData(ClientFlavors.MODEL_OBJECT);
          }
          catch (IOException e)
          {
            return EVENT_IGNORED;
          }
          catch (UnsupportedFlavorException e)
          {
            // Does not happen
            return EVENT_IGNORED;
          }

          if (mo != null)
          {
            List associations = mo.getAssociations();
            if (associations != null)
            {
              int n = associations.size();
              for (int i = 0; i < n; ++i)
              {
                Association assoc = (Association) associations.get(i);
                if (assoc.getAssociationPriority() == priority)
                {
                 
                  JaspiraEventHandlerCode ret = doOpen(assoc, !mo.isModifiable(), event);
                  if (ret != EventModule.EVENT_IGNORED)
                    return ret;
                }
              }
            }
View Full Code Here

      {
        // We do not display an 'Open' menu in the item editor.
        return EVENT_IGNORED;
      }

      ModelObject mo = (ModelObject) ie.getSafeTransferData(ClientFlavors.MODEL_OBJECT);

      List associations = mo.getAssociations();
      if (associations != null)
      {
        JaspiraAction group = new JaspiraAction(AssociationPlugin.this, "submenu.open");

        int n = associations.size();
        for (int iAssoc = 0; iAssoc < n; ++iAssoc)
        {
          Association association = (Association) associations.get(iAssoc);

          String hintMsg = null;
          OpenEventInfo [] openEventInfo = null;

          if (association.getAssociatedObject() == null)
          {
            // Association present, but no associated object.
            // The association contains a hint message, e. g. "Object has not yet been generated"
            hintMsg = association.getHintMsg();
          }
          else
          {
            // Check the mime types supported by this object
            String [] types = association.getAssociationTypes();
            if (types == null || types.length == 0)
            {
              hintMsg = getPluginResourceCollection().getRequiredString("messages.hints.noassociation");
            }
            else
            {
              // Now check if any plugin is able to open this kind of MIME type
              // The association manager will broadcast the plugin.association.supports event in order
              // to determine the open event name that can be used to open the object of the association
              openEventInfo = determineOpenEvents(types, AssociationPlugin.this);

              if (openEventInfo == null)
              {
                hintMsg = getPluginResourceCollection().getRequiredString("messages.hints.wrongassociation");
              }
            }
          }

          if (openEventInfo != null)
          {
            // We are able to open this object.
            // Create an open action for each open event information
            for (int iEvent = 0; iEvent < openEventInfo.length; ++iEvent)
            {
              OpenAction openAction = new OpenAction(association, openEventInfo [iEvent], !mo.isModifiable());
              openAction.setPriority(iAssoc * 10 + iEvent);
              group.addMenuChild(openAction);
            }
          }
          else
View Full Code Here

  {
    if (! (editedObject instanceof ModelObject))
      // 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
    if (! displayMsgContainer())
      return false;
View Full Code Here

   * @param editedObject Edited object that contains the property
   * @param pb Property browser that edits the object
   */
  public static void checkNameUniqueness(ModelObject editedObject, PropertyBrowser pb)
  {
    ModelObject object = (ModelObject) pb.getObject();
    ModelObject originalObject = (ModelObject) pb.getOriginalObject();

    Iterator it = object.getContainerIterator();
    if (it == null)
      // Object is not contained in a collection
      return;

    String name = editedObject.getName();

    while (it.hasNext())
    {
      ModelObject element = (ModelObject) it.next();

      if (element == editedObject || element == object || element == originalObject)
      {
        // Do not consider ourself or the original or the reference object of the object we are editing
        continue;
      }

      if (name.equals(element.getName()))
      {
        element.getModelMgr().getMsgContainer().addMsg(editedObject, "An element having this name already exists.");
        return;
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.openbp.core.model.ModelObject

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.