Example #1
0
 public static String getReference(FlexoModelObject object) {
   String s = "";
   if (object instanceof FlexoProcess) {
     s = "PROCESS-" + ((FlexoProcess) object).getName();
   } else if (object instanceof DMModel) {
     s = "DMMODEL-" + ((DMModel) object).getName();
   } else if (object instanceof DMEOEntity) {
     s = "DMEOENTITY-" + ((DMEOEntity) object).getName();
   } else if (object instanceof AbstractActivityNode) {
     s = "ACTIVITY-" + ((AbstractActivityNode) object).getName() + "-" + object.getFlexoID();
   } else if (object instanceof OperationNode) {
     s = "OPERATION-" + ((OperationNode) object).getName() + "-" + object.getFlexoID();
   } else if (object instanceof DKVModel) {
     s = "DKVMODEL-" + ((DKVModel) object).getName();
   } else if (object instanceof FlexoNavigationMenu) {
     s = "MENU-" + ((FlexoNavigationMenu) object).getName();
   } else if (object instanceof IEPopupComponent) {
     s = "POPUP-" + ((IEPopupComponent) object).getName();
   } else if (object instanceof IETabComponent) {
     s = "TAB-" + ((IETabComponent) object).getName();
   } else if (object instanceof IEPageComponent) {
     s = "PAGE-" + ((IEPageComponent) object).getName();
   } else {
     s = object.getFullyQualifiedName();
   }
   return getValidReference(DocGeneratorConstants.DG_LABEL_PREFIX + s);
 }
 /**
  * Request to supplied SelectionListener of this SelectionManager to be back-synchronized with
  * current selection
  */
 public void fireUpdateSelection(SelectionListener selectionListenerToSynchronize) {
   selectionListenerToSynchronize.fireResetSelection();
   for (Enumeration<FlexoModelObject> e = getSelection().elements(); e.hasMoreElements(); ) {
     FlexoModelObject o = e.nextElement();
     if (!o.isDeleted()) {
       selectionListenerToSynchronize.fireObjectSelected(o);
     }
   }
 }
Example #3
0
 public static String screenshotName(FlexoModelObject o) {
   return CGSymbolicDirectory.FIGURES
       + "/"
       + o.getProject()
           .getScreenshotResource(o, true)
           .getFile()
           .getName()
           .substring(0, o.getProject().getScreenshotResource(o).getFile().getName().length() - 4);
 }
Example #4
0
 private void updateObservedObjects() {
   for (Enumeration en = _observedObjects.elements(); en.hasMoreElements(); ) {
     FlexoModelObject observed = (FlexoModelObject) en.nextElement();
     observed.deleteObserver(this);
   }
   _observedObjects.clear();
   for (int i = 0; i < getRowCount(); i++) {
     D observed = elementAt(i);
     _observedObjects.add(observed);
     observed.addObserver(this);
   }
 }
 protected boolean isInspectable(InspectableObject object) {
   if (!(object instanceof FlexoModelObject)) {
     return true;
   }
   FlexoModelObject obj = (FlexoModelObject) object;
   if (obj.getContext() != null) {
     if (obj.getContext() instanceof PalettePanel) {
       return (((PalettePanel) obj.getContext()).isEdited());
     }
   }
   return true;
 }
 protected boolean isSelectable(FlexoModelObject object) {
   if (object == null) {
     return false;
   }
   if (object.isDeleted()) {
     return false;
   }
   if (object.getContext() != null) {
     if (object.getContext() instanceof PalettePanel) {
       return (((PalettePanel) object.getContext()).isEdited());
     }
   }
   return true;
 }
 @Override
 public String toString() {
   String returned = super.toString() + "\n";
   for (Enumeration<FlexoModelObject> en = _selection.elements(); en.hasMoreElements(); ) {
     FlexoModelObject o = en.nextElement();
     StringTokenizer st = new StringTokenizer(o.getClass().getName(), ".");
     String className = "";
     while (st.hasMoreTokens()) {
       className = st.nextToken();
     }
     returned += "> " + className + ":" + o + "\n";
   }
   return returned;
 }
Example #8
0
  @Override
  protected void initializeFIBComponent() {
    super.initializeFIBComponent();
    FIBBrowser browser = retrieveFIBBrowser(getFIBComponent());
    if (browser == null) {
      logger.warning("Could not retrieve FIBBrowser for component " + getFIBComponent());
      return;
    }
    if (!browser.getClickAction().isSet() || !browser.getClickAction().isValid()) {
      browser.setClickAction(
          new DataBinding("controller.singleClick(" + browser.getName() + ".selected)"));
    }
    if (!browser.getDoubleClickAction().isSet() || !browser.getDoubleClickAction().isValid()) {
      browser.setDoubleClickAction(
          new DataBinding("controller.doubleClick(" + browser.getName() + ".selected)"));
    }
    if (!browser.getRightClickAction().isSet() || !browser.getRightClickAction().isValid()) {
      browser.setRightClickAction(
          new DataBinding("controller.rightClick(" + browser.getName() + ".selected,event)"));
    }

    for (FIBBrowserElement el : browser.getElements()) {
      if (el.getDataClass() != null) {
        if (FlexoModelObject.class.isAssignableFrom(el.getDataClass())) {
          List<FlexoActionType> actionList = FlexoModelObject.getActionList(el.getDataClass());
          for (FlexoActionType actionType : actionList) {
            el.addToActions(new FIBBrowserActionAdapter(actionType));
          }
        }
      }
    }
  }
 @Override
 public FlexoProject getProject() {
   if (_rootObject != null) {
     return _rootObject.getProject();
   }
   return null;
 }
 @Override
 public ValidationIssue<RequiredBindingValidationRule<T>, T> applyValidation(final T object) {
   final FlexoModelObject validatedObject = object;
   BindingDefinition bd = (BindingDefinition) validatedObject.objectForKey(bindingDefinition);
   AbstractBinding bv = (AbstractBinding) validatedObject.objectForKey(bindingName);
   if (bd == null) {
     logger.warning(
         "Object of type "
             + object.getClass().getName()
             + " does not define any '"
             + bindingDefinition
             + "' binding definition");
     return null;
   } else if (bd.getIsMandatory()) {
     if ((bv == null) || (!bv.isBindingValid())) {
       ValidationError<RequiredBindingValidationRule<T>, T> error;
       if (bv == null) {
         error =
             new ValidationError<RequiredBindingValidationRule<T>, T>(this, object, null) {
               @Override
               public String getLocalizedMessage() {
                 return getLocalizedErrorMessageForUndefinedValue();
               }
             };
       } else { // !bv.isBindingValid()
         error =
             new ValidationError<RequiredBindingValidationRule<T>, T>(this, object, null) {
               @Override
               public String getLocalizedMessage() {
                 return getLocalizedErrorMessageForInvalidValue();
               }
             };
       }
       if (object instanceof IEWidget) {
         error.addToFixProposals(new AddEntryToComponentAndSetBinding(bindingName, bd));
       }
       Vector allAvailableBV = bd.searchMatchingBindingValue((Bindable) validatedObject, 2);
       for (int i = 0; i < allAvailableBV.size(); i++) {
         BindingValue proposal = (BindingValue) allAvailableBV.elementAt(i);
         error.addToFixProposals(new SetBinding(proposal));
       }
       return error;
     }
     return null;
   }
   return null;
 }
Example #11
0
 public static Icon screenshot(FlexoModelObject o, ProjectDocGenerator pdg) {
   FlexoCopiedResource r = pdg.getScreenshot(o);
   if (r != null) {
     if (r.getFile().exists()) {
       return new ImageIcon(r.getFile().getAbsolutePath());
     } else {
       if (r.getResourceToCopy() != null) {
         return new ImageIcon(r.getResourceToCopy().getFile().getAbsolutePath());
       }
     }
   }
   return new ImageIcon(o.getProject().getScreenshotResource(o, true).getFile().getAbsolutePath());
 }
 @Override
 public void notifyObjectCreated(FlexoModelObject object) {
   if (logger.isLoggable(Level.FINE)) {
     logger.fine("notifyObjectCreated: " + object);
   }
   if (_currentlyPerformedActionStack.isEmpty()
       && _currentlyUndoneActionStack.isEmpty()
       && _currentlyRedoneActionStack.isEmpty()
       && WARN_MODEL_MODIFICATIONS_OUTSIDE_FLEXO_ACTION_LAYER) {
     logger.warning("FlexoModelObject " + object + " created outside of FlexoAction context !!!");
   } else if (!_currentlyPerformedActionStack.isEmpty()) {
     _createdAndNotNotifiedObjects.get(_currentlyPerformedActionStack.peek()).add(object);
   }
   object.setDocFormat(FlexoDocFormat.HTML, false);
 }
Example #13
0
 static {
   FlexoModelObject.addActionForClass(RefreshHistory.actionType, CGObject.class);
 }
 static {
   FlexoModelObject.addActionForClass(actionType, DMModel.class);
   FlexoModelObject.addActionForClass(actionType, PersistantDataRepositoryFolder.class);
 }
Example #15
0
 static {
   FlexoModelObject.addActionForClass(SaveCVSFile.actionType, CVSFile.class);
 }
 static {
   FlexoModelObject.addActionForClass(GenerateSourceCode.actionType, CGObject.class);
 }
 static {
   FlexoModelObject.addActionForClass(actionType, FlexoPostCondition.class);
 }
 static {
   FlexoModelObject.addActionForClass(actionType, ViewObject.class);
 }
 static {
   FlexoModelObject.addActionForClass(actionType, DMModel.class);
   FlexoModelObject.addActionForClass(actionType, DMPackage.class);
   FlexoModelObject.addActionForClass(actionType, LoadableDMEntity.class);
 }
 static {
   FlexoModelObject.addActionForClass(MakeFlexoProcessContextFree.actionType, FlexoProcess.class);
 }
 static {
   FlexoModelObject.addActionForClass(
       DeclareConnectorInEditionPattern.actionType, ExampleDrawingConnector.class);
 }
 static {
   FlexoModelObject.addActionForClass(
       AddExampleDrawingShape.actionType, ExampleDrawingShema.class);
   FlexoModelObject.addActionForClass(
       AddExampleDrawingShape.actionType, ExampleDrawingShape.class);
 }
 static {
   FlexoModelObject.addActionForClass(actionType, FlexoWorkflow.class);
 }