Package org.openbp.core.model

Examples of org.openbp.core.model.Model


   */
  public void showBrowser()
  {
    // Try to get the current model from the edited object
    Object o = getObject();
    final Model model = (o instanceof ModelObject) ? ((ModelObject) o).getOwningModel() : null;

    // Initialize the item selection dialog
    final ItemSelectionDialog dlg = new ItemSelectionDialog(ApplicationUtil.getActiveWindow(), true);
    dlg.setTitle(title);

    // We may select a single object only
    dlg.setSelectionMode(ItemTree.SELECTION_SINGLE);
    dlg.setShowGroups(false);

    // Determine the types of displayed and selectable objects from the editor parameters
    String [] supportedItemTypes = null;
    String [] selectableItemTypes = null;
    Class [] supportedObjectClasses = null;
    Class [] selectableObjectClasses = null;

    if (itemType != null)
    {
      if (supportedItemTypeList == null)
      {
        supportedItemTypeList = new ArrayList();
        supportedItemTypeList.add(ItemTypes.MODEL);
        if (!itemType.equals(ItemTypes.MODEL))
        {
          supportedItemTypeList.add(itemType);
        }
      }

      if (selectableItemTypeList == null)
      {
        selectableItemTypeList = new ArrayList();
        selectableItemTypeList.add(itemType);
      }
    }

    if (supportedItemTypeList != null)
      supportedItemTypes = CollectionUtil.toStringArray(supportedItemTypeList);
    if (selectableItemTypeList != null)
      selectableItemTypes = CollectionUtil.toStringArray(selectableItemTypeList);
    if (supportedObjectClassList != null)
      supportedObjectClasses = (Class []) CollectionUtil.toArray(supportedObjectClassList, Class.class);
    if (selectableObjectClassList != null)
      selectableObjectClasses = (Class []) CollectionUtil.toArray(selectableObjectClassList, Class.class);

    dlg.setSupportedItemTypes(supportedItemTypes);
    dlg.setSelectableItemTypes(selectableItemTypes);
    dlg.setSupportedObjectClasses(supportedObjectClasses);
    dlg.setSelectableObjectClasses(selectableObjectClasses);

    // Determine the current object from the value of the property (i. e. the object name)
    String objectRef = (String) value;
    ModelObject object = null;

    if (objectRef != null && itemType != null)
    {
      try
      {
        if (model != null)
        {
          object = model.resolveObjectRef(objectRef, itemType);
        }
        else
        {
          ModelQualifier qualifier = new ModelQualifier(objectRef);
          qualifier.setItemType(itemType);
          object = ModelConnector.getInstance().getItemByQualifier(qualifier, false);
        }
      }
      catch (ModelException e)
      {
      }
    }

    ItemTreeState state = new ItemTreeState();

    Model currentModel = null;
    if (object != null)
    {
      // Open the current object
      currentModel = object.getOwningModel();
    }
    else
    {
      // Open the current model
      if (model != null)
      {
        currentModel = model;
      }

      if (openSystemModel)
      {
        // Open the System model
        currentModel = ModelConnector.getInstance().getModelByQualifier(CoreConstants.SYSTEM_MODEL_QUALIFIER);
      }
    }
    if (currentModel != null)
    {
      state.addExpandedQualifier(currentModel.getQualifier());
    }

    // Select the previously selected initial nodes if present
    if (object != null)
    {
      state.addSelectedQualifier(object.getQualifier());
    }
    else if (objectRef != null)
    {
      state.addSelectedQualifier(new ModelQualifier(objectRef));
    }
    else
    {
      if (currentModel != null)
      {
        state.addSelectedQualifier(currentModel.getQualifier());
      }
    }

    // Instantiate the customizer class
    if (customizer == null && customizerClassName != null)
View Full Code Here


    {
      if (propertyName.equals("Name"))
      {
        ComplexTypeItem type = (ComplexTypeItem) editedObject;

        Model model = type.getModel();
        if (model != null)
        {
          // ClassName = model.defaultPackage + ".data." + name
          // If there is an implementation class name specified...
          String oldName = type.getName();
View Full Code Here

   * @return The model
   * @throws OpenBPException If the specified model does not exist
   */
  public Model getModelByQualifier(ModelQualifier modelQualifier)
  {
    Model ret = null;
    for (int i = 0; i < mgrs.length; ++i)
    {
      ret = mgrs[i].internalGetModelByQualifier(modelQualifier);
      if (ret != null)
        break;
View Full Code Here

   * @param modelQualifier Reference to the model
   * @return The model or null
   */
  public Model getOptionalModelByQualifier(ModelQualifier modelQualifier)
  {
    Model ret = null;
    for (int i = 0; i < mgrs.length; ++i)
    {
      ret = mgrs[i].internalGetModelByQualifier(modelQualifier);
      if (ret != null)
        break;
View Full Code Here

    if (qualifier.getModel() == null)
      throw new ModelException("Operation", "Missing model name");
    if (qualifier.getItem() == null)
      throw new ModelException("Operation", "Missing component name");

    Model model = getModelByQualifier(ModelQualifier.constructModelQualifier(qualifier.getModel()));
    return model.getItem(qualifier.getItem(), qualifier.getItemType(), required);
  }
View Full Code Here

    else
    {
      // Reset all model class loaders only
      for (Iterator it = getModels().iterator(); it.hasNext();)
      {
        Model model = (Model) it.next();
        model.resetModel();
      }
    }

    // Initialize the models
    for (int i = 0; i < mgrs.length; ++i)
View Full Code Here

    {
      if (propertyName.equals("Name"))
      {
        JavaActivityItem activity = (JavaActivityItem) editedObject;

        Model model = activity.getModel();
        if (model != null)
        {
          // If there is an implementation class name specified...
          String oldName = activity.getName();
          String oldClassName = activity.getHandlerDefinition().getHandlerClassName();
View Full Code Here

    {
      itItems = ModelConnector.getInstance().getModels().iterator();
    }
    else
    {
      Model model = ((ModelObject) o).getOwningModel();
      itItems = model.getItems(null);
    }

    while (itItems.hasNext())
    {
      Item item = (Item) itItems.next();
View Full Code Here

TOP

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

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.