Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 7a5bd6eb

Přidáno uživatelem Martin Matas před více než 5 roky(ů)

Fixed events calls, imlemented include and exclude for Timeline (refs #7516)

Zobrazit rozdíly:

sources/imiger-core/src/main/webapp/js/components/node.js
323 323
		this.isExcluded = true;
324 324
		this.remove(true);
325 325

  
326
        var notifyTimeline = new CustomEvent('imigerExclude', { detail: { entityID: this.id } });
327
        document.dispatchEvent(notifyTimeline);
328

  
326 329
		app.viewportComponent.removeNode(this);
327 330
	}
328 331

  
......
335 338
		this.isExcluded = false;
336 339
		this.remove(false);
337 340

  
341
        var notifyTimeline = new CustomEvent('imigerInclude', { detail: { entityID: this.id } });
342
        document.dispatchEvent(notifyTimeline);
343

  
338 344
		app.viewportComponent.addNode(this);
339 345
	}
340 346

  
......
407 413
	_onNodeClick(e) {
408 414
		e.stopPropagation();
409 415

  
416
        var archetypeString = app.archetype.vertex[this.archetype].name;
417
        if (archetypeString !== 'person') archetypeString = 'item';
418
        var notifyTimeline;
419

  
410 420
		if (this.isExcluded) {
411 421
			this.highlightWithNeighbours(!this.isHighlighted);
412 422

  
423
            if (e.detail !== this.id) {
424
                notifyTimeline = new CustomEvent('imigerClick', { detail: { entityID: this.id, archetype: archetypeString } });
425
                document.dispatchEvent(notifyTimeline);
426
            }
427

  
413 428
		} else {
414 429
			if (this._panning === true) {
415 430
				this._panning = false;
......
419 434
			if (document.modeForm.mode.value === 'exclude' || (document.modeForm.mode.value === 'move' && e.altKey === true)) {
420 435
				this.exclude();
421 436
				app.sidebarComponent.excludedNodeListComponent.addNode(this);
437

  
422 438
			} else if (document.modeForm.mode.value === 'move') {
423 439
				this.highlightWithNeighbours(!this.isHighlighted);
424 440

  
425 441
				if (e.detail !== this.id) {
426
				    var archetypeString = app.archetype.vertex[this.archetype].name;
427
				    if (archetypeString !== 'person') archetypeString = 'item';
428
                    var notifyTimeline = new CustomEvent('imigerClick', { detail: { entityID: this.id, archetype: archetypeString } });
429
                    window.frames[0].document.dispatchEvent(notifyTimeline);
442
                    notifyTimeline = new CustomEvent('imigerClick', { detail: { entityID: this.id, archetype: archetypeString } });
443
                    document.dispatchEvent(notifyTimeline);
430 444
                }
431 445

  
432 446
				if (this.isHighlighted) {
sources/imiger-core/src/main/webapp/js/timeline/cz/kajda/timeline/Timeline.js
484 484
            _attachTimelineEventListeners : function() {
485 485
                $(window).on("resize", new Closure(this, this._handleResizing));
486 486
                $(document).on("imigerClick", new Closure(this, this._handleIMiGErClick));
487
                $(document).on("imigerExclude", new Closure(this, this._handleIMiGErExclude));
488
                $(document).on("imigerInclude", new Closure(this, this._handleIMiGErInclude));
487 489
                this._htmlElement
488 490
                        .on("mouseover", "*", new Closure(this, this._handleMouseOver))
489 491
                        .on("wheel", new Closure(this, this._handleZooming))
......
500 502
                    .addListener("dropped", this, this._handleWrapperDropped);
501 503
            },
502 504

  
505
            _handleIMiGErExclude : function(e) {
506
                var entity = this.getEntities().get(e.originalEvent.detail.entityID);
507
                $('div[data-entity=' + entity.getId() + ']').hide();
508
            },
509

  
510
            _handleIMiGErInclude : function(e) {
511
                var entity = this.getEntities().get(e.originalEvent.detail.entityID);
512
                $('div[data-entity=' + entity.getId() + ']').show();
513
            },
514

  
503 515
            _handleIMiGErClick : function(e) {
504 516
                var entity = this.getEntities().get(e.originalEvent.detail.entityID),
505 517
                    bandItem = this._bandGroup.getBand(e.originalEvent.detail.archetype).getBandItem(entity.getId());
......
512 524
                        return;
513 525
                    }
514 526
                }
515
                
527

  
516 528
                this.focusItem(bandItem.getEntity(), false);
517 529
                this._fireEvent("itemClick", entity);
518 530
                // FIALA Event for item click

Také k dispozici: Unified diff