• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript spring-flo.EditorComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中spring-flo.EditorComponent的典型用法代码示例。如果您正苦于以下问题:TypeScript EditorComponent类的具体用法?TypeScript EditorComponent怎么用?TypeScript EditorComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了EditorComponent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: describe

describe('Task RenderService', () => {

  const loggerService = new LoggerService();
  const METAMODEL_SERVICE = new MetamodelService(new MockSharedAppService(), loggerService, new MockToolsService());
  const RENDER_SERVICE = new RenderService(METAMODEL_SERVICE, null, null, null, null);
  const EDITOR_SERVICE = new EditorService(null);

  let METAMODEL: Map<string, Map<string, Flo.ElementMetadata>>;
  let component: EditorComponent;
  let fixture: ComponentFixture<EditorComponent>;
  let flo: Flo.EditorContext;

  beforeEach(async(() => {
    METAMODEL_SERVICE.load().then(metamodel => METAMODEL = metamodel);
    TestBed.configureTestingModule({
      imports: [
        FloModule
      ],
      providers: [
        { provide: MetamodelService, useValue: METAMODEL_SERVICE },
        { provide: RenderService, useValue: RENDER_SERVICE },
        { provide: EditorService, useValue: EDITOR_SERVICE }
      ]
    })
      .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(EditorComponent);
    component = fixture.componentInstance;
    component.metamodel = METAMODEL_SERVICE;
    component.renderer = RENDER_SERVICE;
    component.editor = EDITOR_SERVICE;
    const subscription = component.floApi.subscribe((f) => {
      subscription.unsubscribe();
      flo = f;
    });
    // FF needs flo editor to have size otherwise `TypeError: a.getScreenCTM(...) is null`
    const floViewElemnt = $('#flow-view');
    floViewElemnt.css({
      'height': '800px'
    });
    fixture.detectChanges();
  });

  function dropNodeFromPaletteOnCanvas(metadata: Flo.ElementMetadata, location?: dia.Point): dia.Element {
    const node = flo.createNode(metadata, null, location);
    component.setDragDescriptor({
      sourceComponent: Constants.PALETTE_CONTEXT,
      source: {
        view: flo.getPaper().findViewByModel(node)
      }
    });
    component.handleNodeDropping();
    return node;
  }

  function dropNodeFromPaletteOnCanvasLink(metadata: Flo.ElementMetadata, target: dia.Link): dia.Element {
    const node = flo.createNode(metadata, null);
    component.setDragDescriptor({
      sourceComponent: Constants.PALETTE_CONTEXT,
      source: {
        view: flo.getPaper().findViewByModel(node)
      },
      target: {
        view: flo.getPaper().findViewByModel(target),
      }
    });
    component.handleNodeDropping();
    return node;
  }

  function createLink(from: dia.Element, to: dia.Element): dia.Link {
    return flo.createLink({
      'id': from.id, 'port': 'output', 'selector': '.output-port'
    }, {
      'id': to.id, 'port': 'input', 'selector': '.input-port'
    });
  }


  it('default content', () => {
    EDITOR_SERVICE.setDefaultContent(flo, METAMODEL);
    const nodes = flo.getGraph().getElements();
    expect(nodes.length).toBe(2);
    expect(nodes[0].attr('metadata/name')).toBe('START');
    expect(nodes[1].attr('metadata/name')).toBe('END');
    expect(flo.getGraph().getLinks().length).toBe(0);
  });

  it('create handles for task', () => {
    const taskA = flo.createNode(METAMODEL.get('task').get('a'));
    const taskAView = flo.getPaper().findViewByModel(taskA);
    EDITOR_SERVICE.createHandles(flo,
      (owner, kind, action, location) => component.createHandle(owner, kind, action, location),
      taskAView);
    const embeds = taskA.getEmbeddedCells();
    expect(embeds.length).toBe(2);
    const deleteHandle = embeds[0];
    expect(deleteHandle.attr('./kind')).toBe(Constants.REMOVE_HANDLE_TYPE);
//.........这里部分代码省略.........
开发者ID:BoykoAlex,项目名称:spring-cloud-dataflow-ui,代码行数:101,代码来源:editor.service.spec.ts


示例2: describe

describe('editor.service : Auto-Link', () => {
  let component: EditorComponent;
  let fixture: ComponentFixture<EditorComponent>;
  const metamodelService = new MetamodelService(new MockSharedAppService());
  const renderService = new RenderService(metamodelService);
  const editorService = new EditorService(null);
  let metamodel: Map<string, Map<string, Flo.ElementMetadata>>;

  let flo: Flo.EditorContext;

  beforeEach(async(() => {
    metamodelService.load().then(data => metamodel = data);
    TestBed.configureTestingModule({
      imports: [
        FloModule
      ],
      providers: [
        {provide: MetamodelService, useValue: metamodelService},
        {provide: RenderService, useValue: renderService},
        {provide: EditorService, useValue: editorService}
      ]
    })
      .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(EditorComponent);
    component = fixture.componentInstance;
    component.metamodel = metamodelService;
    component.renderer = renderService;
    component.editor = editorService;
    const subscription = component.floApi.subscribe((f) => {
      subscription.unsubscribe();
      flo = f;
    });
    // FF needs flo editor to have size otherwise `TypeError: a.getScreenCTM(...) is null`
    const floViewElemnt = $('#flow-view');
    floViewElemnt.css({
      'height': '800px'
    });
    fixture.detectChanges();
  });

  function dropOnCanvas(metadata: Flo.ElementMetadata, location?: dia.Point): void {
    const node = flo.createNode(metadata, null, location);
    component.setDragDescriptor({
      sourceComponent: Constants.PALETTE_CONTEXT,
      source: {
        view: flo.getPaper().findViewByModel(node)
      }
    });
    component.handleNodeDropping();
  }

  it('DnD on empty canvas', () => {
    dropOnCanvas(metamodel.get('source').get('http'));
    expect(flo.getGraph().getElements().length).toEqual(1);
    expect(flo.getGraph().getElements()[0].attr('metadata/name')).toEqual('http');
  });

  it('Auto-Link: OFF. Drop processor with available source port', () => {
    flo.createNode(metamodel.get('source').get('http'));
    expect(flo.getGraph().getElements().length).toEqual(1);
    dropOnCanvas(metamodel.get('processor').get('filter'));
    expect(flo.getGraph().getElements().length).toEqual(2);
    expect(flo.getGraph().getLinks().length).toEqual(0);
  });

  it('Auto-Link: ON. Drop processor with available source port', () => {
    flo.autolink = true;
    flo.createNode(metamodel.get('source').get('http'));
    expect(flo.getGraph().getElements().length).toEqual(1);
    dropOnCanvas(metamodel.get('processor').get('filter'));
    expect(flo.getGraph().getElements().length).toEqual(2);
    expect(flo.getGraph().getLinks().length).toEqual(1);
  });

  it('Auto-Link: ON. Drop processor with sink on canvas', () => {
    flo.autolink = true;
    const sinkNode = flo.createNode(metamodel.get('sink').get('null'));
    expect(flo.getGraph().getElements().length).toEqual(1);
    dropOnCanvas(metamodel.get('processor').get('filter'));
    expect(flo.getGraph().getElements().length).toEqual(2);
    expect(flo.getGraph().getLinks().length).toEqual(1);
    const l = flo.getGraph().getLinks()[0];
    expect(l.get('target').id).toEqual(sinkNode.id);
    expect(l.get('target').port).toEqual('input');
  });

  it('Auto-Link: ON. Drop processor but no available ports', () => {
    flo.autolink = true;
    const httpNode = flo.createNode(metamodel.get('source').get('http'));
    const nullNode = flo.createNode(metamodel.get('sink').get('null'));
    flo.createLink({
      id: httpNode.id,
      selector: '.output-port',
      port: 'output'
    }, {
      id: nullNode.id,
      selector: '.input-port',
//.........这里部分代码省略.........
开发者ID:BoykoAlex,项目名称:spring-cloud-dataflow-ui,代码行数:101,代码来源:editor.service.spec.ts


示例3: dropOnCanvas

 function dropOnCanvas(metadata: Flo.ElementMetadata, location?: dia.Point): void {
   const node = flo.createNode(metadata, null, location);
   component.setDragDescriptor({
     sourceComponent: Constants.PALETTE_CONTEXT,
     source: {
       view: flo.getPaper().findViewByModel(node)
     }
   });
   component.handleNodeDropping();
 }
开发者ID:BoykoAlex,项目名称:spring-cloud-dataflow-ui,代码行数:10,代码来源:editor.service.spec.ts


示例4: dropNodeFromPaletteOnCanvasLink

 function dropNodeFromPaletteOnCanvasLink(metadata: Flo.ElementMetadata, target: dia.Link): dia.Element {
   const node = flo.createNode(metadata, null);
   component.setDragDescriptor({
     sourceComponent: Constants.PALETTE_CONTEXT,
     source: {
       view: flo.getPaper().findViewByModel(node)
     },
     target: {
       view: flo.getPaper().findViewByModel(target),
     }
   });
   component.handleNodeDropping();
   return node;
 }
开发者ID:BoykoAlex,项目名称:spring-cloud-dataflow-ui,代码行数:14,代码来源:editor.service.spec.ts


示例5:

 (owner, kind, action, location) => component.createHandle(owner, kind, action, location),
开发者ID:BoykoAlex,项目名称:spring-cloud-dataflow-ui,代码行数:1,代码来源:editor.service.spec.ts



注:本文中的spring-flo.EditorComponent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript spring-flo.Shapes.Factory类代码示例发布时间:2022-05-25
下一篇:
TypeScript split.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap