Package org.openbp.core.model

Examples of org.openbp.core.model.ModelObject


    if (!(o instanceof HandlerDefinition))
      return;

    selectionField.addItem(null);

    ModelObject mo = ((HandlerDefinition) o).getOwner();
    String pkg = mo.getOwningModel().getDefaultPackage();
    if (pkg != null)
    {
      String prefix = editor.getParameterParser().getString("prefix");
      String suffix = editor.getParameterParser().getString("suffix");

      StringBuffer className = new StringBuffer(pkg);
      className.append (".");
      if (prefix != null)
      {
        className.append (prefix);
      }
      className.append (mo.getName());
      if (suffix != null)
      {
        className.append (suffix);
      }
View Full Code Here


    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)
    {
      try
      {
        customizer = (ComponentSelectionEditorCustomizer) ReflectUtil.instantiate(customizerClassName, ComponentSelectionEditorCustomizer.class, "component selection editor customizer class");
      }
      catch (Exception e)
      {
        ExceptionUtil.printTrace(e);
      }
    }

    if (customizer != null)
    {
      if (!customizer.initializeDialog(this, dlg))
        return;
    }

    // Build the tree, expanding the first level and the currently selected item
    dlg.rebuildTree();
    dlg.expand(1);
    dlg.restoreState(state);

    dlg.addWindowListener(new WindowAdapter()
    {
      public void windowClosed(WindowEvent we)
      {
        List selection = dlg.getSelectedObjects();
        if (selection != null)
        {
          ModelObject selectedObject = (ModelObject) selection.get(0);

          if (customizer != null)
          {
            if (!customizer.dialogClosed(ComponentSelectionEditor.this, dlg, selectedObject))
              return;
          }

          String objectRef = null;
          if (model != null)
          {
            if (!(selectedObject instanceof ComplexTypeItem))
            {
              objectRef = model.determineObjectRef(selectedObject);
            }
          }

          if (objectRef == null)
          {
            objectRef = selectedObject.getQualifier().toString();
          }

          textField.setText(objectRef);
          textField.requestFocus();
View Full Code Here

    if (rootObjectPropertyPath != null)
    {
      Object o = getObject();
      try
      {
        ModelObject rootObject = (ModelObject) PropertyAccessUtil.getProperty(o, rootObjectPropertyPath);
        dlg.setRootObject(rootObject);
      }
      catch (PropertyException e)
      {
        LogUtil.error(getClass(), "Error accessing property $0 in object of type $1", rootObjectPropertyPath, o.getClass().getName(), e);
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.