示例#1
0
 @Override
 public void drawOutline(Graphics graphics, Screen screen, Vector parentPos) {
   background.drawOutline(graphics, screen, parentPos.add(pos));
   for (ModelElement element : elements) {
     element.drawOutline(graphics, screen, parentPos.add(pos));
   }
   //        graphics.setColor(Color.BLUE);
   //        graphics.drawLine((int) (parentPos.x), (int) (parentPos.y), (int)(getPosition.x),
   // (int)(getPosition.y));
 }
 protected AbstractResourceDefinition(
     ModelElement modelElement,
     final OperationStepHandler addHandler,
     final OperationStepHandler removeHandler) {
   super(
       PathElement.pathElement(modelElement.getName()),
       PicketLinkExtension.getResourceDescriptionResolver(modelElement.getName()),
       addHandler,
       removeHandler);
   this.modelElement = modelElement;
 }
示例#3
0
 public IModelElement getHandleFromMemento(
     String token, MementoTokenizer memento, WorkingCopyOwner owner) {
   switch (token.charAt(0)) {
     case JEM_SCRIPTPROJECT:
       if (!memento.hasMoreTokens()) return this;
       String projectName = memento.nextToken();
       ModelElement project = (ModelElement) getScriptProject(projectName);
       return project.getHandleFromMemento(memento, owner);
   }
   return null;
 }
示例#4
0
 public IModelElement getHandleFromMemento(
     String token, MementoTokenizer memento, WorkingCopyOwner owner) {
   switch (token.charAt(0)) {
     case JEM_SOURCEMODULE:
       if (!memento.hasMoreTokens()) return this;
       String classFileName = memento.nextToken();
       ModelElement classFile = (ModelElement) getSourceModule(classFileName);
       return classFile.getHandleFromMemento(memento, owner);
   }
   return null;
 }
  private void evaluateContext(Element target, ModelElement contextModel, Node contextNode)
      throws ParseException {

    // TODO support for 'bind attribute'
    if (target instanceof ModelElement) {

      contextModel = (ModelElement) target;
      contextNode = contextModel.getInitialContextNode();

    } else if (target.getAttribute("model") != null) {

      // 7.4-3-a: context model which 'model' atttibeute determines is used
      String id = target.getAttribute("model");
      contextModel = (ModelElement) getElementById(id);

      // reset the context node to the top-level element node
      contextNode = contextModel.getInitialContextNode();
    }
    if (contextModel == null) {

      // 7.4-3-c: The first model in document order is used
      contextModel = getInitialContextModel();

      // 7.4-1: 'outermost element' uses the top-level element node
      contextNode = contextModel.getInitialContextNode();
    }

    if (target instanceof XFormsElement) ((XFormsElement) target).setContextNode(contextNode);

    System.out.println(
        "evaluete : context node["
            + target.getTagName()
            + "] = "
            + ((InstanceDocument) contextNode.getOwnerDocument()).getOwner().getAttribute("id"));

    for (Node n = target.getFirstChild(); n != null; n = n.getNextSibling()) {

      if (!(n instanceof Element)) continue;

      // 7.4.3-b: The context model of immediately enclosing element is used
      // 7.4-2: 'non-outermost element' uses
      //  first node of the binding expression of the immediately enclosing element
      if (target instanceof XFormsElement) {
        Node bindingNode = ((XFormsElement) target).getBindingNode();
        if (bindingNode != null) {
          evaluateContext((Element) n, contextModel, bindingNode);
          continue;
        }
      }
      evaluateContext((Element) n, contextModel, contextNode);
    }
  }
示例#6
0
 public void printNode(CorePrinter output) {
   output.formatPrint("DLTK Model:" + getElementName()); // $NON-NLS-1$
   output.indent();
   try {
     IModelElement modelElements[] = this.getChildren();
     for (int i = 0; i < modelElements.length; ++i) {
       IModelElement element = modelElements[i];
       if (element instanceof ModelElement) {
         ((ModelElement) element).printNode(output);
       } else {
         output.print("Unknown element:" + element); // $NON-NLS-1$
       }
     }
   } catch (ModelException ex) {
     output.formatPrint(ex.getLocalizedMessage());
   }
   output.dedent();
 }
 public void delete() {
   for (int i = invoked.size(); i > 0; i--) {
     Invokes aInvoked = invoked.get(i - 1);
     aInvoked.delete();
   }
   for (int i = invokes.size(); i > 0; i--) {
     Invokes aInvoke = invokes.get(i - 1);
     aInvoke.delete();
   }
   for (int i = accesses.size(); i > 0; i--) {
     Accesses aAccess = accesses.get(i - 1);
     aAccess.delete();
   }
   for (int i = isParameterOfs.size(); i > 0; i--) {
     IsParameterOf aIsParameterOf = isParameterOfs.get(i - 1);
     aIsParameterOf.delete();
   }
   super.delete();
 }
示例#8
0
 public void doHandleEvent(DOMEvent evt, ActionElement outermost) {
   ModelElement modelEl = ((XFormsDocument) ownerDocument).getModelElement();
   modelEl.dispatchEvent(DOMEvent.XFORMS_CLOSE);
 }