Пример #1
0
 /**
  * @param functionName
  * @return FunctionType
  */
 private FunctionType getFunctionTypeByName(String functionName) {
   MetaModelRegistry.getEventsFor(widget.getType());
   Set<FunctionType> functions = MetaModelRegistry.getFunctionsFor(event.getEventType());
   for (FunctionType ft : functions) {
     if (ft.getName().equals(functionName)) {
       return ft;
     }
   }
   return null;
 }
Пример #2
0
  /** Fills the function list. */
  private void fillFunctionsList() {
    fctList.removeAll();

    ArrayList<String> names = new ArrayList<String>();

    MetaModelRegistry.getEventsFor(widget.getType());
    Set<FunctionType> functions = MetaModelRegistry.getFunctionsFor(event.getEventType());

    for (FunctionType ft : functions) {
      String funcName = ft.getName();
      names.add(funcName);
    }

    Collections.sort(names);
    fctList.setItems(names.toArray(new String[] {}));
  }
Пример #3
0
 /**
  * Creates the events for the Widget.
  *
  * @param widget The Widget to create the events for
  * @param wt The WidgetTemplate
  */
 private void createEvents(Widget widget, WidgetTemplate wt) {
   for (EventTemplate et : wt.getEventTemplates()) {
     String eventName = et.getEventType();
     Event event = getModelFactory().createEvent();
     FunctionType ft = et.getFunctionType();
     event.setEventName(eventName);
     event.setFunctionName(ft.getName());
     event.setNature(EventNature.get(et.getNature()));
     if (!hasEvent(widget, eventName)) {
       widget.getEvents().add(event);
       createParameters(event, et); // from the template
       // add missing parameters defined in the model.
       for (ParameterType pt : et.getFunctionType().getParameters()) {
         String name = pt.getName();
         if (event.findParameter(name) == null) {
           Parameter p = getModelFactory().createParameter();
           p.setName(name);
           p.setValue(pt.getDefaultValue());
           event.getParameters().add(p);
         }
       }
     }
   }
 }